mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-27 07:23:11 +02:00
libeplayer3: sync with tdt
This commit is contained in:
@@ -16,81 +16,84 @@ static AVFormatContext* avContext = NULL;
|
||||
|
||||
void dump_metadata()
|
||||
{
|
||||
#if LIBAVFORMAT_VERSION_MAJOR > 53
|
||||
AVDictionaryEntry *tag = NULL;
|
||||
while ((tag = av_dict_get(avContext->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
|
||||
#else
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 54
|
||||
AVMetadataTag *tag = NULL;
|
||||
while ((tag = av_metadata_get(avContext->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX)))
|
||||
#else
|
||||
AVDictionaryEntry *tag = NULL;
|
||||
while ((tag = av_dict_get(avContext->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
|
||||
#endif
|
||||
printf("%s: %s\n", tag->key, tag->value);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char* argv[])
|
||||
int main(int argc,char* argv[])
|
||||
{
|
||||
char file[255] = {""};
|
||||
int err, i;
|
||||
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
printf("give me a filename please\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (strstr(argv[1], "://") == NULL)
|
||||
{
|
||||
strcpy(file, "file://");
|
||||
strcpy(file, "file://");
|
||||
}
|
||||
|
||||
|
||||
strcat(file, argv[1]);
|
||||
|
||||
av_register_all();
|
||||
|
||||
#if LIBAVFORMAT_VERSION_MAJOR > 53
|
||||
if ((err = avformat_open_input(&avContext, file, NULL, 0)) != 0) {
|
||||
#else
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 54
|
||||
if ((err = av_open_input_file(&avContext, file, NULL, 0, NULL)) != 0) {
|
||||
#else
|
||||
if ((err = avformat_open_input(&avContext, file, NULL, 0)) != 0) {
|
||||
#endif
|
||||
char error[512];
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 54
|
||||
printf("av_open_input_file failed %d (%s)\n", err, file);
|
||||
#else
|
||||
printf("avformat_open_input failed %d (%s)\n", err, file);
|
||||
#endif
|
||||
av_strerror(err, error, 512);
|
||||
printf("Cause: %s\n", error);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (av_find_stream_info(avContext) < 0)
|
||||
if (av_find_stream_info(avContext) < 0)
|
||||
{
|
||||
printf("Error av_find_stream_info\n");
|
||||
}
|
||||
|
||||
printf("\n***\n");
|
||||
dump_metadata();
|
||||
|
||||
|
||||
printf("\nstream specific metadata:\n");
|
||||
for (i = 0; i < avContext->nb_streams; i++)
|
||||
{
|
||||
AVStream* stream = avContext->streams[i];
|
||||
|
||||
|
||||
if (stream)
|
||||
{
|
||||
#if LIBAVFORMAT_VERSION_MAJOR > 53
|
||||
AVDictionaryEntry *tag = NULL;
|
||||
#else
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 54
|
||||
AVMetadataTag *tag = NULL;
|
||||
#endif
|
||||
|
||||
if (stream->metadata != NULL)
|
||||
#if LIBAVFORMAT_VERSION_MAJOR > 53
|
||||
while ((tag = av_dict_get(stream->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
|
||||
#else
|
||||
AVDictionaryEntry *tag = NULL;
|
||||
#endif
|
||||
if (stream->metadata != NULL)
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 54
|
||||
while ((tag = av_metadata_get(stream->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX)))
|
||||
#else
|
||||
while ((tag = av_dict_get(stream->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
|
||||
#endif
|
||||
printf("%s: %s\n", tag->key, tag->value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user