57 for (i = 0; i < frag->
nb_units; i++) {
78 "header but not a sequence extension: maybe it's " 79 "actually MPEG-1?\n");
91 if (num == 4 && den == 3)
93 else if (num == 16 && den == 9)
95 else if (num == 221 && den == 100)
102 int code, ext_n, ext_d;
105 &code, &ext_n, &ext_d, 0);
127 .colour_description = 0,
128 .colour_primaries = 2,
129 .transfer_characteristics = 2,
130 .matrix_coefficients = 2,
132 .display_horizontal_size =
134 .display_vertical_size =
144 "display extension.\n");
173 .fragment_name =
"frame",
174 .unit_name =
"start code",
182 #define VALIDITY_CHECK(name) do { \ 184 av_log(bsf, AV_LOG_ERROR, "The value 0 for %s is " \ 185 "forbidden.\n", #name); \ 186 return AVERROR(EINVAL); \ 192 #undef VALIDITY_CHECK 197 #define OFFSET(x) offsetof(MPEG2MetadataContext, x) 198 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_BSF_PARAM) 200 {
"display_aspect_ratio",
"Set display aspect ratio (table 6-3)",
202 { .dbl = 0.0 }, 0, 65535,
FLAGS },
204 {
"frame_rate",
"Set frame rate",
206 { .dbl = 0.0 }, 0, UINT_MAX,
FLAGS },
208 {
"video_format",
"Set video format (table 6-6)",
210 { .i64 = -1 }, -1, 7, FLAGS },
211 {
"colour_primaries",
"Set colour primaries (table 6-7)",
213 { .i64 = -1 }, -1, 255, FLAGS },
214 {
"transfer_characteristics",
"Set transfer characteristics (table 6-8)",
216 { .i64 = -1 }, -1, 255, FLAGS },
217 {
"matrix_coefficients",
"Set matrix coefficients (table 6-9)",
219 { .i64 = -1 }, -1, 255, FLAGS },
236 .
name =
"mpeg2_metadata",
238 .priv_class = &mpeg2_metadata_class,
int nb_units
Number of units in this fragment.
uint8_t extension_start_code_identifier
#define se(name, range_min, range_max)
#define AV_LOG_WARNING
Something somehow does not look correct.
#define LIBAVUTIL_VERSION_INT
static av_cold int init(AVCodecContext *avctx)
MPEG2RawSequenceExtension sequence
CodedBitstreamUnitType type
Codec-specific type of this unit.
The bitstream filter state.
const char * av_default_item_name(void *ptr)
Return the context name.
AVRational display_aspect_ratio
void * priv_data
Opaque filter-specific private data.
int ff_cbs_bsf_generic_init(AVBSFContext *bsf, const CBSBSFType *type)
Initialise generic CBS BSF setup.
uint8_t transfer_characteristics
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_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
void * content
Pointer to the decomposed form of this unit.
CodedBitstreamUnit * units
Pointer to an array of units of length nb_units_allocated.
uint8_t colour_description
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
void ff_cbs_bsf_generic_close(AVBSFContext *bsf)
Close a generic CBS BSF instance.
void ff_mpeg12_find_best_frame_rate(AVRational frame_rate, int *code, int *ext_n, int *ext_d, int nonstandard)
MPEG2RawExtensionData sequence_display_extension
int ff_cbs_bsf_generic_filter(AVBSFContext *bsf, AVPacket *pkt)
Filter operation for CBS BSF.
uint8_t horizontal_size_extension
preferred ID for MPEG-1/2 video decoding
union MPEG2RawExtensionData::@35 data
MPEG2RawSequenceDisplayExtension sequence_display
Coded bitstream fragment structure, combining one or more units.
uint8_t frame_rate_extension_n
uint8_t frame_rate_extension_d
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
uint8_t extension_start_code
int ff_cbs_insert_unit_content(CodedBitstreamFragment *frag, int position, CodedBitstreamUnitType type, void *content, AVBufferRef *content_buf)
Insert a new unit into a fragment with the given content.
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
common internal and external API header
static enum AVCodecID codec_ids[]
uint8_t vertical_size_extension
uint8_t matrix_coefficients
int transfer_characteristics
This structure stores compressed data.