webOS Userland
Native system APIs for webOS
StarfishMediaAPIs.h
1 #pragma once
2 
3 #include <string>
4 #include <cstdint>
5 
6 #include <boost/shared_ptr.hpp>
7 
8 namespace mediapipeline {
9  class Player;
10 }
11 
12 namespace smp {
13  class ProgramInfo;
14  class SourceInfo;
15  class VideoTrack;
16 
17  namespace util {
18  bool isPlatformFhd(const std::string& platform);
19  bool isPlatformMStar(const std::string& platform);
20  bool isPlatformSIC(const std::string& platform);
21  bool isPlatformRealtek(const std::string& platform);
22  bool isPlatformSupportSoftwareAudioDecoder(std::string platform);
23 
24  bool isSupportedAudio(std::string audio, int32_t version, int32_t channel);
25  bool isSupportedVideo(std::string video, int32_t width, int32_t height, int32_t frameRate, int64_t bitRate);
26  bool isSupportedVideo(std::string video, int32_t width, int32_t height, int32_t frameRate, int64_t bitRate, std::string decodeType);
27 
28  bool getMaxVideoResolution(std::string video, int32_t* width, int32_t* height, int32_t* frameRate);
29  bool getMaxVideoResolution(std::string video, int32_t* width, int32_t* height, int32_t* frameRate, std::string decodeType);
30  }
31 }
32 
34 {
35 public:
36  StarfishMediaAPIs(const char *uid = nullptr);
38 
39  bool Exit();
40  std::string Feed(const char *payload);
41  bool flush();
42  bool flush(const char *payload);
43  int64_t getCurrentPlaytime();
44  bool getVideoRenderQueueLength(int &length);
45  bool getAudioBufferSize(int &total, int &used);
46  const char *getMediaID();
47  const char *getVolume();
48  bool Load(const char *payload, void(callback)(int type, int64_t numValue, const char *strValue));
49  bool Load(const char *payload, void(callback)(int type, int64_t numValue, const char *strValue, void *data), void *data);
50  bool notifyBackground();
51  bool notifyForeground();
52  bool Pause();
53  bool Play();
54  bool pushEOS();
55  void setCurrentPlaytime(int64_t playtime);
56  bool Seek(const char *millis);
57  bool setAudioMute(const char *message);
58  void setDrmOperation(const char* message);
59  bool setHdrInfo(const char* message);
60  bool SetPlayRate(const char* message);
61  bool SetProperty(const char* message);
62  bool setTimeToDecode(const char *);
63  bool setVolume(const char *);
64  bool setWindowId(const char* message);
65  bool Stop();
66  bool takeSnapshot(const char *message);
67  bool Unload();
68 #ifdef __G_MAIN_H__
69  void setExternalContext(GMainContext *);
70  void unsetExternalContext();
71 #endif
72 private:
73  char unknown[76];
74 public:
75  boost::shared_ptr<mediapipeline::Player> player;
76 private:
77  // Must include big enough storage size. On some system it has 300 bytes, 4KB here should be fairly enough
78  char padding[4096];
79 };
80 
81 enum PF_EVENT_T
82 {
83  PF_EVENT_TYPE_FRAMEREADY = 0x0,
84  PF_EVENT_TYPE_STR_STREAMING_INFO_PERI = 0x1,
85  PF_EVENT_TYPE_INT_BUFFER_RANGE_INFO = 0x2,
86  PF_EVENT_TYPE_INT_DURATION = 0x3,
87  PF_EVENT_TYPE_STR_VIDEO_INFO = 0x4,
88  PF_EVENT_TYPE_STR_VIDEO_TRACK_INFO = 0x5,
89  PF_EVENT_TYPE_STR_AUDIO_INFO = 0x7,
90  PF_EVENT_TYPE_STR_AUDIO_TRACK_INFO = 0x8,
91  PF_EVENT_TYPE_STR_SUBT_TRACK_INFO = 0x9,
92  PF_EVENT_TYPE_STR_BUFF_EVENT = 0xa,
93  PF_EVENT_TYPE_STR_SOURCE_INFO = 0xb,
94  PF_EVENT_TYPE_INT_NUM_PROGRAM = 0xd,
95  PF_EVENT_TYPE_INT_NUM_VIDEO_TRACK = 0xe,
96  PF_EVENT_TYPE_INT_NUM_AUDIO_TRACK = 0xf,
97  PF_EVENT_TYPE_STR_RESOURCE_INFO = 0x11,
98  PF_EVENT_TYPE_INT_ERROR = 0x12,
99  PF_EVENT_TYPE_STR_ERROR = 0x13,
100  PF_EVENT_TYPE_STR_STATE_UPDATE__PRELOADCOMPLETED = 0x15,
101  PF_EVENT_TYPE_STR_STATE_UPDATE__LOADCOMPLETED = 0x16,
102  PF_EVENT_TYPE_STR_STATE_UPDATE__UNLOADCOMPLETED = 0x17,
103  PF_EVENT_TYPE_STR_STATE_UPDATE__TRACKSELECTED = 0x18,
104  PF_EVENT_TYPE_STR_STATE_UPDATE__SEEKDONE = 0x19,
105  PF_EVENT_TYPE_STR_STATE_UPDATE__PLAYING = 0x1a,
106  PF_EVENT_TYPE_STR_STATE_UPDATE__PAUSED = 0x1b,
107  PF_EVENT_TYPE_STR_STATE_UPDATE__ENDOFSTREAM = 0x1c,
108  PF_EVENT_TYPE_STR_CUSTOM = 0x1d,
109  PF_EVENT_TYPE_INT_NEED_DATA = 0x26,
110  PF_EVENT_TYPE_INT_ENOUGH_DATA = 0x27,
111  PF_EVENT_TYPE_INT_SVP_VDEC_READY = 0x2b,
112  PF_EVENT_TYPE_INT_BUFFERLOW = 0x2c,
113  PF_EVENT_TYPE_STR_BUFFERFULL = 0x2d,
114  PF_EVENT_TYPE_STR_BUFFERLOW = 0x2e,
115  PF_EVENT_TYPE_DROPPED_FRAME = 0x30,
116  PF_EVENT_USER_DEFINED = 0x270,
117 };
Definition: StarfishMediaAPIs.h:34