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

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

Issue 111153003: FFmpeg fixups for M33 roll. Now with more Opus! (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DEPS update. Created 7 years 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 | « media/filters/ffmpeg_audio_decoder.cc ('k') | media/filters/opus_audio_decoder.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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 for (int i = 0; i < 3; i++) { 98 for (int i = 0; i < 3; i++) {
99 frame->base[i] = video_frame->data(i); 99 frame->base[i] = video_frame->data(i);
100 frame->data[i] = video_frame->data(i); 100 frame->data[i] = video_frame->data(i);
101 frame->linesize[i] = video_frame->stride(i); 101 frame->linesize[i] = video_frame->stride(i);
102 } 102 }
103 103
104 frame->opaque = NULL; 104 frame->opaque = NULL;
105 video_frame.swap(reinterpret_cast<VideoFrame**>(&frame->opaque)); 105 video_frame.swap(reinterpret_cast<VideoFrame**>(&frame->opaque));
106 frame->type = FF_BUFFER_TYPE_USER; 106 frame->type = FF_BUFFER_TYPE_USER;
107 frame->pkt_pts = codec_context->pkt ? codec_context->pkt->pts :
108 AV_NOPTS_VALUE;
109 frame->width = codec_context->width; 107 frame->width = codec_context->width;
110 frame->height = codec_context->height; 108 frame->height = codec_context->height;
111 frame->format = codec_context->pix_fmt; 109 frame->format = codec_context->pix_fmt;
112 110
113 return 0; 111 return 0;
114 } 112 }
115 113
116 static int GetVideoBufferImpl(AVCodecContext* s, AVFrame* frame) { 114 static int GetVideoBufferImpl(AVCodecContext* s, AVFrame* frame) {
117 FFmpegVideoDecoder* decoder = static_cast<FFmpegVideoDecoder*>(s->opaque); 115 FFmpegVideoDecoder* decoder = static_cast<FFmpegVideoDecoder*>(s->opaque);
118 return decoder->GetVideoBuffer(s, frame); 116 return decoder->GetVideoBuffer(s, frame);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 codec_context_->flags |= CODEC_FLAG_EMU_EDGE; 373 codec_context_->flags |= CODEC_FLAG_EMU_EDGE;
376 codec_context_->get_buffer = GetVideoBufferImpl; 374 codec_context_->get_buffer = GetVideoBufferImpl;
377 codec_context_->release_buffer = ReleaseVideoBufferImpl; 375 codec_context_->release_buffer = ReleaseVideoBufferImpl;
378 376
379 AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); 377 AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
380 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { 378 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) {
381 ReleaseFFmpegResources(); 379 ReleaseFFmpegResources();
382 return false; 380 return false;
383 } 381 }
384 382
385 av_frame_.reset(avcodec_alloc_frame()); 383 av_frame_.reset(av_frame_alloc());
386 return true; 384 return true;
387 } 385 }
388 386
389 } // namespace media 387 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_audio_decoder.cc ('k') | media/filters/opus_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698