FFmpeg
Macros | Functions | Variables
v4l2_m2m_dec.c File Reference
#include <linux/videodev2.h>
#include <sys/ioctl.h>
#include "libavutil/pixfmt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/opt.h"
#include "libavcodec/avcodec.h"
#include "codec_internal.h"
#include "libavcodec/decode.h"
#include "v4l2_context.h"
#include "v4l2_m2m.h"
#include "v4l2_fmt.h"

Go to the source code of this file.

Macros

#define OFFSET(x)   offsetof(V4L2m2mPriv, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
 
#define M2MDEC_CLASS(NAME)
 
#define M2MDEC(NAME, LONGNAME, CODEC, bsf_name)
 

Functions

static int v4l2_try_start (AVCodecContext *avctx)
 
static int v4l2_prepare_decoder (V4L2m2mContext *s)
 
static int v4l2_receive_frame (AVCodecContext *avctx, AVFrame *frame)
 
static av_cold int v4l2_decode_init (AVCodecContext *avctx)
 
static av_cold int v4l2_decode_close (AVCodecContext *avctx)
 
 M2MDEC (h264, "H.264", AV_CODEC_ID_H264, "h264_mp4toannexb")
 
 M2MDEC (hevc, "HEVC", AV_CODEC_ID_HEVC, "hevc_mp4toannexb")
 
 M2MDEC (mpeg1, "MPEG1", AV_CODEC_ID_MPEG1VIDEO, NULL)
 
 M2MDEC (mpeg2, "MPEG2", AV_CODEC_ID_MPEG2VIDEO, NULL)
 
 M2MDEC (mpeg4, "MPEG4", AV_CODEC_ID_MPEG4, NULL)
 
 M2MDEC (h263, "H.263", AV_CODEC_ID_H263, NULL)
 
 M2MDEC (vc1, "VC1", AV_CODEC_ID_VC1, NULL)
 
 M2MDEC (vp8, "VP8", AV_CODEC_ID_VP8, NULL)
 
 M2MDEC (vp9, "VP9", AV_CODEC_ID_VP9, NULL)
 

Variables

static const AVOption options []
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 223 of file v4l2_m2m_dec.c.

◆ FLAGS

Definition at line 224 of file v4l2_m2m_dec.c.

◆ M2MDEC_CLASS

#define M2MDEC_CLASS (   NAME)
Value:
static const AVClass v4l2_m2m_ ## NAME ## _dec_class = { \
.class_name = #NAME "_v4l2m2m_decoder", \
.item_name = av_default_item_name, \
.option = options, \
.version = LIBAVUTIL_VERSION_INT, \
};

Definition at line 233 of file v4l2_m2m_dec.c.

◆ M2MDEC

#define M2MDEC (   NAME,
  LONGNAME,
  CODEC,
  bsf_name 
)
Value:
M2MDEC_CLASS(NAME) \
const FFCodec ff_ ## NAME ## _v4l2m2m_decoder = { \
.p.name = #NAME "_v4l2m2m" , \
CODEC_LONG_NAME("V4L2 mem2mem " LONGNAME " decoder wrapper"), \
.p.type = AVMEDIA_TYPE_VIDEO, \
.p.id = CODEC , \
.priv_data_size = sizeof(V4L2m2mPriv), \
.p.priv_class = &v4l2_m2m_ ## NAME ## _dec_class, \
.init = v4l2_decode_init, \
.close = v4l2_decode_close, \
.bsfs = bsf_name, \
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | \
FF_CODEC_CAP_INIT_CLEANUP, \
.p.wrapper_name = "v4l2m2m", \
}

Definition at line 241 of file v4l2_m2m_dec.c.

Function Documentation

◆ v4l2_try_start()

static int v4l2_try_start ( AVCodecContext avctx)
static

Definition at line 37 of file v4l2_m2m_dec.c.

Referenced by v4l2_receive_frame().

◆ v4l2_prepare_decoder()

static int v4l2_prepare_decoder ( V4L2m2mContext s)
static

requirements

