mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 15:02:50 +02:00
unify AV_VERSION_INT defines; fix cst build
Origin commit data
------------------
Branch: ni/coolstream
Commit: d1ff68dc54
Author: vanhofen <vanhofen@gmx.de>
Date: 2021-08-29 (Sun, 29 Aug 2021)
Origin message was:
------------------
- unify AV_VERSION_INT defines; fix cst build
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -32,7 +32,7 @@ private:
|
|||||||
pthread_mutex_t mutex;
|
pthread_mutex_t mutex;
|
||||||
cList<cDvbSubtitleBitmaps> *bitmaps;
|
cList<cDvbSubtitleBitmaps> *bitmaps;
|
||||||
AVCodecContext * avctx;
|
AVCodecContext * avctx;
|
||||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100)
|
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59, 0, 100)
|
||||||
AVCodec *avcodec;
|
AVCodec *avcodec;
|
||||||
#else
|
#else
|
||||||
const AVCodec *avcodec;
|
const AVCodec *avcodec;
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Neutrino-GUI - DBoxII-Project
|
Neutrino-GUI - DBoxII-Project
|
||||||
|
|
||||||
@@ -167,7 +165,7 @@ bool CFfmpegDec::Init(void *_in, const CFile::FileType /*ft*/)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
avc->pb = avioc;
|
avc->pb = avioc;
|
||||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100)
|
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59, 0, 100)
|
||||||
avc->flags |= AVFMT_FLAG_CUSTOM_IO|AVFMT_FLAG_KEEP_SIDE_DATA;
|
avc->flags |= AVFMT_FLAG_CUSTOM_IO|AVFMT_FLAG_KEEP_SIDE_DATA;
|
||||||
#else
|
#else
|
||||||
avc->flags |= AVFMT_FLAG_CUSTOM_IO;
|
avc->flags |= AVFMT_FLAG_CUSTOM_IO;
|
||||||
@@ -247,7 +245,7 @@ CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, int /*OutputFd*/, State* state,
|
|||||||
Status=DATA_ERR;
|
Status=DATA_ERR;
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,25,101 )
|
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57, 25, 101)
|
||||||
c = avc->streams[best_stream]->codec;
|
c = avc->streams[best_stream]->codec;
|
||||||
#else
|
#else
|
||||||
c = avcodec_alloc_context3(codec);
|
c = avcodec_alloc_context3(codec);
|
||||||
@@ -370,7 +368,7 @@ CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, int /*OutputFd*/, State* state,
|
|||||||
} else{
|
} else{
|
||||||
av_frame_unref(frame);
|
av_frame_unref(frame);
|
||||||
}
|
}
|
||||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57,37,100)
|
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 37, 100)
|
||||||
int len = avcodec_decode_audio4(c, frame, &got_frame, &packet);
|
int len = avcodec_decode_audio4(c, frame, &got_frame, &packet);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
// skip frame
|
// skip frame
|
||||||
@@ -491,7 +489,7 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover)
|
|||||||
if (!is_stream) {
|
if (!is_stream) {
|
||||||
GetMeta(avc->metadata);
|
GetMeta(avc->metadata);
|
||||||
for(unsigned int i = 0; i < avc->nb_streams; i++) {
|
for(unsigned int i = 0; i < avc->nb_streams; i++) {
|
||||||
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,25,101 )
|
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57, 25, 101)
|
||||||
if (avc->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
|
if (avc->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||||
#else
|
#else
|
||||||
if (avc->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
|
if (avc->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||||
@@ -512,7 +510,7 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover)
|
|||||||
DeInit();
|
DeInit();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,25,101 )
|
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57, 25, 101)
|
||||||
if (!codec)
|
if (!codec)
|
||||||
codec = avcodec_find_decoder(avc->streams[best_stream]->codec->codec_id);
|
codec = avcodec_find_decoder(avc->streams[best_stream]->codec->codec_id);
|
||||||
samplerate = avc->streams[best_stream]->codec->sample_rate;
|
samplerate = avc->streams[best_stream]->codec->sample_rate;
|
||||||
@@ -542,7 +540,7 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover)
|
|||||||
printf("CFfmpegDec: format %s (%s) duration %ld\n", avc->iformat->name, type_info.c_str(), total_time);
|
printf("CFfmpegDec: format %s (%s) duration %ld\n", avc->iformat->name, type_info.c_str(), total_time);
|
||||||
|
|
||||||
for(unsigned int i = 0; i < avc->nb_streams; i++) {
|
for(unsigned int i = 0; i < avc->nb_streams; i++) {
|
||||||
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,25,101 )
|
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57, 25, 101)
|
||||||
if (avc->streams[i]->codec->bit_rate > 0)
|
if (avc->streams[i]->codec->bit_rate > 0)
|
||||||
bitrate += avc->streams[i]->codec->bit_rate;
|
bitrate += avc->streams[i]->codec->bit_rate;
|
||||||
#else
|
#else
|
||||||
|
@@ -54,7 +54,7 @@ private:
|
|||||||
size_t buffer_size;
|
size_t buffer_size;
|
||||||
unsigned char *buffer;
|
unsigned char *buffer;
|
||||||
AVFormatContext *avc;
|
AVFormatContext *avc;
|
||||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100)
|
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59, 0, 100)
|
||||||
AVCodec *codec;
|
AVCodec *codec;
|
||||||
#else
|
#else
|
||||||
const AVCodec *codec;
|
const AVCodec *codec;
|
||||||
|
@@ -66,7 +66,9 @@
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <libavformat/avformat.h>
|
#include <libavformat/avformat.h>
|
||||||
|
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 48, 101)
|
||||||
#include <libavcodec/bsf.h>
|
#include <libavcodec/bsf.h>
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (LIBAVCODEC_VERSION_MAJOR > 55)
|
#if (LIBAVCODEC_VERSION_MAJOR > 55)
|
||||||
@@ -80,7 +82,7 @@ class CStreamRec : public CRecordInstance, OpenThreads::Thread
|
|||||||
private:
|
private:
|
||||||
AVFormatContext *ifcx;
|
AVFormatContext *ifcx;
|
||||||
AVFormatContext *ofcx;
|
AVFormatContext *ofcx;
|
||||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,48,100 )
|
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 48, 100)
|
||||||
AVBitStreamFilterContext *bsfc;
|
AVBitStreamFilterContext *bsfc;
|
||||||
#else
|
#else
|
||||||
AVBSFContext *bsfc;
|
AVBSFContext *bsfc;
|
||||||
@@ -2091,7 +2093,7 @@ void CStreamRec::Close()
|
|||||||
avformat_free_context(ofcx);
|
avformat_free_context(ofcx);
|
||||||
}
|
}
|
||||||
if (bsfc){
|
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);
|
av_bitstream_filter_close(bsfc);
|
||||||
#else
|
#else
|
||||||
av_bsf_free(&bsfc);
|
av_bsf_free(&bsfc);
|
||||||
@@ -2113,7 +2115,7 @@ void CStreamRec::FillMovieInfo(CZapitChannel * /*channel*/, APIDList & /*apid_li
|
|||||||
|
|
||||||
for (unsigned i = 0; i < ofcx->nb_streams; i++) {
|
for (unsigned i = 0; i < ofcx->nb_streams; i++) {
|
||||||
AVStream *st = ofcx->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;
|
AVCodecContext * codec = st->codec;
|
||||||
#else
|
#else
|
||||||
AVCodecParameters * codec = st->codecpar;
|
AVCodecParameters * codec = st->codecpar;
|
||||||
@@ -2312,7 +2314,7 @@ bool CStreamRec::Open(CZapitChannel * channel)
|
|||||||
printf("%s: Cannot find stream info [%s]!\n", __FUNCTION__, channel->getUrl().c_str());
|
printf("%s: Cannot find stream info [%s]!\n", __FUNCTION__, channel->getUrl().c_str());
|
||||||
return false;
|
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";
|
const char *hls = "applehttp";
|
||||||
#else
|
#else
|
||||||
const char *hls = "hls";
|
const char *hls = "hls";
|
||||||
@@ -2337,7 +2339,7 @@ bool CStreamRec::Open(CZapitChannel * channel)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string tsfile = std::string(filename) + ".ts";
|
std::string tsfile = std::string(filename) + ".ts";
|
||||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100)
|
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59, 0, 100)
|
||||||
AVOutputFormat *ofmt = av_guess_format(NULL, tsfile.c_str(), NULL);
|
AVOutputFormat *ofmt = av_guess_format(NULL, tsfile.c_str(), NULL);
|
||||||
#else
|
#else
|
||||||
const AVOutputFormat *ofmt = av_guess_format(NULL, tsfile.c_str(), NULL);
|
const AVOutputFormat *ofmt = av_guess_format(NULL, tsfile.c_str(), NULL);
|
||||||
@@ -2365,7 +2367,7 @@ bool CStreamRec::Open(CZapitChannel * channel)
|
|||||||
stream_index = -1;
|
stream_index = -1;
|
||||||
int stid = 0x200;
|
int stid = 0x200;
|
||||||
for (unsigned i = 0; i < ifcx->nb_streams; i++) {
|
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;
|
AVCodecContext * iccx = ifcx->streams[i]->codec;
|
||||||
AVStream *ost = avformat_new_stream(ofcx, iccx->codec);
|
AVStream *ost = avformat_new_stream(ofcx, iccx->codec);
|
||||||
avcodec_copy_context(ost->codec, iccx);
|
avcodec_copy_context(ost->codec, iccx);
|
||||||
@@ -2389,7 +2391,7 @@ bool CStreamRec::Open(CZapitChannel * channel)
|
|||||||
av_dump_format(ofcx, 0, ofcx->url, 1);
|
av_dump_format(ofcx, 0, ofcx->url, 1);
|
||||||
#endif
|
#endif
|
||||||
av_log_set_level(AV_LOG_WARNING);
|
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");
|
bsfc = av_bitstream_filter_init("h264_mp4toannexb");
|
||||||
if (!bsfc)
|
if (!bsfc)
|
||||||
printf("%s: av_bitstream_filter_init h264_mp4toannexb failed!\n", __FUNCTION__);
|
printf("%s: av_bitstream_filter_init h264_mp4toannexb failed!\n", __FUNCTION__);
|
||||||
@@ -2425,14 +2427,14 @@ void CStreamRec::run()
|
|||||||
break;
|
break;
|
||||||
if (pkt.stream_index < 0)
|
if (pkt.stream_index < 0)
|
||||||
continue;
|
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;
|
AVCodecContext *codec = ifcx->streams[pkt.stream_index]->codec;
|
||||||
#else
|
#else
|
||||||
AVCodecParameters *codec = ifcx->streams[pkt.stream_index]->codecpar;
|
AVCodecParameters *codec = ifcx->streams[pkt.stream_index]->codecpar;
|
||||||
#endif
|
#endif
|
||||||
if (bsfc && codec->codec_id == AV_CODEC_ID_H264) {
|
if (bsfc && codec->codec_id == AV_CODEC_ID_H264) {
|
||||||
AVPacket newpkt = pkt;
|
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) {
|
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);
|
av_packet_unref(&pkt);
|
||||||
newpkt.buf = av_buffer_create(newpkt.data, newpkt.size, av_buffer_default_free, NULL, 0);
|
newpkt.buf = av_buffer_create(newpkt.data, newpkt.size, av_buffer_default_free, NULL, 0);
|
||||||
|
@@ -791,7 +791,7 @@ void CStreamStream::Close()
|
|||||||
av_free(avio_ctx);
|
av_free(avio_ctx);
|
||||||
|
|
||||||
if (bsfc){
|
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);
|
av_bitstream_filter_close(bsfc);
|
||||||
#else
|
#else
|
||||||
av_bsf_free(&bsfc);
|
av_bsf_free(&bsfc);
|
||||||
@@ -846,7 +846,7 @@ bool CStreamStream::Open()
|
|||||||
printf("%s: Cannot find stream info [%s]!\n", __FUNCTION__, channel->getUrl().c_str());
|
printf("%s: Cannot find stream info [%s]!\n", __FUNCTION__, channel->getUrl().c_str());
|
||||||
return false;
|
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";
|
const char *hls = "applehttp";
|
||||||
#else
|
#else
|
||||||
const char *hls = "hls";
|
const char *hls = "hls";
|
||||||
@@ -890,7 +890,7 @@ bool CStreamStream::Open()
|
|||||||
av_dict_copy(&ofcx->metadata, ifcx->metadata, 0);
|
av_dict_copy(&ofcx->metadata, ifcx->metadata, 0);
|
||||||
int stid = 0x200;
|
int stid = 0x200;
|
||||||
for (unsigned i = 0; i < ifcx->nb_streams; i++) {
|
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;
|
AVCodecContext * iccx = ifcx->streams[i]->codec;
|
||||||
AVStream *ost = avformat_new_stream(ofcx, iccx->codec);
|
AVStream *ost = avformat_new_stream(ofcx, iccx->codec);
|
||||||
avcodec_copy_context(ost->codec, iccx);
|
avcodec_copy_context(ost->codec, iccx);
|
||||||
@@ -910,7 +910,7 @@ bool CStreamStream::Open()
|
|||||||
av_dump_format(ofcx, 0, ofcx->url, 1);
|
av_dump_format(ofcx, 0, ofcx->url, 1);
|
||||||
#endif
|
#endif
|
||||||
av_log_set_level(AV_LOG_WARNING);
|
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");
|
bsfc = av_bitstream_filter_init("h264_mp4toannexb");
|
||||||
if (!bsfc)
|
if (!bsfc)
|
||||||
printf("%s: av_bitstream_filter_init h264_mp4toannexb failed!\n", __FUNCTION__);
|
printf("%s: av_bitstream_filter_init h264_mp4toannexb failed!\n", __FUNCTION__);
|
||||||
@@ -967,14 +967,14 @@ void CStreamStream::run()
|
|||||||
if (pkt.stream_index < 0)
|
if (pkt.stream_index < 0)
|
||||||
continue;
|
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;
|
AVCodecContext *codec = ifcx->streams[pkt.stream_index]->codec;
|
||||||
#else
|
#else
|
||||||
AVCodecParameters *codec = ifcx->streams[pkt.stream_index]->codecpar;
|
AVCodecParameters *codec = ifcx->streams[pkt.stream_index]->codecpar;
|
||||||
#endif
|
#endif
|
||||||
if (bsfc && codec->codec_id == AV_CODEC_ID_H264 ) {
|
if (bsfc && codec->codec_id == AV_CODEC_ID_H264 ) {
|
||||||
AVPacket newpkt = pkt;
|
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) {
|
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);
|
av_packet_unref(&pkt);
|
||||||
newpkt.buf = av_buffer_create(newpkt.data, newpkt.size, av_buffer_default_free, NULL, 0);
|
newpkt.buf = av_buffer_create(newpkt.data, newpkt.size, av_buffer_default_free, NULL, 0);
|
||||||
|
@@ -33,7 +33,9 @@
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <libavformat/avformat.h>
|
#include <libavformat/avformat.h>
|
||||||
|
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 48, 101)
|
||||||
#include <libavcodec/bsf.h>
|
#include <libavcodec/bsf.h>
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef std::set<int> stream_pids_t;
|
typedef std::set<int> stream_pids_t;
|
||||||
@@ -74,7 +76,7 @@ class CStreamStream : public CStreamInstance
|
|||||||
private:
|
private:
|
||||||
AVFormatContext *ifcx;
|
AVFormatContext *ifcx;
|
||||||
AVFormatContext *ofcx;
|
AVFormatContext *ofcx;
|
||||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,48,100 )
|
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 48, 100)
|
||||||
AVBitStreamFilterContext *bsfc;
|
AVBitStreamFilterContext *bsfc;
|
||||||
#else
|
#else
|
||||||
AVBSFContext *bsfc;
|
AVBSFContext *bsfc;
|
||||||
|
Reference in New Issue
Block a user