FFmpeg
Data Structures | Macros | Functions
v4l2_m2m.h File Reference
#include <semaphore.h>
#include <unistd.h>
#include <dirent.h>
#include <linux/videodev2.h>
#include "libavcodec/avcodec.h"
#include "v4l2_context.h"

Go to the source code of this file.

Data Structures

struct  V4L2m2mContext
 
struct  V4L2m2mPriv
 

Macros

#define container_of(ptr, type, member)
 
#define V4L_M2M_DEFAULT_OPTS
 

Functions

int ff_v4l2_m2m_create_context (V4L2m2mPriv *priv, V4L2m2mContext **s)
 Allocate a new context and references for a V4L2 M2M instance. More...
 
int ff_v4l2_m2m_codec_init (V4L2m2mPriv *priv)
 Probes the video nodes looking for the required codec capabilities. More...
 
int ff_v4l2_m2m_codec_end (V4L2m2mPriv *priv)
 Releases all the codec resources if all AVBufferRefs have been returned to the ctx. More...
 
int ff_v4l2_m2m_codec_reinit (V4L2m2mContext *ctx)
 Reinitializes the V4L2m2mContext when the driver cannot continue processing with the capture parameters. More...
 
int ff_v4l2_m2m_codec_full_reinit (V4L2m2mContext *ctx)
 Reinitializes the V4L2m2mContext when the driver cannot continue processing with the any of the current V4L2Contexts (ie, changes in output and capture). More...
 

Macro Definition Documentation

◆ container_of

#define container_of (   ptr,
  type,
  member 
)
Value:
({ \
const __typeof__(((type *)0)->member ) *__mptr = (ptr); \
(type *)((char *)__mptr - offsetof(type,member) );})

Definition at line 35 of file v4l2_m2m.h.

◆ V4L_M2M_DEFAULT_OPTS

#define V4L_M2M_DEFAULT_OPTS
Value:
{ "num_output_buffers", "Number of buffers in the output context",\
OFFSET(num_output_buffers), AV_OPT_TYPE_INT, { .i64 = 16 }, 2, INT_MAX, FLAGS }

Definition at line 39 of file v4l2_m2m.h.

Function Documentation

◆ ff_v4l2_m2m_create_context()

int ff_v4l2_m2m_create_context ( V4L2m2mPriv priv,
V4L2m2mContext **  s 
)

Allocate a new context and references for a V4L2 M2M instance.

Parameters
[in]ctxThe V4L2m2mPriv instantiated by the encoder/decoder.
[out]ctxThe V4L2m2mContext.
Returns
0 in success, a negative error code otherwise.

Definition at line 329 of file v4l2_m2m.c.

Referenced by v4l2_decode_init(), and v4l2_encode_init().

◆ ff_v4l2_m2m_codec_init()

int ff_v4l2_m2m_codec_init ( V4L2m2mPriv priv)

Probes the video nodes looking for the required codec capabilities.

Parameters
[in]ctxThe V4L2m2mPriv instantiated by the encoder/decoder.
Returns
0 if a driver is found, a negative number otherwise.

Definition at line 291 of file v4l2_m2m.c.

Referenced by v4l2_decode_init(), and v4l2_encode_init().

◆ ff_v4l2_m2m_codec_end()

int ff_v4l2_m2m_codec_end ( V4L2m2mPriv priv)

Releases all the codec resources if all AVBufferRefs have been returned to the ctx.

Otherwise keep the driver open.

Parameters
[in]TheV4L2m2mPriv instantiated by the encoder/decoder.
Returns
0

Definition at line 265 of file v4l2_m2m.c.

Referenced by v4l2_decode_close(), and v4l2_encode_close().

◆ ff_v4l2_m2m_codec_reinit()

int ff_v4l2_m2m_codec_reinit ( V4L2m2mContext ctx)

Reinitializes the V4L2m2mContext when the driver cannot continue processing with the capture parameters.

Parameters
[in]ctxThe V4L2m2mContext instantiated by the encoder/decoder.
Returns
0 in case of success, negative number otherwise

Definition at line 206 of file v4l2_m2m.c.

Referenced by v4l2_handle_event().

◆ ff_v4l2_m2m_codec_full_reinit()

int ff_v4l2_m2m_codec_full_reinit ( V4L2m2mContext ctx)

Reinitializes the V4L2m2mContext when the driver cannot continue processing with the any of the current V4L2Contexts (ie, changes in output and capture).

Parameters
[in]ctxThe V4L2m2mContext instantiated by the encoder/decoder.
Returns
0 in case of success, negative number otherwise
FLAGS
#define FLAGS
Definition: cmdutils.c:515
type
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 type
Definition: writing_filters.txt:86
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225