FFmpeg
Data Structures | Macros | Functions | Variables
mmaldec.c File Reference
#include <bcm_host.h>
#include <interface/mmal/mmal.h>
#include <interface/mmal/mmal_parameters_video.h>
#include <interface/mmal/util/mmal_util.h>
#include <interface/mmal/util/mmal_util_params.h>
#include <interface/mmal/util/mmal_default_components.h>
#include <interface/mmal/vc/mmal_vc_api.h>
#include <stdatomic.h>
#include "avcodec.h"
#include "codec_internal.h"
#include "decode.h"
#include "hwconfig.h"
#include "internal.h"
#include "libavutil/avassert.h"
#include "libavutil/buffer.h"
#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/log.h"

Go to the source code of this file.

Data Structures

struct  FFBufferEntry
 
struct  FFPoolRef
 
struct  FFBufferRef
 
struct  MMALDecodeContext
 

Macros

#define MAX_DELAYED_FRAMES   16
 
#define FFMMAL_DEC(NAME, ID)
 

Functions

static void ffmmal_poolref_unref (FFPoolRef *ref)
 
static void ffmmal_release_frame (void *opaque, uint8_t *data)
 
static int ffmmal_set_ref (AVFrame *frame, FFPoolRef *pool, MMAL_BUFFER_HEADER_T *buffer)
 
static void ffmmal_stop_decoder (AVCodecContext *avctx)
 
static av_cold int ffmmal_close_decoder (AVCodecContext *avctx)
 
static void input_callback (MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer)
 
static void output_callback (MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer)
 
static void control_port_cb (MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer)
 
static int ffmmal_fill_output_port (AVCodecContext *avctx)
 
static enum AVColorSpace ffmmal_csp_to_av_csp (MMAL_FOURCC_T fourcc)
 
static int ffmal_update_format (AVCodecContext *avctx)
 
static av_cold int ffmmal_init_decoder (AVCodecContext *avctx)
 
static void ffmmal_flush (AVCodecContext *avctx)
 
static int ffmmal_add_packet (AVCodecContext *avctx, AVPacket *avpkt, int is_extradata)
 
static int ffmmal_fill_input_port (AVCodecContext *avctx)
 
static int ffmal_copy_frame (AVCodecContext *avctx, AVFrame *frame, MMAL_BUFFER_HEADER_T *buffer)
 
static int ffmmal_read_frame (AVCodecContext *avctx, AVFrame *frame, int *got_frame)
 
static int ffmmal_receive_frame (AVCodecContext *avctx, AVFrame *frame)
 

Variables

static enum AVPixelFormat mmal_pixfmts []
 
static const AVCodecHWConfigInternal *const mmal_hw_configs []
 
static const AVOption options []
 
static const AVClass ffmmal_dec_class
 

Detailed Description

MMAL Video Decoder

Definition in file mmaldec.c.

Macro Definition Documentation

◆ MAX_DELAYED_FRAMES

#define MAX_DELAYED_FRAMES   16

Definition at line 103 of file mmaldec.c.

◆ FFMMAL_DEC

#define FFMMAL_DEC (   NAME,
  ID 
)
Value:
const FFCodec ff_##NAME##_mmal_decoder = { \
.p.name = #NAME "_mmal", \
CODEC_LONG_NAME(#NAME " (mmal)"), \
.p.type = AVMEDIA_TYPE_VIDEO, \
.p.id = ID, \
.priv_data_size = sizeof(MMALDecodeContext), \
.flush = ffmmal_flush, \
.p.priv_class = &ffmmal_dec_class, \
.hw_configs = mmal_hw_configs, \
.p.wrapper_name = "mmal", \
};

Definition at line 838 of file mmaldec.c.

Function Documentation

◆ ffmmal_poolref_unref()

static void ffmmal_poolref_unref ( FFPoolRef ref)
static

Definition at line 109 of file mmaldec.c.

Referenced by ffmal_update_format(), ffmmal_close_decoder(), and ffmmal_release_frame().

◆ ffmmal_release_frame()

static void ffmmal_release_frame ( void *  opaque,
uint8_t *  data 
)
static

Definition at line 118 of file mmaldec.c.

Referenced by ffmmal_set_ref().

◆ ffmmal_set_ref()

static int ffmmal_set_ref ( AVFrame frame,
FFPoolRef pool,
MMAL_BUFFER_HEADER_T *  buffer 
)
static

Definition at line 130 of file mmaldec.c.

Referenced by ffmal_copy_frame().

◆ ffmmal_stop_decoder()

static void ffmmal_stop_decoder ( AVCodecContext avctx)
static

Definition at line 156 of file mmaldec.c.

Referenced by ffmmal_close_decoder(), and ffmmal_flush().

◆ ffmmal_close_decoder()

static av_cold int ffmmal_close_decoder ( AVCodecContext avctx)
static

Definition at line 191 of file mmaldec.c.

Referenced by ffmmal_init_decoder().

◆ input_callback()

static void input_callback ( MMAL_PORT_T *  port,
MMAL_BUFFER_HEADER_T *  buffer 
)
static

Definition at line 209 of file mmaldec.c.

Referenced by ff_decklink_read_header(), ffmmal_flush(), and ffmmal_init_decoder().

◆ output_callback()

static void output_callback ( MMAL_PORT_T *  port,
MMAL_BUFFER_HEADER_T *  buffer 
)
static

