Home | History | Annotate | Download | only in include
      1 /* ------------------------------------------------------------------
      2  * Copyright (C) 1998-2009 PacketVideo
      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
     13  * express or implied.
     14  * See the License for the specific language governing permissions
     15  * and limitations under the License.
     16  * -------------------------------------------------------------------
     17  */
     18 #ifndef PV_PLAYER_TYPES_H_INCLUDED
     19 #define PV_PLAYER_TYPES_H_INCLUDED
     20 
     21 /**
     22  * An enumeration of the major states of the pvPlayer engine.
     23  **/
     24 typedef enum
     25 {
     26     /**
     27         The state immediately after the pvPlayer instance has been successfully created or instantiated.
     28         pvPlayer also returns to this state after successful completion of reset command.
     29         The player data source can be added during this state.
     30         No resources have been allocated yet.
     31     **/
     32     PVP_STATE_IDLE          = 1,
     33 
     34     /**
     35         pvPlayer is in this state after successfully completing initialization of data source or after stopping playback.
     36         Player data sinks and user defined track selector can be added to the player in this state. Also metadata from the
     37         data source can be queried and other playback parameters can be set at this state.
     38     **/
     39     PVP_STATE_INITIALIZED   = 2,
     40 
     41     /**
     42         pvPlayer is in this state when it has successfully completed preparations and ready to start playback.
     43     **/
     44     PVP_STATE_PREPARED      = 3,
     45 
     46     /**
     47      *  pvPlayer is in this state when it is playing back the specified data source. Even if playback is auto-paused, pvPlayer
     48      *  will be in this state.
     49     **/
     50     PVP_STATE_STARTED       = 4,
     51 
     52     /**
     53         pvPlayer is in this state after successfully completiong pausing of playback. All media datapaths have been stopped,
     54         but the buffered data has not been flushed. The playback can be resumed or stopped from this state.
     55     **/
     56     PVP_STATE_PAUSED        = 5,
     57 
     58     /**
     59         pvPlayer enters this state when it encounters an error. This is a transitional state and after pvPlayer performs
     60         error recovery, it will end up in PVP_STATE_IDLE state.
     61     **/
     62     PVP_STATE_ERROR         = 6
     63 } PVPlayerState;
     64 
     65 typedef union PVPPlaybackPositionValueUnion
     66 {
     67     uint32 millisec_value;
     68     uint32 sec_value;
     69     uint32 min_value;
     70     uint32 hour_value;
     71     uint8 smpte_value[4];
     72     uint8 percent_value;
     73     uint32 samplenum_value;
     74     uint32 datapos_value;
     75 } _PVPPlaybackPositionValueUnion;
     76 
     77 typedef enum _PVPPlaybackPositionUnit
     78 {
     79     PVPPBPOSUNIT_UNKNOWN = -1,
     80     PVPPBPOSUNIT_MILLISEC = 0,
     81     PVPPBPOSUNIT_SEC    = 1,
     82     PVPPBPOSUNIT_MIN    = 2,
     83     PVPPBPOSUNIT_HOUR   = 3,
     84     PVPPBPOSUNIT_SMPTE  = 4,
     85     PVPPBPOSUNIT_PERCENT = 5,
     86     PVPPBPOSUNIT_SAMPLENUMBER = 6,
     87     PVPPBPOSUNIT_DATAPOSITION = 7,
     88     PVPPBPOSUNIT_PLAYLIST = 8
     89 } PVPPlaybackPositionUnit;
     90 
     91 /**
     92 * Playback positon mode indicates when the provided playback position is expected to take effect.
     93 * 1) Now => implies that pause any current playback session and start playback from the new position
     94 * 2) End of current play element => A play session can be composed of multiple play elements (say a
     95 * playlist session) and the provided playlist position is to take effect once the current play
     96 * element is complete (say reposition to song 7 after the current song is done)
     97 * 3) End of current play session => This playback position is to take effect once the entire current
     98 * play session is done.
     99 *
    100 */
    101 typedef enum _PVPPlaybackPositionMode
    102 {
    103     PVPPBPOS_MODE_UNKNOWN = -1,
    104     PVPPBPOS_MODE_NOW = 0,
    105     PVPPBPOS_MODE_END_OF_CURRENT_PLAY_ELEMENT = 1,
    106     PVPPBPOS_MODE_END_OF_CURRENT_PLAY_SESSION = 2,
    107 } PVPPlaybackPositionMode;
    108 
    109 typedef struct _PVPPlaybackPosition
    110 {
    111     _PVPPlaybackPositionValueUnion iPosValue;
    112     PVPPlaybackPositionUnit iPosUnit;
    113 #ifdef __cplusplus
    114     bool iIndeterminate;
    115 #else
    116     c_bool iIndeterminate;
    117 #endif
    118     PVPPlaybackPositionMode iMode;
    119     /*
    120      * Typically provided in case of a seek within a playsession
    121      * with multiple elements. This is the index ON which the
    122      * position info provided above applies. Say go to 30 seconds
    123      * into play element 7.
    124      */
    125     int32 iPlayElementIndex;
    126     _PVPPlaybackPositionValueUnion iPlayListPosValue;
    127     PVPPlaybackPositionUnit iPlayListPosUnit;
    128     char* iPlayListUri;
    129 } PVPPlaybackPosition;
    130 
    131 #endif
    132 
    133 
    134