[Libav-user] How to access the struct AVCodecTag?

Giuseppe Torelli giutorcom at gmail.com
Tue Mar 17 21:21:16 EET 2020


Hello,

I want to fill two combo boxes in a GTK+3 program with the container and
its relevant codecs. I have this code:

#include <stdlib.h>
#include <string.h>
#include <libavcodec/avcodec.h>
#include <libavutil/opt.h>
#include <libavformat/avformat.h>

int main(int argc, char **argv)
{
avcodec_register_all();
av_register_all();

AVCodec *encoder = NULL;
struct AVCodecTag **avctag;
AVOutputFormat *outputFormat = NULL;

const char *file = "file.mp4";
outputFormat = av_guess_format(0, file, 0);

if( ! outputFormat)
{
printf ("No container found\n");
exit (1);
}
printf("%s %d\n",outputFormat->long_name,outputFormat->video_codec);

avctag = outputFormat->codec_tag;
printf("%d\n", (outputFormat->codec_tag[0])->id);
}

gcc gives this output:
enum_codec.c:60:9: warning: assignment from incompatible pointer type
[-Wincompatible-pointer-types]
  avctag = outputFormat->codec_tag;
         ^
enum_codec.c:61:45: error: dereferencing pointer to incomplete type ‘const
struct AVCodecTag’
  printf("%d\n", (outputFormat->codec_tag[0])->id);

Even adding this in the code it doesn't make any change:

struct AVCodecTag
{
enum AVCodecID id;
unsigned int tag;
};

Can someone explain how to access id and tag inside AVCodecTag?

Many thanks
GiuTor
--
Youtube: www.youtube.com/giutor73
Instagram: the.italian.dude
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20200317/187e6fbc/attachment.html>


More information about the Libav-user mailing list