summaryrefslogtreecommitdiff
path: root/libavformat/mpeg.c
Commit message (Collapse)AuthorAge
* avformat/demux: Add new demux.h headerAndreas Rheinhardt2022-05-10
| | | | | | And move those stuff already in demuxer-only files to it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* configure: Use a separate config_components.h header for $ALL_COMPONENTSMartin Storsjö2022-03-16
| | | | | | | | This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. Signed-off-by: Martin Storsjö <martin@martin.st>
* mpeg: convert to new channel layout APIAnton Khirnov2022-03-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: Avoid allocation for AVStreamInternalAndreas Rheinhardt2021-09-17
| | | | | | | | | | Do this by allocating AVStream together with the data that is currently in AVStreamInternal; or rather: Put AVStream at the beginning of a new structure called FFStream (which encompasses more than just the internal fields and is a proper context in its own right, hence the name) and remove AVStreamInternal altogether. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Stop including channel_layout.h in avcodec.hAndreas Rheinhardt2021-07-22
| | | | | | Also include channel_layout.h directly wherever used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mpeg: Simplify cleanup after reading vobsub header failsAndreas Rheinhardt2021-07-08
| | | | | | | by setting the FF_FMT_INIT_CLEANUP flag. Furthermore, also remove an unnecessary check for NULL before avformat_close_input(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: move AVStream.{parser,need_parsing} to AVStreamInternalJames Almer2021-05-07
| | | | | | | Those are private fields, no reason to have them exposed in a public header. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: Constify all muxer/demuxersAndreas Rheinhardt2021-04-27
| | | | | | | 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: Constify the API wrt AV(In|Out)putFormatAndreas Rheinhardt2021-04-27
| | | | | | | Also constify AVProbeData. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/subtitles: use av_packet_alloc() to allocate packetsJames Almer2021-03-17
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* lavf: move AVStream.{request_probe,skip_to_keyframe} to AVStreamInternalAnton Khirnov2020-10-28
| | | | | Those are private fields, no reason to have them exposed in a public header.
* avformat/mpeg: Check avio_read() return value in get_pts()Michael Niedermayer2020-08-18
| | | | | | | Found-by: Thierry Foucu <tfoucu@gmail.com> Fixes: Use-of-uninitialized-value Reviewed-by: Thierry Foucu <tfoucu@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mpeg: Decrease score by 1 for files with very little valid dataMichael Niedermayer2020-05-10
| | | | | | Fixes: 8233/PPY6574574605_cut.mp3 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mpeg: Don't use unintialized valueAndreas Rheinhardt2020-04-09
| | | | | | | | vobsub_read_packet() didn't check whether an array of AVPackets was valid and therefore used uninitialized values. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/mpeg: Remove unnecessary av_packet_unref()Andreas Rheinhardt2020-03-26
| | | | | | | Forgotten in 6a67d518. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/mpeg: Remove secondary packet for reading VobSubAndreas Rheinhardt2020-01-01
| | | | | | | | | | | | | | | | | | | | | | When vobsub_read_packet() reads a packet, it uses a dedicated AVPacket to get the subtitle timing and position from an FFDemuxSubtitlesQueue (which has been filled with this data during reading the idx file in vobsub_read_header); afterwards the actual subtitle data is read into the packet destined for output and the timing and position are copied to this packet. Afterwards, the local packet is unreferenced. This can be simplified: Simply use the output packet to get the timing and position from the FFDemuxSubtitlesQueue. The packet's size will be zero afterwards, so that it can be directly used to read the actual subtitle data. This makes copying the packet fields as well as unreferencing the local packet unecessary and also removes an instance of usage of sizeof(AVPacket) in libavformat. The only difference is that the returned packet will already be flagged as a keyframe. This currently only happens in compute_pkt_fields(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mpeg: Fix leaks of AVFormatContext and subtitle packetsAndreas Rheinhardt2019-12-05
| | | | | | | | | If an error happens in vobsub_read_header() after allocating the AVFormatContext intended to read the sub-file, both the AVFormatContext as well as the data in the subtitles queues leaks. This has been fixed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mpeg: Don't copy or leak string in AVBPrintAndreas Rheinhardt2019-12-05
| | | | | | | | | | | | | | | | vobsub_read_header() uses an AVBPrint to write a string and up until now, it collected the string stored in the AVBPrint via av_bprint_finalize(), which might involve an allocation and copy of the string. But this is unnecessary, as the lifetime of the returned string does not exceed the lifetime of the AVBPrint. So use the string in the AVBPrint directly. This also makes it possible to easily fix a memleak: In certain error situations, the string stored in the AVBPrint would not be freed (if it was dynamically allocated). This has been fixed, too. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mpeg: Make VobSub demuxer have its own context structAndreas Rheinhardt2019-12-05
| | | | | | | | | | | | | | | | | When the VobSub demuxer was added, the fields it required were simply added to the MpegDemuxContext (if the VobSub demuxer was selected at all). The mpeg demuxer of course doesn't use these fields even if they are there; and the VobSub demuxer doesn't use the old ones: It opens an mpeg subdemuxer of its own and uses this where a mpeg demuxer is required. Hence the two contexts can be split, saving memory. Furthermore several headers can now be moved to the section that is guarded by #if CONFIG_VOBSUB_DEMUXER (this even includes avassert.h which was unguarded and has been added in 9cde9f70 despite not being used in that patch). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mpeg: Don't free unintialized pointerAndreas Rheinhardt2019-10-24
| | | | | | | | | | | | In order to fix a potential memleak upon failure, 0b8956b2 made sure that a buffer given by a pointer was freed upon error. But this pointer was only initialized upon use and in several cases (Clang gives no fewer than 13 -Wsometimes-uninitialized warnings) this meant that an uninitialized pointer was used to free a buffer. So initialize the pointer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mpeg: Add padding to extradataAndreas Rheinhardt2019-10-24
| | | | | | | | | Extradata is supposed to be padded with AV_INPUT_BUFFER_PADDING_SIZE bytes, yet the VobSub demuxer used av_strdup for the allocation of extradata. This has been changed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mpeg: move the header_str free into end labelSteven Liu2019-10-22
| | | | | | fix CID: 1454875 Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/mpeg: check av_strdup() return valueSteven Liu2019-10-19
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/mpeg: Remove set-but-unused variableAndreas Rheinhardt2019-10-08
| | | | | | Forgotten in 7da57875. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/mpeg: better fix for MLP versus PCM-DVD misdetectionPaul B Mahol2019-10-05
|
* lavf: Constify the probe function argument.Carl Eugen Hoyos2019-03-21
| | | | | Reviewed-by: Lauri Kasanen Reviewed-by: Tomas Härdin
* lavf: Constify AVInputFormat pointer.Carl Eugen Hoyos2019-03-20
|
* lavf/mpeg: fix indentXiaofeng Wang2019-02-18
| | | | | Signed-off-by: Xiaofeng Wang <xiaofeng.wang@bqvision.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mpeg: Support demuxing HEVC in mpeg-ps.Carl Eugen Hoyos2018-09-27
|
* avformat: correct fdebug loglevelGyan Doshi2018-08-14
| | | | | fftools/cmdutils sets loglevel for fdebug to DEBUG but all fdebug output except for two were emitted at TRACE.
* avformat/mpeg: add missing checkPaul B Mahol2018-04-01
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avformat/mpeg: fix logic failurePaul B Mahol2018-04-01
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avformat/mpeg: fix detection and demuxing of raw AC3 in mpegpsPaul B Mahol2018-04-01
| | | | | | Fixes #4889. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avformat/mpeg: fix PCM-DVD mis-detection as MLPPaul B Mahol2018-04-01
| | | | | | Fixes #6563. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avformat: migrate to AVFormatContext->urlMarton Balint2018-01-28
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpeg: zero initialize idx_pktJames Almer2017-09-23
| | | | | | Prevents use of uninitialized stack. Signed-off-by: James Almer <jamrial@gmail.com>
* Merge commit '83548fe894cdb455cc127f754d09905b6d23c173'James Almer2017-03-21
|\ | | | | | | | | | | | | * commit '83548fe894cdb455cc127f754d09905b6d23c173': lavf: fix usage of AVIOContext.seekable Merged-by: James Almer <jamrial@gmail.com>
| * lavf: fix usage of AVIOContext.seekableAnton Khirnov2016-09-30
| | | | | | | | | | | | | | | | It is supposed to be a flag. The only currently defined value is AVIO_SEEKABLE_NORMAL, but other ones may be added in the future. However all the current lavf code treats this field as a bool (mainly for historical reasons). Change all those cases to properly check for AVIO_SEEKABLE_NORMAL.
* | lavf/mpeg: Initialize a stack variable used by memcmp().Carl Eugen Hoyos2017-02-21
| | | | | | | | | | | | Silence a valgrind warning. Fixes ticket #6160.
* | avformat/mpeg: Adjust vid probe threshold to correct mis-detectionMichael Niedermayer2016-11-23
| | | | | | | | | | | | Fixes: _ij.mp3 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'Clément Bœsch2016-06-21
|\| | | | | | | | | | | | | * commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb': cosmetics: Fix spelling mistakes Merged-by: Clément Bœsch <u@pkh.me>
| * cosmetics: Fix spelling mistakesVittorio Giovara2016-05-04
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
| * Drop pointless assert.h #includesDiego Biurrun2016-05-03
| |
* | Merge commit '9200514ad8717c63f82101dc394f4378854325bf'Derek Buitenhuis2016-04-10
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/mpeg: Identify sub-stream ID 0xa1 as mlp.Carl Eugen Hoyos2016-03-09
| | | | | | | | | | | | Fixes ticket #4786. Auto-detection seems difficult, patch mostly confirmed by http://dvd-audio.sourceforge.net/spec/aob.shtml
* | avformat: Add a protocol blacklisting APIDerek Buitenhuis2016-03-04
| | | | | | | | Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* | lavf/mpeg: use FFERROR_REDO instead of AVERROR(EAGAIN).Nicolas George2015-12-03
| |
* | Replace remaining occurances of av_free_packet with av_packet_unrefHendrik Leppkes2015-10-27
| |
* | avformat/vobsub: do not attempt to check duplicate subtitleswm42015-09-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some .idx files actually contain duplicate subtitle events: timestamp: 00:07:52:600, filepos: 00004e800 timestamp: 00:07:52:600, filepos: 00004f800 The second will be dropped, because it has same pts, duration, and text (the text is just a dummy empty string; the real data is retrieved when actually reading vobsub subtitle packets). Dropping this is probably not intended/safe, so avoid it. See trac issue #4872 for a sample. This patch doesn't fix decoding of the sample, though.