Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: media/ffmpeg/ffmpeg_common.cc

Issue 12302029: Linux: add a tool and code to make use_system_ffmpeg option more compatible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build/common.gypi Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/common.gypi ('k') | media/media.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "media/base/decoder_buffer.h" 9 #include "media/base/decoder_buffer.h"
10 #include "media/base/video_frame.h" 10 #include "media/base/video_frame.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 case CODEC_ID_FLAC: 77 case CODEC_ID_FLAC:
78 return kCodecFLAC; 78 return kCodecFLAC;
79 case CODEC_ID_AMR_NB: 79 case CODEC_ID_AMR_NB:
80 return kCodecAMR_NB; 80 return kCodecAMR_NB;
81 case CODEC_ID_AMR_WB: 81 case CODEC_ID_AMR_WB:
82 return kCodecAMR_WB; 82 return kCodecAMR_WB;
83 case CODEC_ID_GSM_MS: 83 case CODEC_ID_GSM_MS:
84 return kCodecGSM_MS; 84 return kCodecGSM_MS;
85 case CODEC_ID_PCM_MULAW: 85 case CODEC_ID_PCM_MULAW:
86 return kCodecPCM_MULAW; 86 return kCodecPCM_MULAW;
87 #ifndef CHROMIUM_OMIT_CODEC_ID_OPUS
87 case CODEC_ID_OPUS: 88 case CODEC_ID_OPUS:
88 return kCodecOpus; 89 return kCodecOpus;
90 #endif
89 default: 91 default:
90 DVLOG(1) << "Unknown audio CodecID: " << codec_id; 92 DVLOG(1) << "Unknown audio CodecID: " << codec_id;
91 } 93 }
92 return kUnknownAudioCodec; 94 return kUnknownAudioCodec;
93 } 95 }
94 96
95 static CodecID AudioCodecToCodecID(AudioCodec audio_codec, 97 static CodecID AudioCodecToCodecID(AudioCodec audio_codec,
96 SampleFormat sample_format) { 98 SampleFormat sample_format) {
97 switch (audio_codec) { 99 switch (audio_codec) {
98 case kCodecAAC: 100 case kCodecAAC:
(...skipping 23 matching lines...) Expand all
122 case kCodecFLAC: 124 case kCodecFLAC:
123 return CODEC_ID_FLAC; 125 return CODEC_ID_FLAC;
124 case kCodecAMR_NB: 126 case kCodecAMR_NB:
125 return CODEC_ID_AMR_NB; 127 return CODEC_ID_AMR_NB;
126 case kCodecAMR_WB: 128 case kCodecAMR_WB:
127 return CODEC_ID_AMR_WB; 129 return CODEC_ID_AMR_WB;
128 case kCodecGSM_MS: 130 case kCodecGSM_MS:
129 return CODEC_ID_GSM_MS; 131 return CODEC_ID_GSM_MS;
130 case kCodecPCM_MULAW: 132 case kCodecPCM_MULAW:
131 return CODEC_ID_PCM_MULAW; 133 return CODEC_ID_PCM_MULAW;
134 #ifndef CHROMIUM_OMIT_CODEC_ID_OPUS
132 case kCodecOpus: 135 case kCodecOpus:
133 return CODEC_ID_OPUS; 136 return CODEC_ID_OPUS;
137 #endif
134 default: 138 default:
135 DVLOG(1) << "Unknown AudioCodec: " << audio_codec; 139 DVLOG(1) << "Unknown AudioCodec: " << audio_codec;
136 } 140 }
137 return CODEC_ID_NONE; 141 return CODEC_ID_NONE;
138 } 142 }
139 143
140 VideoCodec CodecIDToVideoCodec(CodecID codec_id) { 144 VideoCodec CodecIDToVideoCodec(CodecID codec_id) {
141 switch (codec_id) { 145 switch (codec_id) {
142 case CODEC_ID_H264: 146 case CODEC_ID_H264:
143 return kCodecH264; 147 return kCodecH264;
144 case CODEC_ID_THEORA: 148 case CODEC_ID_THEORA:
145 return kCodecTheora; 149 return kCodecTheora;
146 case CODEC_ID_MPEG4: 150 case CODEC_ID_MPEG4:
147 return kCodecMPEG4; 151 return kCodecMPEG4;
148 case CODEC_ID_VP8: 152 case CODEC_ID_VP8:
149 return kCodecVP8; 153 return kCodecVP8;
154 #ifndef CHROMIUM_OMIT_AV_CODEC_ID_VP9
150 case AV_CODEC_ID_VP9: 155 case AV_CODEC_ID_VP9:
151 return kCodecVP9; 156 return kCodecVP9;
157 #endif
152 default: 158 default:
153 DVLOG(1) << "Unknown video CodecID: " << codec_id; 159 DVLOG(1) << "Unknown video CodecID: " << codec_id;
154 } 160 }
155 return kUnknownVideoCodec; 161 return kUnknownVideoCodec;
156 } 162 }
157 163
158 static CodecID VideoCodecToCodecID(VideoCodec video_codec) { 164 static CodecID VideoCodecToCodecID(VideoCodec video_codec) {
159 switch (video_codec) { 165 switch (video_codec) {
160 case kCodecH264: 166 case kCodecH264:
161 return CODEC_ID_H264; 167 return CODEC_ID_H264;
162 case kCodecTheora: 168 case kCodecTheora:
163 return CODEC_ID_THEORA; 169 return CODEC_ID_THEORA;
164 case kCodecMPEG4: 170 case kCodecMPEG4:
165 return CODEC_ID_MPEG4; 171 return CODEC_ID_MPEG4;
166 case kCodecVP8: 172 case kCodecVP8:
167 return CODEC_ID_VP8; 173 return CODEC_ID_VP8;
174 #ifndef CHROMIUM_OMIT_AV_CODEC_ID_VP9
168 case kCodecVP9: 175 case kCodecVP9:
169 return AV_CODEC_ID_VP9; 176 return AV_CODEC_ID_VP9;
177 #endif
170 default: 178 default:
171 DVLOG(1) << "Unknown VideoCodec: " << video_codec; 179 DVLOG(1) << "Unknown VideoCodec: " << video_codec;
172 } 180 }
173 return CODEC_ID_NONE; 181 return CODEC_ID_NONE;
174 } 182 }
175 183
176 static VideoCodecProfile ProfileIDToVideoCodecProfile(int profile) { 184 static VideoCodecProfile ProfileIDToVideoCodecProfile(int profile) {
177 // Clear out the CONSTRAINED & INTRA flags which are strict subsets of the 185 // Clear out the CONSTRAINED & INTRA flags which are strict subsets of the
178 // corresponding profiles with which they're used. 186 // corresponding profiles with which they're used.
179 profile &= ~FF_PROFILE_H264_CONSTRAINED; 187 profile &= ~FF_PROFILE_H264_CONSTRAINED;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 case AV_CH_LAYOUT_HEXAGONAL: 469 case AV_CH_LAYOUT_HEXAGONAL:
462 return CHANNEL_LAYOUT_HEXAGONAL; 470 return CHANNEL_LAYOUT_HEXAGONAL;
463 case AV_CH_LAYOUT_6POINT1: 471 case AV_CH_LAYOUT_6POINT1:
464 return CHANNEL_LAYOUT_6_1; 472 return CHANNEL_LAYOUT_6_1;
465 case AV_CH_LAYOUT_6POINT1_BACK: 473 case AV_CH_LAYOUT_6POINT1_BACK:
466 return CHANNEL_LAYOUT_6_1_BACK; 474 return CHANNEL_LAYOUT_6_1_BACK;
467 case AV_CH_LAYOUT_6POINT1_FRONT: 475 case AV_CH_LAYOUT_6POINT1_FRONT:
468 return CHANNEL_LAYOUT_6_1_FRONT; 476 return CHANNEL_LAYOUT_6_1_FRONT;
469 case AV_CH_LAYOUT_7POINT0_FRONT: 477 case AV_CH_LAYOUT_7POINT0_FRONT:
470 return CHANNEL_LAYOUT_7_0_FRONT; 478 return CHANNEL_LAYOUT_7_0_FRONT;
479 #ifdef AV_CH_LAYOUT_7POINT1_WIDE_BACK
471 case AV_CH_LAYOUT_7POINT1_WIDE_BACK: 480 case AV_CH_LAYOUT_7POINT1_WIDE_BACK:
472 return CHANNEL_LAYOUT_7_1_WIDE_BACK; 481 return CHANNEL_LAYOUT_7_1_WIDE_BACK;
482 #endif
473 case AV_CH_LAYOUT_OCTAGONAL: 483 case AV_CH_LAYOUT_OCTAGONAL:
474 return CHANNEL_LAYOUT_OCTAGONAL; 484 return CHANNEL_LAYOUT_OCTAGONAL;
475 default: 485 default:
476 // FFmpeg channel_layout is 0 for .wav and .mp3. Attempt to guess layout 486 // FFmpeg channel_layout is 0 for .wav and .mp3. Attempt to guess layout
477 // based on the channel count. 487 // based on the channel count.
478 return GuessChannelLayout(channels); 488 return GuessChannelLayout(channels);
479 } 489 }
480 } 490 }
481 491
482 VideoFrame::Format PixelFormatToVideoFormat(PixelFormat pixel_format) { 492 VideoFrame::Format PixelFormatToVideoFormat(PixelFormat pixel_format) {
(...skipping 18 matching lines...) Expand all
501 return PIX_FMT_YUV422P; 511 return PIX_FMT_YUV422P;
502 case VideoFrame::YV12: 512 case VideoFrame::YV12:
503 return PIX_FMT_YUV420P; 513 return PIX_FMT_YUV420P;
504 default: 514 default:
505 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format; 515 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format;
506 } 516 }
507 return PIX_FMT_NONE; 517 return PIX_FMT_NONE;
508 } 518 }
509 519
510 } // namespace media 520 } // namespace media
OLDNEW
« no previous file with comments | « build/common.gypi ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698