Merge pull request #693 from dorianj/tsmf_volume

tsmf: add ability for tsmf audio players to get volume change
This commit is contained in:
Marc-André Moreau 2012-08-10 09:03:35 -07:00
commit cc590eee8f
2 changed files with 8 additions and 5 deletions

View File

@ -34,6 +34,8 @@ struct _ITSMFAudioDevice
boolean (*Play) (ITSMFAudioDevice* audio, uint8* data, uint32 data_size);
/* Get the latency of the last written sample, in 100ns */
uint64 (*GetLatency) (ITSMFAudioDevice* audio);
/* Change the playback volume level */
void (*ChangeVolume) (ITSMFAudioDevice* audio, uint32 newVolume, uint32 muted);
/* Flush queued audio data */
void (*Flush) (ITSMFAudioDevice* audio);
/* Free the audio device */

View File

@ -736,13 +736,14 @@ static void tsmf_stream_change_volume(TSMF_STREAM* stream, uint32 newVolume, uin
if (!stream)
return;
if (!stream->decoder)
return;
if (stream->decoder->ChangeVolume)
if (stream->decoder != NULL && stream->decoder->ChangeVolume)
{
stream->decoder->ChangeVolume(stream->decoder, newVolume, muted);
}
else if (stream->audio != NULL && stream->audio->ChangeVolume)
{
stream->audio->ChangeVolume(stream->audio, newVolume, muted);
}
}
void tsmf_presentation_volume_changed(TSMF_PRESENTATION* presentation, uint32 newVolume, uint32 muted)