OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef MEDIA_BASE_MOCK_FFMPEG_H_ | 5 #ifndef MEDIA_BASE_MOCK_FFMPEG_H_ |
6 #define MEDIA_BASE_MOCK_FFMPEG_H_ | 6 #define MEDIA_BASE_MOCK_FFMPEG_H_ |
7 | 7 |
8 // TODO(scherkus): See if we can remove ffmpeg_common from this file. | 8 // TODO(scherkus): See if we can remove ffmpeg_common from this file. |
9 #include "media/filters/ffmpeg_common.h" | 9 #include "media/filters/ffmpeg_common.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
11 | 11 |
12 namespace media { | 12 namespace media { |
13 | 13 |
14 class MockFFmpeg { | 14 class MockFFmpeg { |
15 public: | 15 public: |
16 MockFFmpeg(); | 16 MockFFmpeg(); |
17 virtual ~MockFFmpeg(); | 17 virtual ~MockFFmpeg(); |
18 | 18 |
19 MOCK_METHOD1(AVCodecFindDecoder, AVCodec*(enum CodecID id)); | 19 MOCK_METHOD1(AVCodecFindDecoder, AVCodec*(enum CodecID id)); |
20 MOCK_METHOD2(AVCodecOpen, int(AVCodecContext* avctx, AVCodec* codec)); | 20 MOCK_METHOD2(AVCodecOpen, int(AVCodecContext* avctx, AVCodec* codec)); |
| 21 MOCK_METHOD1(AVCodecClose, int(AVCodecContext* avctx)); |
21 MOCK_METHOD2(AVCodecThreadInit, int(AVCodecContext* avctx, int threads)); | 22 MOCK_METHOD2(AVCodecThreadInit, int(AVCodecContext* avctx, int threads)); |
22 MOCK_METHOD1(AVCodecFlushBuffers, void(AVCodecContext* avctx)); | 23 MOCK_METHOD1(AVCodecFlushBuffers, void(AVCodecContext* avctx)); |
23 MOCK_METHOD0(AVCodecAllocFrame, AVFrame*()); | 24 MOCK_METHOD0(AVCodecAllocFrame, AVFrame*()); |
24 MOCK_METHOD4(AVCodecDecodeVideo2, | 25 MOCK_METHOD4(AVCodecDecodeVideo2, |
25 int(AVCodecContext* avctx, AVFrame* picture, | 26 int(AVCodecContext* avctx, AVFrame* picture, |
26 int* got_picture_ptr, AVPacket* avpkt)); | 27 int* got_picture_ptr, AVPacket* avpkt)); |
27 | 28 |
28 MOCK_METHOD5(AVOpenInputFile, int(AVFormatContext** format, | 29 MOCK_METHOD5(AVOpenInputFile, int(AVFormatContext** format, |
29 const char* filename, | 30 const char* filename, |
30 AVInputFormat* input_format, | 31 AVInputFormat* input_format, |
31 int buffer_size, | 32 int buffer_size, |
32 AVFormatParameters* parameters)); | 33 AVFormatParameters* parameters)); |
| 34 MOCK_METHOD1(AVCloseInputFile, void(AVFormatContext* format)); |
33 MOCK_METHOD1(AVFindStreamInfo, int(AVFormatContext* format)); | 35 MOCK_METHOD1(AVFindStreamInfo, int(AVFormatContext* format)); |
34 MOCK_METHOD2(AVReadFrame, int(AVFormatContext* format, AVPacket* packet)); | 36 MOCK_METHOD2(AVReadFrame, int(AVFormatContext* format, AVPacket* packet)); |
35 MOCK_METHOD4(AVSeekFrame, int(AVFormatContext *format, | 37 MOCK_METHOD4(AVSeekFrame, int(AVFormatContext *format, |
36 int stream_index, | 38 int stream_index, |
37 int64_t timestamp, | 39 int64_t timestamp, |
38 int flags)); | 40 int flags)); |
39 | 41 |
40 MOCK_METHOD1(AVInitPacket, void(AVPacket* pkt)); | 42 MOCK_METHOD1(AVInitPacket, void(AVPacket* pkt)); |
41 MOCK_METHOD2(AVNewPacket, int(AVPacket* packet, int size)); | 43 MOCK_METHOD2(AVNewPacket, int(AVPacket* packet, int size)); |
42 MOCK_METHOD1(AVFreePacket, void(AVPacket* packet)); | 44 MOCK_METHOD1(AVFreePacket, void(AVPacket* packet)); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 arg0->destruct(arg0); | 106 arg0->destruct(arg0); |
105 } | 107 } |
106 | 108 |
107 // Decrement number of packets allocated. | 109 // Decrement number of packets allocated. |
108 MockFFmpeg::get()->dec_outstanding_packets(); | 110 MockFFmpeg::get()->dec_outstanding_packets(); |
109 } | 111 } |
110 | 112 |
111 } // namespace media | 113 } // namespace media |
112 | 114 |
113 #endif // MEDIA_BASE_MOCK_FFMPEG_H_ | 115 #endif // MEDIA_BASE_MOCK_FFMPEG_H_ |
OLD | NEW |