[Libav-user] Unable to register custom decoder
Timothy Fleming
tim at magichome.net
Wed Jan 29 20:41:22 EET 2020
I'm creating a custom video decoder for ffmpeg. The code compiles and links, my codec library is included. However, when I attempt to play my file, the player (Nova player for Android though that shouldn't matter) doesn't find the decoder.
The decoder is for a matroska container and the stream is correctly tagged in the file. The error message through the app says "Cannot play video. This video format (s_none) is not supported."
I've reviewed the ffmpeg custom codec docs. My starting point was an existing codec. Does my code appear to be the correct way to register a customer codec?
Here are the places I modified libavcodec/libavformat code...
libavformat/matroska.c
const CodecTags ff_mkv_codec_tags[]={
{"A_AAC" , AV_CODEC_ID_AAC},
{"A_AC3" , AV_CODEC_ID_AC3},
...
{"S_MKV/LANDMARK" , AV_CODEC_ID_MPLM}, ///<<< my codec
{"" , AV_CODEC_ID_NONE}
};
libavcodec/allcodecs.c
extern AVCodec ff_libmplm_decoder;
libavcodec/avcodec.h
enum AVCodecID {
AV_CODEC_ID_NONE,
...
AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket
AV_CODEC_ID_MPLM = 0x30000, ///< MediaPipe Landmark decoder
};
libavcodec/codec_desc.c
static const AVCodecDescriptor codec_descriptors[] = {
/* video codecs */
...
{
.id = AV_CODEC_ID_MPLM,
.type = AVMEDIA_TYPE_VIDEO,
.name = "mediapipe_landmark",
.long_name = NULL_IF_CONFIG_SMALL("MediaPipe Landmark")
},
};
In my decoder...
libavcodec/libmplmdec.c
...
AVCodec ff_mplm_decoder = {
.name = LANDMARK_CODEC_NAME,
.long_name = NULL_IF_CONFIG_SMALL("MediaPipe Landmark decoder"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_MPLM,
.priv_data_size = sizeof(MPLMContext),
.init = mplm_decode_init,
.close = mplm_decode_end,
.decode = mplm_decode_frame,
.capabilities = AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
};
// fmt, subfmt, w, h, cpu, dec, name, mangler
STREAM_REGISTER_DEC_VIDEO( VIDEO_FORMAT_MJPG, 0, MAXW, MAXH, MPLMHW, new_dec, LANDMARK_CODEC_NAME, 0 );
libavcodec/libmplmdec.h
#define LANDMARK_CODEC_NAME "S_MKV/LANDMARK"
--
Tim Fleming
tim at magichome.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20200129/cfa337b8/attachment.html>
More information about the Libav-user
mailing list