OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 // Passes the external frame buffer information to libvpx. | 85 // Passes the external frame buffer information to libvpx. |
86 vpx_codec_err_t SetFrameBufferFunctions( | 86 vpx_codec_err_t SetFrameBufferFunctions( |
87 vpx_get_frame_buffer_cb_fn_t cb_get, | 87 vpx_get_frame_buffer_cb_fn_t cb_get, |
88 vpx_release_frame_buffer_cb_fn_t cb_release, void *user_priv) { | 88 vpx_release_frame_buffer_cb_fn_t cb_release, void *user_priv) { |
89 InitOnce(); | 89 InitOnce(); |
90 return vpx_codec_set_frame_buffer_functions( | 90 return vpx_codec_set_frame_buffer_functions( |
91 &decoder_, cb_get, cb_release, user_priv); | 91 &decoder_, cb_get, cb_release, user_priv); |
92 } | 92 } |
93 | 93 |
94 const char* GetDecoderName() { | 94 const char* GetDecoderName() const { |
95 return vpx_codec_iface_name(CodecInterface()); | 95 return vpx_codec_iface_name(CodecInterface()); |
96 } | 96 } |
97 | 97 |
| 98 bool IsVP8() const; |
| 99 |
98 protected: | 100 protected: |
99 virtual vpx_codec_iface_t* CodecInterface() const = 0; | 101 virtual vpx_codec_iface_t* CodecInterface() const = 0; |
100 | 102 |
101 void InitOnce() { | 103 void InitOnce() { |
102 if (!init_done_) { | 104 if (!init_done_) { |
103 const vpx_codec_err_t res = vpx_codec_dec_init(&decoder_, | 105 const vpx_codec_err_t res = vpx_codec_dec_init(&decoder_, |
104 CodecInterface(), | 106 CodecInterface(), |
105 &cfg_, 0); | 107 &cfg_, 0); |
106 ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError(); | 108 ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError(); |
107 init_done_ = true; | 109 init_done_ = true; |
(...skipping 23 matching lines...) Expand all Loading... |
131 const CompressedVideoSource& /* video */, | 133 const CompressedVideoSource& /* video */, |
132 Decoder *decoder) { | 134 Decoder *decoder) { |
133 EXPECT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError(); | 135 EXPECT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError(); |
134 return VPX_CODEC_OK == res_dec; | 136 return VPX_CODEC_OK == res_dec; |
135 } | 137 } |
136 | 138 |
137 // Hook to be called on every decompressed frame. | 139 // Hook to be called on every decompressed frame. |
138 virtual void DecompressedFrameHook(const vpx_image_t& img, | 140 virtual void DecompressedFrameHook(const vpx_image_t& img, |
139 const unsigned int frame_number) {} | 141 const unsigned int frame_number) {} |
140 | 142 |
| 143 // Hook to be called on peek result |
| 144 virtual void HandlePeekResult(Decoder* const decoder, |
| 145 CompressedVideoSource *video, |
| 146 const vpx_codec_err_t res_peek); |
| 147 |
141 protected: | 148 protected: |
142 explicit DecoderTest(const CodecFactory *codec) : codec_(codec) {} | 149 explicit DecoderTest(const CodecFactory *codec) : codec_(codec) {} |
143 | 150 |
144 virtual ~DecoderTest() {} | 151 virtual ~DecoderTest() {} |
145 | 152 |
146 const CodecFactory *codec_; | 153 const CodecFactory *codec_; |
147 }; | 154 }; |
148 | 155 |
149 } // namespace libvpx_test | 156 } // namespace libvpx_test |
150 | 157 |
151 #endif // TEST_DECODE_TEST_DRIVER_H_ | 158 #endif // TEST_DECODE_TEST_DRIVER_H_ |
OLD | NEW |