xref: /haiku/src/add-ons/media/plugins/au_reader/au_reader.h (revision cbe35e2031cb2bfb757422f35006bb9bd382bed1)
1 /*
2  * Copyright (c) 2003-2004, Marcus Overhagen
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without modification,
6  * are permitted provided that the following conditions are met:
7  *
8  *  * Redistributions of source code must retain the above copyright notice,
9  *    this list of conditions and the following disclaimer.
10  *  * Redistributions in binary form must reproduce the above copyright notice,
11  *    this list of conditions and the following disclaimer in the documentation
12  *    and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
18  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
19  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
22  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
23  * OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 #ifndef _AU_READER_H
26 #define _AU_READER_H
27 
28 #include "ReaderPlugin.h"
29 #include "au.h"
30 
31 class auReader : public Reader
32 {
33 public:
34 				auReader();
35 				~auReader();
36 
37 	const char *Copyright();
38 
39 	status_t	Sniff(int32 *streamCount);
40 
41 	void		GetFileFormatInfo(media_file_format *mff);
42 
43 	status_t	AllocateCookie(int32 streamNumber, void **cookie);
44 	status_t	FreeCookie(void *cookie);
45 
46 	status_t	GetStreamInfo(void *cookie, int64 *frameCount, bigtime_t *duration,
47 							  media_format *format, const void **infoBuffer, size_t *infoSize);
48 
49 	status_t	Seek(void *cookie,
50 					 uint32 seekTo,
51 					 int64 *frame, bigtime_t *time);
52 
53 	status_t	GetNextChunk(void *cookie,
54 							 const void **chunkBuffer, size_t *chunkSize,
55 							 media_header *mediaHeader);
56 
57 	BPositionIO *Source() { return fSource; }
58 
59 private:
60 	BPositionIO *	fSource;
61 
62 	media_format	fFormat;
63 	int64			fDataStart;
64 	int64			fDataSize;
65 
66 	int64			fFrameCount;
67 	bigtime_t		fDuration;
68 
69 	bool			fRaw;
70 
71 	int64			fPosition;
72 
73 	int				fChannelCount;
74 	int32			fFrameRate;
75 	int				fBitsPerSample;
76 	int				fBitsPerFrame;
77 	int				fBlockAlign;
78 	uint32			fFormatCode;
79 
80 	void *			fBuffer;
81 	int32 			fBufferSize;
82 };
83 
84 
85 class auReaderPlugin : public ReaderPlugin
86 {
87 public:
88 	Reader *NewReader();
89 };
90 
91 MediaPlugin *instantiate_plugin();
92 
93 #endif
94