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

Side by Side Diff: media/filters/ffmpeg_video_decoder.cc

Issue 2841813002: Converting video color space enums to their corresponding gfx:color space eqvivalent. (Closed)
Patch Set: Fixed ==> "warning C4701: potentially uninitialized local variable 'primary_id' used" Created 3 years, 7 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
« no previous file with comments | « media/base/video_color_space_unittest.cc ('k') | ui/gfx/color_space.h » ('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/filters/ffmpeg_video_decoder.h" 5 #include "media/filters/ffmpeg_video_decoder.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 ColorSpace color_space = AVColorSpaceToColorSpace(codec_context->colorspace, 180 ColorSpace color_space = AVColorSpaceToColorSpace(codec_context->colorspace,
181 codec_context->color_range); 181 codec_context->color_range);
182 if (color_space == COLOR_SPACE_UNSPECIFIED) 182 if (color_space == COLOR_SPACE_UNSPECIFIED)
183 color_space = config_.color_space(); 183 color_space = config_.color_space();
184 video_frame->metadata()->SetInteger(VideoFrameMetadata::COLOR_SPACE, 184 video_frame->metadata()->SetInteger(VideoFrameMetadata::COLOR_SPACE,
185 color_space); 185 color_space);
186 186
187 if (codec_context->color_primaries != AVCOL_PRI_UNSPECIFIED || 187 if (codec_context->color_primaries != AVCOL_PRI_UNSPECIFIED ||
188 codec_context->color_trc != AVCOL_TRC_UNSPECIFIED || 188 codec_context->color_trc != AVCOL_TRC_UNSPECIFIED ||
189 codec_context->colorspace != AVCOL_SPC_UNSPECIFIED) { 189 codec_context->colorspace != AVCOL_SPC_UNSPECIFIED) {
190 video_frame->set_color_space(gfx::ColorSpace::CreateVideo( 190 media::VideoColorSpace video_color_space = media::VideoColorSpace(
191 codec_context->color_primaries, codec_context->color_trc, 191 codec_context->color_primaries, codec_context->color_trc,
192 codec_context->colorspace, 192 codec_context->colorspace,
193 codec_context->color_range != AVCOL_RANGE_MPEG 193 codec_context->color_range != AVCOL_RANGE_MPEG
194 ? gfx::ColorSpace::RangeID::FULL 194 ? gfx::ColorSpace::RangeID::FULL
195 : gfx::ColorSpace::RangeID::LIMITED)); 195 : gfx::ColorSpace::RangeID::LIMITED);
196 video_frame->set_color_space(video_color_space.ToGfxColorSpace());
196 } 197 }
197 198
198 for (size_t i = 0; i < VideoFrame::NumPlanes(video_frame->format()); i++) { 199 for (size_t i = 0; i < VideoFrame::NumPlanes(video_frame->format()); i++) {
199 frame->data[i] = video_frame->data(i); 200 frame->data[i] = video_frame->data(i);
200 frame->linesize[i] = video_frame->stride(i); 201 frame->linesize[i] = video_frame->stride(i);
201 } 202 }
202 203
203 frame->width = coded_size.width(); 204 frame->width = coded_size.width();
204 frame->height = coded_size.height(); 205 frame->height = coded_size.height();
205 frame->format = codec_context->pix_fmt; 206 frame->format = codec_context->pix_fmt;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { 433 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) {
433 ReleaseFFmpegResources(); 434 ReleaseFFmpegResources();
434 return false; 435 return false;
435 } 436 }
436 437
437 av_frame_.reset(av_frame_alloc()); 438 av_frame_.reset(av_frame_alloc());
438 return true; 439 return true;
439 } 440 }
440 441
441 } // namespace media 442 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_color_space_unittest.cc ('k') | ui/gfx/color_space.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698