У меня есть этот код:
#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();
struct AVCodecTag * const *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[0];
printf("%d\n",avctag->id);
}
Компилятор выдает эту странную ошибку, хотя я использовал -> в строке printf:
error: ‘*avctag’ is a pointer; did you mean to use ‘->’?
printf("%d\n",avctag->id);
Но он также выдает предупреждение :
warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
avctag = outputFormat->codec_tag;
AVOutputFormat: codec_tag определяется в соответствии с документами как:
struct AVCodecTag * const *
Это точно так, как я определил указатель выше. Может кто-нибудь подсказать мне, почему я получаю предупреждение и ошибку?
Большое спасибо