unnecessary brackets removed

- distinction ffmpeg versions


Origin commit data
------------------
Branch: master
Commit: 4e086f9883
Author: Frankenstone <dampf_acc@online.de>
Date: 2021-05-17 (Mon, 17 May 2021)



------------------
This commit was generated by Migit
This commit is contained in:
Frankenstone
2021-05-17 21:07:45 +02:00
committed by vanhofen
parent ad2cd91a07
commit 2af4fc68a3
6 changed files with 14 additions and 14 deletions

View File

@@ -327,7 +327,7 @@ AVCodecContext* open_codec(AVMediaType mediaType, AVFormatContext* formatContext
AVCodec * codec = NULL; AVCodec * codec = NULL;
AVCodecContext * codecContext = NULL; AVCodecContext * codecContext = NULL;
int stream_index; int stream_index;
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,25,101 )) #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57,25,101)
stream_index = av_find_best_stream(formatContext, mediaType, -1, -1, NULL, 0); stream_index = av_find_best_stream(formatContext, mediaType, -1, -1, NULL, 0);
if (stream_index >= 0) { if (stream_index >= 0) {
codecContext = formatContext->streams[stream_index]->codec; codecContext = formatContext->streams[stream_index]->codec;

View File

@@ -38,7 +38,7 @@ extern "C" {
#include <libavutil/opt.h> #include <libavutil/opt.h>
} }
#if (LIBAVFORMAT_VERSION_INT > AV_VERSION_INT( 57,25,100 )) #if LIBAVFORMAT_VERSION_INT > AV_VERSION_INT(57,25,100)
#define EPLAYER_MAX_CODECS 16 #define EPLAYER_MAX_CODECS 16
struct CodecList struct CodecList
{ {
@@ -71,7 +71,7 @@ class Input
Player *player; Player *player;
AVFormatContext *avfc; AVFormatContext *avfc;
#if (LIBAVFORMAT_VERSION_INT > AV_VERSION_INT( 57,25,100 )) #if LIBAVFORMAT_VERSION_INT > AV_VERSION_INT(57,25,100)
CodecList codecs[EPLAYER_MAX_CODECS]; CodecList codecs[EPLAYER_MAX_CODECS];
#endif #endif
uint64_t readCount; uint64_t readCount;

View File

@@ -38,7 +38,7 @@ extern "C" {
#define AV_CODEC_ID_INJECTPCM AV_CODEC_ID_PCM_S16LE #define AV_CODEC_ID_INJECTPCM AV_CODEC_ID_PCM_S16LE
/* wrapper */ /* wrapper */
#if (LIBAVFORMAT_VERSION_INT > AV_VERSION_INT( 57,25,100 )) #if LIBAVFORMAT_VERSION_INT > AV_VERSION_INT(57,25,100)
static AVCodecParameters __attribute__ ((unused)) *get_codecpar(AVStream *stream) static AVCodecParameters __attribute__ ((unused)) *get_codecpar(AVStream *stream)
{ {
return stream->codecpar; return stream->codecpar;

View File

@@ -54,7 +54,7 @@ Input::Input()
seek_avts_abs = INT64_MIN; seek_avts_abs = INT64_MIN;
seek_avts_rel = 0; seek_avts_rel = 0;
abortPlayback = false; abortPlayback = false;
#if (LIBAVFORMAT_VERSION_INT > AV_VERSION_INT( 57,25,100 )) #if LIBAVFORMAT_VERSION_INT > AV_VERSION_INT(57,25,100)
for (int n = 0;n < EPLAYER_MAX_CODECS;n++) for (int n = 0;n < EPLAYER_MAX_CODECS;n++)
codecs[n].codec = NULL; codecs[n].codec = NULL;
#endif #endif
@@ -114,7 +114,7 @@ static void logprintf(const char *format, ...)
AVCodecContext *Input::GetCodecContext(unsigned int index) AVCodecContext *Input::GetCodecContext(unsigned int index)
{ {
#if (LIBAVFORMAT_VERSION_INT > AV_VERSION_INT( 57,25,100 )) #if LIBAVFORMAT_VERSION_INT > AV_VERSION_INT(57,25,100)
if (codecs[index].codec) { if (codecs[index].codec) {
return codecs[index].codec; return codecs[index].codec;
} }
@@ -376,7 +376,7 @@ bool Input::ReadSubtitle(const char *filename, const char *format, int pid)
AVCodecContext *c = NULL; AVCodecContext *c = NULL;
AVCodec *codec = NULL; AVCodec *codec = NULL;
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,25,101 )) #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57,25,101)
c = subavfc->streams[0]->codec; c = subavfc->streams[0]->codec;
#else #else
c = avcodec_alloc_context3(codec); c = avcodec_alloc_context3(codec);
@@ -412,7 +412,7 @@ bool Input::ReadSubtitle(const char *filename, const char *format, int pid)
av_packet_unref(&packet); av_packet_unref(&packet);
} }
avcodec_close(c); avcodec_close(c);
#if (LIBAVFORMAT_VERSION_INT > AV_VERSION_INT( 57,25,100 )) #if LIBAVFORMAT_VERSION_INT > AV_VERSION_INT(57,25,100)
avcodec_free_context(&c); avcodec_free_context(&c);
#endif #endif
avformat_close_input(&subavfc); avformat_close_input(&subavfc);
@@ -509,8 +509,8 @@ again:
avfc->iformat->flags |= AVFMT_SEEK_TO_PTS; avfc->iformat->flags |= AVFMT_SEEK_TO_PTS;
avfc->flags = AVFMT_FLAG_GENPTS; avfc->flags = AVFMT_FLAG_GENPTS;
if (player->noprobe) { if (player->noprobe) {
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(55, 43, 100)) || \ #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(55, 43, 100) || \
(LIBAVFORMAT_VERSION_INT > AV_VERSION_INT(57, 25, 0)) LIBAVFORMAT_VERSION_INT > AV_VERSION_INT(57, 25, 0)
avfc->max_analyze_duration = 1; avfc->max_analyze_duration = 1;
#else #else
avfc->max_analyze_duration2 = 1; avfc->max_analyze_duration2 = 1;
@@ -715,7 +715,7 @@ bool Input::Stop()
if (avfc) { if (avfc) {
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex); OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
for (unsigned int i = 0; i < avfc->nb_streams; i++) { for (unsigned int i = 0; i < avfc->nb_streams; i++) {
#if (LIBAVFORMAT_VERSION_INT > AV_VERSION_INT( 57,25,100 )) #if LIBAVFORMAT_VERSION_INT > AV_VERSION_INT(57,25,100)
if (codecs[i].codec) if (codecs[i].codec)
avcodec_free_context(&codecs[i].codec); avcodec_free_context(&codecs[i].codec);
#else #else

View File

@@ -251,7 +251,7 @@ bool WriterPCM::Write(AVPacket *packet, int64_t pts)
decoded_frame = NULL; decoded_frame = NULL;
} }
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,25,101 )) #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57,25,101)
AVCodec *codec = avcodec_find_decoder(c->codec_id); AVCodec *codec = avcodec_find_decoder(c->codec_id);
if (!codec) { if (!codec) {
fprintf(stderr, "%s %d: avcodec_find_decoder(%llx)\n", __func__, __LINE__, (unsigned long long) c->codec_id); fprintf(stderr, "%s %d: avcodec_find_decoder(%llx)\n", __func__, __LINE__, (unsigned long long) c->codec_id);

View File

@@ -300,7 +300,7 @@ AVCodecContext* open_codec(AVMediaType mediaType, AVFormatContext* formatContext
AVCodec * codec = NULL; AVCodec * codec = NULL;
AVCodecContext * codecContext = NULL; AVCodecContext * codecContext = NULL;
int stream_index; int stream_index;
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,25,101 )) #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57,25,101)
stream_index = av_find_best_stream(formatContext, mediaType, -1, -1, NULL, 0); stream_index = av_find_best_stream(formatContext, mediaType, -1, -1, NULL, 0);
if (stream_index >=0 ){ if (stream_index >=0 ){
codecContext = formatContext->streams[stream_index]->codec; codecContext = formatContext->streams[stream_index]->codec;
@@ -360,7 +360,7 @@ int image_to_mpeg2(const char *image_name, const char *encode_name)
av_packet_unref(&packet); av_packet_unref(&packet);
} }
avcodec_close(codecContext); avcodec_close(codecContext);
#if (LIBAVFORMAT_VERSION_INT > AV_VERSION_INT( 57,25,100 )) #if LIBAVFORMAT_VERSION_INT > AV_VERSION_INT(57,25,100)
avcodec_free_context(&codecContext); avcodec_free_context(&codecContext);
#endif #endif
} }