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

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

Issue 11269017: Plumb through cropped output size for VideoFrame (Closed) Base URL: https://git.chromium.org/git/chromium/src@git-svn
Patch Set: Found the windows failure, and fixed it. Thanks akalin@ Created 8 years, 1 month 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_util_unittest.cc ('k') | media/filters/ffmpeg_video_decoder_unittest.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 <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 gfx::Size natural_size; 85 gfx::Size natural_size;
86 if (codec_context->sample_aspect_ratio.num > 0) { 86 if (codec_context->sample_aspect_ratio.num > 0) {
87 natural_size = GetNaturalSize(size, 87 natural_size = GetNaturalSize(size,
88 codec_context->sample_aspect_ratio.num, 88 codec_context->sample_aspect_ratio.num,
89 codec_context->sample_aspect_ratio.den); 89 codec_context->sample_aspect_ratio.den);
90 } else { 90 } else {
91 natural_size = demuxer_stream_->video_decoder_config().natural_size(); 91 natural_size = demuxer_stream_->video_decoder_config().natural_size();
92 } 92 }
93 93
94 if (!VideoFrame::IsValidConfig(format, size, natural_size)) 94 if (!VideoFrame::IsValidConfig(format, size, gfx::Rect(size), natural_size))
95 return AVERROR(EINVAL); 95 return AVERROR(EINVAL);
96 96
97 scoped_refptr<VideoFrame> video_frame = 97 scoped_refptr<VideoFrame> video_frame =
98 VideoFrame::CreateFrame(format, size, natural_size, kNoTimestamp()); 98 VideoFrame::CreateFrame(format, size, gfx::Rect(size), natural_size,
99 kNoTimestamp());
99 100
100 for (int i = 0; i < 3; i++) { 101 for (int i = 0; i < 3; i++) {
101 frame->base[i] = video_frame->data(i); 102 frame->base[i] = video_frame->data(i);
102 frame->data[i] = video_frame->data(i); 103 frame->data[i] = video_frame->data(i);
103 frame->linesize[i] = video_frame->stride(i); 104 frame->linesize[i] = video_frame->stride(i);
104 } 105 }
105 106
106 frame->opaque = NULL; 107 frame->opaque = NULL;
107 video_frame.swap(reinterpret_cast<VideoFrame**>(&frame->opaque)); 108 video_frame.swap(reinterpret_cast<VideoFrame**>(&frame->opaque));
108 frame->type = FF_BUFFER_TYPE_USER; 109 frame->type = FF_BUFFER_TYPE_USER;
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 if (!codec || avcodec_open2(codec_context_, codec, NULL) < 0) { 527 if (!codec || avcodec_open2(codec_context_, codec, NULL) < 0) {
527 ReleaseFFmpegResources(); 528 ReleaseFFmpegResources();
528 return false; 529 return false;
529 } 530 }
530 531
531 av_frame_ = avcodec_alloc_frame(); 532 av_frame_ = avcodec_alloc_frame();
532 return true; 533 return true;
533 } 534 }
534 535
535 } // namespace media 536 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_util_unittest.cc ('k') | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698