libavformat-dev missing metadata.h ?

Reinhard Tartler siretart at tauware.de
Fri Apr 1 16:48:57 UTC 2011


On Fri, Apr 01, 2011 at 16:15:03 (CEST), Grzegorz Szpetkowski wrote:

> Hi,
>
> I am trying to write some code using libavcodec and libavformat as
> described at http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html
> with Debian. I found there is libavformat-dev package (and of course
> libavcodec-dev), but it does not include metadata.h. To make it clear
> here is my C (client) code:
>
> #include <libavcodec/avcodec.h>
> #include <libavformat/avformat.h>
> #include <libavformat/metadata.h>
>
> #include <stdio.h>
> #include <stdlib.h>
>
> int main (int argc, const char* argv[])
> {
> 	// struktura
> 	AVFormatContext* pFormatCtx = NULL; //
> http://www.ffmpeg.org/doxygen/trunk/structAVFormatContext.html
>
> 	av_register_all(); // Initializes libavformat and registers all the
> muxers, demuxers and protocols
>
> 	if(av_open_input_file(&pFormatCtx, argv[1], NULL, 0, NULL) != 0) //
> auto-detect the format
> 		return -1;
>
> 	printf("%d\n", pFormatCtx->nb_streams); // number of streams
> 	
> 	AVMetadata* pMetadata = pFormatCtx->metadata;
>
> 	AVMetadataTag* pMetadataTag = pMetadata->elems;
>
> 	printf("%d\n", pMetadata->count);
> 	
> 	av_close_input_file(pFormatCtx);
>
>     return 0;
> }
>
> I found that I need to include libavformat/metadata.h, because without
> it I am getting "error: dereferencing pointer to incomplete type" (for
> pFormatCtx->metadata and pMetadata->elems).

Well, metadata.h is not a public header, so by including it, you are
using internals of libavformat. I'd consider this a bug in your
application. In order to fix this, I'd recommend doing a) copy the
contents that you need into your project for now, and b) discuss with
Libav/FFmpeg upstream about making the parts of metadata.h that you need
public.

Please note that avformat.h itself contains a Public Metadata API, see
the functions av_metadata_get() and av_metadata_set2(). This way you
don't need to access the elements of AVMetadata directly.

HTH.

-- 
Gruesse/greetings,
Reinhard Tartler, KeyID 945348A4



More information about the pkg-multimedia-maintainers mailing list