]> git.pld-linux.org Git - packages/qmmp.git/blob - ffmpeg3.patch
- fix building with ffmpeg 3.x
[packages/qmmp.git] / ffmpeg3.patch
1 diff -ur qmmp-0.7.1/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp qmmp-0.7.1.ffmpeg3/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp
2 --- qmmp-0.7.1/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp      2013-05-31 11:03:32.000000000 +0200
3 +++ qmmp-0.7.1.ffmpeg3/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp      2016-04-16 19:21:32.427821767 +0200
4 @@ -187,9 +187,9 @@
5      }
6  
7      if (c->channels > 0)
8 -         c->request_channels = qMin(2, c->channels);
9 +         c->request_channel_layout = av_get_default_channel_layout(qMin(2, c->channels));
10      else
11 -         c->request_channels = 2;
12 +         c->request_channel_layout = av_get_default_channel_layout(2);
13  
14      av_dump_format(ic,0,0,0);
15  
16 @@ -207,11 +207,11 @@
17          return false;
18      }
19  
20 -    m_decoded_frame = avcodec_alloc_frame();
21 +    m_decoded_frame = av_frame_alloc();
22  
23      m_totalTime = input()->isSequential() ? 0 : ic->duration * 1000 / AV_TIME_BASE;
24  
25 -    if(c->codec_id == CODEC_ID_SHORTEN) //ffmpeg bug workaround
26 +    if(c->codec_id == AV_CODEC_ID_SHORTEN) //ffmpeg bug workaround
27          m_totalTime = 0;
28  
29      Qmmp::AudioFormat format = Qmmp::PCM_UNKNOWM;
30 @@ -236,7 +236,7 @@
31          return false;
32      }
33  
34 -    configure(c->sample_rate, c->request_channels, format);
35 +    configure(c->sample_rate, av_get_channel_layout_nb_channels(c->request_channel_layout), format);
36  
37      if(ic->bit_rate)
38          m_bitrate = ic->bit_rate/1000;
39 @@ -273,7 +273,7 @@
40          return 0;
41      qint64 len = qMin(m_output_at, maxSize);
42  
43 -    if(av_sample_fmt_is_planar(c->sample_fmt) && c->request_channels > 1)
44 +    if(av_sample_fmt_is_planar(c->sample_fmt) && av_get_channel_layout_nb_channels(c->request_channel_layout) > 1)
45      {
46          int bps = av_get_bytes_per_sample(c->sample_fmt);
47          for(int i = 0; i < len >> 1; i+=bps)
48 @@ -314,7 +314,7 @@
49      int got_frame = 0;
50      if((m_pkt.stream_index == wma_idx))
51      {
52 -        avcodec_get_frame_defaults(m_decoded_frame);
53 +        av_frame_unref(m_decoded_frame);
54  
55          int  l = avcodec_decode_audio4(c, m_decoded_frame, &got_frame, &m_temp_pkt);
56  
57 @@ -372,7 +372,7 @@
58                  m_temp_pkt.size = 0;
59                  continue;
60              }
61 -            if(m_seekTime && c->codec_id == CODEC_ID_APE)
62 +            if(m_seekTime && c->codec_id == AV_CODEC_ID_APE)
63              {
64                  int64_t rescaledPts = av_rescale(m_pkt.pts,
65                                                   AV_TIME_BASE * (int64_t)
66 @@ -385,7 +385,7 @@
67              m_seekTime = 0;
68          }
69  
70 -        if(m_skipBytes > 0 && c->codec_id == CODEC_ID_APE)
71 +        if(m_skipBytes > 0 && c->codec_id == AV_CODEC_ID_APE)
72          {
73              while (m_skipBytes > 0)
74              {
75 @@ -414,7 +414,7 @@
76              m_output_at = 0;
77              m_temp_pkt.size = 0;
78  
79 -            if(c->codec_id == CODEC_ID_SHORTEN || c->codec_id == CODEC_ID_TWINVQ)
80 +            if(c->codec_id == AV_CODEC_ID_SHORTEN || c->codec_id == AV_CODEC_ID_TWINVQ)
81              {
82                  if(m_pkt.data)
83                      av_free_packet(&m_pkt);
84 @@ -425,7 +425,7 @@
85          }
86          else if(m_output_at == 0)
87          {
88 -            if(c->codec_id == CODEC_ID_SHORTEN || c->codec_id == CODEC_ID_TWINVQ)
89 +            if(c->codec_id == AV_CODEC_ID_SHORTEN || c->codec_id == AV_CODEC_ID_TWINVQ)
90                  continue;
91  
92              if(m_pkt.data)
93 diff -ur qmmp-0.7.1/src/plugins/Input/ffmpeg/decoderffmpegfactory.cpp qmmp-0.7.1.ffmpeg3/src/plugins/Input/ffmpeg/decoderffmpegfactory.cpp
94 --- qmmp-0.7.1/src/plugins/Input/ffmpeg/decoderffmpegfactory.cpp        2013-05-31 11:03:32.000000000 +0200
95 +++ qmmp-0.7.1.ffmpeg3/src/plugins/Input/ffmpeg/decoderffmpegfactory.cpp        2016-04-16 19:21:58.867842241 +0200
96 @@ -95,29 +95,29 @@
97      filters = settings.value("FFMPEG/filters", filters).toStringList();
98  
99      //removed unsupported filters
100 -    if(!avcodec_find_decoder(CODEC_ID_WMAV1))
101 +    if(!avcodec_find_decoder(AV_CODEC_ID_WMAV1))
102          filters.removeAll("*.wma");
103 -    if(!avcodec_find_decoder(CODEC_ID_APE))
104 +    if(!avcodec_find_decoder(AV_CODEC_ID_APE))
105          filters.removeAll("*.ape");
106 -    if(!avcodec_find_decoder(CODEC_ID_TTA))
107 +    if(!avcodec_find_decoder(AV_CODEC_ID_TTA))
108          filters.removeAll("*.tta");
109 -    if(!avcodec_find_decoder(CODEC_ID_AAC))
110 +    if(!avcodec_find_decoder(AV_CODEC_ID_AAC))
111          filters.removeAll("*.aac");
112 -    if(!avcodec_find_decoder(CODEC_ID_MP3))
113 +    if(!avcodec_find_decoder(AV_CODEC_ID_MP3))
114          filters.removeAll("*.mp3");
115 -    if(!avcodec_find_decoder(CODEC_ID_AAC) && !avcodec_find_decoder(CODEC_ID_ALAC))
116 +    if(!avcodec_find_decoder(AV_CODEC_ID_AAC) && !avcodec_find_decoder(AV_CODEC_ID_ALAC))
117          filters.removeAll("*.m4a");
118 -    if(!avcodec_find_decoder(CODEC_ID_RA_288))
119 +    if(!avcodec_find_decoder(AV_CODEC_ID_RA_288))
120          filters.removeAll("*.ra");
121 -    if(!avcodec_find_decoder(CODEC_ID_SHORTEN))
122 +    if(!avcodec_find_decoder(AV_CODEC_ID_SHORTEN))
123          filters.removeAll("*.shn");
124 -    if(!avcodec_find_decoder(CODEC_ID_EAC3))
125 +    if(!avcodec_find_decoder(AV_CODEC_ID_EAC3))
126          filters.removeAll("*.ac3");
127 -    if(!avcodec_find_decoder(CODEC_ID_DTS))
128 +    if(!avcodec_find_decoder(AV_CODEC_ID_DTS))
129          filters.removeAll("*.dts");
130 -    if(!avcodec_find_decoder(CODEC_ID_TRUEHD))
131 +    if(!avcodec_find_decoder(AV_CODEC_ID_TRUEHD))
132          filters.removeAll("*.mka");
133 -    if(!avcodec_find_decoder(CODEC_ID_TWINVQ))
134 +    if(!avcodec_find_decoder(AV_CODEC_ID_TWINVQ))
135          filters.removeAll("*.vqf");
136  
137  
138 diff -ur qmmp-0.7.1/src/plugins/Input/ffmpeg/settingsdialog.cpp qmmp-0.7.1.ffmpeg3/src/plugins/Input/ffmpeg/settingsdialog.cpp
139 --- qmmp-0.7.1/src/plugins/Input/ffmpeg/settingsdialog.cpp      2013-05-31 11:03:32.000000000 +0200
140 +++ qmmp-0.7.1.ffmpeg3/src/plugins/Input/ffmpeg/settingsdialog.cpp      2016-04-16 19:22:24.964510907 +0200
141 @@ -38,30 +38,30 @@
142      QStringList filters;
143      filters << "*.wma" << "*.ape" << "*.tta" << "*.m4a" << "*.ra" << "*.shn" << "*.vqf" << "*.ac3";
144      filters = settings.value("FFMPEG/filters", filters).toStringList();
145 -    ui.wmaCheckBox->setEnabled(avcodec_find_decoder(CODEC_ID_WMAV1));
146 -    ui.wmaCheckBox->setChecked(filters.contains("*.wma") && avcodec_find_decoder(CODEC_ID_WMAV1));
147 -    ui.apeCheckBox->setEnabled(avcodec_find_decoder(CODEC_ID_APE));
148 -    ui.apeCheckBox->setChecked(filters.contains("*.ape") && avcodec_find_decoder(CODEC_ID_APE));
149 -    ui.ttaCheckBox->setEnabled(avcodec_find_decoder(CODEC_ID_TTA));
150 -    ui.ttaCheckBox->setChecked(filters.contains("*.tta") && avcodec_find_decoder(CODEC_ID_TTA));
151 -    ui.aacCheckBox->setEnabled(avcodec_find_decoder(CODEC_ID_AAC));
152 -    ui.aacCheckBox->setChecked(filters.contains("*.aac") && avcodec_find_decoder(CODEC_ID_AAC));
153 -    ui.mp3CheckBox->setEnabled(avcodec_find_decoder(CODEC_ID_MP3));
154 -    ui.mp3CheckBox->setChecked(filters.contains("*.mp3") && avcodec_find_decoder(CODEC_ID_MP3));
155 -    ui.mp4CheckBox->setEnabled(avcodec_find_decoder(CODEC_ID_AAC));
156 -    ui.mp4CheckBox->setChecked(filters.contains("*.m4a") && (avcodec_find_decoder(CODEC_ID_AAC)
157 -                                                             || avcodec_find_decoder(CODEC_ID_ALAC)));
158 -    ui.raCheckBox->setEnabled(avcodec_find_decoder(CODEC_ID_RA_288));
159 -    ui.raCheckBox->setChecked(filters.contains("*.ra") && avcodec_find_decoder(CODEC_ID_RA_288));
160 -    ui.shCheckBox->setChecked(filters.contains("*.shn") && avcodec_find_decoder(CODEC_ID_SHORTEN));
161 -    ui.ac3CheckBox->setEnabled(avcodec_find_decoder(CODEC_ID_EAC3));
162 -    ui.ac3CheckBox->setChecked(filters.contains("*.ac3") && avcodec_find_decoder(CODEC_ID_EAC3));
163 -    ui.dtsCheckBox->setEnabled(avcodec_find_decoder(CODEC_ID_DTS));
164 -    ui.dtsCheckBox->setChecked(filters.contains("*.dts") && avcodec_find_decoder(CODEC_ID_DTS));
165 -    ui.mkaCheckBox->setEnabled(avcodec_find_decoder(CODEC_ID_TRUEHD));
166 -    ui.mkaCheckBox->setChecked(filters.contains("*.mka") && avcodec_find_decoder(CODEC_ID_TRUEHD));
167 -    ui.vqfCheckBox->setEnabled(avcodec_find_decoder(CODEC_ID_TWINVQ));
168 -    ui.vqfCheckBox->setChecked(filters.contains("*.vqf") && avcodec_find_decoder(CODEC_ID_TWINVQ));
169 +    ui.wmaCheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_WMAV1));
170 +    ui.wmaCheckBox->setChecked(filters.contains("*.wma") && avcodec_find_decoder(AV_CODEC_ID_WMAV1));
171 +    ui.apeCheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_APE));
172 +    ui.apeCheckBox->setChecked(filters.contains("*.ape") && avcodec_find_decoder(AV_CODEC_ID_APE));
173 +    ui.ttaCheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_TTA));
174 +    ui.ttaCheckBox->setChecked(filters.contains("*.tta") && avcodec_find_decoder(AV_CODEC_ID_TTA));
175 +    ui.aacCheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_AAC));
176 +    ui.aacCheckBox->setChecked(filters.contains("*.aac") && avcodec_find_decoder(AV_CODEC_ID_AAC));
177 +    ui.mp3CheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_MP3));
178 +    ui.mp3CheckBox->setChecked(filters.contains("*.mp3") && avcodec_find_decoder(AV_CODEC_ID_MP3));
179 +    ui.mp4CheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_AAC));
180 +    ui.mp4CheckBox->setChecked(filters.contains("*.m4a") && (avcodec_find_decoder(AV_CODEC_ID_AAC)
181 +                                                             || avcodec_find_decoder(AV_CODEC_ID_ALAC)));
182 +    ui.raCheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_RA_288));
183 +    ui.raCheckBox->setChecked(filters.contains("*.ra") && avcodec_find_decoder(AV_CODEC_ID_RA_288));
184 +    ui.shCheckBox->setChecked(filters.contains("*.shn") && avcodec_find_decoder(AV_CODEC_ID_SHORTEN));
185 +    ui.ac3CheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_EAC3));
186 +    ui.ac3CheckBox->setChecked(filters.contains("*.ac3") && avcodec_find_decoder(AV_CODEC_ID_EAC3));
187 +    ui.dtsCheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_DTS));
188 +    ui.dtsCheckBox->setChecked(filters.contains("*.dts") && avcodec_find_decoder(AV_CODEC_ID_DTS));
189 +    ui.mkaCheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_TRUEHD));
190 +    ui.mkaCheckBox->setChecked(filters.contains("*.mka") && avcodec_find_decoder(AV_CODEC_ID_TRUEHD));
191 +    ui.vqfCheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_TWINVQ));
192 +    ui.vqfCheckBox->setChecked(filters.contains("*.vqf") && avcodec_find_decoder(AV_CODEC_ID_TWINVQ));
193  }
194  
195  SettingsDialog::~SettingsDialog()
This page took 0.042835 seconds and 3 git commands to generate.