Kodi Community Forum
EDL (and ComSkip) integration - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: EDL (and ComSkip) integration (/showthread.php?tid=27798)

Pages: 1 2 3 4


EDL (and ComSkip) integration - DrDDT - 2007-08-07

Hi!

I'm trying implement EDL for XBMC
(see http://forum.xbmc.org/showthread.php?tid=21890&page=4)

I'm very new to XBMC development so please be patient with me.

I'm trying to add the option 'path_to_movie\movie.edl' to the mplayer options, if the file 'path_to_movie\movie.edl' exists.

As suggested, I'll have to do the following:

- Check if the filename give to mplayer is actually a movie and not a stream/playlist:

// Check if file can have EDL
if (item.IsInternetStream()) ....
if (item.IsPlayList()) ....
if (!item.IsVideo()) ....

- If the file can have an edl, generate the possible filename:

CStdString strEdlFileName;
ReplaceExtension(strFile, "edl", strEdlFileName);

- Check if 'path_to_movie\movie.edl' exists
-[ How do I do this? ]-

- Add the option to the mplayer conf
Someting like:

options.SetEDLFile(strFile);

if (m_stredlfile.length() > 0)
{
m_vecOptions.push_back("-edl=" + m_stredlfile );
}


Is this going to work?
How do I check if the EDL file exists?


- spiff - 2007-08-07

CFile::Exists

and yes it will work


- DrDDT - 2007-08-07

spiff Wrote:CFile::Exists

and yes it will work

I gave it a shot, it compiles, but I cannot test it yet:

Code:
Index: mplayer.cpp

===================================================================

--- mplayer.cpp    (revision 9840)

+++ mplayer.cpp    (working copy)

@@ -122,6 +122,7 @@

   m_bLimitedHWAC3 = false;
   m_bDeinterlace = false;
   m_subcp = "";
+  m_strEdl = ""; // DD
   m_synccomp = 0.0f;
}
void CMPlayer::Options::SetFPS(float fFPS)
@@ -279,6 +280,12 @@

   m_iAutoSync = iAutoSync;
}

+// DD
+void CMPlayer::Options::SetEdl(const string& strEdl)
+{
+  m_strEdl = strEdl;
+}
+
void CMPlayer::Options::GetOptions(int& argc, char* argv[])
{
   CStdString strTmp;
@@ -332,6 +339,13 @@

     }
   }

+    // DD
+  if (m_strEdl.length() > 0)
+  {
+      m_vecOptions.push_back("-edl=" + m_strEdl );
+      CLog::Log(LOGINFO, "Found EDL file, adding -edl=%s", m_strEdl.c_str());
+  }
+
   //MOVED TO mplayer.conf
   //Enable mplayer's internal highly accurate sleeping.
   //m_vecOptions.push_back("-softsleep");
@@ -858,6 +872,17 @@

     m_iPTS = 0;
     m_bPaused = false;

+    // DD Check for EDL file
+    CStdString strEdlFileName;
+    if (!bFileOnInternet && bIsVideo && !bIsDVD )
+    {
+        CUtil::ReplaceExtension(strFile, "edl", strEdlFileName);
+        if ( CFile::Exists(strEdlFileName) )
+        {
+            options.SetEdl(strEdlFileName);
+        }
+    }
+
     // first init mplayer. This is needed 2 find out all information
     // like audio channels, fps etc
     load();
Index: MPlayer.h

===================================================================

--- MPlayer.h    (revision 9840)

+++ MPlayer.h    (working copy)

@@ -61,6 +61,9 @@


     void SetAutoSync(int iAutoSync);

+    // DD
+    void SetEdl(const string& strEdl);
+
     void SetAudioOutput(const string& output) { m_videooutput = output; }
     void SetVideoOutput(const string& output) { m_audiooutput = output; }
     void SetAudioCodec(const string& codec) { m_videocodec = codec; }
@@ -94,6 +97,7 @@

     string m_demuxer;
     bool m_bDisableAO;
     string m_subcp;
+    string m_strEdl;
     string m_strChannelMapping;
     string m_strDvdDevice;
     string m_strFlipBiDiCharset;



- spiff - 2007-08-07

i havent tested it either but your diff is unacceptable for inclusion
indent is 2 space using spaces, please comply. and i'd prefer if you didnt spam your name all over the file. (do not mistake this for hostility)


- DrDDT - 2007-08-07

spiff Wrote:i havent tested it either but your diff is unacceptable for inclusion
indent is 2 space using spaces, please comply. and i'd prefer if you didnt spam your name all over the file. (do not mistake this for hostility)

This patch wasn't meant for inclusion, sorry I didn't make this clear.
The 'name spamming' is only for me to find my own changes. I haven't coded a single line for over ten years, so I'm a bit rusty.

I'll test it first, then I'll find the correct formatting and submit rules for patches.


- spiff - 2007-08-07

cool


- DrDDT - 2007-08-08

