diff options
author | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-03 01:19:05 +0000 |
---|---|---|
committer | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-03 01:19:05 +0000 |
commit | b89f293f5159e1adb76355ce8f6078ff76aa062e (patch) | |
tree | eff350626757af7fde85c561c223248efd656811 /media | |
parent | d87395d59ef04bf0182f6d957c2622b25fb37152 (diff) | |
download | chromium_src-b89f293f5159e1adb76355ce8f6078ff76aa062e.zip chromium_src-b89f293f5159e1adb76355ce8f6078ff76aa062e.tar.gz chromium_src-b89f293f5159e1adb76355ce8f6078ff76aa062e.tar.bz2 |
ffmpeg better message for error on opening file if the file opens but the codec is not supported.
BUG=37256
TEST=ffmpeg_tests.exe d:\mediatests\elephant2.m4v with chromium and you should get 'File format not supported'
Review URL: http://codereview.chromium.org/661426
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40472 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/test/ffmpeg_tests/ffmpeg_tests.cc | 16 | ||||
-rw-r--r-- | media/tools/media_bench/media_bench.cc | 16 | ||||
-rw-r--r-- | media/tools/omx_test/file_reader_util.cc | 24 |
3 files changed, 43 insertions, 13 deletions
diff --git a/media/test/ffmpeg_tests/ffmpeg_tests.cc b/media/test/ffmpeg_tests/ffmpeg_tests.cc index b47c5d5..11fd9cc 100644 --- a/media/test/ffmpeg_tests/ffmpeg_tests.cc +++ b/media/test/ffmpeg_tests/ffmpeg_tests.cc @@ -122,9 +122,19 @@ int main(int argc, const char** argv) { av_register_all(); av_register_protocol(&kFFmpegFileProtocol); AVFormatContext* format_context = NULL; - if (av_open_input_file(&format_context, in_path.c_str(), NULL, 0, NULL) < 0) { - std::cerr << "Error: Could not open input for " - << in_path << std::endl; + int result = av_open_input_file(&format_context, in_path.c_str(), + NULL, 0, NULL); + if (result < 0) { + switch (result) { + case AVERROR_NOFMT: + std::cerr << "Error: File format not supported " + << in_path << std::endl; + break; + default: + std::cerr << "Error: Could not open input for " + << in_path << std::endl; + break; + } return 1; } diff --git a/media/tools/media_bench/media_bench.cc b/media/tools/media_bench/media_bench.cc index 5e1b844..57217dc 100644 --- a/media/tools/media_bench/media_bench.cc +++ b/media/tools/media_bench/media_bench.cc @@ -212,9 +212,19 @@ int main(int argc, const char** argv) { av_register_all(); av_register_protocol(&kFFmpegFileProtocol); AVFormatContext* format_context = NULL; - if (av_open_input_file(&format_context, in_path.c_str(), NULL, 0, NULL) < 0) { - std::cerr << "Error: Could not open input for " - << in_path << std::endl; + int result = av_open_input_file(&format_context, in_path.c_str(), + NULL, 0, NULL); + if (result < 0) { + switch (result) { + case AVERROR_NOFMT: + std::cerr << "Error: File format not supported " + << in_path << std::endl; + break; + default: + std::cerr << "Error: Could not open input for " + << in_path << std::endl; + break; + } return 1; } diff --git a/media/tools/omx_test/file_reader_util.cc b/media/tools/omx_test/file_reader_util.cc index 4414cd7..f397bb6 100644 --- a/media/tools/omx_test/file_reader_util.cc +++ b/media/tools/omx_test/file_reader_util.cc @@ -1,6 +1,6 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this -// source code is governed by a BSD-style license that can be found in the -// LICENSE file. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "media/tools/omx_test/file_reader_util.h" @@ -124,10 +124,20 @@ FFmpegFileReader::~FFmpegFileReader() { } bool FFmpegFileReader::Initialize() { - if (av_open_input_file(&format_context_, - filename_.c_str(), NULL, 0, NULL) < 0) { - LOG(ERROR) << "can't open file " << filename_; - return false;; + int result = av_open_input_file(&format_context_, filename_.c_str(), + NULL, 0, NULL); + if (result < 0) { + switch (result) { + case AVERROR_NOFMT: + LOG(ERROR) << "Error: File format not supported " + << filename_ << std::endl; + break; + default: + LOG(ERROR) << "Error: Could not open input for " + << filename_ << std::endl; + break; + } + return false; } if (av_find_stream_info(format_context_) < 0) { LOG(ERROR) << "can't use FFmpeg to parse stream info"; |