tsmf: add ability for tsmf audio players to get volume change

notifications, even when the decoder doesn't support it.
This commit is contained in:
Dorian Johnson
2012-08-07 17:42:45 -05:00
parent b6a9937fa1
commit 3740e2ff46
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

@@ -735,14 +735,15 @@ 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)