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, 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 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 639 of file vaapi_encode_mpeg2.c.

◆ FLAGS

Definition at line 640 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,
VAAPIEncodePicture 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,
VAAPIEncodePicture pic 
)
static

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

◆ vaapi_encode_mpeg2_configure()

static av_cold int vaapi_encode_mpeg2_configure ( AVCodecContext avctx)
static

Definition at line 514 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_mpeg2_init()

static av_cold int vaapi_encode_mpeg2_init ( AVCodecContext avctx)
static

Definition at line 591 of file vaapi_encode_mpeg2.c.

◆ vaapi_encode_mpeg2_close()

static av_cold int vaapi_encode_mpeg2_close ( AVCodecContext avctx)
static

Definition at line 629 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 560 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 566 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 641 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 670 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 683 of file vaapi_encode_mpeg2.c.

◆ ff_mpeg2_vaapi_encoder

const FFCodec ff_mpeg2_vaapi_encoder
Initial value:

Definition at line 690 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:204
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:42
AV_PROFILE_MPEG2_SIMPLE
#define AV_PROFILE_MPEG2_SIMPLE
Definition: defs.h:104
AV_CODEC_CAP_HARDWARE
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
Definition: codec.h:145
FLAG_B_PICTURES
@ FLAG_B_PICTURES
Definition: vaapi_encode.h:408
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:34
vaapi_encode_mpeg2_close
static av_cold int vaapi_encode_mpeg2_close(AVCodecContext *avctx)
Definition: vaapi_encode_mpeg2.c:629
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:514
FLAGS
#define FLAGS
Definition: vaapi_encode_mpeg2.c:640
vaapi_encode_mpeg2_options
static const AVOption vaapi_encode_mpeg2_options[]
Definition: vaapi_encode_mpeg2.c:641
AV_PROFILE_UNKNOWN
#define AV_PROFILE_UNKNOWN
Definition: defs.h:65
vaapi_encode_mpeg2_init_picture_params
static int vaapi_encode_mpeg2_init_picture_params(AVCodecContext *avctx, VAAPIEncodePicture *pic)
Definition: vaapi_encode_mpeg2.c:419
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:1396
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
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:302
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:560
OFFSET
#define OFFSET(x)
Definition: vaapi_encode_mpeg2.c:639
vaapi_encode_mpeg2_init
static av_cold int vaapi_encode_mpeg2_init(AVCodecContext *avctx)
Definition: vaapi_encode_mpeg2.c:591
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
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_RC_OPTIONS
#define VAAPI_ENCODE_RC_OPTIONS
Definition: vaapi_encode.h:532
vaapi_encode_mpeg2_class
static const AVClass vaapi_encode_mpeg2_class
Definition: vaapi_encode_mpeg2.c:683
VAAPI_ENCODE_COMMON_OPTIONS
#define VAAPI_ENCODE_COMMON_OPTIONS
Definition: vaapi_encode.h:505
vaapi_encode_mpeg2_defaults
static const FFCodecDefault vaapi_encode_mpeg2_defaults[]
Definition: vaapi_encode_mpeg2.c:670
AV_PIX_FMT_VAAPI
@ AV_PIX_FMT_VAAPI
Hardware acceleration through VA-API, data[3] contains a VASurfaceID.
Definition: pixfmt.h:126
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:481
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:2226
ff_vaapi_encode_hw_configs
const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs[]
Definition: vaapi_encode.c:35
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
AV_PROFILE_MPEG2_MAIN
#define AV_PROFILE_MPEG2_MAIN
Definition: defs.h:103
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
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:143
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
Definition: opt.h:244