FFmpeg
Data Structures | Macros | Functions | Variables
mpeg2_metadata_bsf.c File Reference
#include "libavutil/common.h"
#include "libavutil/opt.h"
#include "bsf.h"
#include "bsf_internal.h"
#include "cbs.h"
#include "cbs_bsf.h"
#include "cbs_mpeg2.h"
#include "mpeg12.h"

Go to the source code of this file.

Data Structures

struct  MPEG2MetadataContext
 

Macros

#define VALIDITY_CHECK(name)
 
#define OFFSET(x)   offsetof(MPEG2MetadataContext, x)
 
#define FLAGS   (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_BSF_PARAM)
 

Functions

static int mpeg2_metadata_update_fragment (AVBSFContext *bsf, AVPacket *pkt, CodedBitstreamFragment *frag)
 
static int mpeg2_metadata_init (AVBSFContext *bsf)
 

Variables

static const CBSBSFType mpeg2_metadata_type
 
static const AVOption mpeg2_metadata_options []
 
static const AVClass mpeg2_metadata_class
 
static enum AVCodecID mpeg2_metadata_codec_ids []
 
const FFBitStreamFilter ff_mpeg2_metadata_bsf
 

Macro Definition Documentation

◆ VALIDITY_CHECK

#define VALIDITY_CHECK (   name)
Value:
do { \
if (!ctx->name) { \
av_log(bsf, AV_LOG_ERROR, "The value 0 for %s is " \
"forbidden.\n", #name); \
return AVERROR(EINVAL); \
} \
} while (0)

◆ OFFSET

#define OFFSET (   x)    offsetof(MPEG2MetadataContext, x)

Definition at line 197 of file mpeg2_metadata_bsf.c.

◆ FLAGS

Definition at line 198 of file mpeg2_metadata_bsf.c.

Function Documentation

◆ mpeg2_metadata_update_fragment()

static int mpeg2_metadata_update_fragment ( AVBSFContext bsf,
AVPacket pkt,
CodedBitstreamFragment frag 
)
static

Definition at line 47 of file mpeg2_metadata_bsf.c.

◆ mpeg2_metadata_init()

static int mpeg2_metadata_init ( AVBSFContext bsf)
static

Definition at line 178 of file mpeg2_metadata_bsf.c.

Variable Documentation

◆ mpeg2_metadata_type

const CBSBSFType mpeg2_metadata_type
static
Initial value:
= {
.fragment_name = "frame",
.unit_name = "start code",
.update_fragment = &mpeg2_metadata_update_fragment,
}

Definition at line 171 of file mpeg2_metadata_bsf.c.

Referenced by mpeg2_metadata_init().

◆ mpeg2_metadata_options

const AVOption mpeg2_metadata_options[]
static
Initial value:
= {
{ "display_aspect_ratio", "Set display aspect ratio (table 6-3)",
OFFSET(display_aspect_ratio), AV_OPT_TYPE_RATIONAL,
{ .dbl = 0.0 }, 0, 65535, FLAGS },
{ "frame_rate", "Set frame rate",
{ .dbl = 0.0 }, 0, UINT_MAX, FLAGS },
{ "video_format", "Set video format (table 6-6)",
OFFSET(video_format), AV_OPT_TYPE_INT,
{ .i64 = -1 }, -1, 7, FLAGS },
{ "colour_primaries", "Set colour primaries (table 6-7)",
OFFSET(colour_primaries), AV_OPT_TYPE_INT,
{ .i64 = -1 }, -1, 255, FLAGS },
{ "transfer_characteristics", "Set transfer characteristics (table 6-8)",
{ .i64 = -1 }, -1, 255, FLAGS },
{ "matrix_coefficients", "Set matrix coefficients (table 6-9)",
OFFSET(matrix_coefficients), AV_OPT_TYPE_INT,
{ .i64 = -1 }, -1, 255, FLAGS },
{ NULL }
}

Definition at line 199 of file mpeg2_metadata_bsf.c.

◆ mpeg2_metadata_class

const AVClass mpeg2_metadata_class
static
Initial value:
= {
.class_name = "mpeg2_metadata_bsf",
.item_name = av_default_item_name,
}

Definition at line 224 of file mpeg2_metadata_bsf.c.

◆ mpeg2_metadata_codec_ids

enum AVCodecID mpeg2_metadata_codec_ids[]
static
Initial value:

Definition at line 231 of file mpeg2_metadata_bsf.c.

◆ ff_mpeg2_metadata_bsf

const FFBitStreamFilter ff_mpeg2_metadata_bsf
Initial value:
= {
.p.name = "mpeg2_metadata",
.p.codec_ids = mpeg2_metadata_codec_ids,
.p.priv_class = &mpeg2_metadata_class,
.priv_data_size = sizeof(MPEG2MetadataContext),
}

Definition at line 235 of file mpeg2_metadata_bsf.c.

OFFSET
#define OFFSET(x)
Definition: mpeg2_metadata_bsf.c:197
name
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 minimum maximum flags name is the option name
Definition: writing_filters.txt:88
AVERROR
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
filter
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
Definition: filter_design.txt:228
AV_OPT_TYPE_RATIONAL
@ AV_OPT_TYPE_RATIONAL
Definition: opt.h:230
init
static int init
Definition: av_tx.c:47
mpeg2_metadata_init
static int mpeg2_metadata_init(AVBSFContext *bsf)
Definition: mpeg2_metadata_bsf.c:178
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
ctx
AVFormatContext * ctx
Definition: movenc.c:48
MPEG2MetadataContext
Definition: mpeg2_metadata_bsf.c:29
FLAGS
#define FLAGS
Definition: mpeg2_metadata_bsf.c:198
mpeg2_metadata_update_fragment
static int mpeg2_metadata_update_fragment(AVBSFContext *bsf, AVPacket *pkt, CodedBitstreamFragment *frag)
Definition: mpeg2_metadata_bsf.c:47
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
mpeg2_metadata_codec_ids
static enum AVCodecID mpeg2_metadata_codec_ids[]
Definition: mpeg2_metadata_bsf.c:231
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
mpeg2_metadata_options
static const AVOption mpeg2_metadata_options[]
Definition: mpeg2_metadata_bsf.c:199
ff_cbs_bsf_generic_close
void ff_cbs_bsf_generic_close(AVBSFContext *bsf)
Close a generic CBS BSF instance.
Definition: cbs_bsf.c:150
transfer_characteristics
static const struct TransferCharacteristics transfer_characteristics[AVCOL_TRC_NB]
Definition: vf_colorspace.c:165
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:48
ff_cbs_bsf_generic_filter
int ff_cbs_bsf_generic_filter(AVBSFContext *bsf, AVPacket *pkt)
Filter operation for CBS BSF.
Definition: cbs_bsf.c:61
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AV_CODEC_ID_MPEG2VIDEO
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
Definition: codec_id.h:52
mpeg2_metadata_class
static const AVClass mpeg2_metadata_class
Definition: mpeg2_metadata_bsf.c:224