Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #207 from kendrak24/pvr.hts_edl

Implemented GetRecordingEdl for pvr.hts addon.
  • Loading branch information...
commit 0b39fbfc5728f0dd0cca6fc68fc371f7d9e201a7 2 parents 2a3daf8 + 9958549
@opdenkamp authored
View
2  addons/pvr.hts/addon/addon.xml.in
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.hts"
- version="1.9.23"
+ version="1.9.24"
name="Tvheadend HTSP Client"
provider-name="Lars Op den Kamp, Team XBMC">
<requires>
View
3  addons/pvr.hts/addon/changelog.txt
@@ -1,3 +1,6 @@
+1.9.24
+- add EDL support
+
1.9.23
- add timeshift buffer functions
View
94 addons/pvr.hts/src/HTSPData.cpp
@@ -37,6 +37,14 @@ typedef enum {
DVR_PRIO_UNIMPORTANT,
} dvr_prio_t;
+typedef enum {
+ DVR_ACTION_TYPE_CUT,
+ DVR_ACTION_TYPE_MUTE,
+ DVR_ACTION_TYPE_SCENE,
+ DVR_ACTION_TYPE_COMBREAK,
+
+} dvr_action_type_t;
+
using namespace std;
using namespace ADDON;
using namespace PLATFORM;
@@ -1427,3 +1435,89 @@ void CHTSPData::SetSpeed(int speed)
if (m_demux && CanTimeshift())
m_demux->SetSpeed(speed);
}
+
+PVR_ERROR CHTSPData::GetEdl(const PVR_RECORDING &recording, PVR_EDL_ENTRY entries[], int *size)
+{
+ if (GetProtocol() < 12) return PVR_ERROR_NOT_IMPLEMENTED;
+
+ XBMC->Log(LOG_DEBUG, "%s - dvrEntryId:%s", __FUNCTION__, recording.strRecordingId);
+
+ htsmsg_t *msg = htsmsg_create_map();
+ htsmsg_add_str(msg, "method", "getDvrCutpoints");
+ htsmsg_add_u32(msg, "id", atoi(recording.strRecordingId));
+
+ CHTSResult result;
+ ReadResult(msg, result);
+ if (result.status != PVR_ERROR_NO_ERROR)
+ {
+ XBMC->Log(LOG_ERROR, "%s - Failed to get EDL data.", __FUNCTION__);
+ return result.status;
+ }
+
+ htsmsg_t *edlList = htsmsg_get_list(result.message, "cutpoints");
+ if(!edlList)
+ {
+ XBMC->Log(LOG_DEBUG, "%s - No EDL list found.", __FUNCTION__);
+ *size = 0;
+ return PVR_ERROR_NO_ERROR;
+ }
+
+ htsmsg_field_t *field;
+ int index = 0;
+ HTSMSG_FOREACH(field, edlList)
+ {
+ if(field->hmf_type != HMF_MAP)
+ continue;
+
+ if(index < *size)
+ {
+ htsmsg_t *edl = &field->hmf_msg;
+
+ // start and end are in milliseconds
+ unsigned int start, end, type;
+
+ if (htsmsg_get_u32(edl, "start", &start) != 0 ||
+ htsmsg_get_u32(edl, "end", &end) != 0 ||
+ htsmsg_get_u32(edl, "type", &type) != 0)
+ {
+ continue;
+ }
+
+ PVR_EDL_ENTRY entry;
+ entry.start = start;
+ entry.end = end;
+
+ switch(type)
+ {
+ case DVR_ACTION_TYPE_CUT:
+ entry.type = PVR_EDL_TYPE_CUT;
+ break;
+ case DVR_ACTION_TYPE_MUTE:
+ entry.type = PVR_EDL_TYPE_MUTE;
+ break;
+ case DVR_ACTION_TYPE_SCENE:
+ entry.type = PVR_EDL_TYPE_SCENE;
+ break;
+ case DVR_ACTION_TYPE_COMBREAK:
+ entry.type = PVR_EDL_TYPE_COMBREAK;
+ break;
+ default:
+ entry.type = PVR_EDL_TYPE_COMBREAK;
+ break;
+ }
+
+ XBMC->Log(LOG_DEBUG, "%s - EDL: start: %d, end: %d, action: %d", __FUNCTION__, entry.start, entry.end, entry.type);
+
+ entries[index] = entry;
+ index++;
+ }
+ else
+ {
+ XBMC->Log(LOG_ERROR, "%s - Maximum number of EDL entries reached for recordingId: %s", __FUNCTION__, recording.strRecordingId);
+ break;
+ }
+ }
+ *size = index;
+
+ return PVR_ERROR_NO_ERROR;
+}
View
1  addons/pvr.hts/src/HTSPData.h
@@ -92,6 +92,7 @@ class CHTSPData : CHTSPConnectionCallback
DemuxPacket* DemuxRead(void);
bool SeekTime(int time,bool backward,double *startpts);
void SetSpeed(int speed);
+ PVR_ERROR GetEdl(const PVR_RECORDING &recinfo, PVR_EDL_ENTRY entries[], int *size);
private:
SChannels GetChannels();
SChannels GetChannels(int tag);
View
10 addons/pvr.hts/src/client.cpp
@@ -414,6 +414,7 @@ PVR_ERROR GetAddonCapabilities(PVR_ADDON_CAPABILITIES* pCapabilities)
pCapabilities->bHandlesInputStream = true;
pCapabilities->bHandlesDemuxing = true;
pCapabilities->bSupportsRecordingFolders = true;
+ pCapabilities->bSupportsRecordingEdl = true;
return PVR_ERROR_NO_ERROR;
}
@@ -727,6 +728,14 @@ void DemuxFlush(void)
HTSPData->DemuxFlush();
}
+PVR_ERROR GetRecordingEdl(const PVR_RECORDING &recording, PVR_EDL_ENTRY entries[], int *size)
+{
+ if (!HTSPData || !HTSPData->IsConnected())
+ return PVR_ERROR_SERVER_ERROR;
+
+ return HTSPData->GetEdl(recording, &*entries, size);
+}
+
/** UNUSED API FUNCTIONS */
PVR_ERROR DialogChannelScan(void) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR DeleteChannel(const PVR_CHANNEL &channel) { return PVR_ERROR_NOT_IMPLEMENTED; }
@@ -743,7 +752,6 @@ 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) {}
time_t GetPlayingTime() { return 0; }
Please sign in to comment.
Something went wrong with that request. Please try again.