xref: /haiku/src/kits/media/TrackReader.h (revision 644fa5a93845dc4a1bc155f1fd0f94ebdf0b47bc)
1 /***********************************************************************
2  * AUTHOR: Marcus Overhagen
3  *   FILE: TrackReader.h
4  *  DESCR: The undocumented BTrackReader class,
5  *         used by BSound and the GameSound classes
6  ***********************************************************************/
7 
8 #if !defined(_TRACK_READER_H_)
9 #define _TRACK_READER_H_
10 
11 #include <MediaTrack.h>
12 
13 class BMediaFile;
14 
15 namespace BPrivate
16 {
17 
18 class BTrackReader
19 {
20 public:
21 	BTrackReader(BMediaTrack *, media_raw_audio_format const &);
22 	BTrackReader(BFile *, media_raw_audio_format const &);
23 	~BTrackReader();
24 
25 	status_t 	InitCheck();
26 	int64 		CountFrames(void);
27 	int32 		FrameSize(void);
28 	status_t 	ReadFrames(void *in_buffer, int32 frame_count);
29 	status_t 	SeekToFrame(int64 *in_out_frame);
30 
31 	BMediaTrack * 					Track(void);
32 	const media_raw_audio_format & 	Format(void) const;
33 
34 private:
35 	void SetToTrack(BMediaTrack *track);
36 
37 private:
38 	int32	fFrameSize;
39 	uint8 *	fBuffer;
40 	int32 	fBufferOffset;
41 	int32	fBufferUsedSize;
42 	BMediaFile *fMediaFile;
43 	BMediaTrack *fMediaTrack;
44 	media_raw_audio_format fFormat;
45 };
46 
47 }; //namespace BPrivate
48 
49 #endif
50