Skip to content
Browse files

Merge remote-tracking branch 'fetzerch/feature-edl' into pvrapi_1_7_0…

…. closes #173
  • Loading branch information...
2 parents 80ef0fc + a6c1685 commit 121b7c7b2a7b3f49518a5bdcaf1c2fc28baaa0c9 @opdenkamp committed Mar 7, 2013
View
1 addons/pvr.argustv/src/client.cpp
@@ -627,6 +627,7 @@ DemuxPacket* DemuxRead(void) { return NULL; }
void DemuxAbort(void) {}
void DemuxReset(void) {}
void DemuxFlush(void) {}
+PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY[], int*) { return PVR_ERROR_NOT_IMPLEMENTED; };
unsigned int GetChannelSwitchDelay(void) { return 0; }
bool SeekTime(int,bool,double*) { return false; }
void SetSpeed(int) {};
View
1 addons/pvr.demo/src/client.cpp
@@ -313,6 +313,7 @@ PVR_ERROR RenameRecording(const PVR_RECORDING &recording) { return PVR_ERROR_NOT
PVR_ERROR SetRecordingPlayCount(const PVR_RECORDING &recording, int count) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR SetRecordingLastPlayedPosition(const PVR_RECORDING &recording, int lastplayedposition) { return PVR_ERROR_NOT_IMPLEMENTED; }
int GetRecordingLastPlayedPosition(const PVR_RECORDING &recording) { return -1; }
+PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY[], int*) { return PVR_ERROR_NOT_IMPLEMENTED; };
int GetTimersAmount(void) { return -1; }
PVR_ERROR GetTimers(ADDON_HANDLE handle) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR AddTimer(const PVR_TIMER &timer) { return PVR_ERROR_NOT_IMPLEMENTED; }
View
1 addons/pvr.dvbviewer/src/client.cpp
@@ -501,6 +501,7 @@ long long LengthLiveStream(void) { return -1; }
PVR_ERROR SetRecordingPlayCount(const PVR_RECORDING &recording, int count) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR SetRecordingLastPlayedPosition(const PVR_RECORDING &recording, int lastplayedposition) { return PVR_ERROR_NOT_IMPLEMENTED; }
int GetRecordingLastPlayedPosition(const PVR_RECORDING &recording) { return -1; }
+PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY[], int*) { return PVR_ERROR_NOT_IMPLEMENTED; };
unsigned int GetChannelSwitchDelay(void) { return 0; }
void PauseStream(bool bPaused) {}
bool CanPauseStream(void) { return false; }
View
1 addons/pvr.hts/src/client.cpp
@@ -710,6 +710,7 @@ const char * GetLiveStreamURL(const PVR_CHANNEL &channel) { return ""; }
PVR_ERROR SetRecordingPlayCount(const PVR_RECORDING &recording, int count) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR SetRecordingLastPlayedPosition(const PVR_RECORDING &recording, int lastplayedposition) { return PVR_ERROR_NOT_IMPLEMENTED; }
int GetRecordingLastPlayedPosition(const PVR_RECORDING &recording) { return -1; }
+PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY[], int*) { return PVR_ERROR_NOT_IMPLEMENTED; };
unsigned int GetChannelSwitchDelay(void) { return 0; }
void PauseStream(bool bPaused) {}
View
1 addons/pvr.mediaportal.tvserver/src/client.cpp
@@ -853,6 +853,7 @@ void DemuxFlush(void) {}
PVR_ERROR SetRecordingLastPlayedPosition(const PVR_RECORDING &recording, int lastplayedposition) { return PVR_ERROR_NOT_IMPLEMENTED; }
int GetRecordingLastPlayedPosition(const PVR_RECORDING &recording) { return -1; }
+PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY[], int*) { return PVR_ERROR_NOT_IMPLEMENTED; };
unsigned int GetChannelSwitchDelay(void) { return 0; }
bool SeekTime(int,bool,double*) { return false; }
void SetSpeed(int) {};
View
9 addons/pvr.mythtv.cmyth/src/client.cpp
@@ -460,6 +460,7 @@ PVR_ERROR GetAddonCapabilities(PVR_ADDON_CAPABILITIES *pCapabilities)
pCapabilities->bSupportsRecordings = true;
pCapabilities->bSupportsRecordingPlayCount = true;
pCapabilities->bSupportsLastPlayedPosition = true;
+ pCapabilities->bSupportsRecordingEdl = true;
return PVR_ERROR_NO_ERROR;
}
else
@@ -653,6 +654,14 @@ int GetRecordingLastPlayedPosition(const PVR_RECORDING &recording)
return g_client->GetRecordingLastPlayedPosition(recording);
}
+PVR_ERROR GetRecordingEdl(const PVR_RECORDING &recording, PVR_EDL_ENTRY entries[], int *size)
+{
+ if (g_client == NULL)
+ return PVR_ERROR_SERVER_ERROR;
+
+ return g_client->GetRecordingEdl(recording, entries, size);
+}
+
/*******************************************/
/** PVR Timer Functions **/
View
38 addons/pvr.mythtv.cmyth/src/cppmyth/MythConnection.cpp
@@ -359,3 +359,41 @@ long long MythConnection::GetBookmark(MythProgramInfo &recording)
CMYTH_CONN_CALL(bookmark, bookmark < 0, cmyth_get_bookmark(*m_conn_t, *recording.m_proginfo_t));
return bookmark;
}
+
+Edl MythConnection::GetCommbreakList(MythProgramInfo &recording)
+{
+ Edl retval;
+ cmyth_commbreaklist_t list = NULL;
+ CMYTH_CONN_CALL(list, list == NULL, cmyth_get_commbreaklist(*m_conn_t, *recording.m_proginfo_t));
+ if (!list)
+ return retval;
+
+ retval.reserve(list->commbreak_count);
+ for (int i = 0; i < list->commbreak_count; ++i)
+ {
+ cmyth_commbreak commbreak = *list->commbreak_list[i];
+ retval.push_back(commbreak);
+ }
+
+ ref_release(list);
+ return retval;
+}
+
+Edl MythConnection::GetCutList(MythProgramInfo &recording)
+{
+ Edl retval;
+ cmyth_commbreaklist_t list = NULL;
+ CMYTH_CONN_CALL(list, list == NULL, cmyth_get_cutlist(*m_conn_t, *recording.m_proginfo_t));
+ if (!list)
+ return retval;
+
+ retval.reserve(list->commbreak_count);
+ for (int i = 0; i < list->commbreak_count; ++i)
+ {
+ cmyth_commbreak commbreak = *list->commbreak_list[i];
+ retval.push_back(commbreak);
+ }
+
+ ref_release(list);
+ return retval;
+}
View
7 addons/pvr.mythtv.cmyth/src/cppmyth/MythConnection.h
@@ -41,6 +41,9 @@ template <class T> class MythPointerThreadSafe;
typedef std::map<CStdString, MythProgramInfo> ProgramInfoMap;
+typedef cmyth_commbreak MythEdlEntry;
+typedef std::vector<MythEdlEntry> Edl;
+
class MythConnection
{
public:
@@ -89,6 +92,10 @@ class MythConnection
long long GetBookmark(MythProgramInfo &recording);
bool SetBookmark(MythProgramInfo &recording, long long bookmark);
+ // Edl
+ Edl GetCutList(MythProgramInfo &recording);
+ Edl GetCommbreakList(MythProgramInfo &recording);
+
private:
boost::shared_ptr<MythPointerThreadSafe<cmyth_conn_t> > m_conn_t;
CStdString m_server;
View
57 addons/pvr.mythtv.cmyth/src/pvrclient-mythtv.cpp
@@ -861,6 +861,63 @@ int PVRClientMythTV::GetRecordingLastPlayedPosition(const PVR_RECORDING &recordi
return bookmark;
}
+PVR_ERROR PVRClientMythTV::GetRecordingEdl(const PVR_RECORDING &recording, PVR_EDL_ENTRY entries[], int *size)
+{
+ if (g_bExtraDebug)
+ {
+ XBMC->Log(LOG_DEBUG, "%s - Reading edl for: %s", __FUNCTION__, recording.strTitle);
+ }
+
+ CLockObject lock(m_recordingsLock);
+ ProgramInfoMap::iterator it = m_recordings.find(recording.strRecordingId);
+ if (it == m_recordings.end())
+ {
+ XBMC->Log(LOG_DEBUG, "%s - Recording %s does not exist", __FUNCTION__, recording.strRecordingId);
+ *size = 0;
+ return PVR_ERROR_FAILED;
+ }
+
+ float frameRate = m_db.GetRecordingFrameRate(it->second) / 1000.0f;
+ if (frameRate <= 0)
+ {
+ XBMC->Log(LOG_DEBUG, "%s - Failed to read framerate for %s", __FUNCTION__, recording.strRecordingId);
+ *size = 0;
+ return PVR_ERROR_FAILED;
+ }
+
+ Edl commbreakList = m_con.GetCommbreakList(it->second);
+ int commbreakCount = commbreakList.size();
+ XBMC->Log(LOG_DEBUG, "%s - Found %d commercial breaks for: %s", __FUNCTION__, commbreakCount, recording.strTitle);
+
+ Edl cutList = m_con.GetCutList(it->second);
+ XBMC->Log(LOG_DEBUG, "%s - Found %d cut list entries for: %s", __FUNCTION__, cutList.size(), recording.strTitle);
+
+ commbreakList.insert(commbreakList.end(), cutList.begin(), cutList.end());
+
+ int index = 0;
+ Edl::const_iterator edlIt;
+ for (edlIt = commbreakList.begin(); edlIt != commbreakList.end(); ++edlIt)
+ {
+ if (index < *size)
+ {
+ PVR_EDL_ENTRY entry;
+ entry.start = (int64_t)(edlIt->start_mark / frameRate * 1000);
+ entry.end = (int64_t)(edlIt->end_mark / frameRate * 1000);
+ entry.type = index < commbreakCount ? PVR_EDL_TYPE_COMBREAK : PVR_EDL_TYPE_CUT;
+ entries[index] = entry;
+ index++;
+ }
+ else
+ {
+ XBMC->Log(LOG_ERROR, "%s - Maximum number of edl entries reached for: %s", __FUNCTION__, recording.strTitle);
+ break;
+ }
+ }
+
+ *size = index;
+ return PVR_ERROR_NO_ERROR;
+}
+
int PVRClientMythTV::GetTimersAmount(void)
{
if (g_bExtraDebug)
View
1 addons/pvr.mythtv.cmyth/src/pvrclient-mythtv.h
@@ -85,6 +85,7 @@ class PVRClientMythTV : public MythEventObserver
PVR_ERROR SetRecordingPlayCount(const PVR_RECORDING &recording, int count);
PVR_ERROR SetRecordingLastPlayedPosition(const PVR_RECORDING &recording, int lastplayedposition);
int GetRecordingLastPlayedPosition(const PVR_RECORDING &recording);
+ PVR_ERROR GetRecordingEdl(const PVR_RECORDING &recording, PVR_EDL_ENTRY entries[], int *size);
// Timers
int GetTimersAmount();
View
1 addons/pvr.nextpvr/src/client.cpp
@@ -676,6 +676,7 @@ void DemuxFlush(void) {}
PVR_ERROR SetRecordingPlayCount(const PVR_RECORDING &recording, int count) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR SetRecordingLastPlayedPosition(const PVR_RECORDING &recording, int lastplayedposition) { return PVR_ERROR_NOT_IMPLEMENTED; }
int GetRecordingLastPlayedPosition(const PVR_RECORDING &recording) { return -1; }
+PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY[], int*) { return PVR_ERROR_NOT_IMPLEMENTED; };
unsigned int GetChannelSwitchDelay(void) { return 0; }
bool SeekTime(int,bool,double*) { return false; }
View
1 addons/pvr.njoy/src/client.cpp
@@ -261,6 +261,7 @@ PVR_ERROR RenameRecording(const PVR_RECORDING &recording) { return PVR_ERROR_NOT
PVR_ERROR SetRecordingPlayCount(const PVR_RECORDING &recording, int count) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR SetRecordingLastPlayedPosition(const PVR_RECORDING &recording, int lastplayedposition) { return PVR_ERROR_NOT_IMPLEMENTED; }
int GetRecordingLastPlayedPosition(const PVR_RECORDING &recording) { return -1; }
+PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY[], int*) { return PVR_ERROR_NOT_IMPLEMENTED; };
int GetTimersAmount(void) { return -1; }
PVR_ERROR GetTimers(ADDON_HANDLE handle) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR AddTimer(const PVR_TIMER &timer) { return PVR_ERROR_NOT_IMPLEMENTED; }
View
1 addons/pvr.vdr.vnsi/src/client.cpp
@@ -647,6 +647,7 @@ const char * GetLiveStreamURL(const PVR_CHANNEL &channel) { return ""; }
PVR_ERROR SetRecordingPlayCount(const PVR_RECORDING &recording, int count) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR SetRecordingLastPlayedPosition(const PVR_RECORDING &recording, int lastplayedposition) { return PVR_ERROR_NOT_IMPLEMENTED; }
int GetRecordingLastPlayedPosition(const PVR_RECORDING &recording) { return -1; }
+PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY[], int*) { return PVR_ERROR_NOT_IMPLEMENTED; };
unsigned int GetChannelSwitchDelay(void) { return 0; }
void PauseStream(bool bPaused) {}
bool CanPauseStream(void) { return false; }
View
1 addons/pvr.vuplus/src/client.cpp
@@ -588,6 +588,7 @@ long long SeekLiveStream(long long iPosition, int iWhence /* = SEEK_SET */) { re
long long PositionLiveStream(void) { return -1; }
long long LengthLiveStream(void) { return -1; }
PVR_ERROR SetRecordingPlayCount(const PVR_RECORDING &recording, int count) { return PVR_ERROR_NOT_IMPLEMENTED; }
+PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY[], int*) { return PVR_ERROR_NOT_IMPLEMENTED; };
unsigned int GetChannelSwitchDelay(void) { return 0; }
void PauseStream(bool bPaused) {}
bool CanPauseStream(void) { return false; }
View
11 xbmc/xbmc_pvr_dll.h
@@ -284,6 +284,16 @@ extern "C"
*/
int GetRecordingLastPlayedPosition(const PVR_RECORDING& recording);
+ /*!
+ * Retrieve the edit decision list (EDL) of a recording on the backend.
+ * @param recording The recording.
+ * @param edl out: The function has to write the EDL list into this array.
+ * @param size in: The maximum size of the EDL, out: the actual size of the EDL.
+ * @return PVR_ERROR_NO_ERROR if the EDL was successfully read.
+ * @remarks Required if bSupportsRecordingEdl is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function.
+ */
+ PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY edl[], int *size);
+
//@}
/** @name PVR timer methods
* @remarks Only used by XBMC is bSupportsTimers is set to true.
@@ -586,6 +596,7 @@ extern "C"
pClient->SetRecordingPlayCount = SetRecordingPlayCount;
pClient->SetRecordingLastPlayedPosition = SetRecordingLastPlayedPosition;
pClient->GetRecordingLastPlayedPosition = GetRecordingLastPlayedPosition;
+ pClient->GetRecordingEdl = GetRecordingEdl;
pClient->GetTimersAmount = GetTimersAmount;
pClient->GetTimers = GetTimers;
View
22 xbmc/xbmc_pvr_types.h
@@ -33,6 +33,7 @@
#endif
#endif
#include <string.h>
+#include <stdint.h>
#include "xbmc_addon_types.h"
#include "xbmc_epg_types.h"
@@ -67,6 +68,7 @@ struct DemuxPacket;
#define PVR_ADDON_URL_STRING_LENGTH 1024
#define PVR_ADDON_DESC_STRING_LENGTH 1024
#define PVR_ADDON_INPUT_FORMAT_STRING_LENGTH 32
+#define PVR_ADDON_EDL_LENGTH 32
/* using the default avformat's MAX_STREAMS value to be safe */
#define PVR_STREAM_MAX_STREAMS 20
@@ -154,6 +156,7 @@ extern "C" {
bool bSupportsRecordingFolders; /*!< @brief true if the backend supports timers / recordings in folders. */
bool bSupportsRecordingPlayCount; /*!< @brief true if the backend supports play count for recordings. */
bool bSupportsLastPlayedPosition; /*!< @brief true if the backend supports store/retrieve of last played position for recordings. */
+ bool bSupportsRecordingEdl; /*!< @brief true if the backend supports retrieving an edit decision list for recordings. */
} ATTRIBUTE_PACKED PVR_ADDON_CAPABILITIES;
/*!
@@ -288,6 +291,24 @@ extern "C" {
} ATTRIBUTE_PACKED PVR_RECORDING;
/*!
+ * @brief Edit definition list (EDL)
+ */
+ typedef enum
+ {
+ PVR_EDL_TYPE_CUT = 0, /*!< @brief cut (completly remove content) */
+ PVR_EDL_TYPE_MUTE = 1, /*!< @brief mute audio */
+ PVR_EDL_TYPE_SCENE = 2, /*!< @brief scene markers (chapter seeking) */
+ PVR_EDL_TYPE_COMBREAK = 3 /*!< @brief commercial breaks */
+ } PVR_EDL_TYPE;
+
+ typedef struct PVR_EDL_ENTRY
+ {
+ int64_t start; // ms
+ int64_t end; // ms
+ PVR_EDL_TYPE type;
+ } ATTRIBUTE_PACKED PVR_EDL_ENTRY;
+
+ /*!
* @brief Structure to transfer the methods from xbmc_pvr_dll.h to XBMC
*/
typedef struct PVRClient
@@ -320,6 +341,7 @@ extern "C" {
PVR_ERROR (__cdecl* SetRecordingPlayCount)(const PVR_RECORDING&, int);
PVR_ERROR (__cdecl* SetRecordingLastPlayedPosition)(const PVR_RECORDING&, int);
int (__cdecl* GetRecordingLastPlayedPosition)(const PVR_RECORDING&);
+ PVR_ERROR (__cdecl* GetRecordingEdl)(const PVR_RECORDING&, PVR_EDL_ENTRY[], int*);
int (__cdecl* GetTimersAmount)(void);
PVR_ERROR (__cdecl* GetTimers)(ADDON_HANDLE);
PVR_ERROR (__cdecl* AddTimer)(const PVR_TIMER&);

0 comments on commit 121b7c7

Please sign in to comment.
Something went wrong with that request. Please try again.