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

Side by Side Diff: media/webm/webm_stream_parser.cc

Issue 9317096: Fix media code to work with new ffmpeg. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix years. Created 8 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 | « media/tools/media_bench/media_bench.cc ('k') | no next file » | 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/webm/webm_stream_parser.h" 5 #include "media/webm/webm_stream_parser.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "media/ffmpeg/ffmpeg_common.h" 9 #include "media/ffmpeg/ffmpeg_common.h"
10 #include "media/filters/ffmpeg_glue.h" 10 #include "media/filters/ffmpeg_glue.h"
(...skipping 28 matching lines...) Expand all
39 AudioDecoderConfig audio_config_; 39 AudioDecoderConfig audio_config_;
40 VideoDecoderConfig video_config_; 40 VideoDecoderConfig video_config_;
41 41
42 // Backing buffer for |url_protocol_|. 42 // Backing buffer for |url_protocol_|.
43 scoped_array<uint8> url_protocol_buffer_; 43 scoped_array<uint8> url_protocol_buffer_;
44 44
45 // Protocol used by |format_context_|. It must outlive the context object. 45 // Protocol used by |format_context_|. It must outlive the context object.
46 scoped_ptr<FFmpegURLProtocol> url_protocol_; 46 scoped_ptr<FFmpegURLProtocol> url_protocol_;
47 47
48 // FFmpeg format context for this demuxer. It is created by 48 // FFmpeg format context for this demuxer. It is created by
49 // av_open_input_file() during demuxer initialization and cleaned up with 49 // avformat_open_input() during demuxer initialization and cleaned up with
50 // DestroyAVFormatContext() in the destructor. 50 // DestroyAVFormatContext() in the destructor.
51 AVFormatContext* format_context_; 51 AVFormatContext* format_context_;
52 52
53 static const uint8 kWebMHeader[]; 53 static const uint8 kWebMHeader[];
54 static const int kSegmentSizeOffset; 54 static const int kSegmentSizeOffset;
55 static const uint8 kEmptyCluster[]; 55 static const uint8 kEmptyCluster[];
56 56
57 DISALLOW_COPY_AND_ASSIGN(FFmpegConfigHelper); 57 DISALLOW_COPY_AND_ASSIGN(FFmpegConfigHelper);
58 }; 58 };
59 59
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 GG_LONGLONG(0x0100000000000000); 132 GG_LONGLONG(0x0100000000000000);
133 for (int i = 0; i < 8; i++) { 133 for (int i = 0; i < 8; i++) {
134 buf[kSegmentSizeOffset + i] = (tmp >> (8 * (7 - i))) & 0xff; 134 buf[kSegmentSizeOffset + i] = (tmp >> (8 * (7 - i))) & 0xff;
135 } 135 }
136 136
137 url_protocol_.reset(new InMemoryUrlProtocol(buf, buf_size, true)); 137 url_protocol_.reset(new InMemoryUrlProtocol(buf, buf_size, true));
138 std::string key = FFmpegGlue::GetInstance()->AddProtocol(url_protocol_.get()); 138 std::string key = FFmpegGlue::GetInstance()->AddProtocol(url_protocol_.get());
139 139
140 // Open FFmpeg AVFormatContext. 140 // Open FFmpeg AVFormatContext.
141 AVFormatContext* context = NULL; 141 AVFormatContext* context = NULL;
142 int result = av_open_input_file(&context, key.c_str(), NULL, 0, NULL); 142 int result = avformat_open_input(&context, key.c_str(), NULL, NULL);
143 143
144 if (result < 0) 144 if (result < 0)
145 return NULL; 145 return NULL;
146 146
147 return context; 147 return context;
148 } 148 }
149 149
150 bool FFmpegConfigHelper::SetupStreamConfigs() { 150 bool FFmpegConfigHelper::SetupStreamConfigs() {
151 int result = av_find_stream_info(format_context_); 151 int result = avformat_find_stream_info(format_context_, NULL);
152 152
153 if (result < 0) 153 if (result < 0)
154 return false; 154 return false;
155 155
156 bool no_supported_streams = true; 156 bool no_supported_streams = true;
157 for (size_t i = 0; i < format_context_->nb_streams; ++i) { 157 for (size_t i = 0; i < format_context_->nb_streams; ++i) {
158 AVStream* stream = format_context_->streams[i]; 158 AVStream* stream = format_context_->streams[i];
159 AVCodecContext* codec_context = stream->codec; 159 AVCodecContext* codec_context = stream->codec;
160 AVMediaType codec_type = codec_context->codec_type; 160 AVMediaType codec_type = codec_context->codec_type;
161 161
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 if (!audio_buffers.empty() && !host_->OnAudioBuffers(audio_buffers)) 343 if (!audio_buffers.empty() && !host_->OnAudioBuffers(audio_buffers))
344 return -1; 344 return -1;
345 345
346 if (!video_buffers.empty() && !host_->OnVideoBuffers(video_buffers)) 346 if (!video_buffers.empty() && !host_->OnVideoBuffers(video_buffers))
347 return -1; 347 return -1;
348 348
349 return bytes_parsed; 349 return bytes_parsed;
350 } 350 }
351 351
352 } // namespace media 352 } // namespace media
OLDNEW
« no previous file with comments | « media/tools/media_bench/media_bench.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698