19 #ifndef RDKMEDIAPLAYERIMPL
20 #define RDKMEDIAPLAYERIMPL
30 double position, duration, speed, start, end;
31 ProgressData() : position(0), duration(0), speed(0), start(-1), end(-1) {}
44 virtual bool doCanPlayURL(
const std::string& url) = 0;
45 virtual void doInit() = 0;
46 virtual void doLoad(
const std::string& url) = 0;
47 virtual void doSetVideoRectangle(
const IntRect& rect) = 0;
48 virtual void doSetAudioLanguage(std::string& lang) = 0;
49 virtual void doPlay() = 0;
50 virtual void doPause() = 0;
51 virtual void doSetPosition(
float position) = 0;
52 virtual void doSeekToLive() = 0;
53 virtual void doStop() = 0;
54 virtual void doChangeSpeed(
float speed, int32_t overshootTime) = 0;
55 virtual void doSetSpeed(
float speed) = 0;
56 virtual void doSetBlocked(
bool blocked) = 0;
57 virtual void doSetEISSFilterStatus(
bool status) = 0;
58 virtual void doSetVolume(
float volume) = 0;
59 virtual void doSetIsInProgressRecording(
bool isInProgressRecording) = 0;
60 virtual void doSetZoom(
int zoom) = 0;
61 virtual void doSetNetworkBufferSize(int32_t networkBufferSize) = 0;
62 virtual void doSetVideoBufferLength(
float videoBufferLength) = 0;
63 virtual void getProgressData(
ProgressData* progressData) = 0;
64 virtual bool isManagementSession()
const = 0;
69 TuneState getTuneState()
73 void setTuneState(TuneState state)
80 TuneState m_tuneState;
87 OnMediaOpenedEvent(
const char* mediaType,
int duration,
int width,
int height,
const char* availableSpeeds,
const char* availableAudioLanguages,
const char* availableClosedCaptionsLanguages) :
Event(
"onMediaOpened")
89 m_object.set(
"mediaType", mediaType);
90 m_object.set(
"duration", duration);
91 m_object.set(
"width", width);
92 m_object.set(
"height", height);
93 m_object.set(
"availableSpeeds", availableSpeeds);
94 m_object.set(
"availableAudioLanguages", availableAudioLanguages);
95 m_object.set(
"availableClosedCaptionsLanguages", availableClosedCaptionsLanguages);
97 m_object.set(
"customProperties",
"");
98 m_object.set(
"mediaSegments",
"");
109 rtValue nameVal =
"onStatus";
111 Set(
"name", &nameVal);
112 Set(
"position", &val);
113 Set(
"duration", &val);
117 Set(
"bufferPercentage", &val);
118 Set(
"connectionURL", &val);
119 Set(
"dynamicProps", &val);
120 Set(
"isBuffering", &val);
122 Set(
"netStreamInfo", &val);
124 rtError
Get(
const char* name, rtValue* value)
const override
128 if(name == NULL) {
return RT_FAIL; }
130 m_player->getProgressData(&pd);
131 errno_t safec_rc = -1;
134 safec_rc = strcmp_s(
"position", strlen(
"position"), name, &ind);
136 if((safec_rc == EOK) && (!ind)) { *value = pd.position;
return RT_OK; }
138 safec_rc = strcmp_s(
"duration", strlen(
"duration"), name, &ind);
140 if((safec_rc == EOK) && (!ind)) { *value = pd.duration;
return RT_OK; }
141 return rtMapObject::Get(name, value);
155 rtValue nameVal =
"onProgress";
157 Set(
"name", &nameVal);
158 Set(
"position", &val);
159 Set(
"duration", &val);
164 rtError
Get(
const char* name, rtValue* value)
const override
168 if(name == NULL) {
return RT_FAIL; }
170 m_player->getProgressData(&pd);
171 errno_t safec_rc = -1;
174 safec_rc = strcmp_s(
"position", strlen(
"position"), name, &ind);
176 if((safec_rc == EOK) && (!ind)) { *value = pd.position;
return RT_OK; }
178 safec_rc = strcmp_s(
"duration", strlen(
"duration"), name, &ind);
180 if((safec_rc == EOK) && (!ind)) { *value = pd.duration;
return RT_OK; }
182 safec_rc = strcmp_s(
"speed", strlen(
"speed"), name, &ind);
184 if((safec_rc == EOK) && (!ind)) { *value = pd.speed;
return RT_OK; }
186 safec_rc = strcmp_s(
"start", strlen(
"start"), name, &ind);
188 if((safec_rc == EOK) && (!ind)) { *value = pd.start;
return RT_OK; }
190 safec_rc = strcmp_s(
"end", strlen(
"end"), name, &ind);
192 if((safec_rc == EOK) && (!ind)) { *value = pd.end;
return RT_OK; }
194 return rtMapObject::Get(name, value);
214 m_object.set(
"code", code);
215 m_object.set(
"description", rtString(description.c_str()));
223 m_object.set(
"code", code);
224 m_object.set(
"description", rtString(description.c_str()));
232 m_object.set(
"speed", speed);
240 m_object.set(
"props", props);
246 OnSegmentStartedEvent(
const std::string& segmentType,
double duration,
const std::string& segmentId, rtObjectRef
const& segment) :
Event(
"onSegmentStarted")
248 m_object.set(
"segmentType", segmentType.c_str());
249 m_object.set(
"duration", duration);
250 m_object.set(
"segmentId", segmentId.c_str());
251 m_object.set(
"segment", segment);
257 OnSegmentCompletedEvent(
const std::string& segmentType,
double duration,
const std::string& segmentId, rtObjectRef
const& segment) :
Event(
"onSegmentCompleted")
259 m_object.set(
"segmentType", segmentType.c_str());
260 m_object.set(
"duration", duration);
261 m_object.set(
"segmentId", segmentId.c_str());
262 m_object.set(
"segment", segment);
268 OnSegmentWatchedEvent(
const std::string& segmentType,
double duration,
const std::string& segmentId, rtObjectRef
const& segment) :
Event(
"onSegmentWatched")
270 m_object.set(
"segmentType", segmentType.c_str());
271 m_object.set(
"duration", duration);
272 m_object.set(
"segmentId", segmentId.c_str());
273 m_object.set(
"segment", segment);
279 OnBufferWarningEvent(
const std::string& warningType,
double bufferSize,
double bufferFillSize) :
Event(
"onBufferWarning")
281 m_object.set(
"warningType", warningType.c_str());
282 m_object.set(
"bufferSize", bufferSize);
283 m_object.set(
"bufferFillSize", bufferFillSize);
291 m_object.set(
"availableSpeeds", availableSpeeds.c_str());
299 m_object.set(
"locator", locator.c_str());
300 m_object.set(
"eventId", eventId.c_str());
311 m_object.set(
"rmfEISSDataBuffer", rtString(eissData.c_str()));
320 m_object.set(
"message", message);
328 m_object.set(
"bitrate", bitrate);
329 m_object.set(
"reason", reason);
337 m_object.set(
"casData", rtString(data.c_str()));