FFmpeg
Data Structures | Macros | Functions | Variables
libopenh264enc.c File Reference
#include <wels/codec_api.h>
#include <wels/codec_ver.h>
#include "libavutil/attributes.h"
#include "libavutil/common.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "encode.h"
#include "libopenh264.h"

Go to the source code of this file.

Data Structures

struct  SVCContext
 

Macros

#define SM_SIZELIMITED_SLICE   SM_DYN_SLICE
 
#define TARGET_BITRATE_DEFAULT   2*1000*1000
 
#define OFFSET(x)   offsetof(SVCContext, x)
 
#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 
#define DEPRECATED   AV_OPT_FLAG_DEPRECATED
 
#define PROFILE(name, value)   name, NULL, 0, AV_OPT_TYPE_CONST, { .i64 = value }, 0, 0, VE, .unit = "profile"
 

Functions

static av_cold int svc_encode_close (AVCodecContext *avctx)
 
static av_cold int svc_encode_init (AVCodecContext *avctx)
 
static int svc_encode_frame (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet)
 

Variables

static const AVOption options []
 
class {
      class_name = "libopenh264enc"
 
      item_name = av_default_item_name
 
      option = options
 
      version = LIBAVUTIL_VERSION_INT
 
}; 
 
static const FFCodecDefault svc_enc_defaults []
 
const FFCodec ff_libopenh264_encoder
 

Macro Definition Documentation

◆ SM_SIZELIMITED_SLICE

#define SM_SIZELIMITED_SLICE   SM_DYN_SLICE

Definition at line 39 of file libopenh264enc.c.

◆ TARGET_BITRATE_DEFAULT

#define TARGET_BITRATE_DEFAULT   2*1000*1000

Definition at line 42 of file libopenh264enc.c.

◆ OFFSET

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

Definition at line 59 of file libopenh264enc.c.

◆ VE

Definition at line 60 of file libopenh264enc.c.

◆ DEPRECATED

#define DEPRECATED   AV_OPT_FLAG_DEPRECATED

Definition at line 61 of file libopenh264enc.c.

◆ PROFILE

#define PROFILE (   name,
  value 
)    name, NULL, 0, AV_OPT_TYPE_CONST, { .i64 = value }, 0, 0, VE, .unit = "profile"

Function Documentation

◆ svc_encode_close()

static av_cold int svc_encode_close ( AVCodecContext avctx)
static

Definition at line 98 of file libopenh264enc.c.

◆ svc_encode_init()

static av_cold int svc_encode_init ( AVCodecContext avctx)
static

Definition at line 109 of file libopenh264enc.c.

◆ svc_encode_frame()

static int svc_encode_frame ( AVCodecContext avctx,
AVPacket avpkt,
const AVFrame frame,
int *  got_packet 
)
static

