1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

201 Commits

Author SHA1 Message Date
Andreas Rheinhardt
fed0282508 avformat: Avoid allocation for AVFormatInternal
Do this by allocating AVFormatContext together with the data that is
currently in AVFormatInternal; or rather: Put AVFormatContext at the
beginning of a new structure called FFFormatContext (which encompasses
more than just the internal fields and is a proper context in its own
right, hence the name) and remove AVFormatInternal altogether.

The biggest simplifications occured in avformat_alloc_context(), where
one can now simply call avformat_free_context() in case of errors.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-17 04:58:34 +02:00
Paul B Mahol
d1971d69c7 avformat/dv: always set audio packet duration
If audio packet is present in DV stream it have duration of 1 in DV timebase units.
2021-09-12 22:23:35 +02:00
James Almer
57aaeff523 avformat/dv: stop using av_init_packet()
Signed-off-by: James Almer <jamrial@gmail.com>
2021-05-06 09:44:42 -03:00
Andreas Rheinhardt
bc70684e74 avformat: Constify all muxer/demuxers
This is possible now that the next-API is gone.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 11:48:06 -03:00
Marton Balint
76fbb0052d avformat/dv: fix timestamps of audio packets in case of dropped corrupt audio frames
By using the frame counter (and the video time base) for audio pts we lose some
timestamp precision but we ensure that video and audio coming from the same DV
frame are always in sync.

This patch also makes timestamps after seek consistent and it should also fix
the timestamps when the audio clock is unlocked and have a completely
indpendent clock source. (E.g. runs on fixed 48009 Hz which should have been
exact 48000 Hz)

Fixes out of sync timestamps in ticket #8762.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-12-06 18:09:24 +01:00
Marton Balint
9b434bea75 avformat: use av_timecode_make_smpte_tc_string2
WSD format has no frames stored for playback time.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:51:57 +02:00
Andreas Rheinhardt
1fbfa42432 avformat/dv: Avoid allocation for reading timecode
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-06 00:02:19 +02:00
Andreas Rheinhardt
8b0bba864b avformat/dv: Avoid alloction of DVDemuxContext
This commit avoids allocating a DVDemuxContext when demuxing raw DV by
making it part of the demuxer's context. This also allows to remove
dv_read_close().

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-06 00:02:19 +02:00
James Almer
72704cbff4 avformat/dv: free all allocated structs on dv_read_header failure
Also propagate proper AVERROR codes while at it.

Fixes ticket #8230.

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-11 20:38:36 -03:00
Carl Eugen Hoyos
4d8875ec23 lavf: Constify the probe function argument.
Reviewed-by: Lauri Kasanen
Reviewed-by: Tomas Härdin
2019-03-21 11:42:17 +01:00
James Almer
4de591e6fb Merge commit '83548fe894cdb455cc127f754d09905b6d23c173'
* commit '83548fe894cdb455cc127f754d09905b6d23c173':
  lavf: fix usage of AVIOContext.seekable

Merged-by: James Almer <jamrial@gmail.com>
2017-03-21 17:02:30 -03:00
Clément Bœsch
8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +02:00
Vittorio Giovara
41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Derek Buitenhuis
6f69f7a8bf Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
* commit '9200514ad8717c63f82101dc394f4378854325bf':
  lavf: replace AVStream.codec with AVStream.codecpar

This has been a HUGE effort from:
    - Derek Buitenhuis <derek.buitenhuis@gmail.com>
    - Hendrik Leppkes <h.leppkes@gmail.com>
    - wm4 <nfxjfg@googlemail.com>
    - Clément Bœsch <clement@stupeflix.com>
    - James Almer <jamrial@gmail.com>
    - Michael Niedermayer <michael@niedermayer.cc>
    - Rostislav Pehlivanov <atomnuker@gmail.com>

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-10 20:59:55 +01:00
Clément Bœsch
8284a4ba11 lavf/dv: use c->sys->frame_size in dv_frame_offset()
dv_frame_offset() is static and called only from dv_read_seek(), where
c->sys->frame_size is already used.

This simplifies the incoming codecpar merge where
avctx->{coded_width,coded_height,time_base} are not accessible anymore.
2016-03-20 19:28:15 +01:00
Clément Bœsch
6c0cf11f38 lavf/dv: reindent after previous commit 2016-03-20 19:28:15 +01:00
Clément Bœsch
35ba5c424b lavf/dv: do not check for c->sys
dv_extract_video_info() is a static function called only from
avpriv_dv_produce_packet(), where c->sys is made sure to be set.
2016-03-20 14:25:16 +01:00
Anton Khirnov
9200514ad8 lavf: replace AVStream.codec with AVStream.codecpar
Currently, AVStream contains an embedded AVCodecContext instance, which
is used by demuxers to export stream parameters to the caller and by
muxers to receive stream parameters from the caller. It is also used
internally as the codec context that is passed to parsers.

In addition, it is also widely used by the callers as the decoding (when
demuxer) or encoding (when muxing) context, though this has been
officially discouraged since Libav 11.

