I just write a ffcodec for ffmpeg. It can run success with my test codes, and also with ffmpeg test. However , when I tried use it in chrome, it run with some errors as following: [3845:3880:0710/110530.508867:ERROR:ffmpeg_video_decoder.cc(487)] avcodec_open2 failed.-558323010
[3845:3880:0710/110530.509921:ERROR:ffmpeg_video_decoder.cc(491)] avcodec_open2 error: Internal bug, should not have happened.
belowing is my ffcodec options for my decoder, can someone give some advice?:
define OFFSET(x) offsetof(OMXCodecDecoderContext, x)
define VDE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM
define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
{ "omx_libname", "OpenMAX library name", OFFSET(libname), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VDE },
{ "omx_libprefix", "OpenMAX library prefix", OFFSET(libprefix), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VDE },
{ "profile", "Set the Decoding profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, FF_PROFILE_H264_HIGH, VE, "profile" },
{ "baseline", "", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_BASELINE }, 0, 0, VE, "profile" },
{ "main", "", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_MAIN }, 0, 0, VE, "profile" },
{ "high", "", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_HIGH }, 0, 0, VE, "profile" },
{ NULL }
};
static const AVCodecHWConfigInternal *const omx_hw_configs[] = {
&(const AVCodecHWConfigInternal) {
.public = {
.pix_fmt = AV_PIX_FMT_NV12,
.methods = AV_CODEC_HW_CONFIG_METHOD_AD_HOC |
AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX,
.device_type = AV_HWDEVICE_TYPE_MEDIACODEC,
},
.hwaccel = NULL,
},
NULL
};
static const AVOption ff_omxcodec_vdec_options[] = {
{ "delay_flush", "Delay flush until hw output buffers are returned to the decoder",
OFFSET(delay_flush), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, VD },
{ NULL }
};
define DECLARE_OMX_VCLASS(short_name) \
static const AVClass ff_##short_name##_omxcodec_dec_class = { \
.class_name = #short_name "_libomxh264", \
.item_name = av_default_item_name, \
.option = ff_omxcodec_vdec_options, \
.version = LIBAVUTIL_VERSION_INT, \
};
define DECLARE_OMX_VDEC(short_name, full_name, codec_id, bsf) \
DECLARE_OMX_VCLASS(short_name) \
const FFCodec ff_ ## short_name ## omx_decoder = { \
.p.name = #short_name "_omxcodec", \
CODEC_LONG_NAME(full_name " OpenMAX IL decoder"), \
.p.type = AVMEDIA_TYPE_VIDEO, \
.p.id = codec_id, \
.p.priv_class = &ff##short_name##_omxcodec_dec_class, \
.priv_data_size = sizeof(OMXCodecDecoderContext), \
.init = omx_decode_init, \
FF_CODEC_DECODE_CB(omx_decode_frame), \
.close = omx_decode_end,
.flush = omx_decode_flush, \
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HARDWARE, \
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | \
FF_CODEC_CAP_SETS_PKT_DTS, \
.bsfs = bsf, \
.hw_configs = omx_hw_configs, \
.p.wrapper_name = "omxcodec", \
}; **
Latest comments (0)