summaryrefslogtreecommitdiff
path: root/libavformat/srtdec.c
Commit message (Collapse)AuthorAge
* avformat/subtitles: Deduplicate subtitles' read_(packet|seek|close)Andreas Rheinhardt2021-07-18
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/srtdec: Simplify cleanup after read_header failureAndreas Rheinhardt2021-07-08
| | | | | | by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.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/srtdec: Fix memleak upon read header failureAndreas Rheinhardt2020-06-15
| | | | | | | The already parsed subtitles (contained in an FFDemuxSubtitlesQueue) would leak if an error happened upon reading a subsequent subtitle. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* lavf: Constify the probe function argument.Carl Eugen Hoyos2019-03-21
| | | | | Reviewed-by: Lauri Kasanen Reviewed-by: Tomas Härdin
* Fix all -Wformat warnings raised by DJGPPClément Bœsch2017-03-29
|
* lavf/srtdec: fix indentRodger Combs2016-06-25
|
* lavf/srtdec: fix probing files with negative first timestampsRodger Combs2016-06-25
|
* 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/srtdec: do not be strict wrt timing digit lengthsClément Bœsch2016-03-18
| | | | | | | | Fixes a sample with 3-length digits for the seconds reported by wm4.
* | lavf/srtdec: rewrite parsing logicClément Bœsch2016-01-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes Ticket #5032 The samples in Ticket #5032 is using \r\r\n as line breaks. Since we already are handling \r, or \n, or \r\n as line breaks, \r\n\n will be considered as a double line breaks. This is an issue because ff_subtitles_read_text_chunk() will as a result stop extracting a chunk after just one line. So instead of parsing the SRT by "chunks" (which means splitting every double LB), this new parser is detecting timing lines, and split the events on this basis. While this sounds safe and simple, it needs to take into account the event number preceding the timing line while handling situations such as: - event number starting at 0 or actually any number instead of 1 - event numbers not being ordered at all - event number being followed by text garbage (this really happened, see Ticket #4898) - event payload containing one or multiple number (a protagonist saying a count-down, a date or whatever) which could be confused with a chapter number - event number being empty (see Ticket #2167) - all kind of weird line breaks can appear randomly like wild pokémons - untrustable line breaks (Ticket #5032) The sample madness.srt tries to sum up most of this into one sample, ticket5032-rrn.srt is the file containing \r\r\n line breaks. and empty-events-2167.srt contains empty events.
* | avformat/srtdec: make sure we probe a numberClément Bœsch2015-10-09
| | | | | | | | | | Fixes regression since 7218352e0228028dfa009a3799ec93fd041065f1: WebVTT files were matching the SRT probing.
* | avformat/srtdec: more lenient first line probingClément Bœsch2015-10-01
| | | | | | | | Fixes Ticket #4898
* | avformat/srtdec: fix number check for the first characterClément Bœsch2015-10-01
| |
* | avformat/subtitles: forward log context in ff_subtitles_queue_finalize() for ↵Clément Bœsch2015-09-10
| | | | | | | | logging
* | Print a warning if a subtitle demuxer changes utf16 to utf8.Carl Eugen Hoyos2014-10-29
| | | | | | | | | | | | | | This does not fix anything but gives users a chance to know that they must not pass -sub_charenc UTF-16 to ffmpeg. Fixes ticket #4059.
* | avformat/srtdec: simpler and more lenient probingClément Bœsch2014-09-26
| | | | | | | | Fixes Ticket #3935.
* | avformat/srtdec: speed up probingwm42014-09-05
| |
* | avformat/srtdec: UTF-16 supportwm42014-09-05
| |
* | replace calls to url_feof() with avio_feof()James Almer2014-08-08
| | | | | | | | | | Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/subtitles: add a next line jumper and use it.Clément Bœsch2013-09-08
| | | | | | | | | | | | | | | | | | | | | | | | This fixes a bunch of possible overread in avformat with the idiom p += strcspn(p, "\n") + 1 (strcspn() can focus on the trailing '\0' if no '\n' is found, so the +1 leads to an overread). Note on lavf/matroskaenc: no extra subtitles.o Makefile dependency is added because only the header is required for ff_subtitles_next_line(). Note on lavf/mpsubdec: code gets slightly complex to avoid an infinite loop in the probing since there is no more forced increment.
* | avformat/srtdec: skip initial random line breaks.Clément Bœsch2013-09-08
| | | | | | | | | | I found a bunch of (recent) SRT files in the wild with 3 to 10 line breaks at the beginning.
* | avformat/srtdec: Fix pointer corruptionMichael Niedermayer2013-05-14
| | | | | | | | | | | | | | This fixes use of uninitialized memory and possible out of array access Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavf/srtdec: do not try to queue empty subtitle chunks.Clément Bœsch2013-01-27
| | | | | | | | | | Regression since 3af3a30. Fixes Ticket2167.
* | lavf: remove generic index flag from text subtitles.Clément Bœsch2013-01-02
| | | | | | | | This flag is not necessary.
* | lavf: move srtdec:read_chunk() to subtitles utils.Clément Bœsch2012-12-30
| | | | | | | | This function can be useful for various other subtitles formats.
* | lavf/srtdec: remove line break hack.Clément Bœsch2012-12-30
| | | | | | | | This is not necessary anymore since the last commit.
* | srt_probe: make buffer pointer constMichael Niedermayer2012-12-25
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavf/srtdec: reindent after previous commits.Clément Bœsch2012-12-20
| |
* | lavf/srtdec: switch to FFDemuxSubtitlesQueue API.Clément Bœsch2012-12-20
| |
* | lavf/srtdec: trim line break event separators from packet.Clément Bœsch2012-11-20
| | | | | | | | | | | | | | | | | | | | | | | | | | The muxer add them automatically, so this avoid having a bunch of line breaks all over the output files. One '\n' is still kept/added because the lavc subrip decoder seems to have trouble with line ending abruptly (it doesn't flush correctly the tags). This bug is harmless but should be fixed; though, this doesn't look like a trivial change. When this bug gets fixed, we can consider removing the '\n' at the end of the packet. The 2048B buffer limit was also removed while moving to AVBPrint API. Note that this doesn't really matter since the decoder is limited as well.
* | lavf/srtdec: recognize subtitles starting at event index 0.Clément Bœsch2012-11-05
| |
* | srt: make the demuxer output SubRip packets.Clément Bœsch2012-10-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SRT format should never have outputted CODEC_ID_SRT packets in the first place: SRT is a subtitle format containing SubRip text markup events. The timing information is part of the format, not the codec, and thus CODEC_ID_SRT should not exist. Creating packets with the timing information within the payload only leads to problem (such as remuxing with timing alteration not working), especially when the SubRip markup is being used in container like Matroska in addition to this standalone SRT format. The main reason the timing line was included in those CODEC_ID_SRT packets is likely because it contained extra information (the event position) the codec actually needs. This issue is solved by using the AV_PKT_DATA_SUBTITLE_POSITION side data type.
* | lavf/srtdec: simplify start/end computation.Clément Bœsch2012-10-24
| | | | | | | | Also fix potential overflow (CID733778)
* | Merge commit '36ef5369ee9b336febc2c270f8718cec4476cb85'Michael Niedermayer2012-08-07
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '36ef5369ee9b336febc2c270f8718cec4476cb85': Replace all CODEC_ID_* with AV_CODEC_ID_* lavc: add AV prefix to codec ids. Conflicts: doc/APIchanges doc/examples/decoding_encoding.c doc/examples/muxing.c ffmpeg.c ffprobe.c ffserver.c libavcodec/8svx.c libavcodec/avcodec.h libavcodec/dnxhd_parser.c libavcodec/dvdsubdec.c libavcodec/error_resilience.c libavcodec/h263dec.c libavcodec/libvorbisenc.c libavcodec/mjpeg_parser.c libavcodec/mjpegenc.c libavcodec/mpeg12.c libavcodec/mpeg4videodec.c libavcodec/mpegvideo.c libavcodec/mpegvideo_enc.c libavcodec/pcm.c libavcodec/r210dec.c libavcodec/utils.c libavcodec/v210dec.c libavcodec/version.h libavdevice/alsa-audio-dec.c libavdevice/bktr.c libavdevice/v4l2.c libavformat/asfdec.c libavformat/asfenc.c libavformat/avformat.h libavformat/avidec.c libavformat/caf.c libavformat/electronicarts.c libavformat/flacdec.c libavformat/flvdec.c libavformat/flvenc.c libavformat/framecrcenc.c libavformat/img2.c libavformat/img2dec.c libavformat/img2enc.c libavformat/ipmovie.c libavformat/isom.c libavformat/matroska.c libavformat/matroskadec.c libavformat/matroskaenc.c libavformat/mov.c libavformat/movenc.c libavformat/mp3dec.c libavformat/mpeg.c libavformat/mpegts.c libavformat/mxf.c libavformat/mxfdec.c libavformat/mxfenc.c libavformat/nsvdec.c libavformat/nut.c libavformat/oggenc.c libavformat/pmpdec.c libavformat/rawdec.c libavformat/rawenc.c libavformat/riff.c libavformat/sdp.c libavformat/utils.c libavformat/vocenc.c libavformat/wtv.c libavformat/xmv.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * Replace all CODEC_ID_* with AV_CODEC_ID_*Anton Khirnov2012-08-07
| |
* | avformat/srtdec: Write duration into packet from srt demuxer.Philip Langdale2012-08-04
| | | | | | | | | | | | | | The current demuxer does not bother to write packet durations, which makes it impossible to remux into a new format. Signed-off-by: Philip Langdale <philipl@overt.org>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2012-07-30
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: avformat: Drop pointless "format" from container long names swscale: bury one more piece of inline asm under HAVE_INLINE_ASM. wv: K&R formatting cosmetics configure: Add missing descriptions to help output h264_ps: declare array of colorspace strings on its own line. fate: amix: specify f32 sample format for comparison tiny_psnr: support 32-bit float samples eamad/eatgq/eatqi: call special EA IDCT directly eamad: remove use of MpegEncContext mpegvideo: remove unnecessary inclusions of faandct.h af_asyncts: avoid overflow in out_size with large delta values af_asyncts: add first_pts option Conflicts: configure libavcodec/eamad.c libavcodec/h264_ps.c libavformat/crcenc.c libavformat/ffmdec.c libavformat/ffmenc.c libavformat/framecrcenc.c libavformat/md5enc.c libavformat/nutdec.c libavformat/rawenc.c libavformat/yuv4mpeg.c tests/tiny_psnr.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * avformat: Drop pointless "format" from container long namesDiego Biurrun2012-07-30
| |
* | lavf/{srt,microdvd}: correctly raise error on avformat_new_stream() error.Clément Bœsch2012-06-15
| |
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2012-01-28
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: (71 commits) movenc: Allow writing to a non-seekable output if using empty moov movenc: Support adding isml (smooth streaming live) metadata libavcodec: Don't crash in avcodec_encode_audio if time_base isn't set sunrast: Document the different Sun Raster file format types. sunrast: Add a check for experimental type. libspeexenc: use AVSampleFormat instead of deprecated/removed SampleFormat lavf: remove disabled FF_API_SET_PTS_INFO cruft lavf: remove disabled FF_API_OLD_INTERRUPT_CB cruft lavf: remove disabled FF_API_REORDER_PRIVATE cruft lavf: remove disabled FF_API_SEEK_PUBLIC cruft lavf: remove disabled FF_API_STREAM_COPY cruft lavf: remove disabled FF_API_PRELOAD cruft lavf: remove disabled FF_API_NEW_STREAM cruft lavf: remove disabled FF_API_RTSP_URL_OPTIONS cruft lavf: remove disabled FF_API_MUXRATE cruft lavf: remove disabled FF_API_FILESIZE cruft lavf: remove disabled FF_API_TIMESTAMP cruft lavf: remove disabled FF_API_LOOP_OUTPUT cruft lavf: remove disabled FF_API_LOOP_INPUT cruft lavf: remove disabled FF_API_AVSTREAM_QUALITY cruft ... Conflicts: doc/APIchanges libavcodec/8bps.c libavcodec/avcodec.h libavcodec/libx264.c libavcodec/mjpegbdec.c libavcodec/options.c libavcodec/sunrast.c libavcodec/utils.c libavcodec/version.h libavcodec/x86/h264_deblock.asm libavdevice/libdc1394.c libavdevice/v4l2.c libavformat/avformat.h libavformat/avio.c libavformat/avio.h libavformat/aviobuf.c libavformat/dv.c libavformat/mov.c libavformat/utils.c libavformat/version.h libavformat/wtv.c libavutil/Makefile libavutil/file.c libswscale/x86/input.asm libswscale/x86/swscale_mmx.c libswscale/x86/swscale_template.c tests/ref/lavf/ffm Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavf: remove AVFormatParameters from AVFormatContext.read_header signatureAnton Khirnov2012-01-27
| |
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2011-12-01
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: rtpdec: Templatize the code for different g726 bitrate variants rv40: move loop filter to rv34dsp context lavf: make av_set_pts_info private. rtpdec: Add support for G726 audio rtpdec: Add an init function that can do custom codec context initialization avconv: make copy_tb on by default. matroskadec: don't set codec timebase. rmdec: don't set codec timebase. avconv: compute next_pts from input packet duration when possible. lavf: estimate frame duration from r_frame_rate. avconv: update InputStream.pts in the streamcopy case. Conflicts: avconv.c libavdevice/alsa-audio-dec.c libavdevice/bktr.c libavdevice/fbdev.c libavdevice/libdc1394.c libavdevice/oss_audio.c libavdevice/v4l.c libavdevice/v4l2.c libavdevice/vfwcap.c libavdevice/x11grab.c libavformat/au.c libavformat/eacdata.c libavformat/flvdec.c libavformat/mpegts.c libavformat/mxfenc.c libavformat/rtpdec_g726.c libavformat/wtv.c libavformat/xmv.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavf: make av_set_pts_info private.Anton Khirnov2011-11-30
| | | | | | | | It's supposed to be called only from (de)muxers.
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2011-10-20
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: presets: rename presets directory lavc: make avcodec_get_context_defaults3 "officially" public lavf: replace av_new_stream->avformat_new_stream part II. lavf,lavd: replace av_new_stream->avformat_new_stream part I. lavf: add avformat_new_stream as a replacement for av_new_stream. Use correct scaling table for bwd-pred MVs in second B-field Ut Video decoder Makefile: change presets extension to .avpreset lavfi: add rgbtestsrc source, ported from MPlayer libmpcodecs lavfi: add testsrc source AVOptions: add documentation. presets: update libx264 ffpresets Conflicts: Changelog doc/APIchanges doc/ffmpeg.texi ffpresets/libx264-ipod320.ffpreset ffpresets/libx264-ipod640.ffpreset ffserver.c libavcodec/avcodec.h libavcodec/options.c libavcodec/version.h libavdevice/libdc1394.c libavfilter/avfilter.h libavfilter/vsrc_testsrc.c libavformat/flvdec.c libavformat/riff.c libavformat/version.h libavformat/wtv.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavf,lavd: replace av_new_stream->avformat_new_stream part I.Anton Khirnov2011-10-19
| | | | | | | | | | Trivial replacements with sed are done in this commit: sed 's/av_new_stream(\([^)]*\), 0)/avformat_new_stream(\1, NULL)/'
| * Replace FFmpeg with Libav in licence headersMans Rullgard2011-03-19
| | | | | | | | Signed-off-by: Mans Rullgard <mans@mansr.com>
| * avio: deprecate url_feofAnton Khirnov2011-03-07
| | | | | | | | | | | | AVIOContext.eof_reached should be used directly instead. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
| * avio: add avio_tell macro as a replacement for url_ftellAnton Khirnov2011-03-04
| | | | | | | | Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>