2 * Copyright 2008 Stephan Aßmus <superstippi@gmx.de>
3 * All Rights Reserved. Distributed under the terms of the MIT license.
5 #ifndef PROXY_AUDIO_SUPPLIER_H
6 #define PROXY_AUDIO_SUPPLIER_H
11 #include "AudioResampler.h"
12 #include "AudioSupplier.h"
15 class AudioTrackSupplier
;
16 class AudioVolumeConverter
;
17 class PlaybackManager
;
20 class ProxyAudioSupplier
: public AudioSupplier
{
23 PlaybackManager
* playbackManager
);
24 virtual ~ProxyAudioSupplier();
26 // AudioSupplier interface
27 virtual status_t
GetFrames(void* buffer
, int64 frameCount
,
28 bigtime_t startTime
, bigtime_t endTime
);
30 virtual bigtime_t
InitialLatency() const;
31 virtual void SetFormat(const media_format
& format
);
32 virtual const media_format
& Format() const;
34 virtual status_t
InitCheck() const;
37 void SetSupplier(AudioTrackSupplier
* supplier
,
38 float videoFrameRate
);
39 void SetVolume(float volume
);
43 int64
_AudioFrameForVideoFrame(int64 frame
) const;
44 int64
_VideoFrameForAudioFrame(int64 frame
) const;
45 int64
_AudioFrameForTime(bigtime_t time
) const;
46 int64
_VideoFrameForTime(bigtime_t time
) const;
48 void _ReadSilence(void* buffer
, int64 frames
) const;
49 void _ReverseFrames(void* buffer
,
51 void* _SkipFrames(void* buffer
, int64 frames
) const;
54 mutable BLocker fSupplierLock
;
56 PlaybackManager
* fPlaybackManager
;
57 float fVideoFrameRate
;
60 AudioTrackSupplier
* fSupplier
;
61 AudioReader
* fAdapter
;
62 AudioVolumeConverter
* fVolumeConverter
;
63 AudioResampler fAudioResampler
;
67 #endif // PROXY_AUDIO_SUPPLIER_H