There are multiple important problems with this approach:
    - the fields in AVCodecContext are in general one of
        * stream parameters
        * codec options
        * codec state
      However, it's not clear which ones are which. It is consequently
      unclear which fields are a demuxer allowed to set or a muxer allowed to
      read. This leads to erratic behaviour depending on whether decoding or
      encoding is being performed or not (and whether it uses the AVStream
      embedded codec context).
    - various synchronization issues arising from the fact that the same
      context is used by several different APIs (muxers/demuxers,
      parsers, bitstream filters and encoders/decoders) simultaneously, with
      there being no clear rules for who can modify what and the different
      processes being typically delayed with respect to each other.
    - avformat_find_stream_info() making it necessary to support opening
      and closing a single codec context multiple times, thus
      complicating the semantics of freeing various allocated objects in the
      codec context.

Those problems are resolved by replacing the AVStream embedded codec
context with a newly added AVCodecParameters instance, which stores only
the stream parameters exported by the demuxers or read by the muxers.
2016-02-23 17:01:58 +01:00
Carl Eugen Hoyos
3eae98c1ac lavf/dv: Do not return EIO for every error (like EOF).
Fixes ticket #4818.

Reviewed-by: Ronald S. Bultje
Reviewed-by: Paul B Mahol
2015-09-02 00:59:10 +02:00
Michael Niedermayer
2139e58439 avformat/dv: fix used dimension variables
Fixes null pointer dereference during seeking
Fixes Ticket4395

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-26 03:10:27 +01:00
Michael Niedermayer
2924514721 Merge commit '9deaec782810d098bca11c9332fab2d2f4c5fb78'
* commit '9deaec782810d098bca11c9332fab2d2f4c5fb78':
  lavf: move internal fields from public to internal context

Conflicts:
	libavformat/avformat.h
	libavformat/internal.h
	libavformat/mux.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-11 02:47:54 +01:00
wm4
9deaec7828 lavf: move internal fields from public to internal context
This is not an API change; the fields were explicitly declared private
before.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-02-10 21:45:04 +01:00
Michael Niedermayer
72d99c8c26 avformat/dv: check av_malloc() return code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-23 18:15:43 +01:00
Michael Niedermayer
4efdb29c75 avformat/dv: Use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-15 00:38:05 +01:00
Steve Jiekak
a32c3c2392 replaced av_dv_codec_profile by av_dv_codec_profile2 in encoder and dv muxers
Signed-off-by: Steve Jiekak <devaureshy@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 20:24:00 +01:00
Michael Niedermayer
ab6f4fd4a7 libavformat/dv: Make unchanged function arguments const
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-24 19:11:05 +02:00
James Almer
d34ec64a22 replace calls to url_feof() with avio_feof()
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-08 00:48:38 +02:00
Michael Niedermayer
88f038ac97 avformat/dv: implement fallback in dv_extract_pack()
Fixes Ticket2340
Fixes Ticket2341

Based-on mail from Dave Rice <dave@dericed.com>
Tested-by: Dave Rice <dave@dericed.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-17 15:29:27 +02:00
Michael Niedermayer
1b58f13761 Merge commit 'f6ee61fb05482c617f5deee29a190d8ff483b3d1'
* commit 'f6ee61fb05482c617f5deee29a190d8ff483b3d1':
  lavc: export DV profile API used by muxer/demuxer as public

Conflicts:
	configure
	doc/APIchanges
	libavcodec/Makefile
	libavcodec/dv_profile.c
	libavcodec/dv_profile.h
	libavcodec/version.h
	libavformat/dvenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-09 22:27:07 +02:00
Anton Khirnov
f6ee61fb05 lavc: export DV profile API used by muxer/demuxer as public 2014-07-09 13:35:07 +00:00
Michael Niedermayer
c600c8e966 Merge commit 'dca7ba4bffe3e4aeb620cb62955256a0d87561f4'
* commit 'dca7ba4bffe3e4aeb620cb62955256a0d87561f4':
  Remove some unnecessary CONFIG_FOO_COMPONENT ifdefs

Conflicts:
	libavcodec/ac3enc_float.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-12 20:25:48 +02:00
Diego Biurrun
dca7ba4bff Remove some unnecessary CONFIG_FOO_COMPONENT ifdefs
The files are only ever compiled if that condition is true.
2014-06-12 07:10:18 -07:00
Michael Niedermayer
b06741d267 Merge commit '79f2c426fde6e71c40b29504112d0528b85be623'
* commit '79f2c426fde6e71c40b29504112d0528b85be623':
  dv: do not set codec timebase

Conflicts:
	libavformat/dv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-18 14:53:41 +02:00
Anton Khirnov
79f2c426fd dv: do not set codec timebase
It is not supposed to be set from outside of libavcodec.
Set average framerate instead.
2014-05-18 10:24:43 +02:00
Michael Niedermayer
e28130bcaf Merge commit '3cbe1126530449336e2ce59b194bdb8c4eb4abb4'
* commit '3cbe1126530449336e2ce59b194bdb8c4eb4abb4':
  dv: Split DV data table declarations into their own header

