FFmpeg
Data Structures | Macros | Functions | Variables
vaapi_encode_mpeg2.c File Reference
#include <va/va.h>
#include <va/va_enc_mpeg2.h>
#include "libavutil/avassert.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "cbs.h"
#include "cbs_mpeg2.h"
#include "codec_internal.h"
#include "mpeg12.h"
#include "vaapi_encode.h"

Go to the source code of this file.

Data Structures

struct  VAAPIEncodeMPEG2Context
 

Macros

#define OFFSET(x)   offsetof(VAAPIEncodeMPEG2Context, x)
 
#define FLAGS   (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
 
#define PROFILE(name, value)
 
#define LEVEL(name, value)
 

Functions

static int vaapi_encode_mpeg2_write_fragment (AVCodecContext *avctx, char *data, size_t *data_len, CodedBitstreamFragment *frag)
 
static int vaapi_encode_mpeg2_add_header (AVCodecContext *avctx, CodedBitstreamFragment *frag, int type, void *header)
 
static int vaapi_encode_mpeg2_write_sequence_header (AVCodecContext *avctx, char *data, size_t *data_len)
 
static int vaapi_encode_mpeg2_write_picture_header (AVCodecContext *avctx, FFHWBaseEncodePicture *pic, char *data, size_t *data_len)
 
static int vaapi_encode_mpeg2_init_sequence_params (AVCodecContext *avctx)
 
static int vaapi_encode_mpeg2_init_picture_params (AVCodecContext *avctx, FFHWBaseEncodePicture *pic)
 
static int vaapi_encode_mpeg2_init_slice_params (AVCodecContext *avctx, FFHWBaseEncodePicture *pic, VAAPIEncodeSlice *slice)
 
static av_cold int vaapi_encode_mpeg2_configure (AVCodecContext *avctx)
 
static av_cold int vaapi_encode_mpeg2_init (AVCodecContext *avctx)
 
static av_cold int vaapi_encode_mpeg2_close (AVCodecContext *avctx)
 

Variables

static const VAAPIEncodeProfile vaapi_encode_mpeg2_profiles []
 
static const VAAPIEncodeType vaapi_encode_type_mpeg2
 
static const AVOption vaapi_encode_mpeg2_options []
 
static const FFCodecDefault vaapi_encode_mpeg2_defaults []
 
static const AVClass vaapi_encode_mpeg2_class
 
const FFCodec ff_mpeg2_vaapi_encoder
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 641 of file vaapi_encode_mpeg2.c.

◆ FLAGS

Definition at line 642 of file vaapi_encode_mpeg2.c.

◆ PROFILE

#define PROFILE (   name,
  value 
)
Value:
{ .i64 = value }, 0, 0, FLAGS, .unit = "profile"

◆ LEVEL

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

Function Documentation

◆ vaapi_encode_mpeg2_write_fragment()

static int vaapi_encode_mpeg2_write_fragment ( AVCodecContext avctx,
char *  data,
size_t *  data_len,
CodedBitstreamFragment frag 
)
static

◆ vaapi_encode_mpeg2_add_header()

static int vaapi_encode_mpeg2_add_header ( AVCodecContext avctx,
CodedBitstreamFragment frag,
int  type,
void *  header 
)
static

◆ vaapi_encode_mpeg2_write_sequence_header()

static int vaapi_encode_mpeg2_write_sequence_header ( AVCodecContext avctx,
char *  data,
size_t *  data_len 
)
static

Definition at line 110 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_mpeg2_write_picture_header()

static int vaapi_encode_mpeg2_write_picture_header ( AVCodecContext avctx,
FFHWBaseEncodePicture pic,
char *  data,
size_t *  data_len 
)
static

Definition at line 143 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_mpeg2_init_sequence_params()

static int vaapi_encode_mpeg2_init_sequence_params ( AVCodecContext avctx)
static

Definition at line 167 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_mpeg2_init_picture_params()

static int vaapi_encode_mpeg2_init_picture_params ( AVCodecContext avctx,
FFHWBaseEncodePicture pic 
)
static

Definition at line 420 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_mpeg2_init_slice_params()

static int vaapi_encode_mpeg2_init_slice_params ( AVCodecContext avctx,
FFHWBaseEncodePicture pic,
VAAPIEncodeSlice slice 
)
static

Definition at line 483 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_mpeg2_configure()

