/* * Copyright (C) 2006 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. */ /** * MediaPlayer class can be used to control playback * of audio/video files and streams. An example on how to use the methods in * this class can be found in {@link android.widget.VideoView}. * *
Topics covered here are: *
For more information about how to use MediaPlayer, read the * Media Playback developer guide.
*Playback control of audio/video files and streams is managed as a state * machine. The following diagram shows the life cycle and the states of a * MediaPlayer object driven by the supported playback control operations. * The ovals represent the states a MediaPlayer object may reside * in. The arcs represent the playback control operations that drive the object * state transition. There are two types of arcs. The arcs with a single arrow * head represent synchronous method calls, while those with * a double arrow head represent asynchronous method calls.
* *From this state diagram, one can see that a MediaPlayer object has the * following states:
*new
or
* after {@link #reset()} is called, it is in the Idle state; and after
* {@link #release()} is called, it is in the End state. Between these
* two states is the life cycle of the MediaPlayer object.
* new
is in the
* Idle state, while those created with one
* of the overloaded convenient create
methods are NOT
* in the Idle state. In fact, the objects are in the Prepared
* state if the creation using create
method is successful.
* setDataSource
*
methods in an invalid state. IllegalArgumentException
* and IOException
that may be thrown from the overloaded
* setDataSource
methods.Method Name | *Valid Sates | *Invalid States | *Comments |
attachAuxEffect | *{Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted} | *{Idle, Error} | *This method must be called after setDataSource. * Calling it does not change the object state. |
getAudioSessionId | *any | *{} | *This method can be called in any state and calling it does not change * the object state. |
getCurrentPosition | *{Idle, Initialized, Prepared, Started, Paused, Stopped, * PlaybackCompleted} | *{Error} | *Successful invoke of this method in a valid state does not change the * state. Calling this method in an invalid state transfers the object * to the Error state. |
getDuration | *{Prepared, Started, Paused, Stopped, PlaybackCompleted} | *{Idle, Initialized, Error} | *Successful invoke of this method in a valid state does not change the * state. Calling this method in an invalid state transfers the object * to the Error state. |
getVideoHeight | *{Idle, Initialized, Prepared, Started, Paused, Stopped, * PlaybackCompleted} | *{Error} | *Successful invoke of this method in a valid state does not change the * state. Calling this method in an invalid state transfers the object * to the Error state. |
getVideoWidth | *{Idle, Initialized, Prepared, Started, Paused, Stopped, * PlaybackCompleted} | *{Error} | *Successful invoke of this method in a valid state does not change * the state. Calling this method in an invalid state transfers the * object to the Error state. |
isPlaying | *{Idle, Initialized, Prepared, Started, Paused, Stopped, * PlaybackCompleted} | *{Error} | *Successful invoke of this method in a valid state does not change * the state. Calling this method in an invalid state transfers the * object to the Error state. |
pause | *{Started, Paused} | *{Idle, Initialized, Prepared, Stopped, PlaybackCompleted, Error} | *Successful invoke of this method in a valid state transfers the * object to the Paused state. Calling this method in an * invalid state transfers the object to the Error state. |
prepare | *{Initialized, Stopped} | *{Idle, Prepared, Started, Paused, PlaybackCompleted, Error} | *Successful invoke of this method in a valid state transfers the * object to the Prepared state. Calling this method in an * invalid state throws an IllegalStateException. |
prepareAsync | *{Initialized, Stopped} | *{Idle, Prepared, Started, Paused, PlaybackCompleted, Error} | *Successful invoke of this method in a valid state transfers the * object to the Preparing state. Calling this method in an * invalid state throws an IllegalStateException. |
release | *any | *{} | *After {@link #release()}, the object is no longer available. |
reset | *{Idle, Initialized, Prepared, Started, Paused, Stopped, * PlaybackCompleted, Error} | *{} | *After {@link #reset()}, the object is like being just created. |
seekTo | *{Prepared, Started, Paused, PlaybackCompleted} | *{Idle, Initialized, Stopped, Error} | *Successful invoke of this method in a valid state does not change * the state. Calling this method in an invalid state transfers the * object to the Error state. |
setAudioSessionId | *{Idle} | *{Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted, * Error} | *This method must be called in idle state as the audio session ID must be known before * calling setDataSource. Calling it does not change the object state. |
setAudioStreamType | *{Idle, Initialized, Stopped, Prepared, Started, Paused, * PlaybackCompleted} | *{Error} | *Successful invoke of this method does not change the state. In order for the * target audio stream type to become effective, this method must be called before * prepare() or prepareAsync(). |
setAuxEffectSendLevel | *any | *{} | *Calling this method does not change the object state. |
setDataSource | *{Idle} | *{Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted, * Error} | *Successful invoke of this method in a valid state transfers the * object to the Initialized state. Calling this method in an * invalid state throws an IllegalStateException. |
setDisplay | *any | *{} | *This method can be called in any state and calling it does not change * the object state. |
setSurface | *any | *{} | *This method can be called in any state and calling it does not change * the object state. |
setVideoScalingMode | *{Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted} | *{Idle, Error} | *Successful invoke of this method does not change the state. |
setLooping | *{Idle, Initialized, Stopped, Prepared, Started, Paused, * PlaybackCompleted} | *{Error} | *Successful invoke of this method in a valid state does not change * the state. Calling this method in an * invalid state transfers the object to the Error state. |
isLooping | *any | *{} | *This method can be called in any state and calling it does not change * the object state. |
setOnBufferingUpdateListener | *any | *{} | *This method can be called in any state and calling it does not change * the object state. |
setOnCompletionListener | *any | *{} | *This method can be called in any state and calling it does not change * the object state. |
setOnErrorListener | *any | *{} | *This method can be called in any state and calling it does not change * the object state. |
setOnPreparedListener | *any | *{} | *This method can be called in any state and calling it does not change * the object state. |
setOnSeekCompleteListener | *any | *{} | *This method can be called in any state and calling it does not change * the object state. |
setScreenOnWhilePlaying> | *any | *{} | *This method can be called in any state and calling it does not change * the object state. |
setVolume | *{Idle, Initialized, Stopped, Prepared, Started, Paused, * PlaybackCompleted} | *{Error} | *Successful invoke of this method does not change the state. * |
setWakeMode | *any | *{} | *This method can be called in any state and calling it does not change * the object state. |
start | *{Prepared, Started, Paused, PlaybackCompleted} | *{Idle, Initialized, Stopped, Error} | *Successful invoke of this method in a valid state transfers the * object to the Started state. Calling this method in an * invalid state transfers the object to the Error state. |
stop | *{Prepared, Started, Stopped, Paused, PlaybackCompleted} | *{Idle, Initialized, Error} | *Successful invoke of this method in a valid state transfers the * object to the Stopped state. Calling this method in an * invalid state transfers the object to the Error state. |
getTrackInfo | *{Prepared, Started, Stopped, Paused, PlaybackCompleted} | *{Idle, Initialized, Error} | *Successful invoke of this method does not change the state. |
addTimedTextSource | *{Prepared, Started, Stopped, Paused, PlaybackCompleted} | *{Idle, Initialized, Error} | *Successful invoke of this method does not change the state. |
selectTrack | *{Prepared, Started, Stopped, Paused, PlaybackCompleted} | *{Idle, Initialized, Error} | *Successful invoke of this method does not change the state. |
deselectTrack | *{Prepared, Started, Stopped, Paused, PlaybackCompleted} | *{Idle, Initialized, Error} | *Successful invoke of this method does not change the state. |
One may need to declare a corresponding WAKE_LOCK permission {@link * android.R.styleable#AndroidManifestUsesPermission <uses-permission>} * element. * *
This class requires the {@link android.Manifest.permission#INTERNET} permission * when used with network-based content. * * *
Applications may want to register for informational and error
* events in order to be informed of some internal state update and
* possible runtime errors during playback or streaming. Registration for
* these events is done by properly setting the appropriate listeners (via calls
* to
* {@link #setOnPreparedListener(OnPreparedListener)}setOnPreparedListener,
* {@link #setOnVideoSizeChangedListener(OnVideoSizeChangedListener)}setOnVideoSizeChangedListener,
* {@link #setOnSeekCompleteListener(OnSeekCompleteListener)}setOnSeekCompleteListener,
* {@link #setOnCompletionListener(OnCompletionListener)}setOnCompletionListener,
* {@link #setOnBufferingUpdateListener(OnBufferingUpdateListener)}setOnBufferingUpdateListener,
* {@link #setOnInfoListener(OnInfoListener)}setOnInfoListener,
* {@link #setOnErrorListener(OnErrorListener)}setOnErrorListener, etc).
* In order to receive the respective callback
* associated with these listeners, applications are required to create
* MediaPlayer objects on a thread with its own Looper running (main UI
* thread by default has a Looper running).
*
*/
#ifndef __IPCLINUX_EYESEEPLAYER_H__
#define __IPCLINUX_EYESEEPLAYER_H__
#include When done with the MediaPlayer, you should call {@link #release()},
* to free the resources. If not released, too many MediaPlayer instances may
* result in an exception. The supported video scaling modes are:
* When After creating an auxiliary effect (e.g.
* {@link android.media.audiofx.EnvironmentalReverb}), retrieve its ID with
* {@link android.media.audiofx.AudioEffect#getId()} and use it when calling this method
* to attach the player to the effect.
* To detach the effect from the player, call this method with a null effect id.
* This method must be called after one of the overloaded By default the send level is 0, so even if an effect is attached to the player
* this method must be called for the effect to be applied.
* Note that the passed level value is a raw scalar. UI controls should be scaled
* logarithmically: the gain applied by audio framework ranges from -72dB to 0dB,
* so an appropriate conversion from linear UI input x to level is:
* x == 0 -> level = 0
* 0 < x <= R -> level = 10^(72*(x-R)/20/R)
* @param level send level scalar
*/
status_t setAuxEffectSendLevel(float level);
/**
* if not grant, player will only play video and others.
*/
status_t grantPlayAudio(bool bGrant);
/**
* Class for MediaPlayer to return each audio/video/subtitle track's metadata.
*
* @see android.media.MediaPlayer#getTrackInfo
*/
class TrackInfo {
public:
/**
* Gets the track type.
* @return TrackType which indicates if the track is video, audio, timed text.
*/
int getTrackType() const;
/**
* Gets the language code of the track.
* @return a language code in either way of ISO-639-1 or ISO-639-2.
* When the language is unknown or could not be determined,
* ISO-639-2 language code, "und", is returned.
*/
const std::string& getLanguage() const;
enum
{
MEDIA_TRACK_TYPE_UNKNOWN = 0,
MEDIA_TRACK_TYPE_VIDEO = 1,
MEDIA_TRACK_TYPE_AUDIO = 2,
MEDIA_TRACK_TYPE_TIMEDTEXT = 3,
};
int mTrackType; //MEDIA_TRACK_TYPE_VIDEO
std::string mLanguage;
union
{
DEMUX_VIDEO_STREAM_INFO_S mVideoTrackInfo;
DEMUX_AUDIO_STREAM_INFO_S mAudioTrackInfo;
DEMUX_SUBTITLE_STREAM_INFO_S mSubitleTrackInfo;
};
TrackInfo(int trackType, std::string language, int StreamIndex, DEMUX_MEDIA_INFO_S &DemuxMediaInfo);
TrackInfo(const TrackInfo& trackInfo);
TrackInfo& operator=(const TrackInfo& trackInfo);
};
/**
* Returns an array of track information.
*
* @return Array of track info. The total number of tracks is the array length.
* Must be called again if an external timed text source has been added after any of the
* addTimedTextSource methods are called.
* @throws IllegalStateException if it is called in an invalid state.
*/
void getTrackInfo(std::vector
* If a MediaPlayer is in invalid state, it throws an IllegalStateException exception.
* If a MediaPlayer is in Started state, the selected track is presented immediately.
* If a MediaPlayer is not in Started state, it just marks the track to be played.
*
* In any valid state, if it is called multiple times on the same type of track (ie. Video,
* Audio, Timed Text), the most recent one will be chosen.
*
* The first audio and video tracks are selected by default if available, even though
* this method is not called. However, no timed text track will be selected until
* this function is called.
*
* Currently, only timed text tracks or audio tracks can be selected via this method.
* In addition, the support for selecting an audio track at runtime is pretty limited
* in that an audio track can only be selected in the Prepared state.
*
* Currently, the track must be a timed text track and no audio or video tracks can be
* deselected. If the timed text track identified by index has not been
* selected before, it throws an exception.
*
*
* @param charset the canonical name of a charset.
* @return ==0 means successful, !=0 means failed.
*/
status_t setSubCharset(std::string charset);
/**
* Get the subtitle¡¯s charset.
*
*
* @return the canonical name of a charset.
*/
status_t getSubCharset(std::string &charset);
/**
* Set the subtitle¡¯s delay time.
*
*
* @param time delay time in milliseconds. It can be <0.
* @return ==0 means successful, !=0 means failed.
*/
status_t setSubDelay(int time);
/**
* Get the subtitle¡¯s delay time.
*
*
* @return delay time in milliseconds.
*/
int getSubDelay();
/* add by Gary. start {{----------------------------------- */
/* 2011-11-14 */
/* support scale mode */
/**
* enable or disable scale mode for playing video.
*
*
* @param enable if true, enable the scale mode, else disable the scale mode.
* @param width the expected width of the video. Only valid when enable.
* @param height the expected height of the video. Only valid when enable.
*/
status_t enableScaleMode(bool enable, int width, int height);
/* add by Gary. end -----------------------------------}} */
/* clockwise rotation: val=0 no rotation, val=1 90 degree; val=2 180 degree, val=3 270 degree */
status_t setRotation(ROTATE_E val);
/**
* set vdec to consider devery package contains whole frames.
* For h264 vdec speed up!
* @param bFlag if force frame package. true:force, false: not force, use demux configuration.
* must set before prepare().
*/
status_t ForceFramePackage(bool bFlag);
private:
/* Do not change these values without updating their counterparts
* in include/media/mediaplayer.h!
*/
enum
{
MEDIA_NOP = 0, // interface test message
MEDIA_PREPARED = 1,
MEDIA_PLAYBACK_COMPLETE = 2,
MEDIA_BUFFERING_UPDATE = 3,
MEDIA_SEEK_COMPLETE = 4,
MEDIA_SET_VIDEO_SIZE = 5,
MEDIA_TIMED_TEXT = 99,
MEDIA_ERROR = 100,
MEDIA_INFO = 200,
MEDIA_SOURCE_DETECTED = 234, //Add by Bevis.
MEDIA_NOTIFY_EOF = 0x100, //arg1:mod_id MOD_ID_DEMUX
};
class EventHandler : public CallbackDispatcher {
private:
EyeseePlayer *mPlayer;
public:
EventHandler(EyeseePlayer *player):
mPlayer(player) {
}
~EventHandler() {
}
virtual void handleMessage(const CallbackMessage &msg);
};
EventHandler *mEventHandler;
static void postEventFromNative(EyeseePlayer *pPlayer, int what, int arg1, int arg2, const std::shared_ptr
*
*
* @param mode target video scaling mode. Most be one of the supported
* video scaling modes; otherwise, IllegalArgumentException will be thrown.
*
* @see NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW
* @see NATIVE_WINDOW_SCALING_MODE_SCALE_CROP
*/
status_t setVideoScalingMode(int mode);
/**
* Sets the data source (file-path or http/rtsp URL) to use.
*
* @param path the path of the file, or the http/rtsp URL of the stream you want to play
* @throws IllegalStateException if it is called in an invalid state
*
* path
refers to a local file, the file may actually be opened by a
* process other than the calling application. This implies that the pathname
* should be an absolute path (as any other process runs with unspecified current working
* directory), and that the pathname should reference a world-readable file.
* As an alternative, the application could first open the file for reading,
* and then use the file descriptor form {@link #setDataSource(FileDescriptor)}.
*/
status_t setDataSource(std::string path);
/**
* Sets the data source (FileDescriptor) to use. It is the caller's responsibility
* to close the file descriptor. It is safe to do so as soon as this call returns.
*
* @param fd the FileDescriptor for the file you want to play
* @throws IllegalStateException if it is called in an invalid state
*/
status_t setDataSource(int fd);
/**
* Sets the data source (FileDescriptor) to use. The FileDescriptor must be
* seekable (N.B. a LocalSocket is not seekable). It is the caller's responsibility
* to close the file descriptor. It is safe to do so as soon as this call returns.
*
* @param fd the FileDescriptor for the file you want to play
* @param offset the offset into the file where the data to be played starts, in bytes
* @param length the length in bytes of the data to be played
* @throws IllegalStateException if it is called in an invalid state
*/
status_t setDataSource(int fd, int64_t offset, int64_t length);
status_t setVps(float fVps);
float getVps();
status_t setVdecInputBufferSize(unsigned int nBufferSize);
unsigned int getVdecInputBufferSize() const ;
/**
* Prepares the player for playback, synchronously.
*
* After setting the datasource and the display surface, you need to either
* call prepare() or prepareAsync(). For files, it is OK to call prepare(),
* which blocks until MediaPlayer is ready for playback.
*
* @throws IllegalStateException if it is called in an invalid state
*/
status_t prepare();
/**
* Prepares the player for playback, asynchronously.
*
* After setting the datasource and the display surface, you need to either
* call prepare() or prepareAsync(). For streams, you should call prepareAsync(),
* which returns immediately, rather than blocking until enough data has been
* buffered.
*
* @throws IllegalStateException if it is called in an invalid state
*/
//status_t prepareAsync();
/**
* Starts or resumes playback. If playback had previously been paused,
* playback will continue from where it was paused. If playback had
* been stopped, or never started before, playback will start at the
* beginning.
*
* @throws IllegalStateException if it is called in an invalid state
*/
status_t start();
/**
* Stops playback after playback has been stopped or paused.
*
* @throws IllegalStateException if the internal player engine has not been
* initialized.
*/
status_t stop();
/**
* Pauses playback. Call start() to resume.
*
* @throws IllegalStateException if the internal player engine has not been
* initialized.
*/
status_t pause();
/**
* playback complete.
*
* @throws IllegalStateException if the internal player engine has not been
* initialized.
*/
status_t playbackComplete();
public:
/**
* Returns the width of the video.
*
* @return the width of the video, or 0 if there is no video,
* no display surface was set, or the width has not been determined
* yet. The OnVideoSizeChangedListener can be registered via
* {@link #setOnVideoSizeChangedListener(OnVideoSizeChangedListener)}
* to provide a notification when the width is available.
*/
status_t getVideoWidth(int *width);
/**
* Returns the height of the video.
*
* @return the height of the video, or 0 if there is no video,
* no display surface was set, or the height has not been determined
* yet. The OnVideoSizeChangedListener can be registered via
* {@link #setOnVideoSizeChangedListener(OnVideoSizeChangedListener)}
* to provide a notification when the height is available.
*/
status_t getVideoHeight(int *height);
/**
* Checks whether the MediaPlayer is playing.
*
* @return true if currently playing, false otherwise
* @throws IllegalStateException if the internal player engine has not been
* initialized or has been released.
*/
bool isPlaying();
/**
* Seeks to specified time position.
*
* @param msec the offset in milliseconds from the start to seek to
* @throws IllegalStateException if the internal player engine has not been
* initialized
*/
status_t seekTo(int msec);
/**
* Gets the current playback position.
*
* @return the current position in milliseconds
*/
int getCurrentPosition();
/**
* Gets the duration of the file.
*
* @return the duration in milliseconds
*/
int getDuration();
/**
* Resets the MediaPlayer to its uninitialized state. After calling
* this method, you will have to initialize it again by setting the
* data source and calling prepare().
*/
status_t reset();
/**
* Sets the audio stream type for this MediaPlayer. See {@link AudioManager}
* for a list of stream types. Must call this method before prepare() or
* prepareAsync() in order for the target stream type to become effective
* thereafter.
*
* @param streamtype the audio stream type, e.g. AUDIO_STREAM_MUSIC.
* @see android.media.AudioManager
*/
status_t setAudioStreamType(int streamtype);
/**
* Sets the player to be looping or non-looping.
*
* @param looping whether to loop or not
*/
status_t setLooping(bool looping);
/**
* Checks whether the MediaPlayer is looping or non-looping.
*
* @return true if the MediaPlayer is currently looping, false otherwise
*/
bool isLooping();
/**
* Sets the volume on this player.
* This API is recommended for balancing the output of audio streams
* within an application. Unless you are writing an application to
* control user settings, this API should be used in preference to
* {@link AudioManager#setStreamVolume(int, int, int)} which sets the volume of ALL streams of
* a particular type. Note that the passed volume values are raw scalars.
* UI controls should be scaled logarithmically.
* must be called after prepare().
*
* @param leftVolume left volume scalar, [0, 1.0]
* @param rightVolume right volume scalar, [0, 1.0]
*/
status_t setVolume(float leftVolume, float rightVolume);
status_t getVolume(float *leftVolume, float *rightVolume);
status_t setMuteMode(bool mute);
status_t getMuteMode(BOOL* pMute);
/**
* set audio output card type.
* 0-audiocodec; 1-hdmi_audio
*/
status_t setAOCardType(PCM_CARD_TYPE_E cardId);
/**
* Sets the audio session ID.
*
* @param sessionId the audio session ID.
* The audio session ID is a system wide unique identifier for the audio stream played by
* this MediaPlayer instance.
* The primary use of the audio session ID is to associate audio effects to a particular
* instance of MediaPlayer: if an audio session ID is provided when creating an audio effect,
* this effect will be applied only to the audio content of media players within the same
* audio session and not to the output mix.
* When created, a MediaPlayer instance automatically generates its own audio session ID.
* However, it is possible to force this player to be part of an already existing audio session
* by calling this method.
* This method must be called before one of the overloaded setDataSource
methods.
* @throws IllegalStateException if it is called in an invalid state
*/
status_t setAudioSessionId(int sessionId);
/**
* Returns the audio session ID.
*
* @return the audio session ID. {@see #setAudioSessionId(int)}
* Note that the audio session ID is 0 only if a problem occured when the MediaPlayer was contructed.
*/
int getAudioSessionId();
/**
* Attaches an auxiliary effect to the player. A typical auxiliary effect is a reverberation
* effect which can be applied on any sound source that directs a certain amount of its
* energy to this effect. This amount is defined by setAuxEffectSendLevel().
* {@see #setAuxEffectSendLevel(float)}.
* setDataSource
* methods.
* @param effectId system wide unique id of the effect to attach
*/
status_t attachAuxEffect(int effectId);
/**
* Sets the send level of the player to the attached auxiliary effect
* {@see #attachAuxEffect(int)}. The level value range is 0 to 1.0.
*
*
* @param extra an extra code, specific to the error. Typically
* implementation dependent.
*
*
* @return True if the method handled the error, false if it didn't.
* Returning false, or not having an OnErrorListener at all, will
* cause the OnCompletionListener to be called.
*/
virtual bool onError(EyeseePlayer *pMp, int what, int extra) = 0;
};
/**
* Register a callback to be invoked when an error has happened
* during an asynchronous operation.
*
* @param listener the callback that will be run
*/
void setOnErrorListener(OnErrorListener *pListener);
private:
OnErrorListener *mOnErrorListener;
public:
/* Do not change these values without updating their counterparts
* in include/media/mediaplayer.h!
*/
/** Unspecified media player info.
* @see android.media.MediaPlayer.OnInfoListener
*/
enum
{
MEDIA_INFO_UNKNOWN = 1,
/** The player was started because it was used as the next player for another
* player, which just completed playback.
* @see android.media.MediaPlayer.OnInfoListener
* @hide
*/
MEDIA_INFO_STARTED_AS_NEXT = 2,
/** The player just pushed the very first video frame for rendering.
* @see android.media.MediaPlayer.OnInfoListener
*/
MEDIA_INFO_VIDEO_RENDERING_START = 3,
/** The video is too complex for the decoder: it can't decode frames fast
* enough. Possibly only the audio plays fine at this stage.
* @see android.media.MediaPlayer.OnInfoListener
*/
MEDIA_INFO_VIDEO_TRACK_LAGGING = 700,
/** MediaPlayer is temporarily pausing playback internally in order to
* buffer more data.
* @see android.media.MediaPlayer.OnInfoListener
*/
MEDIA_INFO_BUFFERING_START = 701,
/** MediaPlayer is resuming playback after filling buffers.
* @see android.media.MediaPlayer.OnInfoListener
*/
MEDIA_INFO_BUFFERING_END = 702,
/** Bad interleaving means that a media has been improperly interleaved or
* not interleaved at all, e.g has all the video samples first then all the
* audio ones. Video is playing but a lot of disk seeks may be happening.
* @see android.media.MediaPlayer.OnInfoListener
*/
MEDIA_INFO_BAD_INTERLEAVING = 800,
/** The media cannot be seeked (e.g live stream)
* @see android.media.MediaPlayer.OnInfoListener
*/
MEDIA_INFO_NOT_SEEKABLE = 801,
/** A new set of metadata is available.
* @see android.media.MediaPlayer.OnInfoListener
*/
MEDIA_INFO_METADATA_UPDATE = 802,
/** Failed to handle timed text track properly.
* @see android.media.MediaPlayer.OnInfoListener
*
* {@hide}
*/
MEDIA_INFO_TIMED_TEXT_ERROR = 900,
};
/**
* Interface definition of a callback to be invoked to communicate some
* info and/or warning about the media or its playback.
*/
class OnInfoListener
{
public:
/**
* Called to indicate an info or a warning.
*
* @param mp the MediaPlayer the info pertains to.
* @param what the type of info or warning.
*
*
* @param extra an extra code, specific to the info. Typically
* implementation dependent.
* @return True if the method handled the info, false if it didn't.
* Returning false, or not having an OnErrorListener at all, will
* cause the info to be discarded.
*/
OnInfoListener(){}
virtual ~OnInfoListener(){}
virtual bool onInfo(EyeseePlayer *pMp, int what, int extra) = 0;
};
/**
* Register a callback to be invoked when an info/warning is available.
*
* @param listener the callback that will be run
*/
void setOnInfoListener(OnInfoListener *pListener);
private:
OnInfoListener *mOnInfoListener;
/* add by Gary. start {{----------------------------------- */
/* 2011-9-13 9:50:50 */
/* expend interfaces about subtitle, track and so on */
public:
/**
* Set the subtitle¡¯s charset. If the underlying mediaplayer can absolutely parse the charset
* of the subtitles, still use the parsed charset; otherwise, use the charset argument.
*