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

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: Rebase. 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/ffmpeg/ffmpeg_common.h ('k') | media/filters/audio_file_reader.h » ('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/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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 case VideoFrame::YV16: 406 case VideoFrame::YV16:
407 return PIX_FMT_YUV422P; 407 return PIX_FMT_YUV422P;
408 case VideoFrame::YV12: 408 case VideoFrame::YV12:
409 return PIX_FMT_YUV420P; 409 return PIX_FMT_YUV420P;
410 default: 410 default:
411 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format; 411 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format;
412 } 412 }
413 return PIX_FMT_NONE; 413 return PIX_FMT_NONE;
414 } 414 }
415 415
416 void DestroyAVFormatContext(AVFormatContext* format_context) {
417 DCHECK(format_context);
418
419 // Iterate each stream and destroy each one of them.
420 if (format_context->streams) {
421 int streams = format_context->nb_streams;
422 for (int i = 0; i < streams; ++i) {
423 AVStream* stream = format_context->streams[i];
424
425 // The conditions for calling avcodec_close():
426 // 1. AVStream is alive.
427 // 2. AVCodecContext in AVStream is alive.
428 // 3. AVCodec in AVCodecContext is alive.
429 // Notice that closing a codec context without prior avcodec_open2() will
430 // result in a crash in FFmpeg.
431 if (stream && stream->codec && stream->codec->codec) {
432 stream->discard = AVDISCARD_ALL;
433 avcodec_close(stream->codec);
434 }
435 }
436 }
437
438 // Then finally cleanup the format context.
439 avformat_close_input(&format_context);
440 }
441
442 } // namespace media 416 } // namespace media
OLDNEW
« no previous file with comments | « media/ffmpeg/ffmpeg_common.h ('k') | media/filters/audio_file_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698