Chromium Code Reviews| Index: ppapi/cpp/video_decoder.cc |
| diff --git a/ppapi/cpp/video_decoder.cc b/ppapi/cpp/video_decoder.cc |
| index 85654c1edefe18157e9faf7cb7c521b2eb477086..5730072279a7dbe32f0d392ee98aa84da9305d9a 100644 |
| --- a/ppapi/cpp/video_decoder.cc |
| +++ b/ppapi/cpp/video_decoder.cc |
| @@ -25,6 +25,11 @@ const char* interface_name<PPB_VideoDecoder_0_2>() { |
| return PPB_VIDEODECODER_INTERFACE_0_2; |
| } |
| +template <> |
| +const char* interface_name<PPB_VideoDecoder_0_3>() { |
| + return PPB_VIDEODECODER_INTERFACE_0_3; |
| +} |
| + |
| } // namespace |
| VideoDecoder::VideoDecoder() { |
| @@ -44,12 +49,14 @@ int32_t VideoDecoder::Initialize(const Graphics3D& context, |
| PP_VideoProfile profile, |
| PP_HardwareAcceleration acceleration, |
| const CompletionCallback& cc) { |
| + if (has_interface<PPB_VideoDecoder_0_3>()) { |
| + return get_interface<PPB_VideoDecoder_0_3>()->Initialize( |
| + pp_resource(), context.pp_resource(), profile, acceleration, |
| + cc.pp_completion_callback()); |
| + } |
| if (has_interface<PPB_VideoDecoder_0_2>()) { |
| return get_interface<PPB_VideoDecoder_0_2>()->Initialize( |
| - pp_resource(), |
| - context.pp_resource(), |
| - profile, |
| - acceleration, |
| + pp_resource(), context.pp_resource(), profile, acceleration, |
| cc.pp_completion_callback()); |
| } |
| if (has_interface<PPB_VideoDecoder_0_1>()) { |
| @@ -71,6 +78,10 @@ int32_t VideoDecoder::Decode(uint32_t decode_id, |
| uint32_t size, |
| const void* buffer, |
| const CompletionCallback& cc) { |
| + if (has_interface<PPB_VideoDecoder_0_3>()) { |
| + return get_interface<PPB_VideoDecoder_0_3>()->Decode( |
| + pp_resource(), decode_id, size, buffer, cc.pp_completion_callback()); |
| + } |
| if (has_interface<PPB_VideoDecoder_0_2>()) { |
| return get_interface<PPB_VideoDecoder_0_2>()->Decode( |
| pp_resource(), decode_id, size, buffer, cc.pp_completion_callback()); |
| @@ -83,7 +94,12 @@ int32_t VideoDecoder::Decode(uint32_t decode_id, |
| } |
| int32_t VideoDecoder::GetPicture( |
| + PP_Rect* visible_rect, |
| const CompletionCallbackWithOutput<PP_VideoPicture>& cc) { |
| + if (has_interface<PPB_VideoDecoder_0_3>()) { |
| + return get_interface<PPB_VideoDecoder_0_3>()->GetPicture( |
| + pp_resource(), cc.output(), visible_rect, cc.pp_completion_callback()); |
| + } |
| if (has_interface<PPB_VideoDecoder_0_2>()) { |
| return get_interface<PPB_VideoDecoder_0_2>()->GetPicture( |
| pp_resource(), cc.output(), cc.pp_completion_callback()); |
|
dmichael (off chromium)
2014/11/05 19:28:08
Is there some reasonable default we can use for vi
bbudge
2014/11/05 22:41:48
Good idea. Done.
|
| @@ -96,7 +112,10 @@ int32_t VideoDecoder::GetPicture( |
| } |
| void VideoDecoder::RecyclePicture(const PP_VideoPicture& picture) { |
| - if (has_interface<PPB_VideoDecoder_0_2>()) { |
| + if (has_interface<PPB_VideoDecoder_0_3>()) { |
| + get_interface<PPB_VideoDecoder_0_3>()->RecyclePicture(pp_resource(), |
| + &picture); |
| + } else if (has_interface<PPB_VideoDecoder_0_2>()) { |
| get_interface<PPB_VideoDecoder_0_2>()->RecyclePicture(pp_resource(), |
| &picture); |
| } else if (has_interface<PPB_VideoDecoder_0_1>()) { |
| @@ -106,6 +125,10 @@ void VideoDecoder::RecyclePicture(const PP_VideoPicture& picture) { |
| } |
| int32_t VideoDecoder::Flush(const CompletionCallback& cc) { |
| + if (has_interface<PPB_VideoDecoder_0_3>()) { |
| + return get_interface<PPB_VideoDecoder_0_3>()->Flush( |
| + pp_resource(), cc.pp_completion_callback()); |
| + } |
| if (has_interface<PPB_VideoDecoder_0_2>()) { |
| return get_interface<PPB_VideoDecoder_0_2>()->Flush( |
| pp_resource(), cc.pp_completion_callback()); |
| @@ -118,6 +141,10 @@ int32_t VideoDecoder::Flush(const CompletionCallback& cc) { |
| } |
| int32_t VideoDecoder::Reset(const CompletionCallback& cc) { |
| + if (has_interface<PPB_VideoDecoder_0_3>()) { |
| + return get_interface<PPB_VideoDecoder_0_3>()->Reset( |
| + pp_resource(), cc.pp_completion_callback()); |
| + } |
| if (has_interface<PPB_VideoDecoder_0_2>()) { |
| return get_interface<PPB_VideoDecoder_0_2>()->Reset( |
| pp_resource(), cc.pp_completion_callback()); |