reduce ffmpeg warnings, thx DboxOldie

Origin commit data
------------------
Branch: ni/coolstream
Commit: b160f48143
Author: Frankenstone <dampf_acc@online.de>
Date: 2019-03-01 (Fri, 01 Mar 2019)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Frankenstone
2019-03-01 18:34:51 +01:00
committed by vanhofen
parent 244d1d9447
commit 18579fd9b7
3 changed files with 49 additions and 2 deletions

View File

@@ -2297,8 +2297,13 @@ bool CStreamRec::Open(CZapitChannel * channel)
AVIOInterruptCB int_cb = { Interrupt, this };
ifcx->interrupt_callback = int_cb;
#if (LIBAVFORMAT_VERSION_MAJOR < 58)
snprintf(ifcx->filename, sizeof(ifcx->filename), "%s", channel->getUrl().c_str());
av_dump_format(ifcx, 0, ifcx->filename, 0);
#else
snprintf(ifcx->url, channel->getUrl().size() + 1, "%s", channel->getUrl().c_str());
av_dump_format(ifcx, 0, ifcx->url, 0);
#endif
std::string tsfile = std::string(filename) + ".ts";
AVOutputFormat *ofmt = av_guess_format(NULL, tsfile.c_str(), NULL);
@@ -2316,7 +2321,11 @@ bool CStreamRec::Open(CZapitChannel * channel)
}
av_dict_copy(&ofcx->metadata, ifcx->metadata, 0);
#if (LIBAVFORMAT_VERSION_MAJOR < 58)
snprintf(ofcx->filename, sizeof(ofcx->filename), "%s", tsfile.c_str());
#else
snprintf(ofcx->url, tsfile.size() + 1, "%s", tsfile.c_str());
#endif
stream_index = -1;
int stid = 0x200;
@@ -2339,7 +2348,11 @@ bool CStreamRec::Open(CZapitChannel * channel)
stream_index = i;
}
av_log_set_level(AV_LOG_VERBOSE);
#if (LIBAVFORMAT_VERSION_MAJOR < 58)
av_dump_format(ofcx, 0, ofcx->filename, 1);
#else
av_dump_format(ofcx, 0, ofcx->url, 1);
#endif
av_log_set_level(AV_LOG_WARNING);
#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,52,100 ))
bsfc = av_bitstream_filter_init("h264_mp4toannexb");

View File

@@ -836,8 +836,13 @@ bool CStreamStream::Open()
AVIOInterruptCB int_cb = { Interrupt, this };
ifcx->interrupt_callback = int_cb;
#if (LIBAVFORMAT_VERSION_MAJOR < 58)
snprintf(ifcx->filename, sizeof(ifcx->filename), "%s", channel->getUrl().c_str());
av_dump_format(ifcx, 0, ifcx->filename, 0);
#else
snprintf(ifcx->url, channel->getUrl().size() + 1, "%s", channel->getUrl().c_str());
av_dump_format(ifcx, 0, ifcx->url, 0);
#endif
buf = (unsigned char *) av_malloc(IN_SIZE);
if (buf == NULL) {
@@ -873,7 +878,11 @@ bool CStreamStream::Open()
ost->id = stid++;
}
av_log_set_level(AV_LOG_VERBOSE);
#if (LIBAVFORMAT_VERSION_MAJOR < 58)
av_dump_format(ofcx, 0, ofcx->filename, 1);
#else
av_dump_format(ofcx, 0, ofcx->url, 1);
#endif
av_log_set_level(AV_LOG_WARNING);
#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,52,100 ))
bsfc = av_bitstream_filter_init("h264_mp4toannexb");

View File

@@ -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"] = "";