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

Side by Side Diff: media/ffmpeg/ffmpeg_common.cc

Issue 10912080: Switch to AVIO instead of a custom FFmpeg URLProtocol handler. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: AVIO! Created 8 years, 2 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
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/ffmpeg/ffmpeg_common.h" 5 #include "media/ffmpeg/ffmpeg_common.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "media/base/decoder_buffer.h" 9 #include "media/base/decoder_buffer.h"
10 #include "media/base/video_util.h" 10 #include "media/base/video_util.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 case VideoFrame::YV16: 381 case VideoFrame::YV16:
382 return PIX_FMT_YUV422P; 382 return PIX_FMT_YUV422P;
383 case VideoFrame::YV12: 383 case VideoFrame::YV12:
384 return PIX_FMT_YUV420P; 384 return PIX_FMT_YUV420P;
385 default: 385 default:
386 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format; 386 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format;
387 } 387 }
388 return PIX_FMT_NONE; 388 return PIX_FMT_NONE;
389 } 389 }
390 390
391 void DestroyAVFormatContext(AVFormatContext* format_context) {
392 DCHECK(format_context);
393
394 // Iterate each stream and destroy each one of them.
395 if (format_context->streams) {
396 int streams = format_context->nb_streams;
397 for (int i = 0; i < streams; ++i) {
398 AVStream* stream = format_context->streams[i];
399
400 // The conditions for calling avcodec_close():
401 // 1. AVStream is alive.
402 // 2. AVCodecContext in AVStream is alive.
403 // 3. AVCodec in AVCodecContext is alive.
404 // Notice that closing a codec context without prior avcodec_open2() will
405 // result in a crash in FFmpeg.
406 if (stream && stream->codec && stream->codec->codec) {
407 stream->discard = AVDISCARD_ALL;
408 avcodec_close(stream->codec);
409 }
410 }
411 }
412
413 // Then finally cleanup the format context.
414 avformat_close_input(&format_context);
415 }
416
417 } // namespace media 391 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698