Index: source/libvpx/test/decode_test_driver.h |
=================================================================== |
--- source/libvpx/test/decode_test_driver.h (revision 293588) |
+++ source/libvpx/test/decode_test_driver.h (working copy) |
@@ -41,10 +41,16 @@ |
class Decoder { |
public: |
Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline) |
- : cfg_(cfg), deadline_(deadline), init_done_(false) { |
+ : cfg_(cfg), flags_(0), deadline_(deadline), init_done_(false) { |
memset(&decoder_, 0, sizeof(decoder_)); |
} |
+ Decoder(vpx_codec_dec_cfg_t cfg, const vpx_codec_flags_t flag, |
+ unsigned long deadline) // NOLINT |
+ : cfg_(cfg), flags_(flag), deadline_(deadline), init_done_(false) { |
+ memset(&decoder_, 0, sizeof(decoder_)); |
+ } |
+ |
virtual ~Decoder() { |
vpx_codec_destroy(&decoder_); |
} |
@@ -66,15 +72,19 @@ |
} |
void Control(int ctrl_id, int arg) { |
+ Control(ctrl_id, arg, VPX_CODEC_OK); |
+ } |
+ |
+ void Control(int ctrl_id, const void *arg) { |
InitOnce(); |
const vpx_codec_err_t res = vpx_codec_control_(&decoder_, ctrl_id, arg); |
ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError(); |
} |
- void Control(int ctrl_id, const void *arg) { |
+ void Control(int ctrl_id, int arg, vpx_codec_err_t expected_value) { |
InitOnce(); |
const vpx_codec_err_t res = vpx_codec_control_(&decoder_, ctrl_id, arg); |
- ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError(); |
+ ASSERT_EQ(expected_value, res) << DecodeError(); |
} |
const char* DecodeError() { |
@@ -97,6 +107,10 @@ |
bool IsVP8() const; |
+ vpx_codec_ctx_t * GetDecoder() { |
+ return &decoder_; |
+ } |
+ |
protected: |
virtual vpx_codec_iface_t* CodecInterface() const = 0; |
@@ -104,7 +118,7 @@ |
if (!init_done_) { |
const vpx_codec_err_t res = vpx_codec_dec_init(&decoder_, |
CodecInterface(), |
- &cfg_, 0); |
+ &cfg_, flags_); |
ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError(); |
init_done_ = true; |
} |
@@ -112,6 +126,7 @@ |
vpx_codec_ctx_t decoder_; |
vpx_codec_dec_cfg_t cfg_; |
+ vpx_codec_flags_t flags_; |
unsigned int deadline_; |
bool init_done_; |
}; |
@@ -124,6 +139,9 @@ |
virtual void RunLoop(CompressedVideoSource *video, |
const vpx_codec_dec_cfg_t &dec_cfg); |
+ virtual void set_cfg(const vpx_codec_dec_cfg_t &dec_cfg); |
+ virtual void set_flags(const vpx_codec_flags_t flags); |
+ |
// Hook to be called before decompressing every frame. |
virtual void PreDecodeFrameHook(const CompressedVideoSource& /*video*/, |
Decoder* /*decoder*/) {} |
@@ -146,11 +164,16 @@ |
const vpx_codec_err_t res_peek); |
protected: |
- explicit DecoderTest(const CodecFactory *codec) : codec_(codec) {} |
+ explicit DecoderTest(const CodecFactory *codec) |
+ : codec_(codec), |
+ cfg_(), |
+ flags_(0) {} |
virtual ~DecoderTest() {} |
const CodecFactory *codec_; |
+ vpx_codec_dec_cfg_t cfg_; |
+ vpx_codec_flags_t flags_; |
}; |
} // namespace libvpx_test |