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

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

Issue 2697863003: color: Clarify default behaviors (Closed)
Patch Set: Incorporate review feedback Created 3 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
« no previous file with comments | « media/ffmpeg/ffmpeg_common.cc ('k') | media/filters/h264_parser.cc » ('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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 ColorSpace color_space = AVColorSpaceToColorSpace(codec_context->colorspace, 178 ColorSpace color_space = AVColorSpaceToColorSpace(codec_context->colorspace,
179 codec_context->color_range); 179 codec_context->color_range);
180 if (color_space == COLOR_SPACE_UNSPECIFIED) 180 if (color_space == COLOR_SPACE_UNSPECIFIED)
181 color_space = config_.color_space(); 181 color_space = config_.color_space();
182 video_frame->metadata()->SetInteger(VideoFrameMetadata::COLOR_SPACE, 182 video_frame->metadata()->SetInteger(VideoFrameMetadata::COLOR_SPACE,
183 color_space); 183 color_space);
184 184
185 if (codec_context->color_primaries != AVCOL_PRI_UNSPECIFIED || 185 if (codec_context->color_primaries != AVCOL_PRI_UNSPECIFIED ||
186 codec_context->color_trc != AVCOL_TRC_UNSPECIFIED || 186 codec_context->color_trc != AVCOL_TRC_UNSPECIFIED ||
187 codec_context->colorspace != AVCOL_SPC_UNSPECIFIED) { 187 codec_context->colorspace != AVCOL_SPC_UNSPECIFIED) {
188 video_frame->set_color_space( 188 video_frame->set_color_space(gfx::ColorSpace::CreateVideo(
189 gfx::ColorSpace(codec_context->color_primaries, 189 codec_context->color_primaries, codec_context->color_trc,
190 codec_context->color_trc, codec_context->colorspace, 190 codec_context->colorspace,
191 codec_context->color_range != AVCOL_RANGE_MPEG 191 codec_context->color_range != AVCOL_RANGE_MPEG
192 ? gfx::ColorSpace::RangeID::FULL 192 ? gfx::ColorSpace::RangeID::FULL
193 : gfx::ColorSpace::RangeID::LIMITED)); 193 : gfx::ColorSpace::RangeID::LIMITED));
194 } 194 }
195 195
196 for (size_t i = 0; i < VideoFrame::NumPlanes(video_frame->format()); i++) { 196 for (size_t i = 0; i < VideoFrame::NumPlanes(video_frame->format()); i++) {
197 frame->data[i] = video_frame->data(i); 197 frame->data[i] = video_frame->data(i);
198 frame->linesize[i] = video_frame->stride(i); 198 frame->linesize[i] = video_frame->stride(i);
199 } 199 }
200 200
201 frame->width = coded_size.width(); 201 frame->width = coded_size.width();
202 frame->height = coded_size.height(); 202 frame->height = coded_size.height();
203 frame->format = codec_context->pix_fmt; 203 frame->format = codec_context->pix_fmt;
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { 427 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) {
428 ReleaseFFmpegResources(); 428 ReleaseFFmpegResources();
429 return false; 429 return false;
430 } 430 }
431 431
432 av_frame_.reset(av_frame_alloc()); 432 av_frame_.reset(av_frame_alloc());
433 return true; 433 return true;
434 } 434 }
435 435
436 } // namespace media 436 } // namespace media
OLDNEW
« no previous file with comments | « media/ffmpeg/ffmpeg_common.cc ('k') | media/filters/h264_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698