| 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 #include "media/base/mock_ffmpeg.h" | 5 #include "media/base/mock_ffmpeg.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "media/filters/ffmpeg_common.h" | 8 #include "media/filters/ffmpeg_common.h" |
| 9 | 9 |
| 10 using ::testing::_; | 10 using ::testing::_; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 // static | 71 // static |
| 72 void MockFFmpeg::DestructPacket(AVPacket* packet) { | 72 void MockFFmpeg::DestructPacket(AVPacket* packet) { |
| 73 delete [] packet->data; | 73 delete [] packet->data; |
| 74 packet->data = NULL; | 74 packet->data = NULL; |
| 75 packet->size = 0; | 75 packet->size = 0; |
| 76 } | 76 } |
| 77 | 77 |
| 78 // FFmpeg stubs that delegate to the FFmpegMock instance. | 78 // FFmpeg stubs that delegate to the FFmpegMock instance. |
| 79 extern "C" { | 79 extern "C" { |
| 80 | |
| 81 void avcodec_init() { | 80 void avcodec_init() { |
| 82 media::MockFFmpeg::get()->AVCodecInit(); | 81 media::MockFFmpeg::get()->AVCodecInit(); |
| 83 } | 82 } |
| 84 | 83 |
| 85 int av_register_protocol(URLProtocol* protocol) { | 84 int av_register_protocol(URLProtocol* protocol) { |
| 86 return media::MockFFmpeg::get()->AVRegisterProtocol(protocol); | 85 return media::MockFFmpeg::get()->AVRegisterProtocol(protocol); |
| 87 } | 86 } |
| 88 | 87 |
| 89 void av_register_all() { | 88 void av_register_all() { |
| 90 media::MockFFmpeg::get()->AVRegisterAll(); | 89 media::MockFFmpeg::get()->AVRegisterAll(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 } | 166 } |
| 168 | 167 |
| 169 void av_free(void* ptr) { | 168 void av_free(void* ptr) { |
| 170 // Freeing NULL pointers are valid, but they aren't interesting from a mock | 169 // Freeing NULL pointers are valid, but they aren't interesting from a mock |
| 171 // perspective. | 170 // perspective. |
| 172 if (ptr) { | 171 if (ptr) { |
| 173 media::MockFFmpeg::get()->AVFree(ptr); | 172 media::MockFFmpeg::get()->AVFree(ptr); |
| 174 } | 173 } |
| 175 } | 174 } |
| 176 | 175 |
| 176 int av_dup_packet(AVPacket* packet) { |
| 177 return media::MockFFmpeg::get()->AVDupPacket(packet); |
| 178 } |
| 177 } // extern "C" | 179 } // extern "C" |
| 178 | 180 |
| 179 } // namespace media | 181 } // namespace media |
| OLD | NEW |