Please upload your proposed fix to AOSP, see
https://source.android.com/source/submit-patches.html

On Wednesday, June 25, 2014 10:47:48 PM UTC-7, xia...@marvell.com wrote:
>
> Hi,  
>
> I am from Marvell Semiconductor.
>
> I meet a problem about 
> registerExtensions()@frameworks/av/media/mediaserver/register.cpp, hope 
> that I can get some advice here J
>
>
> In frameworks/av/media/mediaserver/Android.mk
>
>    +ifneq ($(BOARD_USE_CUSTOM_MEDIASERVEREXTENSIONS),true)
>
> +include $(CLEAR_VARS)
>
> +LOCAL_SRC_FILES := register.cpp
>
> +LOCAL_MODULE := libregistermsext
>
> +LOCAL_MODULE_TAGS := optional
>
> +include $(BUILD_STATIC_LIBRARY)
>
> +endif
>
> So if we define BOARD_USE_CUSTOM_MEDIASERVEREXTENSIONS := true, we can 
> implement registerExtensions()@frameworks/av/media/mediaserver/register.cpp 
> and load some extensions.
>
>  
>
> Now I have a player called MRVLMediaPlayer(Similar with StageFright 
> player), so I plan to register it into MediaPlayerFactory.
>
> I implement MRVLMediaPlayer as shared library - libmrvl_media_player.so, 
> and it links other shared libraries like libOmxCore.so, ……
>
>  
>
> But here comes the problem: libregistermsext.a is a static library, it 
> can’t load libmrvl_media_player.so without change 
> frameworks/av/media/mediaserver/Android.mk
>
> If mediaserver links libdl.so, we can easily load libmrvl_media_player.so 
> without change frameworks/av/media/mediaserver/Android.mk in this way:
>
>     // Add custom players.
>
> void registerExtensions() {
>
>       android::registerCustomPlayers();
>
> }
>
> à
>
> static bool registerCustomPlayers() {
>
>     dlopen(“player_mmp.so”, RTLD_NOW);
>
>     createFactoryFunc createFactory = (createFactoryFunc) dlsym(handle, 
> "createFactory");
>
>     MediaPlayerFactory::IFactory* factory = 
> createFactory((player_type)kLoadablePlayerStart);
>
>     MediaPlayerFactory::registerFactory(factory, 
> (player_type)kLoadablePlayerStart);
>
> }
>
> And comes the implementation of player_mmp.so:
>
>   MmpPlayer.cpp:
>
>     extern MediaPlayerBase* createMRVLMediaPlayer();
>
> class MmpPlayerFactory : public MediaPlayerFactory::IFactory {
>
>     virtual sp<MediaPlayerBase> createPlayer() {
>
>         ALOGD("create MRVLMediaPlayer");
>
>         return createMRVLMediaPlayer();
>
>     }
>
> }
>
> extern "C" MediaPlayerFactory::IFactory* 
> createFactory(android::player_type playerType) {
>
>     return new MmpPlayerFactory(playerType);
>
> }
>
> Android.mk:
>
> LOCAL_SRC_FILES := MmpPlayer.cpp
>
> LOCAL_SHARED_LIBRARIES  := \
>
>         libcutils            \
>
>         libutils             \
>
>         libmrvl_media_player
>
> LOCAL_MODULE := player_mmp
>
> include $(BUILD_SHARED_LIBRARY)
>
>
> If frameworks/av/media/mediaserver/Android.mk mediaserver already linked 
> libdl.so, the above can be easily done
>
>     @@ -25,7 +27,8 @@ LOCAL_SHARED_LIBRARIES := \
>
>         libmediaplayerservice \
>
>         libutils \
>
>         liblog \
>
> -        libbinder
>
> +       libbinder \
>
> +       libdl
>
>  
>
>  LOCAL_STATIC_LIBRARIES := \
>
>         Libregistermsext
>
>  
>
> Is it possible that Google add libdl.so into mediaserver 
> LOCAL_SHARED_LIBRARIES so that vendors can add their players without modify 
> Android code?
>
> Or do you have any ideas for add customer players which are implemented as 
> shared libraries?
>
>
> Thanks
>

-- 
-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting

--- 
You received this message because you are subscribed to the Google Groups 
"android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-porting+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to