FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
h264_metadata_bsf.c File Reference
#include "libavutil/avstring.h"
#include "libavutil/display.h"
#include "libavutil/common.h"
#include "libavutil/opt.h"
#include "bsf.h"
#include "bsf_internal.h"
#include "cbs.h"
#include "cbs_bsf.h"
#include "cbs_h264.h"
#include "cbs_sei.h"
#include "h264.h"
#include "h264_levels.h"
#include "h2645data.h"
#include "sei.h"

Go to the source code of this file.

Data Structures

struct  H264MetadataContext
 

Macros

#define SET_VUI_FIELD(field)
 
#define CROP(border, unit)
 
#define OFFSET(x)   offsetof(H264MetadataContext, x)
 
#define FLAGS   (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_BSF_PARAM)
 
#define LEVEL(name, value)
 

Enumerations

enum  { FLIP_HORIZONTAL = 1, FLIP_VERTICAL = 2 }
 
enum  { LEVEL_UNSET = -2, LEVEL_AUTO = -1 }
 

Functions

static int h264_metadata_insert_aud (AVBSFContext *bsf, CodedBitstreamFragment *au)
 
static int h264_metadata_update_sps (AVBSFContext *bsf, H264RawSPS *sps)
 
static int h264_metadata_handle_display_orientation (AVBSFContext *bsf, AVPacket *pkt, CodedBitstreamFragment *au, int seek_point)
 
static int h264_metadata_update_fragment (AVBSFContext *bsf, AVPacket *pkt, CodedBitstreamFragment *au)
 
static int h264_metadata_init (AVBSFContext *bsf)
 

Variables

static const CBSBSFType h264_metadata_type
 
static const AVOption h264_metadata_options []
 
static const AVClass h264_metadata_class
 
static enum AVCodecID h264_metadata_codec_ids []
 
const FFBitStreamFilter ff_h264_metadata_bsf
 

Macro Definition Documentation

◆ SET_VUI_FIELD

#define SET_VUI_FIELD (   field)
Value:
do { \
if (ctx->field >= 0) { \
sps->vui.field = ctx->field; \
need_vui = 1; \
} \
} while (0)

◆ CROP

#define CROP (   border,
  unit 
)
Value:
do { \
if (ctx->crop_ ## border >= 0) { \
if (ctx->crop_ ## border % unit != 0) { \
av_log(bsf, AV_LOG_ERROR, "Invalid value for crop_%s: " \
"must be a multiple of %d.\n", #border, unit); \
return AVERROR(EINVAL); \
} \
sps->frame_crop_ ## border ## _offset = \
ctx->crop_ ## border / unit; \
sps->frame_cropping_flag = 1; \
} \
} while (0)

◆ OFFSET

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

Definition at line 591 of file h264_metadata_bsf.c.

◆ FLAGS

Definition at line 592 of file h264_metadata_bsf.c.

◆ LEVEL

#define LEVEL (   name,
  value 
)
Value:
{ .i64 = value }, .flags = FLAGS, .unit = "level"

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
FLIP_HORIZONTAL 
FLIP_VERTICAL 

Definition at line 35 of file h264_metadata_bsf.c.

◆ anonymous enum

anonymous enum
Enumerator
LEVEL_UNSET 
LEVEL_AUTO 

Definition at line 40 of file h264_metadata_bsf.c.

Function Documentation

◆ h264_metadata_insert_aud()

static int h264_metadata_insert_aud ( AVBSFContext bsf,
CodedBitstreamFragment au 
)
static

Definition at line 88 of file h264_metadata_bsf.c.

Referenced by h264_metadata_update_fragment().

◆ h264_metadata_update_sps()

static int h264_metadata_update_sps ( AVBSFContext bsf,
H264RawSPS sps 
)
static

Definition at line 141 of file h264_metadata_bsf.c.

Referenced by h264_metadata_update_fragment().

◆ h264_metadata_handle_display_orientation()

static int h264_metadata_handle_display_orientation ( AVBSFContext bsf,
AVPacket pkt,
CodedBitstreamFragment au,
int  seek_point 
)
static

Definition at line 325 of file h264_metadata_bsf.c.

Referenced by h264_metadata_update_fragment().

◆ h264_metadata_update_fragment()

static int h264_metadata_update_fragment ( AVBSFContext bsf,
AVPacket pkt,
CodedBitstreamFragment au 
)
static

Definition at line 467 of file h264_metadata_bsf.c.

◆ h264_metadata_init()

static int h264_metadata_init ( AVBSFContext bsf)
static

Definition at line 551 of file h264_metadata_bsf.c.

Variable Documentation

◆ h264_metadata_type

const CBSBSFType h264_metadata_type
static
Initial value:
= {
.codec_id = AV_CODEC_ID_H264,
.fragment_name = "access unit",
.unit_name = "NAL unit",
.update_fragment = &h264_metadata_update_fragment,
}

Definition at line 544 of file h264_metadata_bsf.c.

Referenced by h264_metadata_init().

◆ h264_metadata_options

const AVOption h264_metadata_options[]
static

Definition at line 593 of file h264_metadata_bsf.c.

◆ h264_metadata_class

const AVClass h264_metadata_class
static
Initial value:
= {
.class_name = "h264_metadata_bsf",
.item_name = av_default_item_name,
}

Definition at line 704 of file h264_metadata_bsf.c.

◆ h264_metadata_codec_ids

enum AVCodecID h264_metadata_codec_ids[]
static
Initial value:

Definition at line 711 of file h264_metadata_bsf.c.

◆ ff_h264_metadata_bsf

const FFBitStreamFilter ff_h264_metadata_bsf
Initial value:
= {
.p.name = "h264_metadata",
.p.codec_ids = h264_metadata_codec_ids,
.p.priv_class = &h264_metadata_class,
.priv_data_size = sizeof(H264MetadataContext),
}

Definition at line 715 of file h264_metadata_bsf.c.

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
FLAGS
#define FLAGS
Definition: h264_metadata_bsf.c:592
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
h264_metadata_options
static const AVOption h264_metadata_options[]
Definition: h264_metadata_bsf.c:593
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_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts_bsf.c:365
ctx
AVFormatContext * ctx
Definition: movenc.c:48
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:79
h264_metadata_update_fragment
static int h264_metadata_update_fragment(AVBSFContext *bsf, AVPacket *pkt, CodedBitstreamFragment *au)
Definition: h264_metadata_bsf.c:467
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
ff_cbs_bsf_generic_close
void ff_cbs_bsf_generic_close(AVBSFContext *bsf)
Close a generic CBS BSF instance.
Definition: cbs_bsf.c:155
h264_metadata_init
static int h264_metadata_init(AVBSFContext *bsf)
Definition: h264_metadata_bsf.c:551
H264MetadataContext
Definition: h264_metadata_bsf.c:45
h264_metadata_class
static const AVClass h264_metadata_class
Definition: h264_metadata_bsf.c:704
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:50
h264_metadata_codec_ids
static enum AVCodecID h264_metadata_codec_ids[]
Definition: h264_metadata_bsf.c:711
value
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 value
Definition: writing_filters.txt:86
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_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234