45 if (!memcmp(buf,
"File Format=MacCaption_MCC V", 28))
69 { .
key = 16, .len = 3, .value =
"\xFA\x0\x0", },
70 { .key = 17, .len = 6, .value =
"\xFA\x0\x0\xFA\x0\x0", },
71 { .key = 18, .len = 9, .value =
"\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0", },
72 { .key = 19, .len = 12, .value =
"\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0", },
73 { .key = 20, .len = 15, .value =
"\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0", },
74 { .key = 21, .len = 18, .value =
"\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0", },
75 { .key = 22, .len = 21, .value =
"\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0", },
76 { .key = 23, .len = 24, .value =
"\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0", },
77 { .key = 24, .len = 27, .value =
"\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0\xFA\x0\x0", },
78 { .key = 25, .len = 3, .value =
"\xFB\x80\x80", },
79 { .key = 26, .len = 3, .value =
"\xFC\x80\x80", },
80 { .key = 27, .len = 3, .value =
"\xFD\x80\x80", },
81 { .key = 28, .len = 2, .value =
"\x96\x69", },
82 { .key = 29, .len = 2, .value =
"\x61\x01", },
83 { .key = 30, .len = 3, .value =
"\xFC\x80\x80", },
84 { .key = 31, .len = 3, .value =
"\xFC\x80\x80", },
85 { .key = 32, .len = 4, .value =
"\xE1\x00\x00\x00", },
86 { .key = 33, .len = 0, .value =
NULL, },
87 { .key = 34, .len = 0, .value =
NULL, },
88 { .key = 35, .len = 1, .value =
"\x0", },
111 int hh, mm,
ss,
fs,
i = 0, j = 0;
112 int start = 12, count = 0;
117 if (!strncmp(
line,
"File Format=MacCaption_MCC V", 28))
119 if (!strncmp(
line,
"//", 2))
121 if (!strncmp(
line,
"Time Code Rate=", 15)) {
122 char *rate_str =
line + 15;
124 int num = -1, den = -1;
127 num = strtol(rate_str, &
df, 10);
130 av_reduce(&num, &den, num * 1000LL, 1001, INT_MAX);
134 if (num > 0 && den > 0) {
146 lline = (
char *)&
line;
153 if (v >= 16 && v <= 35) {
166 if (
i + 13 >=
sizeof(
line) - 1)
169 if (j >=
sizeof(
out) - 1) {
173 out[j++] = vv | (v << 4);
183 count = (
out[11] & 0x1f) * 3;
184 if (j < start + count + 1)
213 int64_t min_ts, int64_t ts, int64_t max_ts,
int flags)
217 min_ts, ts, max_ts,
flags);
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
#define flags(name, subs,...)
#define ss(width, name, subs,...)
#define fs(width, name, subs,...)
static float sub(float src0, float src1)
static int read_header(FFV1Context *f)
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
static AVRational av_make_q(int num, int den)
Create an AVRational.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
int av_sscanf(const char *string, const char *format,...)
See libc sscanf manual for more information.
int av_strncasecmp(const char *a, const char *b, size_t n)
Locale-independent case-insensitive compare.
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_cold int read_close(AVFormatContext *ctx)
static int mcc_read_seek(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
static int mcc_read_header(AVFormatContext *s)
static int convert(uint8_t x)
static const alias aliases[20]
AVInputFormat ff_mcc_demuxer
static int mcc_read_close(AVFormatContext *s)
static int mcc_read_packet(AVFormatContext *s, AVPacket *pkt)
static int mcc_probe(const AVProbeData *p)
enum AVMediaType codec_type
General type of the encoded data.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
This structure contains the data a format has to probe a file.
int buf_size
Size of buf except extra allocated bytes.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Rational number (pair of numerator and denominator).
AVCodecParameters * codecpar
Codec parameters associated with this stream.
ptrdiff_t ff_subtitles_read_line(FFTextReader *tr, char *buf, size_t size)
Read a line of text.
int64_t ff_text_pos(FFTextReader *r)
Return the byte position of the next byte returned by ff_text_r8().
int ff_subtitles_queue_seek(FFDemuxSubtitlesQueue *q, AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Update current_sub_idx to emulate a seek.
void ff_text_read(FFTextReader *r, char *buf, size_t size)
Read the given number of bytes (in UTF-8).
void ff_text_init_buf(FFTextReader *r, void *buf, size_t size)
Similar to ff_text_init_avio(), but sets it up to read from a bounded buffer.
int ff_text_eof(FFTextReader *r)
Return non-zero if EOF was reached.
void ff_text_init_avio(void *s, FFTextReader *r, AVIOContext *pb)
Initialize the FFTextReader from the given AVIOContext.
int ff_text_r8(FFTextReader *r)
Return the next byte.
int ff_subtitles_queue_read_packet(FFDemuxSubtitlesQueue *q, AVPacket *pkt)
Generic read_packet() callback for subtitles demuxers using this queue system.
int ff_text_peek_r8(FFTextReader *r)
Like ff_text_r8(), but don't remove the byte from the buffer.
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.
void ff_subtitles_queue_clean(FFDemuxSubtitlesQueue *q)
Remove and destroy all the subtitles packets.
AVPacket * ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q, const uint8_t *event, size_t len, int merge)
Insert a new subtitle event.