Definition at line 224 of file mmaldec.c.

Referenced by ffmmal_flush(), ffmmal_init_decoder(), and ffmmal_read_frame().

◆ control_port_cb()

static void control_port_cb ( MMAL_PORT_T *  port,
MMAL_BUFFER_HEADER_T *  buffer 
)
static

Definition at line 232 of file mmaldec.c.

Referenced by ffmmal_flush(), and ffmmal_init_decoder().

◆ ffmmal_fill_output_port()

static int ffmmal_fill_output_port ( AVCodecContext avctx)
static

Definition at line 249 of file mmaldec.c.

Referenced by ffmmal_read_frame(), and ffmmal_receive_frame().

◆ ffmmal_csp_to_av_csp()

static enum AVColorSpace ffmmal_csp_to_av_csp ( MMAL_FOURCC_T  fourcc)
static

Definition at line 269 of file mmaldec.c.

Referenced by ffmal_update_format().

◆ ffmal_update_format()

static int ffmal_update_format ( AVCodecContext avctx)
static

Definition at line 282 of file mmaldec.c.

Referenced by ffmmal_init_decoder(), and ffmmal_read_frame().

◆ ffmmal_init_decoder()

static av_cold int ffmmal_init_decoder ( AVCodecContext avctx)
static

Definition at line 358 of file mmaldec.c.

◆ ffmmal_flush()

static void ffmmal_flush ( AVCodecContext avctx)
static

Definition at line 463 of file mmaldec.c.

◆ ffmmal_add_packet()

static int ffmmal_add_packet ( AVCodecContext avctx,
AVPacket avpkt,
int  is_extradata 
)
static

Definition at line 490 of file mmaldec.c.

Referenced by ffmmal_receive_frame().

◆ ffmmal_fill_input_port()

static int ffmmal_fill_input_port ( AVCodecContext avctx)
static

Definition at line 577 of file mmaldec.c.

Referenced by ffmmal_read_frame(), and ffmmal_receive_frame().

◆ ffmal_copy_frame()

static int ffmal_copy_frame ( AVCodecContext avctx,
AVFrame frame,
MMAL_BUFFER_HEADER_T *  buffer 
)
static

Definition at line 624 of file mmaldec.c.

Referenced by ffmmal_read_frame().

◆ ffmmal_read_frame()

static int ffmmal_read_frame ( AVCodecContext avctx,
AVFrame frame,
int *  got_frame 
)
static

Definition at line 674 of file mmaldec.c.

Referenced by ffmmal_receive_frame().

◆ ffmmal_receive_frame()

static int ffmmal_receive_frame ( AVCodecContext avctx,
AVFrame frame 
)
static

Definition at line 774 of file mmaldec.c.

Variable Documentation

◆ mmal_pixfmts

enum AVPixelFormat mmal_pixfmts[]
static
Initial value:

Definition at line 105 of file mmaldec.c.

Referenced by ffmmal_init_decoder().

◆ mmal_hw_configs

const AVCodecHWConfigInternal* const mmal_hw_configs[]
static
Initial value:
= {
}

Definition at line 820 of file mmaldec.c.

◆ options

const AVOption options[]
static
Initial value:
={
{"extra_buffers", "extra buffers", 0x42, AV_OPT_TYPE_INT, {.i64 = 10}, 0, 256, 0},
{"extra_decoder_buffers", "extra MMAL internal buffered frames", 0x42, AV_OPT_TYPE_INT, {.i64 = 10}, 0, 256, 0},
{NULL}
}

Definition at line 825 of file mmaldec.c.

◆ ffmmal_dec_class

const AVClass ffmmal_dec_class
static
Initial value:
= {
.class_name = "mmal_dec",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 831 of file mmaldec.c.

ffmmal_receive_frame
static int ffmmal_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Definition: mmaldec.c:774
AV_CODEC_CAP_HARDWARE
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
Definition: codec.h:145
AV_PIX_FMT_MMAL
@ AV_PIX_FMT_MMAL
HW acceleration though MMAL, data[3] contains a pointer to the MMAL_BUFFER_HEADER_T structure.
Definition: pixfmt.h:252
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
mmal_hw_configs
static const AVCodecHWConfigInternal *const mmal_hw_configs[]
Definition: mmaldec.c:820
options
static const AVOption options[]
Definition: mmaldec.c:825
ffmmal_flush
static void ffmmal_flush(AVCodecContext *avctx)
Definition: mmaldec.c:463
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
ffmmal_init_decoder
static av_cold int ffmmal_init_decoder(AVCodecContext *avctx)
Definition: mmaldec.c:358
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:237
ffmmal_close_decoder
static av_cold int ffmmal_close_decoder(AVCodecContext *avctx)
Definition: mmaldec.c:191
ID
#define ID(_0)
Definition: mov_chan.c:240
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
HW_CONFIG_INTERNAL
#define HW_CONFIG_INTERNAL(format)
Definition: hwconfig.h:54
MMALDecodeContext
Definition: mmaldec.c:71
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
FF_CODEC_RECEIVE_FRAME_CB
#define FF_CODEC_RECEIVE_FRAME_CB(func)
Definition: codec_internal.h:317
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
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
ffmmal_dec_class
static const AVClass ffmmal_dec_class
Definition: mmaldec.c:831