#include "config.h"
#include <dlfcn.h>
#include <OMX_Core.h>
#include <OMX_Component.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include "libavutil/avstring.h"
#include "libavutil/avutil.h"
#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/log.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "h264.h"
#include "pthread_internal.h"
Go to the source code of this file.
|
static av_cold void * | dlsym_prefixed (void *handle, const char *symbol, const char *prefix) |
|
static av_cold int | omx_try_load (OMXContext *s, void *logctx, const char *libname, const char *prefix, const char *libname2) |
|
static av_cold OMXContext * | omx_init (void *logctx, const char *libname, const char *prefix) |
|
static av_cold void | omx_deinit (OMXContext *omx_context) |
|
| DEFINE_OFFSET_ARRAY (OMXCodecContext, omx_codec_context, mutex_cond_inited_cnt,(OFF(input_mutex), OFF(output_mutex), OFF(state_mutex)),(OFF(input_cond), OFF(output_cond), OFF(state_cond))) |
|
static void | append_buffer (pthread_mutex_t *mutex, pthread_cond_t *cond, int *array_size, OMX_BUFFERHEADERTYPE **array, OMX_BUFFERHEADERTYPE *buffer) |
|
static OMX_BUFFERHEADERTYPE * | get_buffer (pthread_mutex_t *mutex, pthread_cond_t *cond, int *array_size, OMX_BUFFERHEADERTYPE **array, int wait) |
|
static OMX_ERRORTYPE | event_handler (OMX_HANDLETYPE component, OMX_PTR app_data, OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2, OMX_PTR event_data) |
|
static OMX_ERRORTYPE | empty_buffer_done (OMX_HANDLETYPE component, OMX_PTR app_data, OMX_BUFFERHEADERTYPE *buffer) |
|
static OMX_ERRORTYPE | fill_buffer_done (OMX_HANDLETYPE component, OMX_PTR app_data, OMX_BUFFERHEADERTYPE *buffer) |
|
static av_cold int | find_component (OMXContext *omx_context, void *logctx, const char *role, char *str, int str_size) |
|
static av_cold int | wait_for_state (OMXCodecContext *s, OMX_STATETYPE state) |
|
static av_cold int | omx_component_init (AVCodecContext *avctx, const char *role) |
|
static av_cold void | cleanup (OMXCodecContext *s) |
|
static av_cold int | omx_encode_init (AVCodecContext *avctx) |
|
static int | omx_encode_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet) |
|
static av_cold int | omx_encode_end (AVCodecContext *avctx) |
|
◆ to_omx_ticks
#define to_omx_ticks |
( |
|
x | ) |
(x) |
Definition at line 62 of file omx.c.
◆ from_omx_ticks
#define from_omx_ticks |
( |
|
x | ) |
(x) |
Definition at line 63 of file omx.c.
◆ INIT_STRUCT
Value: do { \
x.nSize = sizeof(x); \
x.nVersion =
s->version; \
} while (0)
Definition at line 66 of file omx.c.
◆ CHECK
Value: do { \
if (x != OMX_ErrorNone) { \
"err %x (%d) on line %d\n", x, x, __LINE__); \
} \
} while (0)
Definition at line 70 of file omx.c.
◆ NB_MUTEX_CONDS
◆ OFF
◆ OFFSET
◆ VDE
◆ VE
◆ dlsym_prefixed()
static av_cold void* dlsym_prefixed |
( |
void * |
handle, |
|
|
const char * |
symbol, |
|
|
const char * |
prefix |
|
) |
| |
|
static |
◆ omx_try_load()
static av_cold int omx_try_load |
( |
OMXContext * |
s, |
|
|
void * |
logctx, |
|
|
const char * |
libname, |
|
|
const char * |
prefix, |
|
|
const char * |
libname2 |
|
) |
| |
|
static |
◆ omx_init()
static av_cold OMXContext* omx_init |
( |
void * |
logctx, |
|
|
const char * |
libname, |
|
|
const char * |
prefix |
|
) |
| |
|
static |
◆ omx_deinit()
◆ DEFINE_OFFSET_ARRAY()
DEFINE_OFFSET_ARRAY |
( |
OMXCodecContext |
, |
|
|
omx_codec_context |
, |
|
|
mutex_cond_inited_cnt |
, |
|
|
(OFF(input_mutex), OFF(output_mutex), OFF(state_mutex)) |
, |
|
|
(OFF(input_cond), OFF(output_cond), OFF(state_cond)) |
|
|
) |
| |
◆ append_buffer()
static void append_buffer |
( |
pthread_mutex_t * |
mutex, |
|
|
pthread_cond_t * |
cond, |
|
|
int * |
array_size, |
|
|
OMX_BUFFERHEADERTYPE ** |
array, |
|
|
OMX_BUFFERHEADERTYPE * |
buffer |
|
) |
| |
|
static |
◆ get_buffer()
static OMX_BUFFERHEADERTYPE* get_buffer |
( |
pthread_mutex_t * |
mutex, |
|
|
pthread_cond_t * |
cond, |
|
|
int * |
array_size, |
|
|
OMX_BUFFERHEADERTYPE ** |
array, |
|
|
int |
wait |
|
) |
| |
|
static |
◆ event_handler()
static OMX_ERRORTYPE event_handler |
( |
OMX_HANDLETYPE |
component, |
|
|
OMX_PTR |
app_data, |
|
|
OMX_EVENTTYPE |
event, |
|
|
OMX_U32 |
data1, |
|
|
OMX_U32 |
data2, |
|
|
OMX_PTR |
event_data |
|
) |
| |
|
static |
◆ empty_buffer_done()
static OMX_ERRORTYPE empty_buffer_done |
( |
OMX_HANDLETYPE |
component, |
|
|
OMX_PTR |
app_data, |
|
|
OMX_BUFFERHEADERTYPE * |
buffer |
|
) |
| |
|
static |
◆ fill_buffer_done()
static OMX_ERRORTYPE fill_buffer_done |
( |
OMX_HANDLETYPE |
component, |
|
|
OMX_PTR |
app_data, |
|
|
OMX_BUFFERHEADERTYPE * |
buffer |
|
) |
| |
|
static |
◆ find_component()
static av_cold int find_component |
( |
OMXContext * |
omx_context, |
|
|
void * |
logctx, |
|
|
const char * |
role, |
|
|
char * |
str, |
|
|
int |
str_size |
|
) |
| |
|
static |
◆ wait_for_state()
◆ omx_component_init()
◆ cleanup()
◆ omx_encode_init()
◆ omx_encode_frame()
◆ omx_encode_end()
◆ callbacks
const OMX_CALLBACKTYPE callbacks |
|
static |
◆ options
Initial value:= {
{
"zerocopy",
"Try to avoid copying input frames if possible",
OFFSET(input_zerocopy),
AV_OPT_TYPE_INT, { .i64 = CONFIG_OMX_RPI }, 0, 1,
VE },
}
Definition at line 924 of file omx.c.
◆ omx_encoder_pix_fmts
Initial value:
Definition at line 935 of file omx.c.
◆ omx_mpeg4enc_class
Initial value:= {
.class_name = "mpeg4_omx",
}
Definition at line 939 of file omx.c.
◆ ff_mpeg4_omx_encoder
Initial value:= {
.p.name = "mpeg4_omx",
}
Definition at line 945 of file omx.c.
◆ omx_h264enc_class
Initial value:= {
.class_name = "h264_omx",
}
Definition at line 961 of file omx.c.
◆ ff_h264_omx_encoder
Initial value:= {
.p.name = "h264_omx",
}
Definition at line 967 of file omx.c.
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define AV_PROFILE_H264_MAIN
static OMX_ERRORTYPE empty_buffer_done(OMX_HANDLETYPE component, OMX_PTR app_data, OMX_BUFFERHEADERTYPE *buffer)
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
static enum AVPixelFormat omx_encoder_pix_fmts[]
#define FF_CODEC_ENCODE_CB(func)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_PROFILE_UNKNOWN
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define CODEC_LONG_NAME(str)
#define LIBAVUTIL_VERSION_INT
const char * av_default_item_name(void *ptr)
Return the context name.
static OMX_ERRORTYPE event_handler(OMX_HANDLETYPE component, OMX_PTR app_data, OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2, OMX_PTR event_data)
int(* init)(AVBSFContext *ctx)
static const AVOption options[]
static const AVClass omx_h264enc_class
static int omx_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
#define AV_PROFILE_H264_BASELINE
static av_cold int omx_encode_init(AVCodecContext *avctx)
#define AV_PROFILE_H264_HIGH
static av_cold int omx_encode_end(AVCodecContext *avctx)
@ AV_OPT_TYPE_INT
Underlying C type is int.
static const AVClass omx_mpeg4enc_class
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
static OMX_ERRORTYPE fill_buffer_done(OMX_HANDLETYPE component, OMX_PTR app_data, OMX_BUFFERHEADERTYPE *buffer)