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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 public: | 42 public: |
43 Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline) | 43 Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline) |
44 : cfg_(cfg), deadline_(deadline), init_done_(false) { | 44 : cfg_(cfg), deadline_(deadline), init_done_(false) { |
45 memset(&decoder_, 0, sizeof(decoder_)); | 45 memset(&decoder_, 0, sizeof(decoder_)); |
46 } | 46 } |
47 | 47 |
48 virtual ~Decoder() { | 48 virtual ~Decoder() { |
49 vpx_codec_destroy(&decoder_); | 49 vpx_codec_destroy(&decoder_); |
50 } | 50 } |
51 | 51 |
| 52 vpx_codec_err_t PeekStream(const uint8_t *cxdata, size_t size, |
| 53 vpx_codec_stream_info_t *stream_info); |
| 54 |
52 vpx_codec_err_t DecodeFrame(const uint8_t *cxdata, size_t size); | 55 vpx_codec_err_t DecodeFrame(const uint8_t *cxdata, size_t size); |
53 | 56 |
| 57 vpx_codec_err_t DecodeFrame(const uint8_t *cxdata, size_t size, |
| 58 void *user_priv); |
| 59 |
54 DxDataIterator GetDxData() { | 60 DxDataIterator GetDxData() { |
55 return DxDataIterator(&decoder_); | 61 return DxDataIterator(&decoder_); |
56 } | 62 } |
57 | 63 |
58 void set_deadline(unsigned long deadline) { | 64 void set_deadline(unsigned long deadline) { |
59 deadline_ = deadline; | 65 deadline_ = deadline; |
60 } | 66 } |
61 | 67 |
62 void Control(int ctrl_id, int arg) { | 68 void Control(int ctrl_id, int arg) { |
63 InitOnce(); | 69 InitOnce(); |
(...skipping 14 matching lines...) Expand all Loading... |
78 | 84 |
79 // Passes the external frame buffer information to libvpx. | 85 // Passes the external frame buffer information to libvpx. |
80 vpx_codec_err_t SetFrameBufferFunctions( | 86 vpx_codec_err_t SetFrameBufferFunctions( |
81 vpx_get_frame_buffer_cb_fn_t cb_get, | 87 vpx_get_frame_buffer_cb_fn_t cb_get, |
82 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) { |
83 InitOnce(); | 89 InitOnce(); |
84 return vpx_codec_set_frame_buffer_functions( | 90 return vpx_codec_set_frame_buffer_functions( |
85 &decoder_, cb_get, cb_release, user_priv); | 91 &decoder_, cb_get, cb_release, user_priv); |
86 } | 92 } |
87 | 93 |
| 94 const char* GetDecoderName() { |
| 95 return vpx_codec_iface_name(CodecInterface()); |
| 96 } |
| 97 |
88 protected: | 98 protected: |
89 virtual vpx_codec_iface_t* CodecInterface() const = 0; | 99 virtual vpx_codec_iface_t* CodecInterface() const = 0; |
90 | 100 |
91 void InitOnce() { | 101 void InitOnce() { |
92 if (!init_done_) { | 102 if (!init_done_) { |
93 const vpx_codec_err_t res = vpx_codec_dec_init(&decoder_, | 103 const vpx_codec_err_t res = vpx_codec_dec_init(&decoder_, |
94 CodecInterface(), | 104 CodecInterface(), |
95 &cfg_, 0); | 105 &cfg_, 0); |
96 ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError(); | 106 ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError(); |
97 init_done_ = true; | 107 init_done_ = true; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 explicit DecoderTest(const CodecFactory *codec) : codec_(codec) {} | 140 explicit DecoderTest(const CodecFactory *codec) : codec_(codec) {} |
131 | 141 |
132 virtual ~DecoderTest() {} | 142 virtual ~DecoderTest() {} |
133 | 143 |
134 const CodecFactory *codec_; | 144 const CodecFactory *codec_; |
135 }; | 145 }; |
136 | 146 |
137 } // namespace libvpx_test | 147 } // namespace libvpx_test |
138 | 148 |
139 #endif // TEST_DECODE_TEST_DRIVER_H_ | 149 #endif // TEST_DECODE_TEST_DRIVER_H_ |
OLD | NEW |