unnecessary brackets removed

- distinction ffmpeg versions
This commit is contained in:
Frankenstone
2021-05-17 22:28:02 +02:00
committed by Thilo Graf
parent 284ee4a6ed
commit 86b0246599
4 changed files with 19 additions and 19 deletions

View File

@@ -78,7 +78,7 @@ class CStreamRec : public CRecordInstance, OpenThreads::Thread
private:
AVFormatContext *ifcx;
AVFormatContext *ofcx;
#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,48,100 ))
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,48,100 )
AVBitStreamFilterContext *bsfc;
#else
AVBSFContext *bsfc;
@@ -1998,7 +1998,7 @@ void CStreamRec::Close()
avformat_free_context(ofcx);
}
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);
@@ -2020,7 +2020,7 @@ void CStreamRec::FillMovieInfo(CZapitChannel * /*channel*/, APIDList & /*apid_li
for (unsigned i = 0; i < ofcx->nb_streams; i++) {
AVStream *st = ofcx->streams[i];
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,25,101 ))
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,25,101 )
AVCodecContext * codec = st->codec;
#else
AVCodecParameters * codec = st->codecpar;
@@ -2268,7 +2268,7 @@ bool CStreamRec::Open(CZapitChannel * channel)
stream_index = -1;
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);
@@ -2292,7 +2292,7 @@ bool CStreamRec::Open(CZapitChannel * channel)
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__);
@@ -2328,14 +2328,14 @@ void CStreamRec::run()
break;
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);