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 "avcodec.h"
#include "cbs.h"
#include "cbs_mpeg2.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, VAAPIEncodePicture *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, VAAPIEncodePicture *pic)
 
static int vaapi_encode_mpeg2_init_slice_params (AVCodecContext *avctx, VAAPIEncodePicture *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 AVCodecDefault vaapi_encode_mpeg2_defaults []
 
static const AVClass vaapi_encode_mpeg2_class
 
const AVCodec ff_mpeg2_vaapi_encoder
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 640 of file vaapi_encode_mpeg2.c.

◆ FLAGS

Definition at line 641 of file vaapi_encode_mpeg2.c.

◆ PROFILE

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

◆ LEVEL

#define LEVEL (   name,
  value 
)
Value:
{ .i64 = value }, 0, 0, FLAGS, "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 108 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_mpeg2_write_picture_header()

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

Definition at line 141 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 165 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_mpeg2_init_picture_params()

static int vaapi_encode_mpeg2_init_picture_params ( AVCodecContext avctx,
VAAPIEncodePicture pic 
)
static

Definition at line 417 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_mpeg2_init_slice_params()

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

Definition at line 479 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_mpeg2_configure()

static av_cold int vaapi_encode_mpeg2_configure ( AVCodecContext avctx)
static

Definition at line 512 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_mpeg2_init()

static av_cold int vaapi_encode_mpeg2_init ( AVCodecContext avctx)
static

Definition at line 589 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_mpeg2_close()

static av_cold int vaapi_encode_mpeg2_close ( AVCodecContext avctx)
static

Definition at line 630 of file vaapi_encode_mpeg2.c.

Variable Documentation

◆ vaapi_encode_mpeg2_profiles

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

Definition at line 558 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_type_mpeg2

const VAAPIEncodeType vaapi_encode_type_mpeg2
static
Initial value:
= {
.flags = FLAG_B_PICTURES,
.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 564 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 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, 7, FLAGS, "profile" },
#define PROFILE(name, value)
{ "level", "Set level (in profile_and_level_indication)",
{ .i64 = 4 }, 0, 15, FLAGS, "level" },
#define LEVEL(name, value)
{ LEVEL("low", 10) },
{ LEVEL("main", 8) },
{ LEVEL("high_1440", 6) },
{ LEVEL("high", 4) },
{ NULL },
}

Definition at line 642 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_mpeg2_defaults

const AVCodecDefault 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 671 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 684 of file vaapi_encode_mpeg2.c.

◆ ff_mpeg2_vaapi_encoder

const AVCodec ff_mpeg2_vaapi_encoder
Initial value:
= {
.name = "mpeg2_vaapi",
.long_name = NULL_IF_CONFIG_SMALL("MPEG-2 (VAAPI)"),
.priv_data_size = sizeof(VAAPIEncodeMPEG2Context),
.receive_packet = &ff_vaapi_encode_receive_packet,
.priv_class = &vaapi_encode_mpeg2_class,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.pix_fmts = (const enum AVPixelFormat[]) {
},
.wrapper_name = "vaapi",
}

Definition at line 691 of file vaapi_encode_mpeg2.c.

AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
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:204
FF_PROFILE_MPEG2_SIMPLE
#define FF_PROFILE_MPEG2_SIMPLE
Definition: avcodec.h:1559
FLAG_B_PICTURES
@ FLAG_B_PICTURES
Definition: vaapi_encode.h:358
AV_CODEC_CAP_HARDWARE
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
Definition: codec.h:162
vaapi_encode_mpeg2_close
static av_cold int vaapi_encode_mpeg2_close(AVCodecContext *avctx)
Definition: vaapi_encode_mpeg2.c:630
FF_PROFILE_MPEG2_MAIN
#define FF_PROFILE_MPEG2_MAIN
Definition: avcodec.h:1558
VAAPIEncodeMPEG2Context
Definition: vaapi_encode_mpeg2.c:30
init
static int init
Definition: av_tx.c:47
vaapi_encode_mpeg2_configure
static av_cold int vaapi_encode_mpeg2_configure(AVCodecContext *avctx)
Definition: vaapi_encode_mpeg2.c:512
FLAGS
#define FLAGS
Definition: vaapi_encode_mpeg2.c:641
defaults
static const AVCodecDefault defaults[]
Definition: amfenc_h264.c:361
vaapi_encode_mpeg2_options
static const AVOption vaapi_encode_mpeg2_options[]
Definition: vaapi_encode_mpeg2.c:642
vaapi_encode_mpeg2_init_picture_params
static int vaapi_encode_mpeg2_init_picture_params(AVCodecContext *avctx, VAAPIEncodePicture *pic)
Definition: vaapi_encode_mpeg2.c:417
FF_PROFILE_UNKNOWN
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:1526
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:296
LEVEL
#define LEVEL(name, value)
ff_vaapi_encode_receive_packet
int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
Definition: vaapi_encode.c:1155
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:235
PROFILE
#define PROFILE(name, value)
vaapi_encode_mpeg2_profiles
static const VAAPIEncodeProfile vaapi_encode_mpeg2_profiles[]
Definition: vaapi_encode_mpeg2.c:558
OFFSET
#define OFFSET(x)
Definition: vaapi_encode_mpeg2.c:640
vaapi_encode_mpeg2_init
static av_cold int vaapi_encode_mpeg2_init(AVCodecContext *avctx)
Definition: vaapi_encode_mpeg2.c:589
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
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
VAAPI_ENCODE_RC_OPTIONS
#define VAAPI_ENCODE_RC_OPTIONS
Definition: vaapi_encode.h:463
vaapi_encode_mpeg2_class
static const AVClass vaapi_encode_mpeg2_class
Definition: vaapi_encode_mpeg2.c:684
VAAPI_ENCODE_COMMON_OPTIONS
#define VAAPI_ENCODE_COMMON_OPTIONS
Definition: vaapi_encode.h:445
AV_PIX_FMT_VAAPI
@ AV_PIX_FMT_VAAPI
Hardware acceleration through VA-API, data[3] contains a VASurfaceID.
Definition: pixfmt.h:119
vaapi_encode_mpeg2_init_slice_params
static int vaapi_encode_mpeg2_init_slice_params(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)
Definition: vaapi_encode_mpeg2.c:479
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: internal.h:50
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:108
vaapi_encode_mpeg2_init_sequence_params
static int vaapi_encode_mpeg2_init_sequence_params(AVCodecContext *avctx)
Definition: vaapi_encode_mpeg2.c:165
profile
int profile
Definition: mxfenc.c:2003
ff_vaapi_encode_hw_configs
const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs[]
Definition: vaapi_encode.c:32
vaapi_encode_mpeg2_defaults
static const AVCodecDefault vaapi_encode_mpeg2_defaults[]
Definition: vaapi_encode_mpeg2.c:671
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
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:82
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
vaapi_encode_mpeg2_write_picture_header
static int vaapi_encode_mpeg2_write_picture_header(AVCodecContext *avctx, VAAPIEncodePicture *pic, char *data, size_t *data_len)
Definition: vaapi_encode_mpeg2.c:141
AV_CODEC_ID_MPEG2VIDEO
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
Definition: codec_id.h:52
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:233