OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/ffmpeg/ffmpeg_common.h" | 5 #include "media/ffmpeg/ffmpeg_common.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/base/audio_decoder_config.h" | 8 #include "media/base/audio_decoder_config.h" |
9 #include "media/base/video_decoder_config.h" | 9 #include "media/base/video_decoder_config.h" |
10 | 10 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 switch (layout) { | 291 switch (layout) { |
292 case AV_CH_LAYOUT_MONO: | 292 case AV_CH_LAYOUT_MONO: |
293 return CHANNEL_LAYOUT_MONO; | 293 return CHANNEL_LAYOUT_MONO; |
294 case AV_CH_LAYOUT_STEREO: | 294 case AV_CH_LAYOUT_STEREO: |
295 return CHANNEL_LAYOUT_STEREO; | 295 return CHANNEL_LAYOUT_STEREO; |
296 case AV_CH_LAYOUT_2_1: | 296 case AV_CH_LAYOUT_2_1: |
297 return CHANNEL_LAYOUT_2_1; | 297 return CHANNEL_LAYOUT_2_1; |
298 case AV_CH_LAYOUT_SURROUND: | 298 case AV_CH_LAYOUT_SURROUND: |
299 return CHANNEL_LAYOUT_SURROUND; | 299 return CHANNEL_LAYOUT_SURROUND; |
300 case AV_CH_LAYOUT_4POINT0: | 300 case AV_CH_LAYOUT_4POINT0: |
301 return CHANNEL_LAYOUT_4POINT0; | 301 return CHANNEL_LAYOUT_4_0; |
302 case AV_CH_LAYOUT_2_2: | 302 case AV_CH_LAYOUT_2_2: |
303 return CHANNEL_LAYOUT_2_2; | 303 return CHANNEL_LAYOUT_2_2; |
304 case AV_CH_LAYOUT_QUAD: | 304 case AV_CH_LAYOUT_QUAD: |
305 return CHANNEL_LAYOUT_QUAD; | 305 return CHANNEL_LAYOUT_QUAD; |
306 case AV_CH_LAYOUT_5POINT0: | 306 case AV_CH_LAYOUT_5POINT0: |
307 return CHANNEL_LAYOUT_5POINT0; | 307 return CHANNEL_LAYOUT_5_0; |
308 case AV_CH_LAYOUT_5POINT1: | 308 case AV_CH_LAYOUT_5POINT1: |
309 return CHANNEL_LAYOUT_5POINT1; | 309 return CHANNEL_LAYOUT_5_1; |
310 case AV_CH_LAYOUT_5POINT0_BACK: | 310 case AV_CH_LAYOUT_5POINT0_BACK: |
311 return CHANNEL_LAYOUT_5POINT0_BACK; | 311 return CHANNEL_LAYOUT_5_0_BACK; |
312 case AV_CH_LAYOUT_5POINT1_BACK: | 312 case AV_CH_LAYOUT_5POINT1_BACK: |
313 return CHANNEL_LAYOUT_5POINT1_BACK; | 313 return CHANNEL_LAYOUT_5_1_BACK; |
314 case AV_CH_LAYOUT_7POINT0: | 314 case AV_CH_LAYOUT_7POINT0: |
315 return CHANNEL_LAYOUT_7POINT0; | 315 return CHANNEL_LAYOUT_7_0; |
316 case AV_CH_LAYOUT_7POINT1: | 316 case AV_CH_LAYOUT_7POINT1: |
317 return CHANNEL_LAYOUT_7POINT1; | 317 return CHANNEL_LAYOUT_7_1; |
318 case AV_CH_LAYOUT_7POINT1_WIDE: | 318 case AV_CH_LAYOUT_7POINT1_WIDE: |
319 return CHANNEL_LAYOUT_7POINT1_WIDE; | 319 return CHANNEL_LAYOUT_7_1_WIDE; |
320 case AV_CH_LAYOUT_STEREO_DOWNMIX: | 320 case AV_CH_LAYOUT_STEREO_DOWNMIX: |
321 return CHANNEL_LAYOUT_STEREO_DOWNMIX; | 321 return CHANNEL_LAYOUT_STEREO_DOWNMIX; |
322 default: | 322 default: |
323 // FFmpeg channel_layout is 0 for .wav and .mp3. We know mono and stereo | 323 // FFmpeg channel_layout is 0 for .wav and .mp3. We know mono and stereo |
324 // from the number of channels, otherwise report errors. | 324 // from the number of channels, otherwise report errors. |
325 if (channels == 1) | 325 if (channels == 1) |
326 return CHANNEL_LAYOUT_MONO; | 326 return CHANNEL_LAYOUT_MONO; |
327 if (channels == 2) | 327 if (channels == 2) |
328 return CHANNEL_LAYOUT_STEREO; | 328 return CHANNEL_LAYOUT_STEREO; |
329 DVLOG(1) << "Unsupported channel layout: " << layout; | 329 DVLOG(1) << "Unsupported channel layout: " << layout; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 avcodec_close(stream->codec); | 383 avcodec_close(stream->codec); |
384 } | 384 } |
385 } | 385 } |
386 } | 386 } |
387 | 387 |
388 // Then finally cleanup the format context. | 388 // Then finally cleanup the format context. |
389 avformat_close_input(&format_context); | 389 avformat_close_input(&format_context); |
390 } | 390 } |
391 | 391 |
392 } // namespace media | 392 } // namespace media |
OLD | NEW |