I am trying to compile ffmpeg with libstagefright using NDK. I am getting the following error on the compilation of libstagefright.cpp:
libavcodec/libstagefright.cpp: In function 'int Stagefright_init(AVCodecContext*)':
libavcodec/libstagefright.cpp:283:9: error: no match for 'operator!' (operand type is 'android::sp<android::MetaData>')
if (!meta) {
^
libavcodec/libstagefright.cpp:283:9: note: candidate is:
libavcodec/libstagefright.cpp:283:9: note: operator!(bool) <built-in>
libavcodec/libstagefright.cpp:283:9: note: no known conversion for argument 1 from 'android::sp<android::MetaData>' to 'bool'
make: *** [libavcodec/libstagefright.o] Error 1
The code for the relevant section of libstagefright.cpp is:
meta = new MetaData;
if (!meta) {
ret = AVERROR(ENOMEM);
goto fail;
}
meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_AVC);
meta->setInt32(kKeyWidth, avctx->width);
meta->setInt32(kKeyHeight, avctx->height);
meta->setData(kKeyAVCC, kTypeAVCC, avctx->extradata, avctx->extradata_size);
I am using NDK r10e-rc4 (64-bit)
and Ubuntu 14 64 bit
Can somebody please guide as to why this error is occurring, what am i doing wrong?
In order for compiler to write code for
if (!meta)
android::sp
class has to either have operator!()
defined, or there has to be a way for this class to be converted to bool, i.e. operator bool()
. Since you can't change android::sp
implementation, you'll need to find another way to write that. I assume this should work:
if (meta != NULL)