3 #include <libavformat/avformat.h>
4 #include <libavcodec/avcodec.h>
13 #include "libmythbase/mythconfig.h"
30 QString compilation_artist;
37 AVFormatContext* p_context =
nullptr;
38 AVInputFormat* p_inputformat =
nullptr;
40 QByteArray local8bit =
filename.toLocal8Bit();
41 if ((avformat_open_input(&p_context, local8bit.constData(),
42 p_inputformat,
nullptr) < 0))
47 if (avformat_find_stream_info(p_context,
nullptr) < 0)
50 AVDictionaryEntry *tag = av_dict_get(p_context->metadata,
"title",
nullptr, 0);
59 tag = av_dict_get(p_context->metadata,
"author",
nullptr, 0);
64 tag = av_dict_get(p_context->metadata,
"album",
nullptr, 0);
68 tag = av_dict_get(p_context->metadata,
"genre",
nullptr, 0);
72 tag = av_dict_get(p_context->metadata,
"year",
nullptr, 0);
74 year = atoi(tag->value);
76 tag = av_dict_get(p_context->metadata,
"tracknum",
nullptr, 0);
78 tracknum = atoi(tag->value);
84 title, genre, year, tracknum, length);
86 retdata->determineIfCompilation();
88 avformat_close_input(&p_context);
101 AVFormatContext* p_context =
nullptr;
102 AVInputFormat* p_inputformat =
nullptr;
105 QByteArray local8bit =
filename.toLocal8Bit();
106 if ((avformat_open_input(&p_context, local8bit.constData(),
107 p_inputformat,
nullptr) < 0))
112 if (avformat_find_stream_info(p_context,
nullptr) < 0)
117 avformat_close_input(&p_context);
133 auto time = av_duration(pContext->duration);
134 return duration_cast<std::chrono::milliseconds>(time);