From 5942fbfe6efa448722685c6ec3f157a8dd996228 Mon Sep 17 00:00:00 2001 From: "scherkus@chromium.org" Date: Mon, 15 Jun 2009 23:50:57 +0000 Subject: 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 --- media/base/mock_ffmpeg.cc | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 media/base/mock_ffmpeg.cc (limited to 'media/base/mock_ffmpeg.cc') 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 -- cgit v1.1