vfs: check userland buffers before reading them.
[haiku.git] / src / apps / mediaplayer / media_node_framework / audio / AudioReader.h
blobdfae0865b8e6cb4571bb3c3569b3ab49f8e126e2
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
8 #include <MediaDefs.h>
10 class AudioReader {
11 public:
12 AudioReader();
13 AudioReader(const media_format& format);
14 virtual ~AudioReader();
16 virtual status_t InitCheck() const;
18 void SetFormat(const media_format& format);
19 const media_format& Format() const;
21 virtual bigtime_t InitialLatency() const = 0;
22 virtual status_t Read(void* buffer, int64 pos, int64 frames) = 0;
24 void SetOutOffset(int64 offset);
25 int64 OutOffset() const;
27 int64 FrameForTime(bigtime_t time) const;
28 bigtime_t TimeForFrame(int64 frame) const;
30 protected:
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;
36 protected:
37 media_format fFormat;
38 int64 fOutOffset;
41 #endif // AUDIO_READER_H