59 for (i = 0; i < frag->
nb_units; i++) {
80 "header but not a sequence extension: maybe it's " 81 "actually MPEG-1?\n");
93 if (num == 4 && den == 3)
95 else if (num == 16 && den == 9)
97 else if (num == 221 && den == 100)
104 int code, ext_n, ext_d;
107 &code, &ext_n, &ext_d, 0);
129 .colour_description = 0,
130 .colour_primaries = 2,
131 .transfer_characteristics = 2,
132 .matrix_coefficients = 2,
134 .display_horizontal_size =
136 .display_vertical_size =
146 "display extension.\n");
217 #define VALIDITY_CHECK(name) do { \ 219 av_log(bsf, AV_LOG_ERROR, "The value 0 for %s is " \ 220 "forbidden.\n", #name); \ 221 return AVERROR(EINVAL); \ 227 #undef VALIDITY_CHECK 267 #define OFFSET(x) offsetof(MPEG2MetadataContext, x) 268 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_BSF_PARAM) 270 {
"display_aspect_ratio",
"Set display aspect ratio (table 6-3)",
272 { .dbl = 0.0 }, 0, 65535,
FLAGS },
274 {
"frame_rate",
"Set frame rate",
276 { .dbl = 0.0 }, 0, UINT_MAX,
FLAGS },
278 {
"video_format",
"Set video format (table 6-6)",
280 { .i64 = -1 }, -1, 7, FLAGS },
281 {
"colour_primaries",
"Set colour primaries (table 6-7)",
283 { .i64 = -1 }, -1, 255, FLAGS },
284 {
"transfer_characteristics",
"Set transfer characteristics (table 6-8)",
286 { .i64 = -1 }, -1, 255, FLAGS },
287 {
"matrix_coefficients",
"Set matrix coefficients (table 6-9)",
289 { .i64 = -1 }, -1, 255, FLAGS },
306 .
name =
"mpeg2_metadata",
308 .priv_class = &mpeg2_metadata_class,
int nb_units
Number of units in this fragment.
uint8_t extension_start_code_identifier
AVCodecParameters * par_out
Parameters of the output stream.
#define se(name, range_min, range_max)
#define AV_LOG_WARNING
Something somehow does not look correct.
#define LIBAVUTIL_VERSION_INT
int ff_cbs_write_packet(CodedBitstreamContext *ctx, AVPacket *pkt, CodedBitstreamFragment *frag)
Write the bitstream of a fragment to a packet.
static av_cold int init(AVCodecContext *avctx)
MPEG2RawSequenceExtension sequence
int ff_cbs_init(CodedBitstreamContext **ctx_ptr, enum AVCodecID codec_id, void *log_ctx)
Create and initialise a new context for the given codec.
CodedBitstreamUnitType type
Codec-specific type of this unit.
The bitstream filter state.
const char * av_default_item_name(void *ptr)
Return the context name.
int ff_cbs_insert_unit_content(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int position, CodedBitstreamUnitType type, void *content, AVBufferRef *content_buf)
Insert a new unit into a fragment with the given content.
AVRational display_aspect_ratio
void * priv_data
Opaque filter-specific private data.
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...
static void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, int len, int clip)
int ff_cbs_read_packet(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVPacket *pkt)
Read the data bitstream from a packet into a fragment, then split into units and decompose.
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
void ff_cbs_fragment_free(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Free the units array of a fragment in addition to what ff_cbs_fragment_reset does.
#define i(width, name, range_min, range_max)
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void ff_mpeg12_find_best_frame_rate(AVRational frame_rate, int *code, int *ext_n, int *ext_d, int nonstandard)
int ff_cbs_write_extradata(CodedBitstreamContext *ctx, AVCodecParameters *par, CodedBitstreamFragment *frag)
Write the bitstream of a fragment to the extradata in codec parameters.
MPEG2RawExtensionData sequence_display_extension
union MPEG2RawExtensionData::@39 data
uint8_t horizontal_size_extension
preferred ID for MPEG-1/2 video decoding
MPEG2RawSequenceDisplayExtension sequence_display
Coded bitstream fragment structure, combining one or more units.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
uint8_t frame_rate_extension_n
uint8_t frame_rate_extension_d
Describe the class of an AVClass context structure.
void ff_cbs_fragment_reset(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Free the units contained in a fragment as well as the fragment's own data buffer, but not the units a...
Context structure for coded bitstream operations.
Rational number (pair of numerator and denominator).
uint8_t extension_start_code
void ff_cbs_close(CodedBitstreamContext **ctx_ptr)
Close a context and free all internal state.
int ff_cbs_read_extradata(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVCodecParameters *par)
Read the extradata bitstream found in codec parameters into a fragment, then split into units and dec...
CodedBitstreamContext * cbc
CodedBitstreamFragment fragment
common internal and external API header
static enum AVCodecID codec_ids[]
uint8_t vertical_size_extension
uint8_t matrix_coefficients
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
int transfer_characteristics
This structure stores compressed data.
AVCodecParameters * par_in
Parameters of the input stream.
int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
Called by bitstream filters to get packet for filtering.