--- HomerMultimedia/include/Header_Ffmpeg.h +++ HomerMultimedia/include/Header_Ffmpeg.h @@ -173,4 +173,16 @@ #endif } +inline AVStream *HM_avformat_new_stream(AVFormatContext *s, int id) +{ + #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 10, 0) + return av_new_stream(s, c); + #else + AVStream *st = avformat_new_stream(s, NULL); + if (st) + st->id = id; + return st; + #endif +} + #endif --- HomerMultimedia/src/MediaSource.cpp +++ HomerMultimedia/src/MediaSource.cpp @@ -236,11 +236,19 @@ { if (tCodec->type == AVMEDIA_TYPE_VIDEO) { + #if (LIBAVCODEC_VERSION_MAJOR < 55) bool tEncode = (tCodec->encode != NULL); + #else + bool tEncode = (tCodec->encode2 != NULL); + #endif bool tDecode = (tCodec->decode != NULL); if ((tNextCodec != NULL) && (strcmp(tCodec->name, tNextCodec->name) == 0)) { + #if (LIBAVCODEC_VERSION_MAJOR < 55) tEncode |= (tNextCodec->encode != NULL); + #else + tEncode |= (tNextCodec->encode2 != NULL); + #endif tDecode |= (tNextCodec->decode != NULL); tCodec = tNextCodec; } @@ -296,11 +304,19 @@ // tNextCodec->encode ? "E" : " ", // tNextCodec->name, // tNextCodec->long_name ? tCodec->long_name : ""); + #if (LIBAVCODEC_VERSION_MAJOR < 55) bool tEncode = (tCodec->encode != NULL); + #else + bool tEncode = (tCodec->encode2 != NULL); + #endif bool tDecode = (tCodec->decode != NULL); if ((tNextCodec != NULL) && (strcmp(tCodec->name, tNextCodec->name) == 0)) { + #if (LIBAVCODEC_VERSION_MAJOR < 55) tEncode |= (tNextCodec->encode != NULL); + #else + tEncode |= (tNextCodec->encode2 != NULL); + #endif tDecode |= (tNextCodec->decode != NULL); tCodec = tNextCodec; } @@ -1622,7 +1638,7 @@ sprintf(mRecorderFormatContext->filename, "%s", pSaveFileName.c_str()); // allocate new stream structure - tStream = av_new_stream(mRecorderFormatContext, 0); + tStream = HM_avformat_new_stream(mRecorderFormatContext, 0); mRecorderCodecContext = tStream->codec; // put sample parameters --- HomerMultimedia/src/MediaSourceMuxer.cpp +++ HomerMultimedia/src/MediaSourceMuxer.cpp @@ -377,7 +377,7 @@ // allocate new stream structure LOG(LOG_VERBOSE, "..allocating new stream"); - tStream = av_new_stream(mFormatContext, 0); + tStream = HM_avformat_new_stream(mFormatContext, 0); mCodecContext = tStream->codec; mCodecContext->codec_id = tFormat->video_codec; mCodecContext->codec_type = AVMEDIA_TYPE_VIDEO; @@ -710,7 +710,7 @@ } // allocate new stream structure - tStream = av_new_stream(mFormatContext, 0); + tStream = HM_avformat_new_stream(mFormatContext, 0); mCodecContext = tStream->codec; mCodecContext->codec_id = tFormat->audio_codec; mCodecContext->codec_type = AVMEDIA_TYPE_AUDIO; --- HomerMultimedia/src/RTP.cpp +++ HomerMultimedia/src/RTP.cpp @@ -512,7 +512,7 @@ // verbose timestamp debugging mRtpFormatContext->debug = FF_FDEBUG_TS; // allocate new stream structure - tOuterStream = av_new_stream(mRtpFormatContext, 0);//(AVStream*)av_mallocz(sizeof(AVStream)); + tOuterStream = HM_avformat_new_stream(mRtpFormatContext, 0);//(AVStream*)av_mallocz(sizeof(AVStream)); if (tOuterStream == NULL) { LOG(LOG_ERROR, "Memory allocation failed");