Conflicts:
	libavcodec/dvdata.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-15 12:52:19 +01:00
Diego Biurrun
3cbe112653 dv: Split DV data table declarations into their own header
This is necessary to avoid target config settings bleeding into the host
compilation process with hardcoded tables and the DV VLC tables no longer
present as static tables in a header file.
2013-11-15 01:29:47 +01:00
Michael Niedermayer
59ce62f713 avformat/dv: remove unused variable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-10 12:27:17 +01:00
Michael Niedermayer
ef8f293472 avformat/dv: consider a header match at byte 0 to count as detection of dv in probe
This reduces the amount of data needed to identify dv

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-09 18:39:09 +01:00
Michael Niedermayer
76a47d66c4 avformat/dv: about 3 times faster probe
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-09 14:46:14 +01:00
Michael Niedermayer
13e35a25f6 Merge commit '7ee191cab0dc44700f26c5784e2adeb6a779651b'
* commit '7ee191cab0dc44700f26c5784e2adeb6a779651b':
  dv: Add a guard to not overread the ppcm array

See: 3669915e93
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-08 11:51:36 +02:00
Luca Barbato
7ee191cab0 dv: Add a guard to not overread the ppcm array
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2013-09-07 11:18:01 +02:00
Michael Niedermayer
7565aaecb4 Merge commit 'fcc455ff2e11ed04603aead1984a92ac3a4be226'
* commit 'fcc455ff2e11ed04603aead1984a92ac3a4be226':
  avformat/dv: K&R formatting cosmetics

Conflicts:
	libavformat/dv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-06 18:01:03 +02:00
Diego Biurrun
fcc455ff2e avformat/dv: K&R formatting cosmetics 2013-08-06 11:01:44 +02:00
Michael Niedermayer
3669915e93 dvdec: check ipcm more completely, avoid assert failure.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-13 21:45:53 +01:00
Michael Niedermayer
7eb40d85f2 Merge commit 'ef1b23ad21e3f12fc4ff2a73a6d4d4cd9d630c4b'
* commit 'ef1b23ad21e3f12fc4ff2a73a6d4d4cd9d630c4b': (21 commits)
  jvdec: set channel layout
  iss: set channel layout
  ipmovie: set channel layout
  iff: set channel layout
  idroqdec: set channel layout
  gxfdec: set channel layout when applicable
  gsmdec: set channel layout
  flvdec: set channel layout
  dv: set channel layout
  dsicin: set channel layout
  daud: set channel layout
  cdxl: set channel layout
  bmv: set channel layout
  bink: set channel layout
  bfi: set channel layout
  bethsoftvid: set channel layout
  apc: set channel layout
  amr: set channel_layout
  ppc: replace pointer casting with AV_COPY32
  ppc: fix some unused variable warnings
  ...

Conflicts:
	libavformat/amr.c
	libavformat/iff.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-13 10:55:07 +01:00
Justin Ruggles
d5ca70b103 dv: set channel layout 2012-11-12 10:33:19 -05:00
Michael Niedermayer
6f5f7f705d Merge commit '08b028c18dc31b6de741861b9555669dcca4d12a'
* commit '08b028c18dc31b6de741861b9555669dcca4d12a':
  Remove INIT_AVX from x86inc.asm.
  Remove usage of INIT_AVX in h264_intrapred_10bit.asm.
  dv: fix indentation

Conflicts:
	libavformat/dv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-30 15:28:24 +01:00
Michael Niedermayer
e79c3858b3 Merge commit '14f031d7ecfabba0ef02776d4516aa3dcb7c40d8'
* commit '14f031d7ecfabba0ef02776d4516aa3dcb7c40d8':
  dv: use AVStream.index instead of abusing AVStream.id
  lavfi: add ashowinfo filter
  avcodec: Add a RFC 3389 comfort noise codec
  lpc: Add a function for calculating reflection coefficients from samples
  lpc: Add a function for calculating reflection coefficients from autocorrelation coefficients
  lavr: document upper bound on number of output samples.
  lavr: add general API usage doxy
  indeo3: remove duplicate capabilities line.
  fate: ac3: Add dependencies

Conflicts:
	Changelog
	doc/filters.texi
	libavcodec/Makefile
	libavcodec/allcodecs.c
	libavcodec/avcodec.h
	libavcodec/codec_desc.c
	libavcodec/version.h
	libavfilter/Makefile
	libavfilter/af_ashowinfo.c
	libavfilter/allfilters.c
	libavfilter/version.h
	libavutil/avutil.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-30 14:40:22 +01:00
Anton Khirnov
ede4cedf47 dv: fix indentation 2012-10-29 21:35:09 +01:00
Anton Khirnov
14f031d7ec dv: use AVStream.index instead of abusing AVStream.id 2012-10-29 21:34:05 +01:00