Kodi Community Forum
[WINDOWS] External Player Support Thread - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Windows (https://forum.kodi.tv/forumdisplay.php?fid=59)
+---- Thread: [WINDOWS] External Player Support Thread (/showthread.php?tid=43511)



[WINDOWS] External Player Support Thread - Jester - 2009-01-10

Since the external player patch has made it to the main SVN, any issue should go here, please note that any SVN build starting from Rev17023 has this properly included now.

Usage info is now in the wiki, please take careful note that external player configuration is different depending on the version of XBMC you are running:
  • for 9.04 (Babylon) or an SVN build between Rev17023 and Rev20982, it's in advancedsettings.xml
  • for Rev20983+ it's in playercorefactory.xml
both of these are described in the wiki


- DonJ - 2009-01-10

I'd suggest adding this to the manual/wiki if not done already.


- synci - 2009-01-11

Hey guys,

here is the way im using to get MPC-HC works correctly and opens in FS-mode.

Im using AutoIt V3, get it here http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe

My way... Windows is starting and XBMC is running automaticly. But not with XBMC.exe in autostart, there is an AutoIT script in autostart.

MPC-HC Settings, Output on EVR Custom and Direct3D Fullscreen (Remove tearing)

Code:
;; When this script starts it execute XBMC with args -fs -p (Fullscreen)
Run("C:\Program Files\XBMC\XBMC.exe -fs -p", "", "")
;; It waits for a window called "Media Player Classic Homecinema"
WinWait("Media Player Classic Homecinema")
;; When the window gets detected the script closes the XBMC process
ProcessClose("xbmc.exe")
;; Script sleeps for 10 seconds (Cause im starting files from lan (smb://) and it takes time)
Sleep(10000)
;; Wait closing the process mplayerc.exe (MPC-HC)
ProcessWaitClose("mplayerc.exe")
;; When the process gets closed it starts this script again and begins from first line (Im closing MPC-HC via iMon Pad after movies end)
Run("C:\autostart.exe")
;; Script end
Exit

And my advancedsettings.xml:

Code:
<advancedsettings>
<video>
  <defaultplayer>externalplayer</defaultplayer>
</video>
<externalplayer>
  <filename>C:\python26\python.exe</filename>
<args>c:\mplayerc.py</args>
  <forceontop>true</forceontop>
  <hideconsole>true</hideconsole>
  <hidecursor>false</hidecursor>
</externalplayer>
</advancedsettings>

Im using a python script to get MPC-HC works with SMB, you must put in here the mplayerc.exe directly when you dont watch movies via SMB.

Im using AutoIt V3 for sooo much things, its very easy and good.
Hope it helps a little bit and sorry for my bad english.


- moby-uk - 2009-01-11

WiSo Wrote:... still waiting till other users complain about that some other progs stealing the focus of XBMC after the patch.
The right way to do it would be when calling the external player unlocking the foreground and make the called process the foreground and focused window.

Wiso is correct, and as this is totally unsupported by the XBMC developers asking them to change features in the base program is probably unreasonable.

Wiso: there is already a "LockSetForegroundWindow(LSFW_UNLOCK)" in ExternalPlayer before the external player is launched but it doesn't seem to help when XBMC is fullscreen; maybe a timing issue as immediately afterwards there's a call to g_graphicsContext.Lock() ...

I've implemented a workaround in my local build with changes localized to ExternalPlayer.cpp. basically I hide the XBMC window before the external player is launched and then restore it afterwards, I also needed to delay the call to g_graphicsContext.Lock() slightly.

Win32 GUI programming is not really my thing but this worksforme; you _may_ get a bit of a flicker but it's better than the external player being hidden.

I've also fixed in ExternalPlayer.cpp:
The first argument to the external process wasn't quoted so if the executable was C:\Program Files\Windows Media Player\wmplayer.exe then the arguments would be
0: C:\Program
1: Files\Windows
2: Media
3: Player\wmplayer.exe
followed by the args from advanced setting followed by the file path. That certainly confused WMP on my machine and it would not play the video.


- Jester - 2009-01-11

moby-uk Wrote:Wiso is correct, and as this is totally unsupported by the XBMC developers asking them to change features in the base program is probably unreasonable.

Wiso: there is already a "LockSetForegroundWindow(LSFW_UNLOCK)" in ExternalPlayer before the external player is launched but it doesn't seem to help when XBMC is fullscreen; maybe a timing issue as immediately afterwards there's a call to g_graphicsContext.Lock() ...

I've implemented a workaround in my local build with changes localized to ExternalPlayer.cpp. basically I hide the XBMC window before the external player is launched and then restore it afterwards, I also needed to delay the call to g_graphicsContext.Lock() slightly.

Win32 GUI programming is not really my thing but this worksforme; you _may_ get a bit of a flicker but it's better than the external player being hidden.

I've also fixed in ExternalPlayer.cpp:
The first argument to the external process wasn't quoted so if the executable was C:\Program Files\Windows Media Player\wmplayer.exe then the arguments would be
0: C:\Program
1: Files\Windows
2: Media
3: Player\wmplayer.exe
followed by the args from advanced setting followed by the file path. That certainly confused WMP on my machine and it would not play the video.

thanks for the digging ! mind sharing the diff ? (just PM me) or dump it in a new trac ticket


- moby-uk - 2009-01-11

ashlar Wrote:This works perfectly (bar the default player setting, but I know that's a different story).

Jester has my ExternalPlayer patch to hide the XBMC window before launching the external player. The default player setting was broken in [16391] when code was added to ensure that the dvdplayer core was used for video
Quote:fixed: if a file can be audio or video we have to treat it as video to ensure playback. fixes #5515 - .mod video extension playback

this was obviously added after the externalplayer patch was initially created. Here's a patch to fix:

Code:
--- xbmc\cores\PlayerCoreFactory.cpp-16984    2009-01-11 16:20:31.000000000 -0000
+++ xbmc\cores\PlayerCoreFactory.cpp    2009-01-11 16:14:58.000000000 -0000
@@ -166,13 +166,25 @@
   if (((item.IsDVD()) || item.IsDVDFile() || item.IsDVDImage()))
   {
     vecCores.push_back(EPC_DVDPLAYER);
   }

   if (item.IsVideo()) // video must override audio
-    vecCores.push_back(EPC_DVDPLAYER);
+  {
+    // Handle default players set via advancedsettings:
+    if (g_advancedSettings.m_videoDefaultPlayer == "externalplayer")
+    {
+      vecCores.push_back(EPC_EXTPLAYER);
+      vecCores.push_back(EPC_DVDPLAYER);
+    }
+    else
+    {
+      vecCores.push_back(EPC_DVDPLAYER);
+      vecCores.push_back(EPC_EXTPLAYER);
+    }
+  }

   if( PAPlayer::HandlesType(url.GetFileType()) )
   {
     // We no longer force PAPlayer as our default audio player (used to be true):
     bool bAdd = false;
     if (url.GetProtocol().Equals("mms"))
@@ -204,27 +216,12 @@
         vecCores.push_back(EPC_PAPLAYER);
       }
     }
   }

   // Add all normal players last so you can force them, should you want to
-  // Handle default players set via advancedsettings:
-  if( item.IsVideo() )
-  {
-    if ( g_advancedSettings.m_videoDefaultPlayer == "externalplayer" )
-    {
-      vecCores.push_back(EPC_EXTPLAYER);
-      vecCores.push_back(EPC_DVDPLAYER);
-    }
-    else
-    {
-      vecCores.push_back(EPC_DVDPLAYER);
-      vecCores.push_back(EPC_EXTPLAYER);
-    }
-  }
-  
   if( item.IsAudio())
   {
     if ( g_advancedSettings.m_audioDefaultPlayer == "dvdplayer" )
     {
       vecCores.push_back(EPC_DVDPLAYER);
       vecCores.push_back(EPC_PAPLAYER);



- Jester - 2009-01-11

moby-uk Wrote:Jester has my ExternalPlayer patch to hide the XBMC window before launching the external player. The default player setting was broken in [16391] when code was added to ensure that the dvdplayer core was used for video


this was obviously added after the externalplayer patch was initially created. Here's a patch to fix:

Code:
--- xbmc\cores\PlayerCoreFactory.cpp-16984    2009-01-11 16:20:31.000000000 -0000
+++ xbmc\cores\PlayerCoreFactory.cpp    2009-01-11 16:14:58.000000000 -0000
@@ -166,13 +166,25 @@
   if (((item.IsDVD()) || item.IsDVDFile() || item.IsDVDImage()))
   {
     vecCores.push_back(EPC_DVDPLAYER);
   }

   if (item.IsVideo()) // video must override audio
-    vecCores.push_back(EPC_DVDPLAYER);
+  {
+    // Handle default players set via advancedsettings:
+    if (g_advancedSettings.m_videoDefaultPlayer == "externalplayer")
+    {
+      vecCores.push_back(EPC_EXTPLAYER);
+      vecCores.push_back(EPC_DVDPLAYER);
+    }
+    else
+    {
+      vecCores.push_back(EPC_DVDPLAYER);
+      vecCores.push_back(EPC_EXTPLAYER);
+    }
+  }

   if( PAPlayer::HandlesType(url.GetFileType()) )
   {
     // We no longer force PAPlayer as our default audio player (used to be true):
     bool bAdd = false;
     if (url.GetProtocol().Equals("mms"))
@@ -204,27 +216,12 @@
         vecCores.push_back(EPC_PAPLAYER);
       }
     }
   }

   // Add all normal players last so you can force them, should you want to
-  // Handle default players set via advancedsettings:
-  if( item.IsVideo() )
-  {
-    if ( g_advancedSettings.m_videoDefaultPlayer == "externalplayer" )
-    {
-      vecCores.push_back(EPC_EXTPLAYER);
-      vecCores.push_back(EPC_DVDPLAYER);
-    }
-    else
-    {
-      vecCores.push_back(EPC_DVDPLAYER);
-      vecCores.push_back(EPC_EXTPLAYER);
-    }
-  }
-  
   if( item.IsAudio())
   {
     if ( g_advancedSettings.m_audioDefaultPlayer == "dvdplayer" )
     {
       vecCores.push_back(EPC_DVDPLAYER);
       vecCores.push_back(EPC_PAPLAYER);

cheers for all the work done, i'll include this one too


- moby-uk - 2009-01-11

ashlar Wrote:Tried the "new" build, it works.
When you close the external player there's a brief moment where the desktop is visible. I don't know if something can be done about that while pursuing this way (hide XBMC instead of making it lose focus).

Sorry, I'm afraid not. I personally see this as a workaround; it only took me a short time to do and I'm willing to live with that flicker rather than spend a lot of time trying to get it to work reliably with the fullscreen XBMC window still visible.


- blorgfreth - 2009-01-11

Is there an option to use this only with specific types of playback? I'm thinking specifically in terms of launching PowerDVD or something for playing blu-ray. Ideally, it would still be able to use the internal player for normal DVDs. I love the integrated OSD and such too much to use a full-time external player.


- Jester - 2009-01-11

blorgfreth Wrote:Is there an option to use this only with specific types of playback? I'm thinking specifically in terms of launching PowerDVD or something for playing blu-ray. Ideally, it would still be able to use the internal player for normal DVDs. I love the integrated OSD and such too much to use a full-time external player.

nope


- ashlar - 2009-01-11

moby-uk Wrote:Sorry, I'm afraid not. I personally see this as a workaround; it only took me a short time to do and I'm willing to live with that flicker rather than spend a lot of time trying to get it to work reliably with the fullscreen XBMC window still visible.
Yeah, I imagined so, from your description. Probably the change should be in the intel patch, but I doubt it will happen.
In any case, unless it's easy to fix for somebody else, like this it's working. Tried the latest build and even the default setting works perfectly.

Anyone able to make the "watched" flag work when the external player is used? It's, IMO, the last thing to "fix" for this to be a workable solution, while we wait for improvement in dvdplayer.


- moby-uk - 2009-01-11

ashlar Wrote:Yeah, I imagined so, from your description. Probably the change should be in the intel patch, but I doubt it will happen.
In any case, unless it's easy to fix for somebody else, like this it's working. Tried the latest build and even the default setting works perfectly.

Anyone able to make the "watched" flag work when the external player is used? It's, IMO, the last thing to "fix" for this to be a workable solution, while we wait for improvement in dvdplayer.

It wouldn't be difficult to set the watched flag; the problem is XBMC has no way of knowing whether you watched the video to the end or closed it a few seconds in.


- ashlar - 2009-01-11

moby-uk Wrote:It wouldn't be difficult to set the watched flag; the problem is XBMC has no way of knowing whether you watched the video to the end or closed it a few seconds in.
My feeling is that occasions where you stop a few seconds in are far fewer than occasions where you select a movie/TV series and watch it. A poll maybe?
I ask this because that's how MediaPortal behaves and I find it logical (also, the only thing remaining for me to ditch MP, to be honest Big Grin).


- moby-uk - 2009-01-11

ashlar Wrote:My feeling is that occasions where you stop a few seconds in are far fewer than occasions where you select a movie/TV series and watch it. A poll maybe?
I ask this because that's how MediaPortal behaves and I find it logical (also, the only thing remaining for me to ditch MP, to be honest Big Grin).

Hmmm, it actually does get marked as watched; it's just that the screen doesn't get updated. If you leave the current view and come back you should see that it's happened (can you confirm that for me?). I'm not sure how to make the current window refresh; any XBMC dev reading want to give me a hint?


- ashlar - 2009-01-11

Yes, I confirm the behaviour. If you leave the screen and return it's set as watched.


This forum uses Lukasz Tkacz MyBB addons.