Definition at line 105 of file v4l2_m2m_dec.c.

Referenced by v4l2_decode_init().

◆ v4l2_receive_frame()

static int v4l2_receive_frame ( AVCodecContext avctx,
AVFrame frame 
)
static

Definition at line 136 of file v4l2_m2m_dec.c.

◆ v4l2_decode_init()

static av_cold int v4l2_decode_init ( AVCodecContext avctx)
static

Definition at line 181 of file v4l2_m2m_dec.c.

◆ v4l2_decode_close()

static av_cold int v4l2_decode_close ( AVCodecContext avctx)
static

Definition at line 218 of file v4l2_m2m_dec.c.

◆ M2MDEC() [1/9]

M2MDEC ( h264  ,
"H.264"  ,
AV_CODEC_ID_H264  ,
"h264_mp4toannexb"   
)

◆ M2MDEC() [2/9]

M2MDEC ( hevc  ,
"HEVC"  ,
AV_CODEC_ID_HEVC  ,
"hevc_mp4toannexb"   
)

◆ M2MDEC() [3/9]

M2MDEC ( mpeg1  ,
"MPEG1"  ,
AV_CODEC_ID_MPEG1VIDEO  ,
NULL   
)

◆ M2MDEC() [4/9]

M2MDEC ( mpeg2  ,
"MPEG2"  ,
AV_CODEC_ID_MPEG2VIDEO  ,
NULL   
)

◆ M2MDEC() [5/9]

M2MDEC ( mpeg4  ,
"MPEG4"  ,
AV_CODEC_ID_MPEG4  ,
NULL   
)

◆ M2MDEC() [6/9]

M2MDEC ( h263  ,
"H.263"  ,
AV_CODEC_ID_H263  ,
NULL   
)

◆ M2MDEC() [7/9]

M2MDEC ( vc1  ,
"VC1"  ,
AV_CODEC_ID_VC1  ,
NULL   
)

◆ M2MDEC() [8/9]

M2MDEC ( vp8  ,
"VP8"  ,
AV_CODEC_ID_VP8  ,
NULL   
)

◆ M2MDEC() [9/9]

M2MDEC ( vp9  ,
"VP9"  ,
AV_CODEC_ID_VP9  ,
NULL   
)

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "num_capture_buffers", "Number of buffers in the capture context",
OFFSET(num_capture_buffers), AV_OPT_TYPE_INT, {.i64 = 20}, 2, INT_MAX, FLAGS },
{ NULL},
}

Definition at line 226 of file v4l2_m2m_dec.c.

v4l2_decode_close
static av_cold int v4l2_decode_close(AVCodecContext *avctx)
Definition: v4l2_m2m_dec.c:218
AV_CODEC_CAP_HARDWARE
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
Definition: codec.h:145
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
FFCodec
Definition: codec_internal.h:127
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
OFFSET
#define OFFSET(x)
Definition: v4l2_m2m_dec.c:223
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
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
V4L_M2M_DEFAULT_OPTS
#define V4L_M2M_DEFAULT_OPTS
Definition: v4l2_m2m.h:39
options
static const AVOption options[]
Definition: v4l2_m2m_dec.c:226
v4l2_decode_init
static av_cold int v4l2_decode_init(AVCodecContext *avctx)
Definition: v4l2_m2m_dec.c:181
FLAGS
#define FLAGS
Definition: v4l2_m2m_dec.c:224
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:80
v4l2_receive_frame
static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Definition: v4l2_m2m_dec.c:136
FF_CODEC_RECEIVE_FRAME_CB
#define FF_CODEC_RECEIVE_FRAME_CB(func)
Definition: codec_internal.h:317
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
V4L2m2mPriv
Definition: v4l2_m2m.h:71
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
M2MDEC_CLASS
#define M2MDEC_CLASS(NAME)
Definition: v4l2_m2m_dec.c:233
AV_CODEC_CAP_AVOID_PROBING
#define AV_CODEC_CAP_AVOID_PROBING
Decoder is not a preferred choice for probing.
Definition: codec.h:138