playback_control Class Reference

#include <playback_control.h>

Inheritance diagram for playback_control:
service_base playback_control_v2

List of all members.

Public Types

enum  t_stop_reason { stop_reason_user = 0, stop_reason_eof, stop_reason_starting_another, stop_reason_shutting_down }
enum  t_track_command {
  track_command_default = 0, track_command_play, track_command_next, track_command_prev,
  track_command_settrack, track_command_rand, track_command_resume
}
enum  t_display_level { display_level_none, display_level_basic, display_level_titles, display_level_all }
 

Type used to indicate level of dynamic playback-related info displayed. Safe to use with <> opereators, e.g. level above N always includes information rendered by level N.

More...
typedef playback_control t_interface_entrypoint
typedef playback_control t_interface
typedef service_base t_interface_parent

Public Member Functions

virtual bool get_now_playing (metadb_handle_ptr &p_out)=0
virtual void start (t_track_command p_command=track_command_play, bool p_paused=false)=0
virtual void stop ()=0
 Stops playback.
virtual bool is_playing ()=0
 Returns whether playback is active.
virtual bool is_paused ()=0
 Returns whether playback is active and in paused state.
virtual void pause (bool p_state)=0
virtual bool get_stop_after_current ()=0
 Retrieves stop-after-current-track option state.
virtual void set_stop_after_current (bool p_state)=0
 Alters stop-after-current-track option state.
virtual void set_volume (float p_value)=0
virtual float get_volume ()=0
virtual void volume_up ()=0
 Alters playback volume level one step up.
virtual void volume_down ()=0
 Alters playback volume level one step down.
virtual void volume_mute_toggle ()=0
 Toggles playback mute state.
virtual void playback_seek (double p_time)=0
virtual void playback_seek_delta (double p_delta)=0
virtual bool playback_can_seek ()=0
 Returns whether currently played track is seekable. If it's not, playback_seek/playback_seek_delta calls will be ignored.
virtual double playback_get_position ()=0
 Returns current playback position within currently played track, in seconds.
virtual bool playback_format_title (titleformat_hook *p_hook, pfc::string_base &p_out, const service_ptr_t< class titleformat_object > &p_script, titleformat_text_filter *p_filter, t_display_level p_level)=0
bool playback_format_title_ex (metadb_handle_ptr p_item, titleformat_hook *p_hook, pfc::string_base &p_out, const service_ptr_t< class titleformat_object > &p_script, titleformat_text_filter *p_filter, t_display_level p_level)
 Helper; renders info about any item, including currently playing item info if the item is currently played.
double playback_get_length ()
 Helper; retrieves length of currently playing item.
void toggle_stop_after_current ()
 Toggles stop-after-current state.
void toggle_pause ()
 Toggles pause state.
void play_or_pause ()
 Starts playback if playback is inactive, otherwise toggles pause.
void play_start (t_track_command p_command=track_command_play, bool p_paused=false)
void play_stop ()

Static Public Attributes

static const int volume_mute = -100
static const GUID class_guid

Detailed Description

Provides control for various playback-related operations. All methods provided by this interface work from main app thread only. Calling from another thread will do nothing or trigger an exception. If you need to trigger one of playback_control methods from another thread, see main_thread_callback. Do not call playback_control methods from inside any kind of global callback (e.g. playlist callback), otherwise race conditions may occur. Use static_api_ptr_t to instantiate. See static_api_ptr_t documentation for more info.


Member Typedef Documentation

Reimplemented from service_base.

Reimplemented in playback_control_v2.

Reimplemented in playback_control_v2.


Member Enumeration Documentation

Type used to indicate level of dynamic playback-related info displayed. Safe to use with <> opereators, e.g. level above N always includes information rendered by level N.

Enumerator:
display_level_none 

No playback-related info.

display_level_basic 

Static info and is_playing/is_paused stats.

display_level_titles 

display_level_basic + dynamic track titles on e.g. live streams

display_level_all 

display_level_titles + timing + VBR bitrate display etc

Enumerator:
stop_reason_user 
stop_reason_eof 
stop_reason_starting_another 
stop_reason_shutting_down 
Enumerator:
track_command_default 
track_command_play 
track_command_next 

Plays the next track from the current playlist according to the current playback order.

track_command_prev 

Plays the previous track from the current playlist according to the current playback order.

track_command_settrack 

For internal use only, do not use.

track_command_rand 

Plays a random track from the current playlist.

track_command_resume 

For internal use only, do not use.


Member Function Documentation

