SwfdecAudio

SwfdecAudio — object used for audio output

Synopsis


#include <swfdec/swfdec.h>

                    SwfdecAudio;
gsize               swfdec_audio_render                 (SwfdecAudio *audio,
                                                         gint16 *dest,
                                                         gsize start_offset,
                                                         gsize n_samples);

Object Hierarchy

  GObject
   +----SwfdecAudio

Signals

  "changed"                                        : Run Last
  "new-data"                                       : Run Last

Description

SwfdecAudio is the way audio output is provided by a SwfdecPlayer. See its documentation on how to access SwfdecAudio objects.

An audio object gives access to one audio stream played inside a player. You are responsible for outputting this data, swfdec does not try to do this for you.

Audio data is always provided in 16bit host-endian stereo. If the data was encoded into a different format originally, Swfdec will already have decoded it. The data is always referenced relative to the player. Sample 0 references the first sample to be played at the current position. If the player gets iterated, sample 0 changes. There is no way to access samples belonging to a previous state.

Details

SwfdecAudio

typedef struct _SwfdecAudio SwfdecAudio;

This object is used for audio output. It is an abstract class.


swfdec_audio_render ()

gsize               swfdec_audio_render                 (SwfdecAudio *audio,
                                                         gint16 *dest,
                                                         gsize start_offset,
                                                         gsize n_samples);

Renders the samples from audio into the area pointed to by dest. Existing data in dest is overwritten.

audio :

a SwfdecAudio

dest :

memory area to render to

start_offset :

offset in samples at which to start rendering. The offset is calculated relative to the last iteration, so the value set by swfdec_player_set_audio_advance() is ignored.

n_samples :

amount of samples to render.

Returns :

The amount of samples actually rendered. Usually this number is equal to n_samples, but if you arrived at the end of stream or the stream is still loading, this number may be lower. It indicates that no more samples are available.

Signal Details

The "changed" signal

void                user_function                      (SwfdecAudio *audio,
                                                        gpointer     user_data)      : Run Last

This signal is emitted whenever the data of the audio changed and cached data should be rerendered. This happens for example when the volume of the audio is changed by the Flash file.

audio :

the SwfdecAudio affected

user_data :

user data set when the signal handler was connected.

The "new-data" signal

void                user_function                      (SwfdecAudio *audio,
                                                        gpointer     user_data)      : Run Last

This signal is emitted whenever new data was loaded into audio. You want to listen to this signal when swfdec_audio_render() previously returned less samples than you wanted to render.

audio :

the SwfdecAudio affected

user_data :

user data set when the signal handler was connected.

See Also

SwfdecPlayer