Commit Graph

20 Commits

Author SHA1 Message Date
Andreas Rheinhardt
f545155eb3 avformat/webvttdec: Simplify cleanup after read_header failure
by setting the FF_FMT_INIT_CLEANUP flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 15:19:55 +02: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
Andreas Rheinhardt
ef6a9e5e31 avutil/buffer: Switch AVBuffer API to size_t
Announced in 14040a1d91.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:13 -03:00
Andreas Rheinhardt
7447045cc0 avformat/webvttdec: Accept \r as newline
After parsing the end timestamp of a WebVTT cue block, the current code
skips everything after the start of the timestamp that is not a \t, ' '
or \n and treats what is next as the start of a WebVTT cue settings list.
Yet if there is no such list, but a single \r, this will skip a part of
the cue payload (namely everything until the first occurence of \t, ' '
or \n) and treat what has not been skipped as the beginning of the
WebVTT cue settings list that extends until the next \r or \n (or the
end).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-26 07:48:10 +02:00
Andreas Rheinhardt
c784fe8b86 avformat/webvttdec: Fix memleak upon read header failure
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>
2020-06-15 16:54:06 +02:00
Andreas Rheinhardt
e35a59ea63 avformat/webvttdec: Remove write-only variable
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-23 20:09:38 +02:00
Jun Zhao
c351873e06 lavf/webvtt: fix ffmpeg -h demuxer=webvtt can't dump options
fix ffmpeg -h demuxer=webvtt can't dump options

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-06-14 13:18:32 +08: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
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
Ricardo Constantino
6eaf97c289 avformat/webvttdec: Don't stop parsing on comments
Signed-off-by: Ricardo Constantino <wiiaboo@gmail.com>
2015-10-12 22:16:12 +02:00
Clément Bœsch
af924fd9e4 avformat/subtitles: forward log context in ff_subtitles_queue_finalize() for logging 2015-09-10 21:40:07 +02:00
Michael Niedermayer
b0517467c0 avformat/webvttdec: Dont skip over a never checked byte after -->
Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7f49667d83db_3396_WebVTT_capability_tester.vtt
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-07 04:09:19 +01:00
Matthew Heaney
1029822a91 lavf/webvttdec: use private option to specify WebVTT kind
WebVTT subtitle tracks have four kinds. Certain downstream muxers
(such as for WebM) need to know which WebVTT kind this is, in order to
specify the codec id of the output track.

A new private input option, "-kind", has been added to the WebVTT
demuxer.  It accepts as a value any of "subtitles" (the default),
"captions", "descriptions", and "metadata".  The kind option value is
used to assign a value to the stream disposition flag, to which four
new values have been added, corresponding the four WebVTT kinds.

Signed-off-by: Matthew Heaney <matthewjheaney@google.com>
Signed-off-by: Clément Bœsch <ubitux@gmail.com>
2013-06-25 00:13:47 +02:00
Clément Bœsch
07f6a66bf5 lavf/webvttdec: factorize identifier and settings side data code. 2013-06-01 15:12:49 +02:00
Matthew Heaney
8f75ba9926 lavf/webvttdec: save cue id and settings as side data
Currently the WebVTT demuxer parses the cues but throws away
the cue id (the optional first line of the cue) and cue
settings (the optional rendering instructions that follow
the timestamp).

However, in order to write inband text tracks (to WebM
files), the entire cue payload from the WebVTT source must
be preserved.

This commit makes no change to the data part of the output
buffer packet (where the actual cue text is stored), but
does add the cue id and settings as a side data items, if
they're present in the cue. Existing code that cares only
about the data part of the packet can continue to ignore the
side data.

There are two new packet data type flags,
AV_PKT_DATA_WEBVTT_IDENTIFIER and
AV_PKT_DATA_WEBVTT_SETTINGS.
2013-06-01 15:12:49 +02:00
Clément Bœsch
dc8b36746a lavf/webvtt: use ff_subtitles_read_chunk().
The FATE test is updated because the line breaks in the dialogue
rectangles are now proper CRLF.
2013-01-03 07:46:30 +01:00
Clément Bœsch
8bc74221f8 lavf: remove generic index flag from text subtitles.
This flag is not necessary.
2013-01-02 10:32:21 +01:00
Clément Bœsch
bad4e112a2 lavf: use ff_subtitles_queue_seek() for text subtitles demuxers. 2012-12-02 00:06:03 +01:00
Clément Bœsch
99a520000d lavf/webvttdec: fix potential timing overflows.
Should fix CID733781 and CID733782.
2012-10-21 01:16:49 +02:00
Clément Bœsch
2599541b3d WebVTT demuxer and decoder. 2012-09-23 15:24:08 +02:00