Go to the documentation of this file.
76 if (sh && !
ctx->mpeg1_warned) {
78 "header but not a sequence extension: maybe it's "
79 "actually MPEG-1?\n");
80 ctx->mpeg1_warned = 1;
85 if (
ctx->display_aspect_ratio.num &&
ctx->display_aspect_ratio.den) {
89 ctx->display_aspect_ratio.den, 65535);
91 if (num == 4 && den == 3)
93 else if (num == 16 && den == 9)
95 else if (num == 221 && den == 100)
101 if (
ctx->frame_rate.num &&
ctx->frame_rate.den) {
102 int code, ext_n, ext_d;
105 &
code, &ext_n, &ext_d, 0);
108 se->frame_rate_extension_n = ext_n;
109 se->frame_rate_extension_d = ext_d;
112 if (
ctx->video_format >= 0 ||
113 ctx->colour_primaries >= 0 ||
114 ctx->transfer_characteristics >= 0 ||
115 ctx->matrix_coefficients >= 0) {
118 ctx->sequence_display_extension.extension_start_code =
120 ctx->sequence_display_extension.extension_start_code_identifier =
122 sde = &
ctx->sequence_display_extension.data.sequence_display;
127 .colour_description = 0,
128 .colour_primaries = 2,
129 .transfer_characteristics = 2,
130 .matrix_coefficients = 2,
132 .display_horizontal_size =
134 .display_vertical_size =
140 &
ctx->sequence_display_extension,
144 "display extension.\n");
149 if (
ctx->video_format >= 0)
152 if (
ctx->colour_primaries >= 0 ||
153 ctx->transfer_characteristics >= 0 ||
154 ctx->matrix_coefficients >= 0) {
157 if (
ctx->colour_primaries >= 0)
160 if (
ctx->transfer_characteristics >= 0)
163 if (
ctx->matrix_coefficients >= 0)
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 .
p.
name =
"mpeg2_metadata",
AVRational display_aspect_ratio
#define AV_LOG_WARNING
Something somehow does not look correct.
@ MPEG2_EXTENSION_SEQUENCE
int ff_cbs_bsf_generic_init(AVBSFContext *bsf, const CBSBSFType *type)
Initialise generic CBS BSF setup.
void * content
Pointer to the decomposed form of this unit.
int ff_cbs_insert_unit_content(CodedBitstreamFragment *frag, int position, CodedBitstreamUnitType type, void *content, void *content_ref)
Insert a new unit into a fragment with the given content.
int transfer_characteristics
#define se(name, range_min, range_max)
MPEG2RawSequenceDisplayExtension sequence_display
CodedBitstreamUnitType type
Codec-specific type of this unit.
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
The bitstream filter state.
void ff_mpeg12_find_best_frame_rate(AVRational frame_rate, int *code, int *ext_n, int *ext_d, int nonstandard)
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
uint8_t colour_description
CodedBitstreamUnit * units
Pointer to an array of units of length nb_units_allocated.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Coded bitstream fragment structure, combining one or more units.
#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.
@ MPEG2_EXTENSION_SEQUENCE_DISPLAY
uint8_t matrix_coefficients
AVCodecID
Identify the syntax and semantics of the bitstream.
MPEG2RawSequenceExtension sequence
AVBitStreamFilter p
The public AVBitStreamFilter.
int(* init)(AVBSFContext *ctx)
uint8_t extension_start_code_identifier
void ff_cbs_bsf_generic_close(AVBSFContext *bsf)
Close a generic CBS BSF instance.
static const struct TransferCharacteristics transfer_characteristics[AVCOL_TRC_NB]
#define i(width, name, range_min, range_max)
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
@ MPEG2_START_SEQUENCE_HEADER
uint8_t transfer_characteristics
void * priv_data
Opaque filter-specific private data.
int ff_cbs_bsf_generic_filter(AVBSFContext *bsf, AVPacket *pkt)
Filter operation for CBS BSF.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
MPEG2RawExtensionData sequence_display_extension
union MPEG2RawExtensionData::@55 data
This structure stores compressed data.
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
int nb_units
Number of units in this fragment.