- unify AV_VERSION_INT defines; fix cst build

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2021-08-29 19:22:49 +02:00
committed by Thilo Graf
parent ee09213b50
commit a1703cbcd0
6 changed files with 28 additions and 26 deletions

View File

@@ -788,7 +788,7 @@ void CStreamStream::Close()
av_free(avio_ctx);
if (bsfc){
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,48,100 )
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 48, 100)
av_bitstream_filter_close(bsfc);
#else
av_bsf_free(&bsfc);
@@ -843,7 +843,7 @@ bool CStreamStream::Open()
printf("%s: Cannot find stream info [%s]!\n", __FUNCTION__, channel->getUrl().c_str());
return false;
}
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58,27,102)
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 27, 102)
const char *hls = "applehttp";
#else
const char *hls = "hls";
@@ -887,7 +887,7 @@ bool CStreamStream::Open()
av_dict_copy(&ofcx->metadata, ifcx->metadata, 0);
int stid = 0x200;
for (unsigned i = 0; i < ifcx->nb_streams; i++) {
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,25,101 )
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57, 25, 101)
AVCodecContext * iccx = ifcx->streams[i]->codec;
AVStream *ost = avformat_new_stream(ofcx, iccx->codec);
avcodec_copy_context(ost->codec, iccx);
@@ -907,7 +907,7 @@ bool CStreamStream::Open()
av_dump_format(ofcx, 0, ofcx->url, 1);
#endif
av_log_set_level(AV_LOG_WARNING);
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,48,100 )
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 48, 100)
bsfc = av_bitstream_filter_init("h264_mp4toannexb");
if (!bsfc)
printf("%s: av_bitstream_filter_init h264_mp4toannexb failed!\n", __FUNCTION__);
@@ -964,14 +964,14 @@ void CStreamStream::run()
if (pkt.stream_index < 0)
continue;
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,25,101 )
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57, 25, 101)
AVCodecContext *codec = ifcx->streams[pkt.stream_index]->codec;
#else
AVCodecParameters *codec = ifcx->streams[pkt.stream_index]->codecpar;
#endif
if (bsfc && codec->codec_id == AV_CODEC_ID_H264 ) {
AVPacket newpkt = pkt;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,48,100 )
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 48, 100)
if (av_bitstream_filter_filter(bsfc, codec, NULL, &newpkt.data, &newpkt.size, pkt.data, pkt.size, pkt.flags & AV_PKT_FLAG_KEY) >= 0) {
av_packet_unref(&pkt);
newpkt.buf = av_buffer_create(newpkt.data, newpkt.size, av_buffer_default_free, NULL, 0);