Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added: support for vdr cut scenes (marks file). #792

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
65 changes: 65 additions & 0 deletions xbmc/cores/dvdplayer/Edl.cpp
Expand Up @@ -132,6 +132,9 @@ bool CEdl::ReadEditDecisionLists(const CStdString& strMovie, const float fFrameR

if (!bFound)
bFound = ReadBeyondTV(strMovie);

if (!bFound)
bFound = ReadVdrMarks(strMovie, fFramesPerSecond);
}
/*
* Or if the movie points to MythTV and isn't live TV.
Expand Down Expand Up @@ -1082,3 +1085,65 @@ void CEdl::MergeShortCommBreaks()
}
return;
}

bool CEdl::ReadVdrMarks(const CStdString& strMovie, const float fFramesPerSecond)
{
Clear();

CStdString vdrFilename(URIUtils::GetParentPath(strMovie) + "marks");
if (!CFile::Exists(vdrFilename))
{
vdrFilename+=".vdr";
if (!CFile::Exists(vdrFilename))
return false;
}

CFile vdrFile;
if (!vdrFile.Open(vdrFilename))
{
CLog::Log(LOGERROR, "%s - Could not open vdr marks file: %s", __FUNCTION__, vdrFilename.c_str());
return false;
}

int iLine = 0;
CStdString strBuffer;

while (vdrFile.ReadString(strBuffer.GetBuffer(1024), 1024))
{
strBuffer.ReleaseBuffer();

iLine++;

CStdString strtime, strComment;
int iff=0;
int iFieldsRead = sscanf(strBuffer, "%7c.%2i %512c", strtime.GetBuffer(7), &iff, strComment.GetBuffer(512));
strtime.ReleaseBuffer();
strComment.ReleaseBuffer();

if (iFieldsRead != 3)
{
CLog::Log(LOGWARNING, "%s - Error on line %i in vdr marks file: %s", __FUNCTION__, iLine, vdrFilename.c_str());
continue;
}

if(!AddSceneMarker((int64_t)(StringUtils::TimeStringToSeconds(strtime)*1000 + iff/fFramesPerSecond*1000)))
CLog::Log(LOGWARNING, "%s - Error adding scene markers: %s and %d frames", __FUNCTION__, strtime.c_str(), iff);
}

strBuffer.ReleaseBuffer();

vdrFile.Close();

if (HasSceneMarker())
{
CLog::Log(LOGDEBUG, "%s - Read %"PRIuS" scene markers in vdr marks file: %s", __FUNCTION__,
m_vecSceneMarkers.size(), vdrFilename.c_str());
return true;
}
else
{
CLog::Log(LOGDEBUG, "%s - No scene markers found in vdr marks file: %s", __FUNCTION__,
vdrFilename.c_str());
return false;
}
}
1 change: 1 addition & 0 deletions xbmc/cores/dvdplayer/Edl.h
Expand Up @@ -78,6 +78,7 @@ class CEdl
bool ReadBeyondTV(const CStdString& strMovie);
bool ReadMythCommBreakList(const CStdString& strMovie, const float fFramesPerSecond);
bool ReadMythCutList(const CStdString& strMovie, const float fFramesPerSecond);
bool ReadVdrMarks(const CStdString& strMovie, const float fFramesPerSecond);

bool AddCut(Cut& NewCut);
bool AddSceneMarker(const int64_t sceneMarker);
Expand Down