Package: ffdiaporama / 1.5-4

libav10.patch Patch series | download
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
From: anton@khirnov.net
To: 739221@bugs.debian.org
Subject: Re: FTBFS with libav10
Date: Sat, 01 Mar 2014 11:14:08 +0100

--- a/src/engine/cBaseMediaFile.cpp
+++ b/src/engine/cBaseMediaFile.cpp
@@ -1603,7 +1603,7 @@ void cVideoFile::ReadAudioFrame(bool Pre
     int64_t         SrcSampleSize       =(AudioStream->codec->sample_fmt==AV_SAMPLE_FMT_S16?2:1)*int64_t(AudioStream->codec->channels);
     int64_t         DstSampleSize       =(SoundTrackBloc->SampleBytes*SoundTrackBloc->Channels);
     AVPacket        *StreamPacket       =NULL;
-    int64_t         MaxAudioLenDecoded  =AVCODEC_MAX_AUDIO_FRAME_SIZE*3;
+    int64_t         MaxAudioLenDecoded  =192000*3;
     int64_t         AudioLenDecoded     =0;
     uint8_t         *BufferForDecoded   =(uint8_t *)av_malloc(MaxAudioLenDecoded+8);    //***************** !
     double          dPosition           =double(Position)/1000;     // Position in double format
@@ -1745,78 +1745,37 @@ void cVideoFile::ReadAudioFrame(bool Pre
     if (AudioLenDecoded>0) {
         if ((AudioStream->codec->sample_fmt!=AV_SAMPLE_FMT_S16)||(AudioStream->codec->channels!=2)||(AudioStream->codec->sample_rate!=48000)) {
             // Resample sound to wanted freq. using ffmpeg audio_resample function
-            /*#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54,60,0)
-
-                SwrContext *RSC=swr_alloc_set_opts(NULL,
-                        AV_CH_LAYOUT_STEREO,                                        // output channel layout (AV_CH_LAYOUT_*)
-                        av_get_alt_sample_fmt(AV_SAMPLE_FMT_S16, 1),                // output sample format (AV_SAMPLE_FMT_*).
-                        48000,                                                      // output sample rate (frequency in Hz)
-                        AudioStream->codec->channel_layout,                         // input channel layout (AV_CH_LAYOUT_*)
-                        av_get_alt_sample_fmt(AudioStream->codec->sample_fmt,1),    // input sample format (AV_SAMPLE_FMT_*).
-                        AudioStream->codec->sample_rate,                            // input sample rate (frequency in Hz)
-                        0,                                                          // logging level offset
-                        NULL);                                                      // parent logging context, can be NULL
-
-                if (RSC!=NULL) {
-                    swr_init(RSC);
-
-                    uint8_t       *BufSampled=(uint8_t *)av_malloc(MaxAudioLenDecoded);
-                    const uint8_t *BufSrc=BufferForDecoded;
-
-                    AudioLenDecoded=swr_convert(RSC,&BufSampled,MaxAudioLenDecoded/DstSampleSize,&BufSrc,AudioLenDecoded/SrcSampleSize)*DstSampleSize;
-
-                    // Adjust volume
-                    if (Volume!=1) {
-                        int16_t *Buf1=(int16_t*)BufSampled;
-                        int32_t mix;
-                        for (int j=0;j<AudioLenDecoded/4;j++) {
-                            // Left channel : Adjust if necessary (16 bits)
-                            mix=int32_t(double(*(Buf1))*Volume); if (mix>32767)  mix=32767; else if (mix<-32768) mix=-32768;  *(Buf1++)=int16_t(mix);
-                            // Right channel : Adjust if necessary (16 bits)
-                            mix=int32_t(double(*(Buf1))*Volume); if (mix>32767)  mix=32767; else if (mix<-32768) mix=-32768;  *(Buf1++)=int16_t(mix);
-                        }
-                    }
-
-                    // Append data to SoundTrackBloc
-                    SoundTrackBloc->AppendData((int16_t*)BufSampled,AudioLenDecoded);
-                    swr_free(&RSC);             // Close the resampling audio context
-                    av_free(BufSampled);        // Free allocated buffers
+	    AVAudioResampleContext *avr = avresample_alloc_context();
+            uint8_t *BufSampled = (uint8_t*)av_malloc(MaxAudioLenDecoded);
+	    int ret;
+
+	    av_opt_set_int(avr, "in_channel_layout", AudioStream->codec->channel_layout, 0);
+	    av_opt_set_int(avr, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0);
+	    av_opt_set_int(avr, "in_sample_rate", AudioStream->codec->sample_rate, 0);
+	    av_opt_set_int(avr, "out_sample_rate", 48000, 0);
+	    av_opt_set_int(avr, "in_sample_fmt", AudioStream->codec->sample_fmt, 0);
+	    av_opt_set_int(avr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0);
+
+	    avresample_open(avr);
+
+            ret = avresample_convert(avr, &BufSampled, MaxAudioLenDecoded, MaxAudioLenDecoded / DstSampleSize,
+                            &BufferForDecoded, AudioLenDecoded, AudioLenDecoded / SrcSampleSize);
+
+            // Adjust volume
+            if (Volume!=1) {
+                int16_t *Buf1=(int16_t*)BufSampled;
+                int32_t mix;
+                for (int j = 0; j < ret; j++) {
+                    Buf1[2 * j] = av_clip_int16(Buf1[2 * j] * Volume);
+                    Buf1[2 * j + 1] = av_clip_int16(Buf1[2 * j + 1] * Volume);
                 }
+            }
 
-            #else   // Before AV_VERSION_INT(54,60,0)
-            */
-                ReSampleContext *RSC=av_audio_resample_init(                        // Context for resampling audio data
-                    SoundTrackBloc->Channels,AudioStream->codec->channels,          // output_channels, input_channels
-                    SoundTrackBloc->SamplingRate,AudioStream->codec->sample_rate,   // output_rate, input_rate
-                    AV_SAMPLE_FMT_S16,AudioStream->codec->sample_fmt,               // sample_fmt_out, sample_fmt_in
-                    16,                                                             // filter_length (trying 4 !)
-                    10,                                                             // log2_phase_count
-                    1,                                                              // linear
-                    1.0);                                                           // cutoff
-                if (RSC!=NULL) {
-
-                    short int *BufSampled=(short int*)av_malloc(MaxAudioLenDecoded);
-
-                    AudioLenDecoded=audio_resample(RSC,BufSampled,(short int*)BufferForDecoded,AudioLenDecoded/SrcSampleSize)*DstSampleSize;
-
-                    // Adjust volume
-                    if (Volume!=1) {
-                        int16_t *Buf1=(int16_t*)BufSampled;
-                        int32_t mix;
-                        for (int j=0;j<AudioLenDecoded/4;j++) {
-                            // Left channel : Adjust if necessary (16 bits)
-                            mix=int32_t(double(*(Buf1))*Volume); if (mix>32767)  mix=32767; else if (mix<-32768) mix=-32768;  *(Buf1++)=int16_t(mix);
-                            // Right channel : Adjust if necessary (16 bits)
-                            mix=int32_t(double(*(Buf1))*Volume); if (mix>32767)  mix=32767; else if (mix<-32768) mix=-32768;  *(Buf1++)=int16_t(mix);
-                        }
-                    }
+            // Append data to SoundTrackBloc
+            SoundTrackBloc->AppendData((int16_t*)BufSampled, ret * 2 * 2);
+            avresample_free(&avr);
+            av_free(BufSampled);        // Free allocated buffers
 
-                    // Append data to SoundTrackBloc
-                    SoundTrackBloc->AppendData((int16_t*)BufSampled,AudioLenDecoded);
-                    audio_resample_close(RSC);   // Close the resampling audio context
-                    av_free(BufSampled);         // Free allocated buffers
-                }
-            //#endif
         } else {
             SoundTrackBloc->AppendData((int16_t*)BufferForDecoded,AudioLenDecoded);
         }
@@ -1943,15 +1902,7 @@ void cVideoFile::ReadAudioFrame(bool Pre
         inputs->pad_idx = 0;
         inputs->next = NULL;
 
-        #if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(2,23,0)
         if ((result=avfilter_graph_parse(VideoFilterGraph,m_filters.toLocal8Bit().constData(),inputs,outputs,NULL))<0) {
-        #elif LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,1,0)
-        if ((result=avfilter_graph_parse(VideoFilterGraph,m_filters.toLocal8Bit().constData(),&inputs,&outputs,NULL))<0) {
-        #elif LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,17,0)
-        if ((result=avfilter_graph_parse(VideoFilterGraph,m_filters.toLocal8Bit().constData(),inputs,outputs,NULL))<0) {
-        #else
-        if ((result=avfilter_graph_parse(VideoFilterGraph,m_filters.toLocal8Bit().constData(),&inputs,&outputs,NULL))<0) {
-        #endif
             ToLog(LOGMSG_CRITICAL,QString("Error in cVideoFile::VideoFilter_Open : avfilter_graph_parse"));
             return result;
         }
--- a/src/engine/cDeviceModelDef.cpp
+++ b/src/engine/cDeviceModelDef.cpp
@@ -142,12 +142,12 @@ int ORDERIMAGENAME[2][NBR_SIZEDEF]={
 
 struct sVideoCodecDef VIDEOCODECDEF[NBR_VIDEOCODECDEF]={
     {
-        false,false,CODEC_ID_MJPEG,VCODEC_MJPEG,VCODECST_MJPEG,                                               // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
+        false,false,AV_CODEC_ID_MJPEG,VCODEC_MJPEG,VCODECST_MJPEG,                                               // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
         "mjpeg","Motion JPEG",                                                                          // ShortName[50], LongName[200]
         "",                                                                                             // PossibleBitrate
         {{""},{""}}                                                                                     // DefaultBitrate[2][NBR_SIZEDEF]
     },{
-        false,false,CODEC_ID_MPEG2VIDEO,VCODEC_MPEG,VCODECST_MPEG,                                            // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
+        false,false,AV_CODEC_ID_MPEG2VIDEO,VCODEC_MPEG,VCODECST_MPEG,                                            // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
         "mpeg2video","MPEG-2 video",                                                                    // ShortName[50], LongName[200]
         "2000k#3000k#4000k#6000k#8000k#10000k#12000k#15000k#20000k#400k",                               // PossibleBitrate
         {{                                                                                              // DefaultBitrate[2][NBR_SIZEDEF] - PAL
@@ -176,7 +176,7 @@ struct sVideoCodecDef VIDEOCODECDEF[NBR_
         "20000k"    // 1080p-29.97
         }}
     },{
-        false,false,CODEC_ID_MPEG4,VCODEC_MPEG4,VCODECST_MPEG4,                                               // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
+        false,false,AV_CODEC_ID_MPEG4,VCODEC_MPEG4,VCODECST_MPEG4,                                               // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
         "mpeg4","DivX/XVid/MPEG-4",                                                                     // ShortName[50], LongName[200]
         "500k#1000k#1200k#1500k#2000k#2500k#3000k#4000k#5000k#6000k#8000k#400k#4500k",                  // PossibleBitrate
         {{                                                                                              // DefaultBitrate[2][NBR_SIZEDEF] - PAL
@@ -205,7 +205,7 @@ struct sVideoCodecDef VIDEOCODECDEF[NBR_
         "8000k"     // 1080p-29.97
         }}
     },{
-        false,false,CODEC_ID_H264,VCODEC_H264HQ,VCODECST_H264HQ,                                              // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
+        false,false,AV_CODEC_ID_H264,VCODEC_H264HQ,VCODECST_H264HQ,                                              // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
         "libx264","High Quality H.264 AVC/MPEG-4 AVC",                                                  // ShortName[50], LongName[200]
         "500k#1000k#1200k#1500k#2000k#2500k#3000k#4000k#5000k#6000k#8000k#10000k#12000k#400k#3500k",    // PossibleBitrate
         {{                                                                                              // DefaultBitrate[2][NBR_SIZEDEF] - PAL
@@ -234,7 +234,7 @@ struct sVideoCodecDef VIDEOCODECDEF[NBR_
         "8000k",    // 1080p-29.97
         }}
     },{
-        false,false,CODEC_ID_H264,VCODEC_H264PQ,VCODECST_H264PQ,                                              // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
+        false,false,AV_CODEC_ID_H264,VCODEC_H264PQ,VCODECST_H264PQ,                                              // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
         "libx264","Phone Quality H.264 AVC/MPEG-4 AVC",                                                 // ShortName[50], LongName[200]
         "500k#1000k#1200k#1500k#2000k#2500k#3000k#4000k#5000k#6000k#8000k#10000k#400k#3500k",           // PossibleBitrate
         {{                                                                                              // DefaultBitrate[2][NBR_SIZEDEF] - PAL
@@ -263,7 +263,7 @@ struct sVideoCodecDef VIDEOCODECDEF[NBR_
         "8000k"     // 1080p-29.97
         }}
     },{
-        false,false,CODEC_ID_VP8,VCODEC_VP8,VCODECST_VP8,                                                     // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
+        false,false,AV_CODEC_ID_VP8,VCODEC_VP8,VCODECST_VP8,                                                     // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
         "libvpx","WebM-VP8",                                                                            // ShortName[50], LongName[200]
         "500k#1000k#1200k#1500k#2000k#2500k#3000k#4000k#5000k#6000k#8000k#400k#3500k",                  // PossibleBitrate
         {{                                                                                              // DefaultBitrate[2][NBR_SIZEDEF] - PAL
@@ -321,7 +321,7 @@ struct sVideoCodecDef VIDEOCODECDEF[NBR_
         "8000k"     // 1080p-29.97
         }}
     },{
-        false,false,CODEC_ID_THEORA,VCODEC_THEORA,VCODECST_THEORA,                                           // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
+        false,false,AV_CODEC_ID_THEORA,VCODEC_THEORA,VCODECST_THEORA,                                           // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
         "libtheora","Theora VP3",                                                                       // ShortName[50], LongName[200]
         "500k#1000k#1200k#1500k#2000k#2500k#3000k#4000k#5000k#6000k#8000k#400k#3500k",                  // PossibleBitrate
         {{                                                                                              // DefaultBitrate[2][NBR_SIZEDEF] - PAL
@@ -350,22 +350,22 @@ struct sVideoCodecDef VIDEOCODECDEF[NBR_
         "8000k"     // 1080p-29.97
         }}
     },{
-        false,false,CODEC_ID_H264,VCODEC_X264LL,VCODECST_X264LL,                                        // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
+        false,false,AV_CODEC_ID_H264,VCODEC_X264LL,VCODECST_X264LL,                                        // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
         "libx264","x264 lossless",                                                                      // ShortName[50], LongName[200]
         "",                                                                                             // PossibleBitrate
         {{""},{""}}                                                                                     // DefaultBitrate[2][NBR_SIZEDEF]
     },{
-        false,false,CODEC_ID_WMV1,VCODEC_WMV1,VCODECST_WMV1,                                            // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
+        false,false,AV_CODEC_ID_WMV1,VCODEC_WMV1,VCODECST_WMV1,                                            // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
         "wmv1","Windows Media Video 7",                                                                 // ShortName[50], LongName[200]
         "",                                                                                             // PossibleBitrate
         {{""},{""}}                                                                                     // DefaultBitrate[2][NBR_SIZEDEF]
     },{
-        false,false,CODEC_ID_WMV2,VCODEC_WMV2,VCODECST_WMV2,                                            // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
+        false,false,AV_CODEC_ID_WMV2,VCODEC_WMV2,VCODECST_WMV2,                                            // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
         "wmv2","Windows Media Video 8",                                                                 // ShortName[50], LongName[200]
         "",                                                                                             // PossibleBitrate
         {{""},{""}}                                                                                     // DefaultBitrate[2][NBR_SIZEDEF]
     },{
-        false,false,CODEC_ID_WMV3,VCODEC_WMV3,VCODECST_WMV3,                                            // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
+        false,false,AV_CODEC_ID_WMV3,VCODEC_WMV3,VCODECST_WMV3,                                            // IsFind,Codec_id,FFD_VCODEC,FFD_VCODECST
         "wmv3","Windows Media Video 9",                                                                 // ShortName[50], LongName[200]
         "",                                                                                             // PossibleBitrate
         {{""},{""}}                                                                                     // DefaultBitrate[2][NBR_SIZEDEF]
@@ -373,17 +373,17 @@ struct sVideoCodecDef VIDEOCODECDEF[NBR_
 };
 
 struct sAudioCodecDef AUDIOCODECDEF[NBR_AUDIOCODECDEF]={
-    {false,false, CODEC_ID_PCM_S16LE,"pcm_s16le",         "WAV (PCM signed 16-bit little-endian)","",     false,"",""},
-    {false,false, CODEC_ID_MP3,      "libmp3lame",        "MP3 (MPEG-1/2 Audio Layer III)",       "8k#16k#24k#32k#40k#48k#56k#64k#80k#96k#112k#128k#144k#160k#192k#224k#256k#320k",     false,"","160k"},
-    {false,false, CODEC_ID_AAC,      "aac",               "AAC-LC (Advanced Audio Codec)",        "64k#80k#96k#112k#128k#144k#160k#192k#224k#256k#320k#384k",     true,"224k#256k#320k#384k#448k#500k#512k#576k#640k","160k"},
-    {false,false, CODEC_ID_AC3,      "ac3",               "AC3 (Doly Digital)",                   "64k#80k#96k#112k#128k#144k#160k#192k#224k#256k#320k#384k",     true,"224k#256k#320k#384k#448k#500k#512k#576k#640k","160k"},
-    {false,false, CODEC_ID_VORBIS,   "vorbis",            "OGG (Vorbis)",                         "64k#96k#128k#192k#256k#500k",     false,"","128k"},
-    {false,false, CODEC_ID_MP2,      "mp2",               "MP2 (MPEG-1 Audio Layer II)",          "64k#96k#128k#192k#256k#500k",     false,"","128k"},
-    {false,false, CODEC_ID_AMR_WB,   "libvo_amrwbenc",    "Adaptive Multi-Rate (AMR) Wide-Band",  "6.60k#8.85k#12.65k#14.25k#15.85k#18.25k#19.85k#23.05k#23.85k",     false,"","6.60k"},
-    {false,false, CODEC_ID_FLAC,     "flac",              "FLAC (Free Lossless Audio Codec)",     "",     false,"",""},
-    {false,false, CODEC_ID_AMR_NB,   "libopencore_amrnb", "Adaptive Multi-Rate (AMR) NB",         "",     false,"",""},
-    {false,false, CODEC_ID_WMAV1,    "wmav1",             "Windows Media Audio 1",                "",     false,"",""},
-    {false,false, CODEC_ID_WMAV2,    "wmav2",             "Windows Media Audio 2",                "",     false,"",""}
+    {false,false, AV_CODEC_ID_PCM_S16LE,"pcm_s16le",         "WAV (PCM signed 16-bit little-endian)","",     false,"",""},
+    {false,false, AV_CODEC_ID_MP3,      "libmp3lame",        "MP3 (MPEG-1/2 Audio Layer III)",       "8k#16k#24k#32k#40k#48k#56k#64k#80k#96k#112k#128k#144k#160k#192k#224k#256k#320k",     false,"","160k"},
+    {false,false, AV_CODEC_ID_AAC,      "aac",               "AAC-LC (Advanced Audio Codec)",        "64k#80k#96k#112k#128k#144k#160k#192k#224k#256k#320k#384k",     true,"224k#256k#320k#384k#448k#500k#512k#576k#640k","160k"},
+    {false,false, AV_CODEC_ID_AC3,      "ac3",               "AC3 (Doly Digital)",                   "64k#80k#96k#112k#128k#144k#160k#192k#224k#256k#320k#384k",     true,"224k#256k#320k#384k#448k#500k#512k#576k#640k","160k"},
+    {false,false, AV_CODEC_ID_VORBIS,   "vorbis",            "OGG (Vorbis)",                         "64k#96k#128k#192k#256k#500k",     false,"","128k"},
+    {false,false, AV_CODEC_ID_MP2,      "mp2",               "MP2 (MPEG-1 Audio Layer II)",          "64k#96k#128k#192k#256k#500k",     false,"","128k"},
+    {false,false, AV_CODEC_ID_AMR_WB,   "libvo_amrwbenc",    "Adaptive Multi-Rate (AMR) Wide-Band",  "6.60k#8.85k#12.65k#14.25k#15.85k#18.25k#19.85k#23.05k#23.85k",     false,"","6.60k"},
+    {false,false, AV_CODEC_ID_FLAC,     "flac",              "FLAC (Free Lossless Audio Codec)",     "",     false,"",""},
+    {false,false, AV_CODEC_ID_AMR_NB,   "libopencore_amrnb", "Adaptive Multi-Rate (AMR) NB",         "",     false,"",""},
+    {false,false, AV_CODEC_ID_WMAV1,    "wmav1",             "Windows Media Audio 1",                "",     false,"",""},
+    {false,false, AV_CODEC_ID_WMAV2,    "wmav2",             "Windows Media Audio 2",                "",     false,"",""}
 };
 
 struct sFormatDef FORMATDEF[NBR_FORMATDEF]={
--- a/src/engine/cDeviceModelDef.h
+++ b/src/engine/cDeviceModelDef.h
@@ -66,8 +66,9 @@ extern "C" {
 
     #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54,60,0)
     #include "libavutil/samplefmt.h"
-    #include "libswresample/swresample.h"
+    #include <libavresample/avresample.h>
     #endif
+    #include <libavutil/opt.h>
 
     // include for libavfilter
     #if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,13,0)       // For all
@@ -92,9 +93,6 @@ extern "C" {
             #include "libavfilter/avcodec.h"
         #else                                                   // From 3.1
             //#define AUDIO_LIBAVFILTER
-            #if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(3,17,0)   // From 3.17
-                #include "libavfilter/avcodec.h"
-            #endif
             #include "libavfilter/buffersink.h"
             #include "libavfilter/buffersrc.h"
         #endif
--- a/src/ffDiaporama/DlgRenderVideo/DlgRenderVideo.cpp
+++ b/src/ffDiaporama/DlgRenderVideo/DlgRenderVideo.cpp
@@ -736,25 +736,25 @@ bool DlgRenderVideo::ComputeAudioPart(QS
 
         switch (AUDIOCODECDEF[AudioCodecIndex].Codec_id) {
 
-            case CODEC_ID_PCM_S16LE:
+            case AV_CODEC_ID_PCM_S16LE:
                 aCodec=QString("-acodec copy");             // Use copy instead of -acodec pcm_s16le because we generate temp.wav as pcm_s16le !
                 break;
 
-            case CODEC_ID_FLAC:
+            case AV_CODEC_ID_FLAC:
                 aCodec=QString("-acodec flac");
                 break;
 
-            case CODEC_ID_AC3:
+            case AV_CODEC_ID_AC3:
                 if (isAVCONV) aCodec=QString("-acodec %1 -sample_fmt:1 flt -ab %2").arg(AUDIOCODECDEF[AudioCodecIndex].ShortName).arg(AudioBitRate);
                     else      aCodec=QString("-acodec %1 -ab %2").arg(AUDIOCODECDEF[AudioCodecIndex].ShortName).arg(AudioBitRate);
                 break;
 
-            case CODEC_ID_MP2:
-            case CODEC_ID_MP3:
-            case CODEC_ID_AAC:
-            case CODEC_ID_VORBIS:
-            case CODEC_ID_AMR_WB:
-            case CODEC_ID_AMR_NB:
+            case AV_CODEC_ID_MP2:
+            case AV_CODEC_ID_MP3:
+            case AV_CODEC_ID_AAC:
+            case AV_CODEC_ID_VORBIS:
+            case AV_CODEC_ID_AMR_WB:
+            case AV_CODEC_ID_AMR_NB:
                 aCodec=QString("-acodec %1 -ab %2").arg(AUDIOCODECDEF[AudioCodecIndex].ShortName).arg(AudioBitRate);
                 break;
 
@@ -763,10 +763,10 @@ bool DlgRenderVideo::ComputeAudioPart(QS
                 Continue=false;
                 break;
         }
-        if (AUDIOCODECDEF[AudioCodecIndex].Codec_id==CODEC_ID_AMR_WB) {
+        if (AUDIOCODECDEF[AudioCodecIndex].Codec_id==AV_CODEC_ID_AMR_WB) {
             AudioChannels=1;
             AudioFrequency=16000;
-        } else if (AUDIOCODECDEF[AudioCodecIndex].Codec_id==CODEC_ID_AMR_NB) {
+        } else if (AUDIOCODECDEF[AudioCodecIndex].Codec_id==AV_CODEC_ID_AMR_NB) {
             AudioChannels=1;
             AudioFrequency=8000;
         }
@@ -988,7 +988,7 @@ void DlgRenderVideo::DoAccept() {
         AudioCodec=AUDIOCODECDEF[AudioCodecIndex].ShortName;
 
         // Special case adjustment
-        if (AUDIOCODECDEF[AudioCodecIndex].Codec_id==CODEC_ID_PCM_S16LE)    AudioBitRate=1536;      // Special case for WAV
+        if (AUDIOCODECDEF[AudioCodecIndex].Codec_id==AV_CODEC_ID_PCM_S16LE)    AudioBitRate=1536;      // Special case for WAV
         if (QString(FORMATDEF[OutputFileFormat].ShortName)==QString("flv")) AudioFrequency=44100;   // Special case for FLV
         if (QString(FORMATDEF[OutputFileFormat].ShortName)==QString("3gp")) AudioFrequency=8000;    // Special case for AMRNB
 
@@ -1118,7 +1118,7 @@ void DlgRenderVideo::DoAccept() {
                 QString("%1 -aspect %2:%3").arg(aCodec).arg(GeoW).arg(GeoH);
 
             // Activate multithreading support if getCpuCount()>1 and codec is h264 or VP8
-            if (((getCpuCount()-1)>1)&&((VIDEOCODECDEF[VideoCodecIndex].Codec_id==CODEC_ID_H264)||(VIDEOCODECDEF[VideoCodecIndex].Codec_id==CODEC_ID_VP8)))
+            if (((getCpuCount()-1)>1)&&((VIDEOCODECDEF[VideoCodecIndex].Codec_id==AV_CODEC_ID_H264)||(VIDEOCODECDEF[VideoCodecIndex].Codec_id==AV_CODEC_ID_VP8)))
                 ffmpegCommand=ffmpegCommand+" -threads "+QString("%1").arg(getCpuCount()-1);
 
             ffmpegCommand=ffmpegCommand+" \""+OutputFileName+"\"";
@@ -1334,7 +1334,7 @@ bool DlgRenderVideo::WriteTempAudioFile(
     if (Fmt==NULL) {
         CustomMessageBox(this,QMessageBox::Critical,QApplication::translate("DlgRenderVideo","Render video"),"Error creating temporary wav file!");
         Continue=false;
-    } else Fmt->audio_codec=CODEC_ID_PCM_S16LE;
+    } else Fmt->audio_codec=AV_CODEC_ID_PCM_S16LE;
 
     // allocate the output media context
     if (Continue) {
@@ -1371,12 +1371,12 @@ bool DlgRenderVideo::WriteTempAudioFile(
         #else
         avcodec_get_context_defaults3(WriteWAV.AudioCodecContext,NULL);     // Fill stream with default values
         #endif
-        AudioCodec=avcodec_find_encoder(CODEC_ID_PCM_S16LE);                    // Open Audio encoder
+        AudioCodec=avcodec_find_encoder(AV_CODEC_ID_PCM_S16LE);                    // Open Audio encoder
         if (!AudioCodec) {
             CustomMessageBox(this,QMessageBox::Critical,QApplication::translate("DlgRenderVideo","Render video"),"Audio codec not found!");
             Continue=false;
         } else {
-            WriteWAV.AudioCodecContext->codec_id             = CODEC_ID_PCM_S16LE;
+            WriteWAV.AudioCodecContext->codec_id             = AV_CODEC_ID_PCM_S16LE;
             WriteWAV.AudioCodecContext->codec_type           = AVMEDIA_TYPE_AUDIO;
             WriteWAV.AudioCodecContext->sample_fmt           = AV_SAMPLE_FMT_S16;
             WriteWAV.AudioCodecContext->sample_rate          = 48000;
@@ -1388,7 +1388,7 @@ bool DlgRenderVideo::WriteTempAudioFile(
             WriteWAV.AudioCodecContext->channels             = 2;
             WriteWAV.AudioCodecContext->channel_layout       = AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT;    //CH_LAYOUT_STEREO;
             WriteWAV.AudioCodecContext->time_base            = (AVRational){1,WriteWAV.AudioCodecContext->sample_rate};
-            WriteWAV.AudioStream->r_frame_rate               = WriteWAV.AudioCodecContext->time_base;
+            WriteWAV.AudioStream->avg_frame_rate             = WriteWAV.AudioCodecContext->time_base;
             WriteWAV.AudioStream->time_base                  = WriteWAV.AudioCodecContext->time_base;
             WriteWAV.AudioCodecContext->flags               |= CODEC_FLAG_GLOBAL_HEADER;
 
@@ -1557,8 +1557,6 @@ void DlgRenderVideo::WriteRenderedMusicT
             memset(PacketSound,0,WriteWAV->RenderMusic.SoundPacketSize);
         }
 
-        #if FF_API_OLD_ENCODE_AUDIO
-
             // Init frame
             AVFrame *frame=avcodec_alloc_frame();
             if (frame->extended_data!=frame->data) {
@@ -1605,32 +1603,6 @@ void DlgRenderVideo::WriteRenderedMusicT
             }
             av_free(frame);
 
-        #else
-            int out_size= avcodec_encode_audio(WriteWAV->AudioCodecContext,WriteWAV->audio_outbuf,WriteWAV->RenderMusic.SoundPacketSize,(short int *)PacketSound);
-            if (out_size>0) {
-                AVPacket pkt;
-                av_init_packet(&pkt);
-
-                if ((WriteWAV->AudioCodecContext->coded_frame!=NULL)&&(WriteWAV->AudioCodecContext->coded_frame->pts!=int64_t(INT64_C(0x8000000000000000))))
-                    pkt.pts=av_rescale_q(WriteWAV->AudioCodecContext->coded_frame->pts,WriteWAV->AudioCodecContext->time_base,WriteWAV->AudioStream->time_base);
-
-                if ((WriteWAV->AudioCodecContext->coded_frame!=NULL)&&(WriteWAV->AudioCodecContext->coded_frame->key_frame))
-                    pkt.flags|=AV_PKT_FLAG_KEY;
-
-                pkt.stream_index=WriteWAV->AudioStream->index;
-                pkt.data        =WriteWAV->audio_outbuf;
-                pkt.size        =out_size;
-
-                // write the compressed frame in the media file
-                if (av_interleaved_write_frame(WriteWAV->OutputFormatContext,&pkt)!=0) {
-                    CustomMessageBox(this,QMessageBox::Critical,QApplication::translate("DlgRenderVideo","Render video"),"Error while writing audio frame!");
-                    *Continue=false;
-                }
-            } else if (out_size<0) {
-                CustomMessageBox(this,QMessageBox::Critical,QApplication::translate("DlgRenderVideo","Render video"),"Error encoding sound!");
-                *Continue=false;
-            }
-        #endif
         av_free(PacketSound);
     }
 }
--- a/src/common.pri
+++ b/src/common.pri
@@ -78,4 +78,4 @@ win32 {
 #---- Libs for windows and linux
 LIBS        += -ltag                                                        #------ TAGlib
 LIBS	    += -lSDL                                                        #------ SDL
-LIBS        += -lavformat -lavcodec -lavutil -lswscale -lavfilter           #------ libav lib link
+LIBS        += -lavformat -lavcodec -lavutil -lswscale -lavfilter -lavresample #------ libav lib link