vfs: check userland buffers before reading them.
[haiku.git] / src / kits / media / TrackReader.h
blob090c776b6649596852022cee334ab070f41b721d
1 /***********************************************************************
2 * AUTHOR: Marcus Overhagen
3 * FILE: TrackReader.h
4 * DESCR: The undocumented BTrackReader class,
5 * used by BSound and the GameSound classes
6 ***********************************************************************/
8 #if !defined(_TRACK_READER_H_)
9 #define _TRACK_READER_H_
11 #include <MediaTrack.h>
13 class BMediaFile;
15 namespace BPrivate
18 class BTrackReader
20 public:
21 BTrackReader(BMediaTrack *, media_raw_audio_format const &);
22 BTrackReader(BFile *, media_raw_audio_format const &);
23 ~BTrackReader();
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);
31 BMediaTrack * Track(void);
32 const media_raw_audio_format & Format(void) const;
34 private:
35 void SetToTrack(BMediaTrack *track);
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;
47 }; //namespace BPrivate
49 #endif