Go to the documentation of this file.
61 if (!memcmp(buf,
"File Format=MacCaption_MCC V", 28))
84 #define CCPAD "\xFA\x0\x0"
85 #define CCPAD3 CCPAD CCPAD CCPAD
91 { .
key = 16, .len = 3, .value =
cc_pad, },
92 { .key = 17, .len = 6, .value =
cc_pad, },
93 { .key = 18, .len = 9, .value =
cc_pad, },
94 { .key = 19, .len = 12, .value =
cc_pad, },
95 { .key = 20, .len = 15, .value =
cc_pad, },
96 { .key = 21, .len = 18, .value =
cc_pad, },
97 { .key = 22, .len = 21, .value =
cc_pad, },
98 { .key = 23, .len = 24, .value =
cc_pad, },
99 { .key = 24, .len = 27, .value =
cc_pad, },
100 { .key = 25, .len = 3, .value =
"\xFB\x80\x80", },
101 { .key = 26, .len = 3, .value =
"\xFC\x80\x80", },
102 { .key = 27, .len = 3, .value =
"\xFD\x80\x80", },
103 { .key = 28, .len = 2, .value =
"\x96\x69", },
104 { .key = 29, .len = 2, .value =
"\x61\x01", },
105 { .key = 30, .len = 3, .value =
"\xFC\x80\x80", },
106 { .key = 31, .len = 3, .value =
"\xFC\x80\x80", },
107 { .key = 32, .len = 4, .value =
"\xE1\x00\x00\x00", },
108 { .key = 33, .len = 0, .value =
NULL, },
109 { .key = 34, .len = 0, .value =
NULL, },
110 { .key = 35, .len = 1, .value =
"\x0", },
162 { .
rate = { .
num = 24, .den = 1 }, .str =
"24" },
163 { .rate = { .num = 25, .den = 1 }, .str =
"25" },
164 { .rate = { .num = 30000, .den = 1001 }, .str =
"30DF" },
165 { .rate = { .num = 30, .den = 1 }, .str =
"30" },
166 { .rate = { .num = 50, .den = 1 }, .str =
"50" },
167 { .rate = { .num = 60000, .den = 1001 }, .str =
"60DF" },
168 { .rate = { .num = 60, .den = 1 }, .str =
"60" },
176 bool bad_after =
false;
177 for (; *after; after++) {
198 unsigned digit = **line_left -
'0';
204 unsigned char after = **line_left;
205 if (!after || !strchr(after_set, after))
274 if (!strncmp(
line,
"File Format=MacCaption_MCC V", 28))
276 if (!strncmp(
line,
"//", 2))
278 if (!strncmp(
line,
"Time Code Rate=", 15)) {
284 if (strchr(
line,
'='))
286 char *line_left =
line;
311 uint8_t v =
convert(*line_left++);
313 if (v >= 16 && v <= 35) {
322 bytestream2_put_byte(&pb, vv | (v << 4));
336 bytestream2_put_byte(&pb, 0);
352 int len = cc_count * 3;
397 #define OFFSET(x) offsetof(MCCContext, x)
398 #define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
401 {
"eia608_extract",
"extract EIA-608/708 captions from VANC packets",
OFFSET(eia608_extract),
AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1,
SD },
417 .p.extensions =
"mcc",
int ff_text_r8(FFTextReader *r)
Return the next byte.
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 convert(uint8_t x)
static av_const int av_isspace(int c)
Locale-independent conversion of ASCII isspace.
static void merge(GetBitContext *gb, uint8_t *dst, uint8_t *src, int size)
Merge two consequent lists of equal size depending on bits read.
@ AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_8BIT_LUMA
used for VBI and ANC
uint32_t flags
flags such as drop frame, +24 hours support, ...
uint16_t payload_sample_count
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int buf_size
Size of buf except extra allocated bytes.
static int mcc_parse_time_code_part(char **line_left, unsigned *value, unsigned max, const char *after_set)
static int parse_time_code_rate(AVFormatContext *s, AVStream *st, TimeTracker *tt, const char *time_code_rate)
AVSmpte436mWrappingType wrapping_type
ptrdiff_t ff_subtitles_read_line(FFTextReader *tr, char *buf, size_t size)
Read a line of text.
int av_smpte_436m_anc_append(AVPacket *pkt, int anc_packet_count, const AVSmpte436mCodedAnc *anc_packets)
Append more ANC packets to a single AV_CODEC_ID_SMPTE_436M_ANC AVPacket's data.
static int mcc_read_close(AVFormatContext *s)
int start
timecode frame start (first base frame number)
static av_cold int read_close(AVFormatContext *ctx)
static const AVOption mcc_options[]
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.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
static av_always_inline void bytestream2_init_writer(PutByteContext *p, uint8_t *buf, int buf_size)
int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start, void *log_ctx)
Init a timecode struct with the passed parameters.
int av_smpte_291m_anc_8bit_decode(AVSmpte291mAnc8bit *out, AVSmpte436mPayloadSampleCoding sample_coding, uint16_t sample_count, const uint8_t *payload, void *log_ctx)
Decode a AVSmpte436mCodedAnc payload into AVSmpte291mAnc8bit.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
static av_always_inline int bytestream2_tell_p(const PutByteContext *p)
static av_always_inline unsigned int bytestream2_put_buffer(PutByteContext *p, const uint8_t *src, unsigned int size)
static int mcc_parse_time_code(char **line_left, MCCTimecode *tc)
int av_stristart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str independent of case.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
int ff_subtitles_queue_read_packet(FFDemuxSubtitlesQueue *q, AVPacket *pkt)
Generic read_packet() callback for subtitles demuxers using this queue system.
@ AV_CLASS_CATEGORY_DEMUXER
#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...
void ff_text_read(FFTextReader *r, char *buf, size_t size)
Read the given number of bytes (in UTF-8).
AVCodecParameters * codecpar
Codec parameters associated with this stream.
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
const char * av_default_item_name(void *ptr)
Return the context name.
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.
AVRational rate
frame rate in rational form
void ff_text_init_avio(void *s, FFTextReader *r, AVIOContext *pb)
Initialize the FFTextReader from the given AVIOContext.
int av_timecode_init_from_components(AVTimecode *tc, AVRational rate, int flags, int hh, int mm, int ss, int ff, void *log_ctx)
Init a timecode struct from the passed timecode components.
static int time_tracker_set_time(TimeTracker *tt, const MCCTimecode *tc, void *log_ctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ AV_SMPTE_436M_WRAPPING_TYPE_VANC_FIELD_2
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 alias aliases[20]
static av_const int av_isdigit(int c)
Locale-independent conversion of ASCII isdigit.
void ff_subtitles_queue_clean(FFDemuxSubtitlesQueue *q)
Remove and destroy all the subtitles packets.
static int read_header(FFV1Context *f, RangeCoder *c)
An encoded ANC packet within a single AV_CODEC_ID_SMPTE_436M_ANC AVPacket's data.
static int mcc_probe(const AVProbeData *p)
An ANC packet with an 8-bit payload.
uint32_t payload_array_length
static int mcc_read_packet(AVFormatContext *s, AVPacket *pkt)
static const AVClass mcc_class
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
static int mcc_read_seek(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
int64_t ff_text_pos(FFTextReader *r)
Return the byte position of the next byte returned by ff_text_r8().
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
@ AV_CODEC_ID_SMPTE_436M_ANC
const FFInputFormat ff_mcc_demuxer
static const char cc_pad[27]
@ AV_TIMECODE_FLAG_DROPFRAME
timecode is drop frame
uint8_t payload[AV_SMPTE_436M_CODED_ANC_PAYLOAD_CAPACITY]
the payload, has size payload_array_length.
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int av_smpte_291m_anc_8bit_extract_cta_708(const AVSmpte291mAnc8bit *anc, uint8_t *cc_data, void *log_ctx)
Try to decode an ANC packet into EIA-608/CTA-708 data (AV_CODEC_ID_EIA_608).
int ff_text_peek_r8(FFTextReader *r)
Like ff_text_r8(), but don't remove the byte from the buffer.
static struct ValidTimeCodeRate valid_time_code_rates[]
static av_always_inline int bytestream2_seek_p(PutByteContext *p, int offset, int whence)
void ff_text_init_buf(FFTextReader *r, const void *buf, size_t size)
Similar to ff_text_init_avio(), but sets it up to read from a bounded buffer.
static int time_tracker_init(TimeTracker *tt, AVStream *st, AVRational rate, void *log_ctx)
static int read_probe(const AVProbeData *p)
int ff_text_eof(FFTextReader *r)
Return non-zero if EOF was reached.
@ AV_SMPTE_436M_WRAPPING_TYPE_VANC_FRAME
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
int64_t pos
byte position in stream, -1 if unknown
AVSmpte436mPayloadSampleCoding payload_sample_coding
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_SMPTE_436M_CODED_ANC_PAYLOAD_CAPACITY
max number of bytes that can be stored in the payload of AVSmpte436mCodedAnc
static int mcc_read_header(AVFormatContext *s)
The official guide to swscale for confused that consecutive non overlapping rectangles of slice_bottom special converter These generally are unscaled converters of common like for each output line the vertical scaler pulls lines from a ring buffer When the ring buffer does not contain the wanted line