[jitsi-dev] libjnffmpeg issues with Debian compilation


#1

Hi all,

Today I try to build libjnffmpeg with the Debian way (i.e. by passing the LIBAV=1 argument).

Here my command line to compile:
ant ffmpeg -Dx264=/usr -Dlame=/usr -Dffmpeg=/usr -DLIBAV=1

Compilation succeed but when I tried the fresh compiled native library and in Jitsi (video preview) I have got this error which loops until I close the video preview window:
[java] 17:02:16.109 GRAVE: [15] org.jitsi.impl.neomedia.codec.video.HFlip.error() avfilter_graph_get_filter: buffer/Parsed_buffer_0

I looked more closely at the compilation output:
[cc] /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c: In function ‘Java_org_jitsi_impl_neomedia_codec_FFmpeg_avcodec_1alloc_1context3’:
[cc] /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c:70:13: warning: passing argument 1 of ‘avcodec_alloc_context3’ discards ‘const’ qualifier from pointer target type [enabled by default]
[cc] In file included from /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c:15:0:
[cc] /usr/include/libavcodec/avcodec.h:3925:17: note: expected ‘struct AVCodec *’ but argument is of type ‘const struct AVCodec *’
[cc] /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c: In function ‘Java_org_jitsi_impl_neomedia_codec_FFmpeg_avcodec_1encode_1audio’:
[cc] /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c:166:17: warning: ‘avcodec_encode_audio’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:4269) [-Wdeprecated-declarations]
[cc] /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c: In function ‘ffsink_query_formats’:
[cc] /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c:539:9: warning: implicit declaration of function ‘ff_make_format_list’ [-Wimplicit-function-declaration]
[cc] /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c:539:9: warning: passing argument 2 of ‘avfilter_set_common_formats’ makes pointer from integer without a cast [enabled by default]
[cc] In file included from /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c:17:0:
[cc] /usr/include/libavfilter/avfilter.h:467:6: note: expected ‘struct AVFilterFormats *’ but argument is of type ‘int’
[cc] /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c:548:9: warning: implicit declaration of function ‘query_formats’ [-Wimplicit-function-declaration]
[cc] /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c: In function ‘Java_org_jitsi_impl_neomedia_codec_FFmpeg_avfilter_1graph_1parse’:
[cc] /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c:580:21: warning: passing argument 3 of ‘avfilter_graph_parse’ from incompatible pointer type [enabled by default]
[cc] In file included from /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c:18:0:
[cc] /usr/include/libavfilter/avfiltergraph.h:119:5: note: expected ‘struct AVFilterInOut *’ but argument is of type ‘struct AVFilterInOut **’
[cc] /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c:580:21: warning: passing argument 4 of ‘avfilter_graph_parse’ from incompatible pointer type [enabled by default]
[cc] In file included from /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c:18:0:
[cc] /usr/include/libavfilter/avfiltergraph.h:119:5: note: expected ‘struct AVFilterInOut *’ but argument is of type ‘struct AVFilterInOut **’
[cc] /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c:606:47: warning: assignment from incompatible pointer type [enabled by default]
[cc] /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c: In function ‘Java_org_jitsi_impl_neomedia_codec_FFmpeg_get_1filtered_1video_1frame’:
[cc] /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c:709:5: warning: implicit declaration of function ‘av_buffersrc_write_frame’ [-Wimplicit-function-declaration]
[cc] /home/seb/svn_work/libjitsi2/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c:713:9: warning: implicit declaration of function ‘ff_request_frame’ [-Wimplicit-function-declaration]

First warning about avcodec_alloc_context3 is not harmful (just a const in prototype in FFmpeg version and not in libav ones).

You notice several "implicit declaration of function...". I checked at my Debian installation if the related functions are in the library (libavcodec, libavfilter, ...) with nm -D and none of them are present. But there are the equivalent with the same prototype as ffmpeg:

$ nm -D /usr/lib/libavfilter.so.1 | grep make_format_list
0000000000005a50 T avfilter_make_format_list
$ nm -D /usr/lib/libavfilter.so.1 | grep query_format
0000000000005820 T avfilter_default_query_formats
$ nm -D /usr/lib/libavfilter.so.1 | grep request_frame
00000000000046b0 T avfilter_request_frame

For the av_buffersrc_write_frame warning, this function is not available in libavfilter (on Debian testing) but we can use av_buffersrc_add_frame instead. We just have to pass two additionnal parameters from the AVFrame structure (pts and sample_aspect_ratio). See http://lists.libav.org/pipermail/libav-commits/2012-May/006629.html.

Last warnings are related to avfilter_graph_parse. In libav the prototype differs from the one in FFmpeg: in FFmpeg we attended a pointer on pointer and in libav we just attended a pointer. The libav's avfilter_graph_parse expect also that the input and output are known prior to the call (FFmpeg version allows us to pass NULL pointer). It exists in recent libav the avfilter_graph_parse2 function which have and behaves like FFmpeg's avfilter_graph_parse but it is not in Debian's libavfilter unfortunately. So this part is the origin of the error when Jitsi try to mirror the video (HFlip).

For this one my knowledge of avfilter is quite old so is someone wants to look at it ?

Anyway, in attachment there is a patch for all warnings but the avfilter_graph_parse ones.

Regards,

libjitsi-FFmpeg-implicit-declaration-libav.diff (2.01 KB)

···

--
Seb