Go to the documentation of this file.
31 switch (wrapping_type) {
48 switch (payload_sample_coding) {
89 #define SMPTE_436M_ANC_ENTRY_HEADER_SIZE ( \
122 uint32_t payload_array_element_size =
AV_RB32(in);
124 if (payload_array_element_size != 1)
127 if (needed_size >
size)
155 if (needed_size >
size)
177 if (anc_packet_count < 0 || anc_packet_count >= (1
L << 16) ||
size < 0)
182 if (
size < needed_size)
188 for (
int i = 0;
i < anc_packet_count;
i++) {
203 int final_packet_count = 0;
210 if (anc_packet_count < 0 || anc_packet_count >= (1
L << 16))
212 final_packet_count += anc_packet_count;
213 if (final_packet_count >= (1
L << 16))
215 int ret, additional_size = write_start -
pkt->
size;
216 for (
int i = 0;
i < anc_packet_count;
i++) {
220 additional_size +=
ret;
225 for (
int i = 0;
i < anc_packet_count;
i++) {
242 .size_left = buf_size - 2,
243 .data_left = buf + 2,
269 switch (sample_coding) {
282 return (sample_count + 3) & -4;
289 return 4 * ((sample_count + 2) / 3);
297 uint16_t sample_count,
298 const uint8_t *payload,
301 switch (sample_coding) {
313 if (sample_count < 3)
315 out->did = *payload++;
316 out->sdid_or_dbn = *payload++;
317 out->data_count = *payload++;
318 if (sample_count < out->data_count + 3)
320 memcpy(
out->payload, payload,
out->data_count);
330 "decoding an ANC packet using the 10-bit SMPTE 436M sample coding isn't implemented.\n");
350 switch (sample_coding) {
368 "encoding an ANC packet using the 10-bit SMPTE 436M sample coding isn't implemented.\n");
376 uint16_t line_number,
382 out->line_number = line_number;
383 out->wrapping_type = wrapping_type;
384 out->payload_sample_coding = sample_coding;
390 out->payload_sample_count =
ret;
396 out->payload_array_length =
ret;
398 switch (sample_coding) {
412 memset(
out->payload +
out->payload_array_length - 4, 0, 4);
414 out->payload[0] = payload->
did;
426 "encoding an ANC packet using the 10-bit SMPTE 436M sample coding isn't implemented.\n");
441 uint16_t cdp_identifier = bytestream2_get_be16(&gb);
442 if (cdp_identifier != 0x9669) {
446 bytestream2_get_byte(&gb);
447 bytestream2_get_byte(&gb);
448 bytestream2_get_byte(&gb);
449 bytestream2_get_be16(&gb);
450 unsigned section_id = bytestream2_get_byte(&gb);
452 const unsigned TIME_CODE_SECTION_ID = 0x71;
453 if (section_id == TIME_CODE_SECTION_ID) {
455 section_id = bytestream2_get_byte(&gb);
457 const unsigned CC_DATA_SECTION_ID = 0x72;
458 if (section_id == CC_DATA_SECTION_ID) {
462 unsigned cc_count = bytestream2_get_byte(&gb) & 0x1F;
463 unsigned data_length = cc_count * 3;
@ AV_SMPTE_436M_WRAPPING_TYPE_VANC_FIELD_1
int av_smpte_436m_coded_anc_payload_size(AVSmpte436mPayloadSampleCoding sample_coding, uint16_t sample_count)
Get the minimum number of bytes needed to store a AVSmpte436mCodedAnc payload.
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
@ AV_SMPTE_436M_WRAPPING_TYPE_VANC_PROGRESSIVE_FRAME
static av_always_inline int bytestream2_get_bytes_left(const GetByteContext *g)
#define AVERROR_EOF
End of file.
int av_grow_packet(AVPacket *pkt, int grow_by)
Increase packet size, correctly zeroing padding.
@ AV_SMPTE_436M_WRAPPING_TYPE_HANC_FIELD_2
@ AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_8BIT_LUMA
used for VBI and ANC
uint16_t payload_sample_count
int av_smpte_436m_anc_iter_next(AVSmpte436mAncIterator *iter, AVSmpte436mCodedAnc *anc)
Get the next ANC packet from the iterator, advancing the iterator.
AVSmpte436mWrappingType wrapping_type
int av_smpte_291m_anc_8bit_get_sample_count(const AVSmpte291mAnc8bit *anc, AVSmpte436mPayloadSampleCoding sample_coding, void *log_ctx)
Compute the sample count needed to encode a AVSmpte291mAnc8bit into a AVSmpte436mCodedAnc payload.
int av_smpte_436m_coded_anc_validate(const AVSmpte436mCodedAnc *anc)
Validate a AVSmpte436mCodedAnc structure.
@ AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_8BIT_COLOR_DIFF_WITH_PARITY_ERROR
only used for ANC
#define AV_SMPTE_291M_ANC_DID_CTA_708
AVSmpte291mAnc8bit::did when carrying CTA-708 data (for AV_CODEC_ID_EIA_608)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
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.
@ AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_10BIT_LUMA_AND_COLOR_DIFF
used for VBI and ANC
#define AVERROR_BUFFER_TOO_SMALL
Buffer too small.
uint8_t payload[AV_SMPTE_291M_ANC_PAYLOAD_CAPACITY]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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.
int av_smpte_436m_anc_encode(uint8_t *out, int size, int anc_packet_count, const AVSmpte436mCodedAnc *anc_packets)
Encode ANC packets into a single AV_CODEC_ID_SMPTE_436M_ANC AVPacket's data.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
@ AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_1BIT_LUMA
only used for VBI
int av_smpte_436m_anc_iter_init(AVSmpte436mAncIterator *iter, const uint8_t *buf, int buf_size)
Set up iteration over the ANC packets in a single AV_CODEC_ID_SMPTE_436M_ANC AVPacket's data.
@ AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_8BIT_LUMA_AND_COLOR_DIFF
used for VBI and ANC
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
@ AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_8BIT_LUMA_AND_COLOR_DIFF_WITH_PARITY_ERROR
only used for ANC
@ AV_SMPTE_436M_WRAPPING_TYPE_HANC_FRAME
@ AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_1BIT_COLOR_DIFF
only used for VBI
@ AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_10BIT_LUMA
used for VBI and ANC
int av_smpte_291m_anc_8bit_encode(AVSmpte436mCodedAnc *out, uint16_t line_number, AVSmpte436mWrappingType wrapping_type, AVSmpte436mPayloadSampleCoding sample_coding, const AVSmpte291mAnc8bit *payload, void *log_ctx)
Encode a AVSmpte291mAnc8bit into a AVSmpte436mCodedAnc.
@ AV_SMPTE_436M_WRAPPING_TYPE_VANC_FIELD_2
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_RB32
void av_smpte_291m_anc_8bit_fill_checksum(AVSmpte291mAnc8bit *anc)
Fill in the correct checksum for a AVSmpte291mAnc8bit.
AVSmpte436mPayloadSampleCoding
Payload Sample Coding from Table 4 (page 10) and Table 7 (page 13) of: https://pub....
static int smpte_436m_anc_decode_entry(const uint8_t *in, int size, AVSmpte436mCodedAnc *anc)
Decode an ANC packet.
@ AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_10BIT_COLOR_DIFF
used for VBI and ANC
An encoded ANC packet within a single AV_CODEC_ID_SMPTE_436M_ANC AVPacket's data.
#define SMPTE_436M_ANC_ENTRY_HEADER_SIZE
An ANC packet with an 8-bit payload.
@ AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_8BIT_LUMA_WITH_PARITY_ERROR
only used for ANC
@ AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_8BIT_COLOR_DIFF
used for VBI and ANC
uint32_t payload_array_length
#define i(width, name, range_min, range_max)
static int validate_smpte_436m_anc_wrapping_type(AVSmpte436mWrappingType wrapping_type)
AVSmpte436mWrappingType
Wrapping Type from Table 7 (page 13) of: https://pub.smpte.org/latest/st436/s436m-2006....
uint8_t payload[AV_SMPTE_436M_CODED_ANC_PAYLOAD_CAPACITY]
the payload, has size payload_array_length.
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).
@ AV_SMPTE_436M_WRAPPING_TYPE_HANC_FIELD_1
#define AV_SMPTE_291M_ANC_SDID_CTA_708
AVSmpte291mAnc8bit::sdid_or_dbn when carrying CTA-708 data (for AV_CODEC_ID_EIA_608)
static int smpte_436m_anc_encode_entry(uint8_t *out, int size, const AVSmpte436mCodedAnc *anc)
Encode an ANC packet.
Iterator over the ANC packets in a single AV_CODEC_ID_SMPTE_436M_ANC AVPacket's data.
static int validate_smpte_436m_anc_payload_sample_coding(AVSmpte436mPayloadSampleCoding payload_sample_coding)
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
static av_always_inline unsigned int bytestream2_get_bufferu(GetByteContext *g, uint8_t *dst, unsigned int size)
@ AV_SMPTE_436M_WRAPPING_TYPE_VANC_FRAME
This structure stores compressed data.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
AVSmpte436mPayloadSampleCoding payload_sample_coding
#define AV_SMPTE_436M_CODED_ANC_SAMPLE_CAPACITY
max number of samples that can be stored in the payload of AVSmpte436mCodedAnc
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
@ AV_SMPTE_436M_WRAPPING_TYPE_HANC_PROGRESSIVE_FRAME
#define AV_SMPTE_436M_CODED_ANC_PAYLOAD_CAPACITY
max number of bytes that can be stored in the payload of AVSmpte436mCodedAnc
uint16_t anc_packets_left
@ AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_1BIT_LUMA_AND_COLOR_DIFF
only used for VBI
const uint8_t * data_left
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