25 #include "mediaplayer.h"
26 #include "rdkmediaplayerimpl.h"
27 #ifdef USE_EXTERNAL_CAS
28 #include "CASDataListener.h"
29 #include "CASHelper.h"
30 #include "casservice.h"
32 using namespace anycas;
36 virtual void open(
const std::string& openData) = 0;
37 virtual void registerCASData() = 0;
38 virtual void sendCASData(
const std::string& data) = 0;
39 virtual void destroy(
const std::string& casOcdmId) = 0;
45 #ifdef USE_EXTERNAL_CAS
54 static bool canPlayURL(
const std::string& url);
57 bool doCanPlayURL(
const std::string& url);
59 void doLoad(
const std::string& url);
60 void doSetVideoRectangle(
const IntRect& rect);
61 void doSetAudioLanguage(std::string& lang);
64 void doSetPosition(
float position);
67 void doChangeSpeed(
float speed, int32_t overshootTime);
68 void doSetSpeed(
float speed);
69 void doSetBlocked(
bool blocked);
70 void doSetEISSFilterStatus(
bool status);
71 void doSetVolume(
float volume);
72 void doSetIsInProgressRecording(
bool isInProgressRecording);
73 void doSetZoom(
int zoom);
74 void doSetNetworkBufferSize(int32_t networkBufferSize);
75 void doSetVideoBufferLength(
float videoBufferLength);
77 bool isManagementSession()
const;
79 #ifdef USE_EXTERNAL_CAS
81 void open(
const std::string& openData);
82 void registerCASData();
83 void sendCASData(
const std::string& data);
84 void destroy(
const std::string& casOcdmId);
87 uint32_t setKeySlot(uint16_t pid, std::vector<uint8_t> data);
88 uint32_t deleteKeySlot(uint16_t pid);
92 ICasFilterStatus create(uint16_t pid, ICasFilterParam ¶m, ICasHandle **pHandle);
93 ICasFilterStatus setState(
bool isRunning, ICasHandle* handle);
94 ICasFilterStatus start(ICasHandle* handle);
95 ICasFilterStatus destroy(ICasHandle* handle);
97 uint32_t getPATBuffer(std::vector<uint8_t>& patBuf);
98 uint32_t getPMTBuffer(std::vector<uint8_t>& pmtBuf);
99 uint32_t getCATBuffer(std::vector<uint8_t>& catBuf);
100 bool getAudioPidFromPMT(uint32_t *pid,
const std::string& audioLang);
104 void mediaPlayerEngineUpdated();
105 void mediaPlaybackCompleted();
106 void mediaFrameReceived();
107 void mediaWarningReceived();
108 void volumeChanged(
float volume);
109 void playerStateChanged();
110 void videoStateChanged();
111 void durationChanged();
114 void videoDecoderHandleReceived();
115 void eissDataReceived();
117 void sectionDataReceived();
118 void languageChange();
119 void psiUpdateReceived(uint8_t psiStatus);
121 int getCurrentAudioPid();
124 void doTimeUpdate(
bool forced =
false);
125 void startPlaybackProgressMonitor();
126 void stopPlaybackProgressMonitor();
127 bool refreshCachedCurrentTime(
bool forced =
false);
128 bool endedPlayback()
const;
129 bool potentiallyPlaying()
const;
130 bool couldPlayIfEnoughData()
const;
131 static bool setContentType(
const std::string &url, std::string& contentType);
132 int get_section_length(vector<uint8_t>sectionDataBuffer);
133 vector<uint8_t> get_multiple_section_data(vector<uint8_t>§ionDataBuffer,
int sectionSize);
135 std::unique_ptr<MediaPlayer> m_mediaPlayer;
136 MediaPlayer::RMFPlayerState m_playerState;
137 MediaPlayer::RMFVideoBufferState m_videoState;
138 MediaPlayer::RMFVideoBufferState m_videoStateMaximum;
144 float m_lastReportedCurrentTime;
145 float m_lastReportedDuration;
146 float m_lastReportedPlaybackRate;
147 #ifdef USE_EXTERNAL_CAS
151 guint m_playbackProgressMonitorTag;
152 gint64 m_lastRefreshTime;
153 std::string m_contentType;
154 gint64 m_loadStartTime { 0 };
155 gint64 m_setURLTime { 0 };
156 gint64 m_loadedTime { 0 };
157 gint64 m_loadCompleteTime { 0 };
158 gint64 m_playStartTime { 0 };
159 gint64 m_playEndTime { 0 };
160 gint64 m_firstFrameTime { 0 };
161 #ifdef USE_EXTERNAL_CAS
163 mutable std::mutex cas_mutex;