summaryrefslogtreecommitdiff
blob: 985145e065403db02d5922b9cf13116a4c7dfa6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
--- 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)
         {
+            #ifndef FF_API_OLD_ENCODE_AUDIO
             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))
             {
+                #ifndef FF_API_OLD_ENCODE_AUDIO
                 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 : "");
+            #ifndef FF_API_OLD_ENCODE_AUDIO
             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))
             {
+                #ifndef FF_API_OLD_ENCODE_AUDIO
                 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");