I've got it working now (after a few bugfixes).

I'll try to add a on/off switch in the settings now.


- spiff - 2007-08-08

why would we want that? if you dont want your edls, rename them / delete them.


- DrDDT - 2007-08-08

spiff Wrote:why would we want that? if you dont want your edls, rename them / delete them.

Doesn't the same goes for subtitles?
If I have a recorded tv show, and have comskip generate an edl for removing commercials, I might want to disable the EDL because too much of the show was disabled.

Maybe later then.


- spiff - 2007-08-08

oh sorry you mean an osd option. a conditional osd option (only shown if we have an edl) is all fine. i thought you meant a "real" setting in settings->video.


- DrDDT - 2007-08-09

The following code uses the edl option in mplayer when a 'moviename.edl' file is found.

Observations:
- The 'mute' function doesn't seem to work
- The 'skip' function works fine. You can still use the forward/back functions to see the skipped parts.

Here is the patch, hopefully using the correct format this time:

Code:
Index: mplayer.cpp

===================================================================

--- mplayer.cpp    (revision 9840)

+++ mplayer.cpp    (working copy)

@@ -122,6 +122,7 @@

   m_bLimitedHWAC3 = false;
   m_bDeinterlace = false;
   m_subcp = "";
+  m_strEdl = "";
   m_synccomp = 0.0f;
}
void CMPlayer::Options::SetFPS(float fFPS)
@@ -279,6 +280,11 @@

   m_iAutoSync = iAutoSync;
}

+void CMPlayer::Options::SetEdl(const string& strEdl)
+{
+  m_strEdl = strEdl;
+}
+
void CMPlayer::Options::GetOptions(int& argc, char* argv[])
{
   CStdString strTmp;
@@ -332,6 +338,12 @@

     }
   }

+  if (m_strEdl.length() > 0)
+  {
+    m_vecOptions.push_back("-edl");
+    m_vecOptions.push_back( m_strEdl.c_str());
+  }
+
   //MOVED TO mplayer.conf
   //Enable mplayer's internal highly accurate sleeping.
   //m_vecOptions.push_back("-softsleep");
@@ -858,6 +870,16 @@

     m_iPTS = 0;
     m_bPaused = false;

+    CStdString strEdlFileName;
+    if (!bFileOnInternet && bIsVideo && !bIsDVD )
+    {
+      CUtil::ReplaceExtension(strFile, ".edl", strEdlFileName);
+      if ( CFile::Exists(strEdlFileName) )
+      {
+        options.SetEdl(strEdlFileName);
+      }
+    }
+    
     // first init mplayer. This is needed 2 find out all information
     // like audio channels, fps etc
     load();
@@ -2051,4 +2073,4 @@

     m_evProcessDone.WaitMSec(1000);
     m_evProcessDone.WaitMSec(1000);
   }
-}

\ No newline at end of file

+}
Index: MPlayer.h

===================================================================

--- MPlayer.h    (revision 9840)

+++ MPlayer.h    (working copy)

@@ -61,6 +61,8 @@


     void SetAutoSync(int iAutoSync);

+    void SetEdl(const string& strEdl);
+
     void SetAudioOutput(const string& output) { m_videooutput = output; }
     void SetVideoOutput(const string& output) { m_audiooutput = output; }
     void SetAudioCodec(const string& codec) { m_videocodec = codec; }
@@ -94,6 +96,7 @@

     string m_demuxer;
     bool m_bDisableAO;
     string m_subcp;
+    string m_strEdl;
     string m_strChannelMapping;
     string m_strDvdDevice;
     string m_strFlipBiDiCharset;



- DrDDT - 2007-08-09

Would it be doable to show the EDL 'skip' parts when showing the movie play progress bar?
Maybe use a differen color, so if one shows the progress bar, you know where parts are going to be skipped?


- DrDDT - 2007-08-10

DrDDT Wrote:Would it be doable to show the EDL 'skip' parts when showing the movie play progress bar?
Maybe use a differen color, so if one shows the progress bar, you know where parts are going to be skipped?

Example of the progress bar I was thinking of.
Maybe also the miniature one in the top right of the screen, if it uses the same code.

Image


- spiff - 2007-08-10

it does use the same code. however there's no such support as of yet.

patch welcome, i doubt any of the devs care (i for one do not). it would be rather tricky, as the progress bar is just generated based on info labels

i'll apply your submitted patch tonite unless elupus objects for some reason (cant see why)


- DrDDT - 2007-08-12

spiff Wrote:it does use the same code. however there's no such support as of yet.

patch welcome, i doubt any of the devs care (i for one do not). it would be rather tricky, as the progress bar is just generated based on info labels

i'll apply your submitted patch tonite unless elupus objects for some reason (cant see why)

Great! I see the patch is in.

Shouldn't we add this to the Wiki now?

Somewhere in this page?

http://xboxmediacenter.com/wiki/index.php?title=Videos