2013-06-20, 12:13
I'm working on a Xiaomi Box to make XBMC to use external players to output 1080p quality video.
I looked into the source code of these branches:
github.com/xbmc/xbmc 12.2
github.com/xbmcandroid/xbmc 12.2
github.com/xbmc/xbmc master
I found the "github.com/xbmcandroid/xbmc" add code to directly call Android Activity by adding a function ExternalPlayer::ExecuteAppAndroid() and it has been merged to the "github.com/xbmc/xbmc master".
I think this is not a good design.
First, The function of ExternalPlayer::ExecuteAppAndroid() is hard-coded:
{
CXBMCApp::StartActivity(strSwitches, "android.intent.action.VIEW", "video/*", strPath);
}
For an Activity's Intent not "android.intent.action.VIEW", this method will not work.
For an Activity which is not the default activity of the application, this method will not work.
Second, the implementation of CXBMCApp::StartActivity() is inflexible and incomplete.
Acturely, the Linux system() can start an Android activity like this:
So we need only change the part of playercorefactory.xml like this:
I looked into the source code of these branches:
github.com/xbmc/xbmc 12.2
github.com/xbmcandroid/xbmc 12.2
github.com/xbmc/xbmc master
I found the "github.com/xbmcandroid/xbmc" add code to directly call Android Activity by adding a function ExternalPlayer::ExecuteAppAndroid() and it has been merged to the "github.com/xbmc/xbmc master".
I think this is not a good design.
First, The function of ExternalPlayer::ExecuteAppAndroid() is hard-coded:
{
CXBMCApp::StartActivity(strSwitches, "android.intent.action.VIEW", "video/*", strPath);
}
For an Activity's Intent not "android.intent.action.VIEW", this method will not work.
For an Activity which is not the default activity of the application, this method will not work.
Second, the implementation of CXBMCApp::StartActivity() is inflexible and incomplete.
Acturely, the Linux system() can start an Android activity like this:
Quote: system("am start -a android.intent.action.VIEW -n com.mxtech.videoplayer.ad/com.mxtech.videoplayer.ActivityScreen$WebDelegate -d {0}");Here "am" is an android system application and has many parameters.
So we need only change the part of playercorefactory.xml like this:
Quote: <!-- MXPlayer Free definition -->Comparing to the part of the playercorefactory.xml in "github.com/xbmcandroid/xbmc 12.2":
<player name="MXPlayerFree" type="ExternalPlayer" audio="false" video="true">
<!-- Android intent -->
<filename>am</filename>
<filename>start -a android.intent.action.VIEW -n com.mxtech.videoplayer.ad/com.mxtech.videoplayer.ActivityScreen$WebDelegate -d {0}</filename>
<!-- Hide XBMC -->
<hidexbmc>true</hidexbmc>
<!-- After 2 minutes bump the play count of the item in XBMC -->
<playcountminimumtime>120</playcountminimumtime>
</player>
Quote: <!-- MXPlayer Free definition -->
<player name="MXPlayerFree" type="ExternalPlayer" audio="false" video="true">
<!-- Android intent -->
<filename>com.mxtech.videoplayer.ad</filename>
<!-- Hide XBMC -->
<hidexbmc>true</hidexbmc>
<!-- After 2 minutes bump the play count of the item in XBMC -->
<playcountminimumtime>120</playcountminimumtime>
</player>