mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 08:51:10 +02:00
reduce ffmpeg warnings, thx DboxOldie
This commit is contained in:
@@ -155,6 +155,7 @@ void CStreamInfo2::analyzeStream(AVFormatContext *avfc, unsigned int idx)
|
||||
m["language"] = getISO639Description(lang->value);
|
||||
}
|
||||
|
||||
#if (LIBAVFORMAT_VERSION_MAJOR > 57) || ((LIBAVFORMAT_VERSION_MAJOR == 57) && (LIBAVFORMAT_VERSION_MINOR > 32))
|
||||
AVCodecContext *avctx;
|
||||
int ret;
|
||||
|
||||
@@ -167,32 +168,54 @@ void CStreamInfo2::analyzeStream(AVFormatContext *avfc, unsigned int idx)
|
||||
avcodec_free_context(&avctx);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
char buf[256];
|
||||
#if (LIBAVFORMAT_VERSION_MAJOR > 57) || ((LIBAVFORMAT_VERSION_MAJOR == 57) && (LIBAVFORMAT_VERSION_MINOR > 32))
|
||||
avcodec_string(buf, sizeof(buf), avctx, 0);
|
||||
avcodec_free_context(&avctx);
|
||||
#else
|
||||
avcodec_string(buf, sizeof(buf), st->codec, 0);
|
||||
#endif
|
||||
m["codec"] = buf;
|
||||
size_t pos = m["codec"].find_first_of(":");
|
||||
if (pos != std::string::npos)
|
||||
m["codec"] = m["codec"].erase(0,pos+2);
|
||||
#if (LIBAVFORMAT_VERSION_MAJOR > 57) || ((LIBAVFORMAT_VERSION_MAJOR == 57) && (LIBAVFORMAT_VERSION_MINOR > 32))
|
||||
m["codec_type"] = av_get_media_type_string(st->codecpar->codec_type);
|
||||
#else
|
||||
m["codec_type"] = av_get_media_type_string(st->codec->codec_type);
|
||||
#endif
|
||||
m["codec_type"][0] ^= 'a' ^ 'A';
|
||||
|
||||
m["pid"] = to_string(st->id);
|
||||
|
||||
#if (LIBAVFORMAT_VERSION_MAJOR > 57) || ((LIBAVFORMAT_VERSION_MAJOR == 57) && (LIBAVFORMAT_VERSION_MINOR > 32))
|
||||
if (st->sample_aspect_ratio.num && av_cmp_q(st->sample_aspect_ratio, st->codecpar->sample_aspect_ratio))
|
||||
#else
|
||||
if (st->sample_aspect_ratio.num && av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio))
|
||||
#endif
|
||||
{
|
||||
AVRational display_aspect_ratio;
|
||||
av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
|
||||
#if (LIBAVFORMAT_VERSION_MAJOR > 57) || ((LIBAVFORMAT_VERSION_MAJOR == 57) && (LIBAVFORMAT_VERSION_MINOR > 32))
|
||||
st->codecpar->width * st->sample_aspect_ratio.num,
|
||||
st->codecpar->height * st->sample_aspect_ratio.den,
|
||||
#else
|
||||
st->codec->width * st->sample_aspect_ratio.num,
|
||||
st->codec->height * st->sample_aspect_ratio.den,
|
||||
#endif
|
||||
1024 * 1024);
|
||||
snprintf(buf, sizeof(buf), "%d:%d", st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
|
||||
m["sar"] = buf;
|
||||
snprintf(buf, sizeof(buf), "%d:%d", display_aspect_ratio.num, display_aspect_ratio.den);
|
||||
m["dar"] = buf;
|
||||
}
|
||||
#if (LIBAVFORMAT_VERSION_MAJOR > 57) || ((LIBAVFORMAT_VERSION_MAJOR == 57) && (LIBAVFORMAT_VERSION_MINOR > 32))
|
||||
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
|
||||
#else
|
||||
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
|
||||
#endif
|
||||
{
|
||||
if (st->avg_frame_rate.den && st->avg_frame_rate.num)
|
||||
m["fps"] = fps_str(av_q2d(st->avg_frame_rate));
|
||||
@@ -202,8 +225,10 @@ void CStreamInfo2::analyzeStream(AVFormatContext *avfc, unsigned int idx)
|
||||
#endif
|
||||
if (st->time_base.den && st->time_base.num)
|
||||
m["tbn"] = fps_str(1 / av_q2d(st->time_base));
|
||||
// if (st->codec->time_base.den && st->codec->time_base.num)
|
||||
// m["tbc"] = fps_str(1 / av_q2d(st->codec->time_base));
|
||||
#if (LIBAVFORMAT_VERSION_MAJOR < 57) || ((LIBAVFORMAT_VERSION_MAJOR == 57) && (LIBAVFORMAT_VERSION_MINOR < 33))
|
||||
if (st->codec->time_base.den && st->codec->time_base.num)
|
||||
m["tbc"] = fps_str(1 / av_q2d(st->codec->time_base));
|
||||
#endif
|
||||
}
|
||||
|
||||
m["disposition"] = "";
|
||||
|
Reference in New Issue
Block a user