FFmpeg: libavformat/rcwtdec.c Source File
Go to the documentation of this file. 1 /*
2 * RCWT (Raw Captions With Time) demuxer
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 /*
22 * RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
23 * used open source tool for processing 608/708 Closed Captions (CC) sources.
24 *
25 * This demuxer implements the specification as of March 2024, which has
26 * been stable and unchanged since April 2014.
27 *
28 * A free specification of RCWT can be found here:
29 * @url{https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT}
30 */
31
37
38 #define RCWT_HEADER_SIZE 11
39
43
45 {
47
51
52 /* read header */
56
59 "(only version 0.001 is known)\n");
61 }
62
65
66 /* setup stream */
68 if (!st)
70
73
75
76 /* demux */
82
83 if (cluster_nb_blocks == 0)
84 continue;
85
87 if (!sub)
89
93
94 sub->
pos = cluster_pos;
95 sub->
pts = cluster_pts;
96 }
97
99
100 return 0;
101 }
102
104 {
108 AV_RB16(
p->buf + 6) == 0x0001 ? 50 : 0;
109 }
110
122 };
int ff_subtitles_read_close(AVFormatContext *s)
const FFInputFormat ff_rcwt_demuxer
Filter the word "frame" indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
enum AVMediaType codec_type
General type of the encoded data.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
static int rcwt_probe(const AVProbeData *p)
static av_cold int read_close(AVFormatContext *ctx)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
unsigned int avio_rl16(AVIOContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int ff_subtitles_read_packet(AVFormatContext *s, AVPacket *pkt)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define FF_INFMT_FLAG_INIT_CLEANUP
For an FFInputFormat with this flag set read_close() needs to be called by the caller upon read_heade...
AVCodecParameters * codecpar
Codec parameters associated with this stream.
static int rcwt_read_header(AVFormatContext *avf)
AVIOContext * pb
I/O context.
This structure contains the data a format has to probe a file.
AVPacket * ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q, const uint8_t *event, size_t len, int merge)
Insert a new subtitle event.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
void ff_subtitles_queue_finalize(void *log_ctx, FFDemuxSubtitlesQueue *q)
Set missing durations, sort subtitles by PTS (and then byte position), and drop duplicated events.
static const uint8_t header[24]
static int read_header(FFV1Context *f, RangeCoder *c)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int ff_subtitles_read_seek(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_WB16 unsigned int_TMPL AV_RB8
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
static int read_probe(const AVProbeData *p)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
int64_t pos
byte position in stream, -1 if unknown
uint64_t avio_rl64(AVIOContext *s)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
void * priv_data
Format private data.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
Generated on Tue Nov 18 2025 19:23:33 for FFmpeg by
doxygen
1.8.17