summaryrefslogtreecommitdiff
path: root/libavformat/dv.c
Commit message (Collapse)AuthorAgeFilesLines
* lavf/dv: use a more granular timebase for audioAnton Khirnov2023-05-021-3/+24
| | | | | | | | | | | | | One that is fine enough to represent all DV audio sample rates. Audio packet durations are now sample-accurate. This largely undoes commit 76fbb0052df471075858c1cb82b04c8be7adba8d. To avoid breaking the issue fixed by that commit, resync audio timestamps against video if they get more than one frame apart. The sample from issue #8762 still works correctly after this commit. Slightly changes the results of the lavf-dv seektest, due to the audio timebase being more granular.
* lavf/dv: shorten code by using a local variableAnton Khirnov2023-05-021-4/+7
|
* lavf/dv: do not set video timebase more than onceAnton Khirnov2023-05-021-9/+27
| | | | | | | | | | | | | Current code will call avpriv_set_pts_info() for each video frame, possibly setting a different timebase if the stream framerate changes. This violates API conventions, as the timebase is supposed to stay constant after stream creation. Change the demuxer to set a single timebase that is fine enough to handle all supported DV framerates. The seek tests change slightly because the new timebase is more granular.
* lavf/dv: do not update AVCodecParameters.sample_rate while demuxingAnton Khirnov2022-09-051-15/+34
| | | | | | Demuxers are not allowed to do this and few callers, if any, will handle this correctly. Send the AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE side data instead.
* lavf/dv: set audio bitrate only at stream creationAnton Khirnov2022-09-051-1/+1
| | | | | | Demuxers are not supposed to update AVCodecParameters after the stream was seen by the caller. This value is not important enough to support dynamic updates for.
* lavf/dv: set non-changing AVStream fields only onceAnton Khirnov2022-09-051-2/+2
|
* lavf/dv: forward errors from avformat_new_stream()Anton Khirnov2022-09-051-2/+7
|
* lavf/dv: return a meaningful error code from avpriv_dv_produce_packet()Anton Khirnov2022-09-051-1/+1
|
* lavf/dv: make returning the video packet optionalAnton Khirnov2022-09-051-8/+11
| | | | | | | | | | The mov demuxer only returns DV audio, video packets are discarded. It first reads the data to be parsed into a packet. Then both this packet and the pointer to its data are passed together to avpriv_dv_produce_packet(), which parses the data and partially overwrites the packet. This is confusing and potentially dangerous, so just pass NULL and avoid pointless packet modification.
* lavc/dv: rename constants to follow our naming conventionsAnton Khirnov2022-09-051-9/+9
| | | | CamelCase for enum tags, ALL_CAPS for enum values.
* lavf/dv: always provide avpriv_dv_* symbolsAnton Khirnov2022-09-051-0/+23
| | | | They are used from libavdevice.
* dv: convert to new channel layout APIVittorio Giovara2022-03-151-2/+1
| | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/dv: Set AVFMTCTX_NOHEADER flagAndreas Rheinhardt2021-09-261-0/+3
| | | | | | Audio streams are only added when a packet is read. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: Avoid allocation for AVFormatInternalAndreas Rheinhardt2021-09-171-2/+3
| | | | | | | | | | | | | 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>
* avformat/dv: always set audio packet durationPaul B Mahol2021-09-121-0/+4
| | | | If audio packet is present in DV stream it have duration of 1 in DV timebase units.
* avformat/dv: stop using av_init_packet()James Almer2021-05-061-4/+20
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: Constify all muxer/demuxersAndreas Rheinhardt2021-04-271-1/+1
| | | | | | | 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>
* avformat/dv: fix timestamps of audio packets in case of dropped corrupt ↵Marton Balint2020-12-061-14/+2
| | | | | | | | | | | | | | | | | 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>
* avformat: use av_timecode_make_smpte_tc_string2Marton Balint2020-09-131-1/+1
| | | | | | WSD format has no frames stored for playback time. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/dv: Avoid allocation for reading timecodeAndreas Rheinhardt2020-08-061-9/+4
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/dv: Avoid alloction of DVDemuxContextAndreas Rheinhardt2020-08-061-41/+32
| | | | | | | | | 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>
* avformat/dv: free all allocated structs on dv_read_header failureJames Almer2019-10-111-5/+15
| | | | | | | | | 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>
* lavf: Constify the probe function argument.Carl Eugen Hoyos2019-03-211-1/+1
| | | | | Reviewed-by: Lauri Kasanen Reviewed-by: Tomas Härdin
* Merge commit '83548fe894cdb455cc127f754d09905b6d23c173'James Almer2017-03-211-1/+1
|\ | | | | | | | | | | | | * commit '83548fe894cdb455cc127f754d09905b6d23c173': lavf: fix usage of AVIOContext.seekable Merged-by: James Almer <jamrial@gmail.com>
* \ Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'Clément Bœsch2016-06-211-8/+8
|\ \ | |/ | | | | | | | | | | * commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb': cosmetics: Fix spelling mistakes Merged-by: Clément Bœsch <u@pkh.me>
| * cosmetics: Fix spelling mistakesVittorio Giovara2016-05-041-8/+8
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | Merge commit '9200514ad8717c63f82101dc394f4378854325bf'Derek Buitenhuis2016-04-101-14/+14
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * lavf: replace AVStream.codec with AVStream.codecparAnton Khirnov2016-02-231-22/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | lavf/dv: use c->sys->frame_size in dv_frame_offset()Clément Bœsch2016-03-201-4/+3
| | | | | | | | | | | | | | | | 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.
* | lavf/dv: reindent after previous commitClément Bœsch2016-03-201-15/+15
| |
* | lavf/dv: do not check for c->sysClément Bœsch2016-03-201-5/+1
| | | | | | | | | | dv_extract_video_info() is a static function called only from avpriv_dv_produce_packet(), where c->sys is made sure to be set.
* | lavf/dv: Do not return EIO for every error (like EOF).Carl Eugen Hoyos2015-09-021-1/+6
| | | | | | | | | | | | | | Fixes ticket #4818. Reviewed-by: Ronald S. Bultje Reviewed-by: Paul B Mahol
* | avformat/dv: fix used dimension variablesMichael Niedermayer2015-03-261-2/+2
| | | | | | | | | | | | | | Fixes null pointer dereference during seeking Fixes Ticket4395 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '9deaec782810d098bca11c9332fab2d2f4c5fb78'Michael Niedermayer2015-02-111-2/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | * 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>
| * lavf: move internal fields from public to internal contextwm42015-02-101-2/+2
| | | | | | | | | | | | | | This is not an API change; the fields were explicitly declared private before. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* | avformat/dv: check av_malloc() return codeMichael Niedermayer2015-01-231-0/+3
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/dv: Use av_freep() to avoid leaving stale pointers in memoryMichael Niedermayer2014-12-151-1/+1
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | replaced av_dv_codec_profile by av_dv_codec_profile2 in encoder and dv muxersSteve Jiekak2014-12-041-2/+2
| | | | | | | | | | Signed-off-by: Steve Jiekak <devaureshy@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | libavformat/dv: Make unchanged function arguments constMichael Niedermayer2014-09-241-5/+5
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | replace calls to url_feof() with avio_feof()James Almer2014-08-081-1/+1
| | | | | | | | | | Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/dv: implement fallback in dv_extract_pack()Michael Niedermayer2014-07-171-20/+23
| | | | | | | | | | | | | | | | | | 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>
* | Merge commit 'f6ee61fb05482c617f5deee29a190d8ff483b3d1'Michael Niedermayer2014-07-091-7/+8
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * lavc: export DV profile API used by muxer/demuxer as publicAnton Khirnov2014-07-091-7/+8
| |
* | Merge commit 'dca7ba4bffe3e4aeb620cb62955256a0d87561f4'Michael Niedermayer2014-06-121-3/+1
|\ \ | |/ | | | | | | | | | | | | | | | | * commit 'dca7ba4bffe3e4aeb620cb62955256a0d87561f4': Remove some unnecessary CONFIG_FOO_COMPONENT ifdefs Conflicts: libavcodec/ac3enc_float.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * Remove some unnecessary CONFIG_FOO_COMPONENT ifdefsDiego Biurrun2014-06-121-3/+1
| | | | | | | | The files are only ever compiled if that condition is true.
* | Merge commit '79f2c426fde6e71c40b29504112d0528b85be623'Michael Niedermayer2014-05-181-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | * commit '79f2c426fde6e71c40b29504112d0528b85be623': dv: do not set codec timebase Conflicts: libavformat/dv.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * dv: do not set codec timebaseAnton Khirnov2014-05-181-1/+1
| | | | | | | | | | It is not supposed to be set from outside of libavcodec. Set average framerate instead.
* | Merge commit '3cbe1126530449336e2ce59b194bdb8c4eb4abb4'Michael Niedermayer2013-11-151-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | * commit '3cbe1126530449336e2ce59b194bdb8c4eb4abb4': dv: Split DV data table declarations into their own header Conflicts: libavcodec/dvdata.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * dv: Split DV data table declarations into their own headerDiego Biurrun2013-11-151-1/+1
| | | | | | | | | | | | 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.
* | avformat/dv: remove unused variableMichael Niedermayer2013-11-101-1/+1
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>