summaryrefslogtreecommitdiffstats
path: root/media/base/mock_ffmpeg.cc
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-15 23:50:57 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-15 23:50:57 +0000
commit5942fbfe6efa448722685c6ec3f157a8dd996228 (patch)
tree95f3001e63ada59e0d4b57d62025425012ed2545 /media/base/mock_ffmpeg.cc
parent9f1591d628b6b90e5bad4ad00264300188b29194 (diff)
downloadchromium_src-5942fbfe6efa448722685c6ec3f157a8dd996228.zip
chromium_src-5942fbfe6efa448722685c6ec3f157a8dd996228.tar.gz
chromium_src-5942fbfe6efa448722685c6ec3f157a8dd996228.tar.bz2
Moving MockFFmpeg to its own file and some media.gyp cleanup.
Step one of having a completely mocked FFmpeg library. Review URL: http://codereview.chromium.org/126160 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18455 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/mock_ffmpeg.cc')
-rw-r--r--media/base/mock_ffmpeg.cc60
1 files changed, 60 insertions, 0 deletions
diff --git a/media/base/mock_ffmpeg.cc b/media/base/mock_ffmpeg.cc
new file mode 100644
index 0000000..4e9fc03
--- /dev/null
+++ b/media/base/mock_ffmpeg.cc
@@ -0,0 +1,60 @@
+// Copyright (c) 2009 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/base/mock_ffmpeg.h"
+
+#include "base/logging.h"
+#include "media/filters/ffmpeg_common.h"
+
+namespace media {
+
+MockFFmpeg* MockFFmpeg::instance_ = NULL;
+
+// static
+void MockFFmpeg::set(MockFFmpeg* instance) {
+ instance_ = instance;
+}
+
+// static
+MockFFmpeg* MockFFmpeg::get() {
+ return instance_;
+}
+
+// FFmpeg stubs that delegate to the FFmpegMock instance.
+extern "C" {
+
+AVCodec* avcodec_find_decoder(enum CodecID id) {
+ return media::MockFFmpeg::get()->AVCodecFindDecoder(id);
+}
+
+int avcodec_open(AVCodecContext* avctx, AVCodec* codec) {
+ return media::MockFFmpeg::get()->AVCodecOpen(avctx, codec);
+}
+
+int avcodec_thread_init(AVCodecContext* avctx, int threads) {
+ return media::MockFFmpeg::get()->AVCodecThreadInit(avctx, threads);
+}
+
+void avcodec_flush_buffers(AVCodecContext* avctx) {
+ NOTREACHED();
+}
+
+AVFrame* avcodec_alloc_frame() {
+ NOTREACHED();
+ return NULL;
+}
+
+int avcodec_decode_video2(AVCodecContext* avctx, AVFrame* picture,
+ int* got_picture_ptr, AVPacket* avpkt) {
+ NOTREACHED();
+ return 0;
+}
+
+void av_init_packet(AVPacket* pkt) {
+ NOTREACHED();
+}
+
+} // extern "C"
+
+} // namespace media