Definition at line 361 of file libopenh264enc.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "loopfilter", "enable loop filter", OFFSET(loopfilter), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE },
{ "profile", "set profile restrictions", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = AV_PROFILE_UNKNOWN }, AV_PROFILE_UNKNOWN, 0xffff, VE, .unit = "profile" },
#define PROFILE(name, value)
{ PROFILE("constrained_baseline", AV_PROFILE_H264_CONSTRAINED_BASELINE) },
{ "max_nal_size", "set maximum NAL size in bytes", OFFSET(max_nal_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
{ "allow_skip_frames", "allow skipping frames to hit the target bitrate", OFFSET(skip_frames), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
{ "coder", "Coder type", OFFSET(coder), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE, .unit = "coder" },
{ "default", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, INT_MIN, INT_MAX, VE, .unit = "coder" },
{ "cavlc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, .unit = "coder" },
{ "cabac", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, .unit = "coder" },
{ "vlc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, .unit = "coder" },
{ "ac", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, .unit = "coder" },
{ "rc_mode", "Select rate control mode", OFFSET(rc_mode), AV_OPT_TYPE_INT, { .i64 = RC_QUALITY_MODE }, RC_OFF_MODE, RC_TIMESTAMP_MODE, VE, .unit = "rc_mode" },
{ "off", "bit rate control off", 0, AV_OPT_TYPE_CONST, { .i64 = RC_OFF_MODE }, 0, 0, VE, .unit = "rc_mode" },
{ "quality", "quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = RC_QUALITY_MODE }, 0, 0, VE, .unit = "rc_mode" },
{ "bitrate", "bitrate mode", 0, AV_OPT_TYPE_CONST, { .i64 = RC_BITRATE_MODE }, 0, 0, VE, .unit = "rc_mode" },
{ "buffer", "using buffer status to adjust the video quality (no bitrate control)", 0, AV_OPT_TYPE_CONST, { .i64 = RC_BUFFERBASED_MODE }, 0, 0, VE, .unit = "rc_mode" },
{ NULL }
}

Definition at line 62 of file libopenh264enc.c.

◆ class_name

class_name = "libopenh264enc"
private

Definition at line 92 of file libopenh264enc.c.

◆ item_name

item_name = av_default_item_name
private

Definition at line 93 of file libopenh264enc.c.

◆ option

option = options
private

Definition at line 94 of file libopenh264enc.c.

◆ version

version = LIBAVUTIL_VERSION_INT
private

Definition at line 95 of file libopenh264enc.c.

◆ @155

const { ... }

◆ svc_enc_defaults

const FFCodecDefault svc_enc_defaults[]
static
Initial value:
= {
{ "b", "0" },
{ "g", "-1" },
{ "qmin", "-1" },
{ "qmax", "-1" },
{ NULL },
}

Definition at line 424 of file libopenh264enc.c.

◆ ff_libopenh264_encoder

const FFCodec ff_libopenh264_encoder
Initial value:
= {
.p.name = "libopenh264",
CODEC_LONG_NAME("OpenH264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
.p.type = AVMEDIA_TYPE_VIDEO,
.priv_data_size = sizeof(SVCContext),
.close = svc_encode_close,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP |
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
.defaults = svc_enc_defaults,
.p.priv_class = &class,
.p.wrapper_name = "libopenh264",
}

Definition at line 432 of file libopenh264enc.c.

SVCContext
Definition: libopenh264dec.c:37
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
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_H264_MAIN
#define AV_PROFILE_H264_MAIN
Definition: defs.h:112
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:696
FF_CODEC_ENCODE_CB
#define FF_CODEC_ENCODE_CB(func)
Definition: codec_internal.h:320
AV_PROFILE_UNKNOWN
#define AV_PROFILE_UNKNOWN
Definition: defs.h:65
AV_CODEC_CAP_OTHER_THREADS
#define AV_CODEC_CAP_OTHER_THREADS
Codec supports multithreading through a method other than slice- or frame-level multithreading.
Definition: codec.h:124
svc_encode_frame
static int svc_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet)
Definition: libopenh264enc.c:361
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
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:79
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
NULL
#define NULL
Definition: coverity.c:32
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:85
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
PROFILE
#define PROFILE(name, value)
OFFSET
#define OFFSET(x)
Definition: libopenh264enc.c:59
profile
int profile
Definition: mxfenc.c:2228
AVCOL_RANGE_MPEG
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition: pixfmt.h:679
svc_encode_init
static av_cold int svc_encode_init(AVCodecContext *avctx)
Definition: libopenh264enc.c:109
AV_PROFILE_H264_HIGH
#define AV_PROFILE_H264_HIGH
Definition: defs.h:114
svc_encode_close
static av_cold int svc_encode_close(AVCodecContext *avctx)
Definition: libopenh264enc.c:98
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
VE
#define VE
Definition: libopenh264enc.c:60
AV_PROFILE_H264_CONSTRAINED_BASELINE
#define AV_PROFILE_H264_CONSTRAINED_BASELINE
Definition: defs.h:111
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FF_CODEC_CAP_AUTO_THREADS
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
Definition: codec_internal.h:73
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
rc_mode
mfxU16 rc_mode
Definition: qsvenc.c:143
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
svc_enc_defaults
static const FFCodecDefault svc_enc_defaults[]
Definition: libopenh264enc.c:424