virtual bool playback_control::get_now_playing ( metadb_handle_ptr p_out  )  [pure virtual]

Retrieves now playing item handle.

Returns:
true on success, false on failure (not playing).
virtual bool playback_control::get_stop_after_current (  )  [pure virtual]

Retrieves stop-after-current-track option state.

virtual float playback_control::get_volume (  )  [pure virtual]

Retrieves playback volume level.

Returns:
current playback volume level, in dB; 0 for full volume.
virtual bool playback_control::is_paused (  )  [pure virtual]

Returns whether playback is active and in paused state.

virtual bool playback_control::is_playing (  )  [pure virtual]

Returns whether playback is active.

virtual void playback_control::pause ( bool  p_state  )  [pure virtual]

Toggles pause state if playback is active.

Parameters:
p_state set to true when pausing or to false when unpausing.
void playback_control::play_or_pause (  )  [inline]

Starts playback if playback is inactive, otherwise toggles pause.

void playback_control::play_start ( t_track_command  p_command = track_command_play,
bool  p_paused = false 
) [inline]
void playback_control::play_stop (  )  [inline]
virtual bool playback_control::playback_can_seek (  )  [pure virtual]

Returns whether currently played track is seekable. If it's not, playback_seek/playback_seek_delta calls will be ignored.

virtual bool playback_control::playback_format_title ( titleformat_hook p_hook,
pfc::string_base p_out,
const service_ptr_t< class titleformat_object > &  p_script,
titleformat_text_filter p_filter,
t_display_level  p_level 
) [pure virtual]

Renders information about currently playing item.

Parameters:
p_hook Optional callback object overriding fields and functions; set to NULL if not used.
p_out String receiving the output on success.
p_script Titleformat script to use. Use titleformat_compiler service to create one.
p_filter Optional callback object allowing input to be filtered according to context (i.e. removal of linebreak characters present in tags when rendering playlist lines). Set to NULL when not used.
p_level Indicates level of dynamic playback-related info displayed. See t_display_level enum for more details.
Returns:
true on success, false when no item is currently being played.
bool playback_control::playback_format_title_ex ( metadb_handle_ptr  p_item,
titleformat_hook p_hook,
pfc::string_base p_out,
const service_ptr_t< class titleformat_object > &  p_script,
titleformat_text_filter p_filter,
t_display_level  p_level 
) [inline]

Helper; renders info about any item, including currently playing item info if the item is currently played.

double playback_control::playback_get_length (  ) 

Helper; retrieves length of currently playing item.

virtual double playback_control::playback_get_position (  )  [pure virtual]

Returns current playback position within currently played track, in seconds.

virtual void playback_control::playback_seek ( double  p_time  )  [pure virtual]

Seeks in currenly played track to specified time.

Parameters:
p_time target time in seconds.
virtual void playback_control::playback_seek_delta ( double  p_delta  )  [pure virtual]

Seeks in currently played track by specified time forward or back.

Parameters:
p_delta time in seconds to seek by; can be positive to seek forward or negative to seek back.
virtual void playback_control::set_stop_after_current ( bool  p_state  )  [pure virtual]

Alters stop-after-current-track option state.

virtual void playback_control::set_volume ( float  p_value  )  [pure virtual]

Alters playback volume level.

Parameters:
p_value volume in dB; 0 for full volume.
virtual void playback_control::start ( t_track_command  p_command = track_command_play,
bool  p_paused = false 
) [pure virtual]

Starts playback. If playback is already active, existing process is stopped first.

Parameters:
p_command Specifies what track to start playback from. See t_track_Command enum for more info.
p_paused Specifies whether playback should be started as paused.
virtual void playback_control::stop (  )  [pure virtual]

Stops playback.

void playback_control::toggle_pause (  )  [inline]

Toggles pause state.

void playback_control::toggle_stop_after_current (  )  [inline]

Toggles stop-after-current state.

virtual void playback_control::volume_down (  )  [pure virtual]

Alters playback volume level one step down.

virtual void playback_control::volume_mute_toggle (  )  [pure virtual]

Toggles playback mute state.

virtual void playback_control::volume_up (  )  [pure virtual]

Alters playback volume level one step up.


Member Data Documentation

const GUID playback_control::class_guid [static]
Initial value:
 
{ 0xbf803668, 0x2977, 0x4c71, { 0xb9, 0xab, 0x5c, 0x77, 0xc3, 0x38, 0xc9, 0x70 } }

Reimplemented in playback_control_v2.

const int playback_control::volume_mute = -100 [static]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated by  doxygen 1.6.2