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; //

        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);

    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).

I am using gcc -o MySample MySample.c -lavformat -lavcodec to compile
above code.

Is there any reason why there is no metadata.h header in
libavformat-dev package ? I downloaded added this file manually (to
/usr/include/libavformat directory) and It works ok (maybe I am doing
it in wrong way)

Grzegorz Szpetkowski

pkg-multimedia-maintainers mailing list

Reply via email to