SwfdecGtkPlayer

## SwfdecGtkPlayer SwfdecGtkPlayer — an improved SwfdecPlayer |

## Synopsis

    #include <swfdec/swfdec-gtk.h>

                        SwfdecGtkPlayer;
    #define             SWFDEC_GTK_PRIORITY_ITERATE
    #define             SWFDEC_GTK_PRIORITY_REDRAW
    SwfdecPlayer*       swfdec_gtk_player_new               (SwfdecAsDebugger *debugger);
    gboolean            swfdec_gtk_player_get_playing       (SwfdecGtkPlayer *player);
    void                swfdec_gtk_player_set_playing       (SwfdecGtkPlayer *player,
                                                             gboolean playing);
    double              swfdec_gtk_player_get_speed         (SwfdecGtkPlayer *player);
    void                swfdec_gtk_player_set_speed         (SwfdecGtkPlayer *player,
                                                             double speed);
    gboolean            swfdec_gtk_player_get_audio_enabled (SwfdecGtkPlayer *player);
    void                swfdec_gtk_player_set_audio_enabled (SwfdecGtkPlayer *player,
                                                             gboolean enabled);
    GdkWindow*          swfdec_gtk_player_get_missing_plugins_window
                                                            (SwfdecGtkPlayer *player);
    void                swfdec_gtk_player_set_missing_plugins_window
                                                            (SwfdecGtkPlayer *player,
                                                             GdkWindow *window);

## Object Hierarchy

      GObject
       +----SwfdecAsContext
             +----SwfdecPlayer
                   +----SwfdecGtkPlayer

## Properties

      "audio-enabled"            gboolean              : Read / Write
      "missing-plugins-window"   GdkWindow*            : Read / Write
      "playing"                  gboolean              : Read / Write
      "speed"                    gdouble               : Read / Write

## Description

The SwfdecGtkPlayer adds common functionality to the rather barebones SwfdecPlayer class, such as automatic playback and audio handling. Note that by default, the player will be paused, so you need to call `swfdec_gtk_player_set_playing()` on the new player.

`see_also`: SwfdecPlayer

## Details

### SwfdecGtkPlayer

    typedef struct _SwfdecGtkPlayer SwfdecGtkPlayer;

The structure for the Swfdec Gtk player contains no public fields.

### SWFDEC_GTK_PRIORITY_ITERATE

    #define SWFDEC_GTK_PRIORITY_ITERATE (GDK_PRIORITY_REDRAW + 10)

The priority used for advancing a player that is playing.

### SWFDEC_GTK_PRIORITY_REDRAW

    #define SWFDEC_GTK_PRIORITY_REDRAW  (GDK_PRIORITY_REDRAW + 20)

The priority used for scheduling repaint operations resulting from advancing a player.

### swfdec_gtk_player_new ()

    SwfdecPlayer*       swfdec_gtk_player_new               (SwfdecAsDebugger *debugger);

Creates a new Swfdec Gtk player. This function calls `swfdec_init()` for you if it wasn't called before.

`debugger` : | `NULL` or a SwfdecAsDebugger to debug this player
Returns : | The new player

### swfdec_gtk_player_get_playing ()

    gboolean            swfdec_gtk_player_get_playing       (SwfdecGtkPlayer *player);

Queries if the player is playing.

`player` : | a SwfdecGtkPlayer
Returns : | `TRUE` if the player is playing

### swfdec_gtk_player_set_playing ()

    void                swfdec_gtk_player_set_playing       (SwfdecGtkPlayer *player,
                                                             gboolean playing);

Sets if `player` should be playing or not. If the player is playing, a timer will be attached to the default main loop that periodically calls `swfdec_player_advance()`.

`player` : | a SwfdecGtkPlayer
`playing` : | if the player should play or not

### swfdec_gtk_player_get_speed ()

    double              swfdec_gtk_player_get_speed         (SwfdecGtkPlayer *player);

Queries the current playback speed. If the player is currently paused, it will report the speed that it would use if playing.

`player` : | a SwfdecGtkPlayer
Returns : | the current playback speed.

### swfdec_gtk_player_set_speed ()

    void                swfdec_gtk_player_set_speed         (SwfdecGtkPlayer *player,
                                                             double speed);

Sets the new playback speed. 1.0 means the default speed, bigger values make playback happen faster. Audio will only play back if the speed is 1.0. Note that if the player is not playing when calling this function, it will not automatically start.

`player` : | a SwfdecGtkPlayer
`speed` : | the new playback speed

### swfdec_gtk_player_get_audio_enabled ()

    gboolean            swfdec_gtk_player_get_audio_enabled (SwfdecGtkPlayer *player);

Queries if audio playback for `player` is enabled or not.

`player` : | a SwfdecGtkPlayer
Returns : | `TRUE` if audio playback is enabled

### swfdec_gtk_player_set_audio_enabled ()

    void                swfdec_gtk_player_set_audio_enabled (SwfdecGtkPlayer *player,
                                                             gboolean enabled);

Enables or disables automatic audio playback.

`player` : | a SwfdecGtkPlayer
`enabled` : | `TRUE` to enable audio

### swfdec_gtk_player_get_missing_plugins_window ()

    GdkWindow*          swfdec_gtk_player_get_missing_plugins_window
                                                            (SwfdecGtkPlayer *player);

Gets the window used for automatic codec install. See `swfdec_gtk_player_set_missing_plugins_window()` for details.

`player` : | a SwfdecPlayer
Returns : | the GdkWindow used as parent for showing missing plugin dialogs or `NULL` if automatic codec install is disabled.

### swfdec_gtk_player_set_missing_plugins_window ()

    void                swfdec_gtk_player_set_missing_plugins_window
                                                            (SwfdecGtkPlayer *player,
                                                             GdkWindow *window);

Sets a given GdkWindow to be used as the reference window when popping up automatic codec install dialogs. Automatic codec install happens when Swfdec cannot find a GStreamer plugin to play back a given media file. The player will automaticcaly pause when this happens to allow the plugin install to finish and will resume playback after the codec install has completed. You can use `NULL` to disable this feature. It is disable by default. Note that this function takes a GdkWindow, not a GtkWindow, as its argument. This makes it slightly more inconvenient to use, as you need to call `gtk_widget_show()` on your GtkWindow before having access to its GdkWindow, but it allows automatic plugin installatio even when your application does not have a window. You can use `gdk_get_default_root_window()` to obtain a default window in that case. For details about automatic codec install, see the GStreamer documentation, in particular the function `gst_install_plugins_async()`. If Swfdec was compiled without GStreamer support, this function will have no effect.

`player` : | a SwfdecGtkPlayer
`window` : | the window to use for popping up codec install dialogs or `NULL`

## Property Details

### The `"audio-enabled"` property

      "audio-enabled"            gboolean              : Read / Write

TRUE if automatic audio handling is enabled.

Default value: TRUE

### The `"missing-plugins-window"` property

      "missing-plugins-window"   GdkWindow*            : Read / Write

window on which to do autmatic missing plugins installation.

### The `"playing"` property

      "playing"                  gboolean              : Read / Write

TRUE if the player is playing (d'oh).

Default value: FALSE

### The `"speed"` property

      "speed"                    gdouble               : Read / Write

desired playback speed.

Allowed values: >= G_MINDOUBLE

Default value: 1