FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
mmaldec.c File Reference

MMAL Video Decoder. More...

#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 "avcodec.h"
#include "internal.h"
#include "libavutil/atomic.h"
#include "libavutil/avassert.h"
#include "libavutil/buffer.h"
#include "libavutil/common.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_CLASS(NAME)
 
#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_decode (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 

Variables

AVHWAccel ff_h264_mmal_hwaccel
 
AVHWAccel ff_mpeg2_mmal_hwaccel
 
AVHWAccel ff_mpeg4_mmal_hwaccel
 
AVHWAccel ff_vc1_mmal_hwaccel
 
static const AVOption options []
 

Detailed Description

MMAL Video Decoder.

Definition in file mmaldec.c.

Macro Definition Documentation

#define MAX_DELAYED_FRAMES   16

Definition at line 94 of file mmaldec.c.

Referenced by ffmmal_read_frame().

#define FFMMAL_DEC_CLASS (   NAME)
Value:
static const AVClass ffmmal_##NAME##_dec_class = { \
.class_name = "mmal_" #NAME "_dec", \
.option = options, \
.version = LIBAVUTIL_VERSION_INT, \
};
#define LIBAVUTIL_VERSION_INT
Definition: version.h:70
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:72
static const AVOption options[]
Definition: mmaldec.c:819
Describe the class of an AVClass context structure.
Definition: log.h:67

Definition at line 825 of file mmaldec.c.

#define FFMMAL_DEC (   NAME,
  ID 
)
Value:
AVCodec ff_##NAME##_mmal_decoder = { \
.name = #NAME "_mmal", \
.long_name = NULL_IF_CONFIG_SMALL(#NAME " (mmal)"), \
.type = AVMEDIA_TYPE_VIDEO, \
.id = ID, \
.priv_data_size = sizeof(MMALDecodeContext), \
.priv_class = &ffmmal_##NAME##_dec_class, \
.capabilities = AV_CODEC_CAP_DELAY, \
.caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, \
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_MMAL, \
};
static void flush(AVCodecContext *avctx)
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static int ffmmal_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: mmaldec.c:750
#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: avcodec.h:881
static void ffmmal_flush(AVCodecContext *avctx)
Definition: mmaldec.c:432
static av_cold int ffmmal_init_decoder(AVCodecContext *avctx)
Definition: mmaldec.c:330
static av_cold int ffmmal_close_decoder(AVCodecContext *avctx)
Definition: mmaldec.c:177
#define FFMMAL_DEC_CLASS(NAME)
Definition: mmaldec.c:825
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
#define ID(x)
Definition: cast5.c:29
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:262
#define FF_CODEC_CAP_SETS_PKT_DTS
Decoders marked with FF_CODEC_CAP_SETS_PKT_DTS want to set AVFrame.pkt_dts manually.
Definition: internal.h:55
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
Definition: ccaption_dec.c:572
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:63
HW acceleration though MMAL, data[3] contains a pointer to the MMAL_BUFFER_HEADER_T structure...
Definition: pixfmt.h:241
AVPixelFormat
Pixel format.
Definition: pixfmt.h:61

Definition at line 832 of file mmaldec.c.

Function Documentation

static void ffmmal_poolref_unref ( FFPoolRef ref)
static

Definition at line 96 of file mmaldec.c.

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

static void ffmmal_release_frame ( void opaque,
uint8_t data 
)
static

Definition at line 104 of file mmaldec.c.

Referenced by ffmmal_set_ref().

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

Definition at line 116 of file mmaldec.c.

Referenced by ffmal_copy_frame().

static void ffmmal_stop_decoder ( AVCodecContext avctx)
static

Definition at line 142 of file mmaldec.c.

Referenced by ffmmal_close_decoder(), and ffmmal_flush().

static av_cold int ffmmal_close_decoder ( AVCodecContext avctx)
static

Definition at line 177 of file mmaldec.c.

Referenced by ffmmal_init_decoder().

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

Definition at line 195 of file mmaldec.c.

Referenced by ffmmal_flush(), and ffmmal_init_decoder().

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

Definition at line 210 of file mmaldec.c.

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

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

Definition at line 218 of file mmaldec.c.

Referenced by ffmmal_flush(), and ffmmal_init_decoder().

static int ffmmal_fill_output_port ( AVCodecContext avctx)
static

Definition at line 236 of file mmaldec.c.

Referenced by ffmmal_decode(), and ffmmal_read_frame().

static enum AVColorSpace ffmmal_csp_to_av_csp ( MMAL_FOURCC_T  fourcc)
static

Definition at line 256 of file mmaldec.c.

Referenced by ffmal_update_format().

static int ffmal_update_format ( AVCodecContext avctx)
static

Definition at line 269 of file mmaldec.c.

Referenced by ffmmal_init_decoder(), and ffmmal_read_frame().

static av_cold int ffmmal_init_decoder ( AVCodecContext avctx)
static

Definition at line 330 of file mmaldec.c.

static void ffmmal_flush ( AVCodecContext avctx)
static

Definition at line 432 of file mmaldec.c.

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

Definition at line 459 of file mmaldec.c.

Referenced by ffmmal_decode().

static int ffmmal_fill_input_port ( AVCodecContext avctx)
static

Definition at line 556 of file mmaldec.c.

Referenced by ffmmal_decode(), and ffmmal_read_frame().

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

Definition at line 603 of file mmaldec.c.

Referenced by ffmmal_read_frame().

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

Definition at line 649 of file mmaldec.c.

Referenced by ffmmal_decode().

static int ffmmal_decode ( AVCodecContext avctx,
void data,
int *  got_frame,
AVPacket avpkt 
)
static

Definition at line 750 of file mmaldec.c.

Variable Documentation

AVHWAccel ff_h264_mmal_hwaccel
Initial value:
= {
.name = "h264_mmal",
.pix_fmt = AV_PIX_FMT_MMAL,
}
HW acceleration though MMAL, data[3] contains a pointer to the MMAL_BUFFER_HEADER_T structure...
Definition: pixfmt.h:241

Definition at line 791 of file mmaldec.c.

AVHWAccel ff_mpeg2_mmal_hwaccel
Initial value:
= {
.name = "mpeg2_mmal",
.pix_fmt = AV_PIX_FMT_MMAL,
}
preferred ID for MPEG-1/2 video decoding
Definition: avcodec.h:106
HW acceleration though MMAL, data[3] contains a pointer to the MMAL_BUFFER_HEADER_T structure...
Definition: pixfmt.h:241

Definition at line 798 of file mmaldec.c.

AVHWAccel ff_mpeg4_mmal_hwaccel
Initial value:
= {
.name = "mpeg4_mmal",
.pix_fmt = AV_PIX_FMT_MMAL,
}
HW acceleration though MMAL, data[3] contains a pointer to the MMAL_BUFFER_HEADER_T structure...
Definition: pixfmt.h:241

Definition at line 805 of file mmaldec.c.

AVHWAccel ff_vc1_mmal_hwaccel
Initial value:
= {
.name = "vc1_mmal",
.pix_fmt = AV_PIX_FMT_MMAL,
}
HW acceleration though MMAL, data[3] contains a pointer to the MMAL_BUFFER_HEADER_T structure...
Definition: pixfmt.h:241

Definition at line 812 of file mmaldec.c.

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}
}
#define NULL
Definition: coverity.c:32

Definition at line 819 of file mmaldec.c.