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