xref: /haiku/src/apps/mediaplayer/media_node_framework/audio/AudioReader.h (revision 0fc56ed57bdd5d2d44f33edd17d94210704613bd)
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 
10 class AudioReader {
11 public:
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	status_t			Read(void* buffer, int64 pos, int64 frames) = 0;
22 
23 			void				SetOutOffset(int64 offset);
24 			int64				OutOffset() const;
25 
26 			int64				FrameForTime(bigtime_t time) const;
27 			bigtime_t			TimeForFrame(int64 frame) const;
28 
29 protected:
30 			void*				ReadSilence(void* buffer, int64 frames) const;
31 			void*				SkipFrames(void* buffer, int64 frames) const;
32 			void				ReverseFrames(void* buffer,
33 									int64 frames) const;
34 
35 protected:
36 			media_format		fFormat;
37 			int64				fOutOffset;
38 };
39 
40 #endif	// AUDIO_READER_H
41