1/*
2 * Copyright © 2000-2006 Ingo Weinhold <ingo_weinhold@gmx.de>
3 * All rights reserved. Distributed under the terms of the MIT licensce.
4 */
5#ifndef AUDIO_READER_H
6#define AUDIO_READER_H
7
8#include <MediaDefs.h>
9
10class AudioReader {
11public:
12								AudioReader();
13								AudioReader(const media_format& format);
14	virtual						~AudioReader();
15
16	virtual	status_t			InitCheck() const;
17
18			void				SetFormat(const media_format& format);
19			const media_format&	Format() const;
20
21	virtual bigtime_t			InitialLatency() const = 0;
22	virtual	status_t			Read(void* buffer, int64 pos, int64 frames) = 0;
23
24			void				SetOutOffset(int64 offset);
25			int64				OutOffset() const;
26
27			int64				FrameForTime(bigtime_t time) const;
28			bigtime_t			TimeForFrame(int64 frame) const;
29
30protected:
31			void*				ReadSilence(void* buffer, int64 frames) const;
32			void*				SkipFrames(void* buffer, int64 frames) const;
33			void				ReverseFrames(void* buffer,
34									int64 frames) const;
35
36protected:
37			media_format		fFormat;
38			int64				fOutOffset;
39};
40
41#endif	// AUDIO_READER_H
42