/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef DASH_PLAYER_H_ #define DASH_PLAYER_H_ #include #include #include #include "DashPlayerStats.h" #include #define KEY_DASH_ADAPTION_PROPERTIES 8002 #define KEY_DASH_MPD_QUERY 8003 #define KEY_DASH_QOE_EVENT 8004 #define KEY_DASH_QOE_PERIODIC_EVENT 8008 namespace android { struct DashCodec; struct MetaData; struct DashPlayerDriver; enum { kWhatQOE, kWhatQOEPlay, kWhatQOEStop, kWhatQOESwitch, kWhatQOEPeriodic, }; struct DashPlayer : public AHandler { DashPlayer(); void setUID(uid_t uid); void setDriver(const wp &driver); void setDataSource(const sp &source); void setDataSource( const char *url, const KeyedVector *headers); void setDataSource(int fd, int64_t offset, int64_t length); #ifdef ANDROID_JB_MR2 void setVideoSurfaceTexture(const sp &bufferProducer); #else void setVideoSurfaceTexture(const sp &surfaceTexture); #endif void setAudioSink(const sp &sink); void start(); void pause(); void resume(); // Will notify the driver through "notifyResetComplete" once finished. void resetAsync(); // Will notify the driver through "notifySeekComplete" once finished. void seekToAsync(int64_t seekTimeUs); status_t prepareAsync(); status_t getParameter(int key, Parcel *reply); status_t setParameter(int key, const Parcel &request); status_t dump(int fd, const Vector &args); public: struct DASHHTTPLiveSource; struct WFDSource; protected: virtual ~DashPlayer(); virtual void onMessageReceived(const sp &msg); private: struct Decoder; struct Renderer; struct Source; enum { // These keys must be in sync with the keys in QCTimedText.java KEY_DISPLAY_FLAGS = 1, // int KEY_STYLE_FLAGS = 2, // int KEY_BACKGROUND_COLOR_RGBA = 3, // int KEY_HIGHLIGHT_COLOR_RGBA = 4, // int KEY_SCROLL_DELAY = 5, // int KEY_WRAP_TEXT = 6, // int KEY_START_TIME = 7, // int KEY_STRUCT_BLINKING_TEXT_LIST = 8, // List KEY_STRUCT_FONT_LIST = 9, // List KEY_STRUCT_HIGHLIGHT_LIST = 10,// List KEY_STRUCT_HYPER_TEXT_LIST = 11,// List KEY_STRUCT_KARAOKE_LIST = 12,// List KEY_STRUCT_STYLE_LIST = 13,// List