1 /* 2 * Copyright 2019 Rockchip Electronics Co. LTD 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 * author: rimon.xu@rock-chips.com 17 * fxw@rock-chips.com 18 * date: 2020-04-27 19 * module: RTMediaPlayerInterface 20 */ 21 22 #ifndef INCLUDE_RT_PLAYER_RTMEDIAPLAYERINTERFACE_H_ 23 #define INCLUDE_RT_PLAYER_RTMEDIAPLAYERINTERFACE_H_ 24 25 #include <sys/types.h> 26 #include <inttypes.h> 27 #include "rt_metadata.h" // NOLINT 28 29 class IMediaDataSource; 30 31 class RTPlayerListener { 32 public: ~RTPlayerListener()33 virtual ~RTPlayerListener() {} 34 virtual void notify(INT32 msg, INT32 ext1, INT32 ext2, void* ptr) = 0; 35 }; 36 37 class RTMediaPlayerInterface { 38 public: RTMediaPlayerInterface()39 RTMediaPlayerInterface() {} ~RTMediaPlayerInterface()40 virtual ~RTMediaPlayerInterface() {} 41 42 /* parameter operations */ 43 virtual rt_status setUID(uid_t uid) = 0; 44 virtual rt_status setDataSource(const char *url, const char *headers) = 0; 45 virtual rt_status setDataSource(INT32 fd, INT64 offset, INT64 length) = 0; 46 virtual rt_status setDataSource(IMediaDataSource *source) = 0; 47 virtual rt_status setLooping(INT32 loop) = 0; 48 virtual rt_status setListener(RTPlayerListener *listener) = 0; 49 50 /* control operations */ 51 virtual rt_status initCheck() = 0; 52 virtual rt_status prepare() = 0; 53 virtual rt_status prepareAsync() = 0; 54 virtual rt_status seekTo(INT64 usec) = 0; 55 virtual rt_status start() = 0; 56 virtual rt_status stop() = 0; 57 virtual rt_status pause() = 0; 58 virtual rt_status reset() = 0; 59 virtual rt_status wait(INT64 timeUs = 0) = 0; 60 61 /* parameter query operations */ 62 virtual rt_status getState() = 0; 63 virtual rt_status getCurrentPosition(INT64 *usec) = 0; 64 virtual rt_status getDuration(INT64 *usec) = 0; 65 virtual rt_status dump(INT32 fd, const char *args) = 0; 66 67 /* advanced query/control operations */ 68 virtual rt_status invoke(RtMetaData *request, RtMetaData *reply) = 0; 69 virtual rt_status setParameter(INT32 key, RtMetaData *request) = 0; 70 virtual rt_status getParameter(INT32 key, RtMetaData *reply) = 0; 71 72 /* configuration video/audio/subtitle sink */ 73 virtual rt_status setVideoSink(const void *videoSink) = 0; 74 virtual rt_status setAudioSink(const void *audioSink) = 0; 75 virtual rt_status setSubteSink(const void *subteSink) = 0; 76 }; 77 78 #endif // INCLUDE_RT_PLAYER_RTMEDIAPLAYERINTERFACE_H_ 79