diff options
author | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-01 03:18:28 +0000 |
---|---|---|
committer | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-01 03:18:28 +0000 |
commit | 2ffc31a4ee37b7745d2bdc8ed2a704f7f02c9589 (patch) | |
tree | 34122669bf4397a7c59156d6af5f47f49af08933 /ppapi | |
parent | 1695f071610fc582b0bd9342cb13a4eae291707f (diff) | |
download | chromium_src-2ffc31a4ee37b7745d2bdc8ed2a704f7f02c9589.zip chromium_src-2ffc31a4ee37b7745d2bdc8ed2a704f7f02c9589.tar.gz chromium_src-2ffc31a4ee37b7745d2bdc8ed2a704f7f02c9589.tar.bz2 |
Replace the use of an int32* with an explicit profile for decoder configuration.
Replaces the error-prone, overly-general, error-containing, and brittle
manually-terminated array-of-ints holding name/value pairs (except for names
that don't take values) with a simple profile parameter (specifying only information we
actually use today).
BUG=none
TEST=trybots, ovdatest, gles2
Review URL: http://codereview.chromium.org/7779001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99111 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/c/dev/pp_video_dev.h | 172 | ||||
-rw-r--r-- | ppapi/c/dev/ppb_video_decoder_dev.h | 10 | ||||
-rw-r--r-- | ppapi/cpp/dev/video_decoder_dev.cc | 12 | ||||
-rw-r--r-- | ppapi/cpp/dev/video_decoder_dev.h | 8 | ||||
-rw-r--r-- | ppapi/examples/gles2/gles2.cc | 9 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_messages.h | 3 | ||||
-rw-r--r-- | ppapi/proxy/ppb_video_decoder_proxy.cc | 17 | ||||
-rw-r--r-- | ppapi/proxy/ppb_video_decoder_proxy.h | 9 | ||||
-rw-r--r-- | ppapi/proxy/resource_creation_proxy.cc | 4 | ||||
-rw-r--r-- | ppapi/proxy/resource_creation_proxy.h | 2 | ||||
-rw-r--r-- | ppapi/shared_impl/video_decoder_impl.cc | 15 | ||||
-rw-r--r-- | ppapi/shared_impl/video_decoder_impl.h | 5 | ||||
-rw-r--r-- | ppapi/tests/test_video_decoder.cc | 2 | ||||
-rw-r--r-- | ppapi/thunk/ppb_video_decoder_thunk.cc | 4 | ||||
-rw-r--r-- | ppapi/thunk/resource_creation_api.h | 2 |
15 files changed, 57 insertions, 217 deletions
diff --git a/ppapi/c/dev/pp_video_dev.h b/ppapi/c/dev/pp_video_dev.h index 0ae1fd7..7b54f9d 100644 --- a/ppapi/c/dev/pp_video_dev.h +++ b/ppapi/c/dev/pp_video_dev.h @@ -13,157 +13,29 @@ #include "ppapi/c/pp_size.h" #include "ppapi/c/pp_stdint.h" -// Enumeration defining global dictionary ranges for various purposes that are -// used to handle the configurations of the video decoder. -// -// IMPORTANT! Dictionary keys and corresponding values MUST match the ones found -// in VideoDecodeAccelerator interface in Chromium media stack -// (media/video/video_decode_accelerator.h)! -enum PP_VideoAttributeDictionary { - PP_VIDEOATTR_DICTIONARY_TERMINATOR = 0, - - PP_VIDEOATTR_DICTIONARY_BITSTREAM_FORMAT_BASE = 0x100, - // Array of key/value pairs describing video configuration. - // It could include any keys from PP_VideoKey. Its last element shall be - // PP_VIDEOATTR_BITSTREAMFORMATKEY_NONE with no corresponding value. - // An example: - // { - // PP_VIDEOATTR_BITSTREAMFORMATKEY_FOURCC, PP_VIDEODECODECID_VP8, - // PP_VIDEOATTR_BITSTREAMFORMATKEY_VP8_PROFILE, (PP_VP8PROFILE_1 | - // PP_VP8PROFILE_2 | - // PP_VP8PROFILE_3), - // PP_VIDEOATTR_DICTIONARY_TERMINATOR - // }; - // Keys for defining video bitstream format. - // Value is type of PP_VideoCodecFourcc. Commonly known attributes values are - // defined in PP_VideoCodecFourcc enumeration. - PP_VIDEOATTR_BITSTREAMFORMATKEY_FOURCC, - // Bitrate in bits/s. Attribute value is 32-bit unsigned integer. - PP_VIDEOATTR_BITSTREAMFORMATKEY_BITRATE, - // Width and height of the input video bitstream, if known by the application. - // Decoder will expect the bitstream to match these values and does memory - // considerations accordingly. - PP_VIDEOATTR_BITSTREAMFORMATKEY_WIDTH, - PP_VIDEOATTR_BITSTREAMFORMATKEY_HEIGHT, - // Following attributes are applicable only in case of VP8. - // Key for VP8 profile attribute. Attribute value is bitmask of flags defined - // in PP_VP8Profile_Dev enumeration. - PP_VIDEOATTR_BITSTREAMFORMATKEY_VP8_PROFILE, - // Number of partitions per picture. Attribute value is unsigned 32-bit - // integer. - PP_VIDEOATTR_BITSTREAMFORMATKEY_VP8_NUM_OF_PARTITIONS, - // Following attributes are applicable only in case of H.264. - // Value is bitmask collection from the flags defined in PP_H264Profile. - PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_PROFILE, - // Value is type of PP_H264Level. - PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_LEVEL, - // Value is type of PP_H264PayloadFormat_Dev. - PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_PAYLOADFORMAT, - // Subset for H.264 features, attribute value 0 signifies unsupported. - // This is needed in case decoder has partial support for certain profile. - // Default for features are enabled if they're part of supported profile. - // H264 tool called Flexible Macroblock Ordering. - PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_FMO, - // H264 tool called Arbitrary Slice Ordering. - PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_ASO, - // H264 tool called Interlacing. - PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_INTERLACE, - // H264 tool called Context-Adaptive Binary Arithmetic Coding. - PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_CABAC, - // H264 tool called Weighted Prediction. - PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_FEATURE_WEIGHTEDPREDICTION, - - PP_VIDEOATTR_DICTIONARY_COLOR_FORMAT_BASE = 0x1000, - // This specifies the output color format for a decoded frame. Value is one - // of the values in PP_ColorFormat_Dev enumeration. - PP_VIDEOATTR_PICTUREFORMATKEY_COLORFORMAT -}; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoAttributeDictionary, 4); -typedef int32_t PP_VideoConfigElement; - -enum PP_VideoCodecFourcc { - PP_VIDEOCODECFOURCC_NONE = 0, - PP_VIDEOCODECFOURCC_VP8 = 0x00385056, // a.k.a. Fourcc 'VP8\0'. - PP_VIDEOCODECFOURCC_H264 = 0x31637661 // a.k.a. Fourcc 'avc1'. -}; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VideoCodecFourcc, 4); - -// VP8 specific information to be carried over the APIs. -// Enumeration for flags defining supported VP8 profiles. -enum PP_VP8Profile_Dev { - PP_VP8PROFILE_NONE = 0, - PP_VP8PROFILE_0 = 1, - PP_VP8PROFILE_1 = 1 << 1, - PP_VP8PROFILE_2 = 1 << 2, - PP_VP8PROFILE_3 = 1 << 3 -}; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_VP8Profile_Dev, 4); - -// H.264 specific information to be carried over the APIs. -// Enumeration for flags defining supported H.264 profiles. -enum PP_H264Profile_Dev { - PP_H264PROFILE_NONE = 0, - PP_H264PROFILE_BASELINE = 1, - PP_H264PROFILE_MAIN = 1 << 2, - PP_H264PROFILE_EXTENDED = 1 << 3, - PP_H264PROFILE_HIGH = 1 << 4, - PP_H264PROFILE_HIGH10PROFILE = 1 << 5, - PP_H264PROFILE_HIGH422PROFILE = 1 << 6, - PP_H264PROFILE_HIGH444PREDICTIVEPROFILE = 1 << 7, - PP_H264PROFILE_SCALABLEBASELINE = 1 << 8, - PP_H264PROFILE_SCALABLEHIGH = 1 << 9, - PP_H264PROFILE_STEREOHIGH = 1 << 10, - PP_H264PROFILE_MULTIVIEWHIGH = 1 << 11 -}; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_H264Profile_Dev, 4); - -// Enumeration for defining H.264 level of decoder implementation. -enum PP_H264Level_Dev { - PP_H264LEVEL_NONE = 0, - PP_H264LEVEL_10 = 1, - PP_H264LEVEL_1B = PP_H264LEVEL_10 | 1 << 1, - PP_H264LEVEL_11 = PP_H264LEVEL_1B | 1 << 2, - PP_H264LEVEL_12 = PP_H264LEVEL_11 | 1 << 3, - PP_H264LEVEL_13 = PP_H264LEVEL_12 | 1 << 4, - PP_H264LEVEL_20 = PP_H264LEVEL_13 | 1 << 5, - PP_H264LEVEL_21 = PP_H264LEVEL_20 | 1 << 6, - PP_H264LEVEL_22 = PP_H264LEVEL_21 | 1 << 7, - PP_H264LEVEL_30 = PP_H264LEVEL_22 | 1 << 8, - PP_H264LEVEL_31 = PP_H264LEVEL_30 | 1 << 9, - PP_H264LEVEL_32 = PP_H264LEVEL_31 | 1 << 10, - PP_H264LEVEL_40 = PP_H264LEVEL_32 | 1 << 11, - PP_H264LEVEL_41 = PP_H264LEVEL_40 | 1 << 12, - PP_H264LEVEL_42 = PP_H264LEVEL_41 | 1 << 13, - PP_H264LEVEL_50 = PP_H264LEVEL_42 | 1 << 14, - PP_H264LEVEL_51 = PP_H264LEVEL_50 | 1 << 15 -}; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_H264Level_Dev, 4); - -// Enumeration to describe which payload format is used within the exchanged -// bitstream buffers. -enum PP_H264PayloadFormat_Dev { - PP_H264PAYLOADFORMAT_NONE = 0, - // NALUs separated by Start Code. - PP_H264PAYLOADFORMAT_BYTESTREAM = 1, - // Exactly one raw NALU per buffer. - PP_H264PAYLOADFORMAT_ONE_NALU_PER_BUFFER = 1 << 1, - // NALU separated by 1-byte interleaved length field. - PP_H264PAYLOADFORMAT_ONE_BYTE_INTERLEAVED_LENGTH = 1 << 2, - // NALU separated by 2-byte interleaved length field. - PP_H264PAYLOADFORMAT_TWO_BYTE_INTERLEAVED_LENGTH = 1 << 3, - // NALU separated by 4-byte interleaved length field. - PP_H264PAYLOADFORMAT_FOUR_BYTE_INTERLEAVED_LENGTH = 1 << 4 -}; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_H264PayloadFormat_Dev, 4); - -// Enumeration for various color formats. -enum PP_ColorFormat_Dev { - // Value represents 32-bit RGBA format where each component is 8-bit in order - // R-G-B-A. Regardless of endianness of the architecture color components are - // stored in this order in the memory. - PP_VIDEOATTR_COLORFORMAT_RGBA = 0 +// Video decoder configuration-related enums. + +// NOTE: these must be kept in sync with the versions in +// media/video/video_decode_accelerator.h! + +// Video stream profile. +enum PP_VideoDecoder_Profile { + // Keep the values in this enum unique, as they imply format (h.264 vs. VP8, + // for example), and keep the values for a particular format grouped together + // for clarity. + PP_VIDEODECODER_H264PROFILE_NONE = 0, + PP_VIDEODECODER_H264PROFILE_BASELINE, + PP_VIDEODECODER_H264PROFILE_MAIN, + PP_VIDEODECODER_H264PROFILE_EXTENDED, + PP_VIDEODECODER_H264PROFILE_HIGH, + PP_VIDEODECODER_H264PROFILE_HIGH10PROFILE, + PP_VIDEODECODER_H264PROFILE_HIGH422PROFILE, + PP_VIDEODECODER_H264PROFILE_HIGH444PREDICTIVEPROFILE, + PP_VIDEODECODER_H264PROFILE_SCALABLEBASELINE, + PP_VIDEODECODER_H264PROFILE_SCALABLEHIGH, + PP_VIDEODECODER_H264PROFILE_STEREOHIGH, + PP_VIDEODECODER_H264PROFILE_MULTIVIEWHIGH }; -PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_ColorFormat_Dev, 4); // The data structure for video bitstream buffer. struct PP_VideoBitstreamBuffer_Dev { diff --git a/ppapi/c/dev/ppb_video_decoder_dev.h b/ppapi/c/dev/ppb_video_decoder_dev.h index 5a3417e..aab226e 100644 --- a/ppapi/c/dev/ppb_video_decoder_dev.h +++ b/ppapi/c/dev/ppb_video_decoder_dev.h @@ -9,8 +9,8 @@ #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_var.h" -#define PPB_VIDEODECODER_DEV_INTERFACE_0_15 "PPB_VideoDecoder(Dev);0.15" -#define PPB_VIDEODECODER_DEV_INTERFACE PPB_VIDEODECODER_DEV_INTERFACE_0_15 +#define PPB_VIDEODECODER_DEV_INTERFACE_0_16 "PPB_VideoDecoder(Dev);0.16" +#define PPB_VIDEODECODER_DEV_INTERFACE PPB_VIDEODECODER_DEV_INTERFACE_0_16 // Video decoder interface. // @@ -35,14 +35,12 @@ struct PPB_VideoDecoder_Dev { // Parameters: // |instance| pointer to the plugin instance. // |context_3d| a PPB_Context3D_Dev resource in which decoding will happen. - // |decoder_config| the configuration to use to initialize the decoder. + // |profile| the video stream's format profile. // // The created decoder is returned as PP_Resource. 0 means failure. - // TODO(fischman/vrk): Get rid of silly PP_VideoConfigElement* vector in favor - // of config struct. PP_Resource (*Create)(PP_Instance instance, PP_Resource context, - const PP_VideoConfigElement* decoder_config); + enum PP_VideoDecoder_Profile profile); // Tests whether |resource| is a video decoder created through Create // function of this interface. diff --git a/ppapi/cpp/dev/video_decoder_dev.cc b/ppapi/cpp/dev/video_decoder_dev.cc index cde75f6..f7ab651 100644 --- a/ppapi/cpp/dev/video_decoder_dev.cc +++ b/ppapi/cpp/dev/video_decoder_dev.cc @@ -23,22 +23,22 @@ template <> const char* interface_name<PPB_VideoDecoder_Dev>() { } // namespace -VideoDecoder_Dev::VideoDecoder_Dev(const Instance& instance, +VideoDecoder_Dev::VideoDecoder_Dev(const Instance* instance, const Context3D_Dev& context, - const PP_VideoConfigElement* config) { + PP_VideoDecoder_Profile profile) { if (!has_interface<PPB_VideoDecoder_Dev>()) return; PassRefFromConstructor(get_interface<PPB_VideoDecoder_Dev>()->Create( - instance.pp_instance(), context.pp_resource(), config)); + instance->pp_instance(), context.pp_resource(), profile)); } -VideoDecoder_Dev::VideoDecoder_Dev(const Instance& instance, +VideoDecoder_Dev::VideoDecoder_Dev(const Instance* instance, const Graphics3D_Dev& context, - const PP_VideoConfigElement* config) { + PP_VideoDecoder_Profile profile) { if (!has_interface<PPB_VideoDecoder_Dev>()) return; PassRefFromConstructor(get_interface<PPB_VideoDecoder_Dev>()->Create( - instance.pp_instance(), context.pp_resource(), config)); + instance->pp_instance(), context.pp_resource(), profile)); } VideoDecoder_Dev::VideoDecoder_Dev(PP_Resource resource) : Resource(resource) { diff --git a/ppapi/cpp/dev/video_decoder_dev.h b/ppapi/cpp/dev/video_decoder_dev.h index 504e713..e260050 100644 --- a/ppapi/cpp/dev/video_decoder_dev.h +++ b/ppapi/cpp/dev/video_decoder_dev.h @@ -25,12 +25,12 @@ class Instance; class VideoDecoder_Dev : public Resource { public: // See PPB_VideoDecoder_Dev::Create. - VideoDecoder_Dev(const Instance& instance, + VideoDecoder_Dev(const Instance* instance, const Context3D_Dev& context, - const PP_VideoConfigElement* config); - VideoDecoder_Dev(const Instance& instance, + PP_VideoDecoder_Profile profile); + VideoDecoder_Dev(const Instance* instance, const Graphics3D_Dev& context, - const PP_VideoConfigElement* config); + PP_VideoDecoder_Profile profile); explicit VideoDecoder_Dev(PP_Resource resource); virtual ~VideoDecoder_Dev(); diff --git a/ppapi/examples/gles2/gles2.cc b/ppapi/examples/gles2/gles2.cc index f661d0a..26d94a4 100644 --- a/ppapi/examples/gles2/gles2.cc +++ b/ppapi/examples/gles2/gles2.cc @@ -235,16 +235,11 @@ void GLES2DemoInstance::DidChangeView( } void GLES2DemoInstance::InitializeDecoders() { - PP_VideoConfigElement configs[] = { - PP_VIDEOATTR_BITSTREAMFORMATKEY_H264_PROFILE, - PP_H264PROFILE_BASELINE, - PP_VIDEOATTR_DICTIONARY_TERMINATOR, - }; - assert(video_decoders_.empty()); for (int i = 0; i < kNumDecoders; ++i) { DecoderClient* client = new DecoderClient( - this, new pp::VideoDecoder_Dev(*this, *context_, configs)); + this, new pp::VideoDecoder_Dev( + this, *context_, PP_VIDEODECODER_H264PROFILE_BASELINE)); assert(!client->decoder()->is_null()); assert(video_decoders_.insert(std::make_pair( client->decoder()->pp_resource(), client)).second); diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index dd98b5e..f8559b3 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -44,6 +44,7 @@ IPC_ENUM_TRAITS(PP_InputEvent_Type) IPC_ENUM_TRAITS(PP_InputEvent_MouseButton) +IPC_ENUM_TRAITS(PP_VideoDecoder_Profile) IPC_ENUM_TRAITS(PP_VideoDecodeError_Dev) IPC_STRUCT_TRAITS_BEGIN(PP_Point) @@ -1020,7 +1021,7 @@ IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBVideoCapture_StopCapture, IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBVideoDecoder_Create, PP_Instance /* instance */, ppapi::HostResource /* context */, - std::vector<PP_VideoConfigElement> /* config */, + PP_VideoDecoder_Profile /* profile */, ppapi::HostResource /* result */) IPC_MESSAGE_ROUTED4(PpapiHostMsg_PPBVideoDecoder_Decode, ppapi::HostResource /* video_decoder */, diff --git a/ppapi/proxy/ppb_video_decoder_proxy.cc b/ppapi/proxy/ppb_video_decoder_proxy.cc index 3763bbe..f9e4379 100644 --- a/ppapi/proxy/ppb_video_decoder_proxy.cc +++ b/ppapi/proxy/ppb_video_decoder_proxy.cc @@ -33,7 +33,7 @@ class VideoDecoder : public Resource, public VideoDecoderImpl { static VideoDecoder* Create(const HostResource& resource, PP_Resource graphics_context, - const PP_VideoConfigElement* config); + PP_VideoDecoder_Profile profile); // Resource overrides. virtual PPB_VideoDecoder_API* AsPPB_VideoDecoder_API() OVERRIDE; @@ -210,17 +210,13 @@ bool PPB_VideoDecoder_Proxy::OnMessageReceived(const IPC::Message& msg) { PP_Resource PPB_VideoDecoder_Proxy::CreateProxyResource( PP_Instance instance, PP_Resource graphics_context, - const PP_VideoConfigElement* config) { + PP_VideoDecoder_Profile profile) { PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); // Dispatcher is null if it cannot find the instance passed to it (i.e. if the // client passes in an invalid instance). if (!dispatcher) return 0; - std::vector<PP_VideoConfigElement> copied; - if (!VideoDecoderImpl::CopyConfigsToVector(config, &copied)) - return 0; - HostResource host_context; gpu::gles2::GLES2Implementation* gles2_impl = NULL; @@ -242,7 +238,7 @@ PP_Resource PPB_VideoDecoder_Proxy::CreateProxyResource( HostResource result; dispatcher->Send(new PpapiHostMsg_PPBVideoDecoder_Create( INTERFACE_ID_PPB_VIDEO_DECODER_DEV, instance, - host_context, copied, &result)); + host_context, profile, &result)); if (result.is_null()) return 0; @@ -254,20 +250,17 @@ PP_Resource PPB_VideoDecoder_Proxy::CreateProxyResource( void PPB_VideoDecoder_Proxy::OnMsgCreate( PP_Instance instance, const HostResource& graphics_context, - const std::vector<PP_VideoConfigElement>& config, + PP_VideoDecoder_Profile profile, HostResource* result) { thunk::EnterFunction<thunk::ResourceCreationAPI> resource_creation(instance, true); if (resource_creation.failed()) return; - std::vector<PP_VideoConfigElement> copied = config; - copied.push_back(PP_VIDEOATTR_DICTIONARY_TERMINATOR); - // Make the resource and get the API pointer to its interface. result->SetHostResource( instance, resource_creation.functions()->CreateVideoDecoder( - instance, graphics_context.host_resource(), &copied.front())); + instance, graphics_context.host_resource(), profile)); } void PPB_VideoDecoder_Proxy::OnMsgDecode( diff --git a/ppapi/proxy/ppb_video_decoder_proxy.h b/ppapi/proxy/ppb_video_decoder_proxy.h index 56c21c5..b34cb22 100644 --- a/ppapi/proxy/ppb_video_decoder_proxy.h +++ b/ppapi/proxy/ppb_video_decoder_proxy.h @@ -23,9 +23,10 @@ class PPB_VideoDecoder_Proxy : public InterfaceProxy { static const Info* GetInfo(); // Creates a VideoDecoder object in the plugin process. - static PP_Resource CreateProxyResource(PP_Instance instance, - PP_Resource graphics_context, - const PP_VideoConfigElement* config); + static PP_Resource CreateProxyResource( + PP_Instance instance, + PP_Resource graphics_context, + PP_VideoDecoder_Profile profile); // InterfaceProxy implementation. virtual bool OnMessageReceived(const IPC::Message& msg); @@ -39,7 +40,7 @@ class PPB_VideoDecoder_Proxy : public InterfaceProxy { // plugin process. void OnMsgCreate(PP_Instance instance, const ppapi::HostResource& graphics_context, - const std::vector<PP_VideoConfigElement>& config, + PP_VideoDecoder_Profile profile, ppapi::HostResource* result); void OnMsgDecode( const ppapi::HostResource& decoder, diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc index bd020f3..0a0c791 100644 --- a/ppapi/proxy/resource_creation_proxy.cc +++ b/ppapi/proxy/resource_creation_proxy.cc @@ -305,9 +305,9 @@ PP_Resource ResourceCreationProxy::CreateVideoCapture(PP_Instance instance) { PP_Resource ResourceCreationProxy::CreateVideoDecoder( PP_Instance instance, PP_Resource context3d_id, - const PP_VideoConfigElement* config) { + PP_VideoDecoder_Profile profile) { return PPB_VideoDecoder_Proxy::CreateProxyResource( - instance, context3d_id, config); + instance, context3d_id, profile); } PP_Resource ResourceCreationProxy::CreateVideoLayer( diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h index 6ad936f..0f1589b 100644 --- a/ppapi/proxy/resource_creation_proxy.h +++ b/ppapi/proxy/resource_creation_proxy.h @@ -117,7 +117,7 @@ class ResourceCreationProxy : public FunctionGroupBase, virtual PP_Resource CreateVideoDecoder( PP_Instance instance, PP_Resource context3d_id, - const PP_VideoConfigElement* config) OVERRIDE; + PP_VideoDecoder_Profile profile) OVERRIDE; virtual PP_Resource CreateVideoLayer(PP_Instance instance, PP_VideoLayerMode_Dev mode) OVERRIDE; virtual PP_Resource CreateWheelInputEvent( diff --git a/ppapi/shared_impl/video_decoder_impl.cc b/ppapi/shared_impl/video_decoder_impl.cc index 00d971b..71921f92 100644 --- a/ppapi/shared_impl/video_decoder_impl.cc +++ b/ppapi/shared_impl/video_decoder_impl.cc @@ -89,19 +89,4 @@ void VideoDecoderImpl::FlushCommandBuffer() { gles2_impl_->Flush(); } -bool VideoDecoderImpl::CopyConfigsToVector( - const PP_VideoConfigElement* configs_to_copy, - std::vector<PP_VideoConfigElement>* out_configs) { - // TODO(fischman/vrk): This is still broken. We need to get rid of the silly - // PP_VideoConfigElement vector in favor of a struct (see TODO in - // ppb_video_decoder_dev.h). - const PP_VideoConfigElement* current = configs_to_copy; - while (current && *current != PP_VIDEOATTR_DICTIONARY_TERMINATOR) { - out_configs->push_back(*current); - out_configs->push_back(*(current + 1)); - current += 2; - } - return true; -} - } // namespace ppapi diff --git a/ppapi/shared_impl/video_decoder_impl.h b/ppapi/shared_impl/video_decoder_impl.h index b71f27d..1060740 100644 --- a/ppapi/shared_impl/video_decoder_impl.h +++ b/ppapi/shared_impl/video_decoder_impl.h @@ -39,11 +39,6 @@ class PPAPI_SHARED_EXPORT VideoDecoderImpl // PPB_VideoDecoder_API implementation. virtual void Destroy() OVERRIDE; - // Copy C-style config list into |out_configs| vector. - static bool CopyConfigsToVector( - const PP_VideoConfigElement* configs_to_copy, - std::vector<PP_VideoConfigElement>* out_configs); - protected: bool SetFlushCallback(PP_CompletionCallback callback); bool SetResetCallback(PP_CompletionCallback callback); diff --git a/ppapi/tests/test_video_decoder.cc b/ppapi/tests/test_video_decoder.cc index 9b9d965..0be8d95 100644 --- a/ppapi/tests/test_video_decoder.cc +++ b/ppapi/tests/test_video_decoder.cc @@ -28,7 +28,7 @@ void TestVideoDecoder::QuitMessageLoop() { std::string TestVideoDecoder::TestCreateFailure() { PP_Resource decoder = video_decoder_interface_->Create( - instance_->pp_instance(), 0, NULL); + instance_->pp_instance(), 0, static_cast<PP_VideoDecoder_Profile>(-1)); if (decoder != 0) return "Create: error detecting invalid context & configs"; diff --git a/ppapi/thunk/ppb_video_decoder_thunk.cc b/ppapi/thunk/ppb_video_decoder_thunk.cc index cb0485c..b7a72d9 100644 --- a/ppapi/thunk/ppb_video_decoder_thunk.cc +++ b/ppapi/thunk/ppb_video_decoder_thunk.cc @@ -18,11 +18,11 @@ typedef EnterResource<PPB_VideoDecoder_API> EnterVideoDecoder; PP_Resource Create(PP_Instance instance, PP_Resource context_3d, - const PP_VideoConfigElement* config) { + PP_VideoDecoder_Profile profile) { EnterFunction<ResourceCreationAPI> enter(instance, true); if (enter.failed()) return 0; - return enter.functions()->CreateVideoDecoder(instance, context_3d, config); + return enter.functions()->CreateVideoDecoder(instance, context_3d, profile); } PP_Bool IsVideoDecoder(PP_Resource resource) { diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h index 8757382..e34f659 100644 --- a/ppapi/thunk/resource_creation_api.h +++ b/ppapi/thunk/resource_creation_api.h @@ -119,7 +119,7 @@ class ResourceCreationAPI { virtual PP_Resource CreateVideoDecoder( PP_Instance instance, PP_Resource context3d_id, - const PP_VideoConfigElement* config) = 0; + PP_VideoDecoder_Profile profile) = 0; virtual PP_Resource CreateVideoLayer(PP_Instance instance, PP_VideoLayerMode_Dev mode) = 0; virtual PP_Resource CreateWheelInputEvent( |