static av_cold int vaapi_encode_mpeg2_configure ( AVCodecContext avctx)
static

Definition at line 516 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_mpeg2_init()

static av_cold int vaapi_encode_mpeg2_init ( AVCodecContext avctx)
static

Definition at line 593 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_mpeg2_close()

static av_cold int vaapi_encode_mpeg2_close ( AVCodecContext avctx)
static

Definition at line 631 of file vaapi_encode_mpeg2.c.

Variable Documentation

◆ vaapi_encode_mpeg2_profiles

const VAAPIEncodeProfile vaapi_encode_mpeg2_profiles[]
static
Initial value:
= {
{ AV_PROFILE_MPEG2_MAIN, 8, 3, 1, 1, VAProfileMPEG2Main },
{ AV_PROFILE_MPEG2_SIMPLE, 8, 3, 1, 1, VAProfileMPEG2Simple },
}

Definition at line 562 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_type_mpeg2

const VAAPIEncodeType vaapi_encode_type_mpeg2
static
Initial value:
= {
.default_quality = 10,
.sequence_params_size = sizeof(VAEncSequenceParameterBufferMPEG2),
.init_sequence_params = &vaapi_encode_mpeg2_init_sequence_params,
.picture_params_size = sizeof(VAEncPictureParameterBufferMPEG2),
.init_picture_params = &vaapi_encode_mpeg2_init_picture_params,
.slice_params_size = sizeof(VAEncSliceParameterBufferMPEG2),
.init_slice_params = &vaapi_encode_mpeg2_init_slice_params,
.sequence_header_type = VAEncPackedHeaderSequence,
.write_sequence_header = &vaapi_encode_mpeg2_write_sequence_header,
.picture_header_type = VAEncPackedHeaderPicture,
.write_picture_header = &vaapi_encode_mpeg2_write_picture_header,
}

Definition at line 568 of file vaapi_encode_mpeg2.c.

Referenced by vaapi_encode_mpeg2_init().

◆ vaapi_encode_mpeg2_options

const AVOption vaapi_encode_mpeg2_options[]
static
Initial value:
= {
{ "profile", "Set profile (in profile_and_level_indication)",
{ .i64 = AV_PROFILE_UNKNOWN }, AV_PROFILE_UNKNOWN, 7, FLAGS, .unit = "profile" },
#define PROFILE(name, value)
{ "level", "Set level (in profile_and_level_indication)",
{ .i64 = 4 }, 0, 15, FLAGS, .unit = "level" },
#define LEVEL(name, value)
{ LEVEL("low", 10) },
{ LEVEL("main", 8) },
{ LEVEL("high_1440", 6) },
{ LEVEL("high", 4) },
{ NULL },
}

Definition at line 643 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_mpeg2_defaults

const FFCodecDefault vaapi_encode_mpeg2_defaults[]
static
Initial value:
= {
{ "b", "0" },
{ "bf", "1" },
{ "g", "120" },
{ "i_qfactor", "1" },
{ "i_qoffset", "0" },
{ "b_qfactor", "6/5" },
{ "b_qoffset", "0" },
{ "qmin", "-1" },
{ "qmax", "-1" },
{ NULL },
}

Definition at line 673 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_mpeg2_class

const AVClass vaapi_encode_mpeg2_class
static
Initial value:
= {
.class_name = "mpeg2_vaapi",
.item_name = av_default_item_name,
}

Definition at line 686 of file vaapi_encode_mpeg2.c.

◆ ff_mpeg2_vaapi_encoder

const FFCodec ff_mpeg2_vaapi_encoder
Initial value:

Definition at line 693 of file vaapi_encode_mpeg2.c.

AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
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
level
uint8_t level
Definition: svq3.c:205
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:43
AV_PROFILE_MPEG2_SIMPLE
#define AV_PROFILE_MPEG2_SIMPLE
Definition: defs.h:105
AV_CODEC_CAP_HARDWARE
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
Definition: codec.h:145
vaapi_encode_mpeg2_write_picture_header
static int vaapi_encode_mpeg2_write_picture_header(AVCodecContext *avctx, FFHWBaseEncodePicture *pic, char *data, size_t *data_len)
Definition: vaapi_encode_mpeg2.c:143
FF_CODEC_CAP_NOT_INIT_THREADSAFE
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
Definition: codec_internal.h:35
vaapi_encode_mpeg2_close
static av_cold int vaapi_encode_mpeg2_close(AVCodecContext *avctx)
Definition: vaapi_encode_mpeg2.c:631
VAAPIEncodeMPEG2Context
Definition: vaapi_encode_mpeg2.c:32
vaapi_encode_mpeg2_configure
static av_cold int vaapi_encode_mpeg2_configure(AVCodecContext *avctx)
Definition: vaapi_encode_mpeg2.c:516
FLAGS
#define FLAGS
Definition: vaapi_encode_mpeg2.c:642
vaapi_encode_mpeg2_options
static const AVOption vaapi_encode_mpeg2_options[]
Definition: vaapi_encode_mpeg2.c:643
FF_HW_FLAG_B_PICTURES
@ FF_HW_FLAG_B_PICTURES
Definition: hw_base_encode.h:53
AV_PROFILE_UNKNOWN
#define AV_PROFILE_UNKNOWN
Definition: defs.h:65
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
Definition: codec.h:159
LEVEL
#define LEVEL(name, value)
ff_vaapi_encode_receive_packet
int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
Definition: vaapi_encode.c:2086
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
FF_CODEC_RECEIVE_PACKET_CB
#define FF_CODEC_RECEIVE_PACKET_CB(func)
Definition: codec_internal.h:326
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
PROFILE
#define PROFILE(name, value)
vaapi_encode_mpeg2_profiles
static const VAAPIEncodeProfile vaapi_encode_mpeg2_profiles[]
Definition: vaapi_encode_mpeg2.c:562
OFFSET
#define OFFSET(x)
Definition: vaapi_encode_mpeg2.c:641
vaapi_encode_mpeg2_init
static av_cold int vaapi_encode_mpeg2_init(AVCodecContext *avctx)
Definition: vaapi_encode_mpeg2.c:593
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
vaapi_encode_mpeg2_init_picture_params
static int vaapi_encode_mpeg2_init_picture_params(AVCodecContext *avctx, FFHWBaseEncodePicture *pic)
Definition: vaapi_encode_mpeg2.c:420
VAAPI_ENCODE_RC_OPTIONS
#define VAAPI_ENCODE_RC_OPTIONS
Definition: vaapi_encode.h:364
vaapi_encode_mpeg2_class
static const AVClass vaapi_encode_mpeg2_class
Definition: vaapi_encode_mpeg2.c:686
vaapi_encode_mpeg2_init_slice_params
static int vaapi_encode_mpeg2_init_slice_params(AVCodecContext *avctx, FFHWBaseEncodePicture *pic, VAAPIEncodeSlice *slice)
Definition: vaapi_encode_mpeg2.c:483
VAAPI_ENCODE_COMMON_OPTIONS
#define VAAPI_ENCODE_COMMON_OPTIONS
Definition: vaapi_encode.h:350
vaapi_encode_mpeg2_defaults
static const FFCodecDefault vaapi_encode_mpeg2_defaults[]
Definition: vaapi_encode_mpeg2.c:673
AV_PIX_FMT_VAAPI
@ AV_PIX_FMT_VAAPI
Hardware acceleration through VA-API, data[3] contains a VASurfaceID.
Definition: pixfmt.h:126
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
vaapi_encode_mpeg2_write_sequence_header
static int vaapi_encode_mpeg2_write_sequence_header(AVCodecContext *avctx, char *data, size_t *data_len)
Definition: vaapi_encode_mpeg2.c:110
vaapi_encode_mpeg2_init_sequence_params
static int vaapi_encode_mpeg2_init_sequence_params(AVCodecContext *avctx)
Definition: vaapi_encode_mpeg2.c:167
profile
int profile
Definition: mxfenc.c:2233
AVCOL_RANGE_MPEG
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition: pixfmt.h:700
ff_vaapi_encode_hw_configs
const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs[]
Definition: vaapi_encode.c:36
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
AV_PROFILE_MPEG2_MAIN
#define AV_PROFILE_MPEG2_MAIN
Definition: defs.h:104
AV_CODEC_CAP_DELAY
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: codec.h:76
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
HW_BASE_ENCODE_COMMON_OPTIONS
#define HW_BASE_ENCODE_COMMON_OPTIONS
Definition: hw_base_encode.h:239
AV_CODEC_ID_MPEG2VIDEO
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
Definition: codec_id.h:54
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299