summaryrefslogtreecommitdiffstats
path: root/media/base/mock_ffmpeg.cc
diff options
context:
space:
mode:
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