RDK Documentation (Open Sourced RDK Components)
mediaplayergeneric.h
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2018 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 #ifndef MEDIAPLAYERGENERIC_H
20 #define MEDIAPLAYERGENERIC_H
21 
22 #include <gst/gst.h>
23 
24 #include "intrect.h"
25 #include "mediaplayer.h"
26 #include "timer.h"
27 
29 {
30 public:
31  explicit MediaPlayerGeneric(MediaPlayerClient* client);
32  virtual ~MediaPlayerGeneric();
33 
34  MediaPlayer::RMFPlayerState rmf_playerState() const;
35  MediaPlayer::RMFVideoBufferState rmf_videoState() const;
36  bool rmf_load(const std::string &url);
37  void rmf_play();
38  void rmf_stop();
39  void rmf_pause();
40  bool rmf_canItPlay() const;
41  bool rmf_isPaused() const;
42  void rmf_setRate(float speed);
43  float rmf_getRate() const;
44  void rmf_setVolume(float volume);
45  float rmf_getVolume() const;
46  void rmf_setMute(bool mute);
47  bool rmf_isMuted() const;
48  float rmf_getDuration() const;
49  float rmf_getCurrentTime() const;
50  void rmf_seekToLivePosition();
51  void rmf_seekToStartPosition();
52  void rmf_seek(float time);
53  bool rmf_isSeeking() const;
54  unsigned long rmf_getCCDecoderHandle() const;
55  std::string rmf_getAudioLanguages() const;
56  void rmf_setAudioLanguage(const std::string &audioLang);
57  void rmf_setAudioMute(bool isMuted);
58  void rmf_setEissFilterStatus(bool status);
59  void rmf_setVideoZoom(unsigned short zoomVal);
60  void rmf_setVideoBufferLength(float bufferLength);
61  void rmf_setInProgressRecording(bool isInProgress);
62  bool rmf_isItInProgressRecording() const;
63  std::string rmf_getMediaErrorMessage() const;
64  void rmf_changeSpeed(float speed, short overshootTime);
65  std::string rmf_getMediaWarnDescription() const;
66  int rmf_getMediaWarnData() const;
67  std::string rmf_getAvailableAudioTracks() const;
68  std::string rmf_getCaptionDescriptor() const;
69  std::string rmf_getEISSDataBuffer() const;
70  void rmf_setNetworkBufferSize(int bufferSize);
71  int rmf_getNetworkBufferSize() const;
72  void rmf_setVideoRectangle(unsigned x, unsigned y, unsigned w, unsigned h);
73  MediaPlayerSink* rmf_getPlayerSink() { return nullptr; };
74  IRMFMediaSource* rmf_getSource() { return nullptr; };
75  int rmf_getVideoPid();
76  int rmf_getAudioPid();
77  void rmf_setVideoKeySlot(const char* str);
78  void rmf_setAudioKeySlot(const char* str);
79  void rmf_deleteVideoKeySlot();
80  void rmf_deleteAudioKeySlot();
81  uint32_t getPATBuffer(std::vector<uint8_t>& buf) { return 0; }
82  uint32_t getPMTBuffer(std::vector<uint8_t>& buf) { return 0; }
83  uint32_t getCATBuffer(std::vector<uint8_t>& buf) { return 0; }
84  bool getAudioPidFromPMT(uint32_t *pid, const std::string& audioLang) { };
85  bool getAudioMute() const { };
86  void setFilter(uint16_t pid, char* filterParam, uint32_t *pFilterId) { }
87  uint32_t getSectionData(uint32_t *filterId, std::vector<uint8_t>& sectionData) { return 0; }
88  void releaseFilter(uint32_t filterId) { }
89  void resumeFilter(uint32_t filterId) { }
90  void pauseFilter(uint32_t filterId) { }
91 
92 private:
93  static void busMessageCallback(GstBus* bus, GstMessage* msg, gpointer data);
94 
95  GstElement* pipeline() const;
96 
97  void updateStates();
98  bool changePipelineState(GstState newState);
99  void handleBusMessage(GstBus* bus, GstMessage* msg);
100  void endOfStream();
101  void notifyError(const char *message);
102  void loadingFailed(MediaPlayer::RMFPlayerState error);
103  void cleanup();
104 
105  MediaPlayerClient* m_playerClient;
106  GstElement* m_pipeline;
107  MediaPlayer::RMFPlayerState m_playerState;
108  MediaPlayer::RMFVideoBufferState m_videoState;
109  std::string m_url;
110  std::string m_errorMsg;
111  bool m_errorOccured;
112  bool m_seekIsPending;
113  float m_seekTime;
114  IntRect m_lastKnownRect;
115 };
116 
117 #endif /* MEDIAPLAYERGENERIC_H */
MediaPlayer
Definition: mediaplayer.h:51
MediaPlayerGeneric
Definition: mediaplayergeneric.h:28
MediaPlayerClient
Definition: mediaplayer.h:29
IntRect
Definition: intrect.h:22