149 codec.id = pCodec->id; |
149 codec.id = pCodec->id; |
150 codec.isAudio = pCodec->type == AVMEDIA_TYPE_AUDIO; |
150 codec.isAudio = pCodec->type == AVMEDIA_TYPE_AUDIO; |
151 codec.shortName = pCodec->name; |
151 codec.shortName = pCodec->name; |
152 codec.longName = pCodec->long_name; |
152 codec.longName = pCodec->long_name; |
153 |
153 |
154 codec.isRecomended = false; |
154 codec.isRecommended = false; |
155 if (strcmp(pCodec->name, "libx264") == 0) |
155 if (strcmp(pCodec->name, "libx264") == 0) |
156 { |
156 { |
157 codec.longName = "H.264/MPEG-4 Part 10 AVC (x264)"; |
157 codec.longName = "H.264/MPEG-4 Part 10 AVC (x264)"; |
158 codec.isRecomended = true; |
158 codec.isRecommended = true; |
159 } |
159 } |
160 else if (strcmp(pCodec->name, "libxvid") == 0) |
160 else if (strcmp(pCodec->name, "libxvid") == 0) |
161 { |
161 { |
162 codec.longName = "MPEG-4 Part 2 (Xvid)"; |
162 codec.longName = "MPEG-4 Part 2 (Xvid)"; |
163 codec.isRecomended = true; |
163 codec.isRecommended = true; |
164 } |
164 } |
165 else if (strcmp(pCodec->name, "libmp3lame") == 0) |
165 else if (strcmp(pCodec->name, "libmp3lame") == 0) |
166 { |
166 { |
167 codec.longName = "MP3 (MPEG audio layer 3) (LAME)"; |
167 codec.longName = "MP3 (MPEG audio layer 3) (LAME)"; |
168 codec.isRecomended = true; |
168 codec.isRecommended = true; |
169 } |
169 } |
170 else |
170 else |
171 codec.longName = pCodec->long_name; |
171 codec.longName = pCodec->long_name; |
172 |
172 |
173 if (strcmp(pCodec->name, "mpeg4") == 0 || strcmp(pCodec->name, "ac3_fixed") == 0) |
173 if (strcmp(pCodec->name, "mpeg4") == 0 || strcmp(pCodec->name, "ac3_fixed") == 0) |
174 codec.isRecomended = true; |
174 codec.isRecommended = true; |
175 |
|
176 // FIXME: remove next line |
|
177 //codec.longName += QString(" (%1)").arg(codec.shortName); |
|
178 } |
175 } |
179 |
176 |
180 // get list of all formats |
177 // get list of all formats |
181 AVOutputFormat* pFormat = NULL; |
178 AVOutputFormat* pFormat = NULL; |
182 while ((pFormat = av_oformat_next(pFormat))) |
179 while ((pFormat = av_oformat_next(pFormat))) |
205 ext.truncate(strcspn(pFormat->extensions, ",")); |
202 ext.truncate(strcspn(pFormat->extensions, ",")); |
206 format.extension = ext; |
203 format.extension = ext; |
207 format.shortName = pFormat->name; |
204 format.shortName = pFormat->name; |
208 format.longName = QString("%1 (*.%2)").arg(pFormat->long_name).arg(ext); |
205 format.longName = QString("%1 (*.%2)").arg(pFormat->long_name).arg(ext); |
209 |
206 |
210 // FIXME: remove next line |
207 format.isRecommended = strcmp(pFormat->name, "mp4") == 0 || strcmp(pFormat->name, "avi") == 0; |
211 //format.longName += QString(" (%1)").arg(format.shortName); |
|
212 |
|
213 format.isRecomended = strcmp(pFormat->name, "mp4") == 0 || strcmp(pFormat->name, "avi") == 0; |
|
214 |
208 |
215 formats[pFormat->name] = format; |
209 formats[pFormat->name] = format; |
216 } |
210 } |
217 } |
211 } |
218 |
212 |
219 void LibavInteraction::fillFormats(QComboBox * pFormats) |
213 void LibavInteraction::fillFormats(QComboBox * pFormats) |
220 { |
214 { |
221 // first insert recomended formats |
215 // first insert recomended formats |
222 foreach(const Format & format, formats) |
216 foreach(const Format & format, formats) |
223 if (format.isRecomended) |
217 if (format.isRecommended) |
224 pFormats->addItem(format.longName, format.shortName); |
218 pFormats->addItem(format.longName, format.shortName); |
225 |
219 |
226 // remember where to place separator between recomended and other formats |
220 // remember where to place separator between recomended and other formats |
227 int sep = pFormats->count(); |
221 int sep = pFormats->count(); |
228 |
222 |
229 // insert remaining formats |
223 // insert remaining formats |
230 foreach(const Format & format, formats) |
224 foreach(const Format & format, formats) |
231 if (!format.isRecomended) |
225 if (!format.isRecommended) |
232 pFormats->addItem(format.longName, format.shortName); |
226 pFormats->addItem(format.longName, format.shortName); |
233 |
227 |
234 // insert separator if necessary |
228 // insert separator if necessary |
235 if (sep != 0 && sep != pFormats->count()) |
229 if (sep != 0 && sep != pFormats->count()) |
236 pFormats->insertSeparator(sep); |
230 pFormats->insertSeparator(sep); |
241 Format & format = formats[fmt]; |
235 Format & format = formats[fmt]; |
242 |
236 |
243 // first insert recomended codecs |
237 // first insert recomended codecs |
244 foreach(Codec * codec, format.codecs) |
238 foreach(Codec * codec, format.codecs) |
245 { |
239 { |
246 if (codec->isRecomended) |
240 if (codec->isRecommended) |
247 { |
241 { |
248 if (codec->isAudio) |
242 if (codec->isAudio) |
249 pACodecs->addItem(codec->longName, codec->shortName); |
243 pACodecs->addItem(codec->longName, codec->shortName); |
250 else |
244 else |
251 pVCodecs->addItem(codec->longName, codec->shortName); |
245 pVCodecs->addItem(codec->longName, codec->shortName); |
257 int asep = pACodecs->count(); |
251 int asep = pACodecs->count(); |
258 |
252 |
259 // insert remaining codecs |
253 // insert remaining codecs |
260 foreach(Codec * codec, format.codecs) |
254 foreach(Codec * codec, format.codecs) |
261 { |
255 { |
262 if (!codec->isRecomended) |
256 if (!codec->isRecommended) |
263 { |
257 { |
264 if (codec->isAudio) |
258 if (codec->isAudio) |
265 pACodecs->addItem(codec->longName, codec->shortName); |
259 pACodecs->addItem(codec->longName, codec->shortName); |
266 else |
260 else |
267 pVCodecs->addItem(codec->longName, codec->shortName); |
261 pVCodecs->addItem(codec->longName, codec->shortName); |