xref: /haiku/src/add-ons/media/plugins/ffmpeg/AVFormatReader.h (revision a244fc3ac7ccad9577d8ab9c364698fc03458eaa)
1 /*
2  * Copyright 2009, Stephan Aßmus <superstippi@gmx.de>
3  * All rights reserved. Distributed under the terms of the GNU L-GPL license.
4  */
5 #ifndef AV_FORMAT_READER_H
6 #define AV_FORMAT_READER_H
7 
8 
9 #include "ReaderPlugin.h"
10 
11 
12 struct AVFormatContext;
13 
14 
15 class AVFormatReader : public Reader {
16 public:
17 								AVFormatReader();
18 								~AVFormatReader();
19 
20 	virtual	const char*			Copyright();
21 
22 	virtual	status_t			Sniff(int32* streamCount);
23 
24 	virtual	void				GetFileFormatInfo(media_file_format* mff);
25 
26 	virtual	status_t			AllocateCookie(int32 streamNumber,
27 									void** cookie);
28 	virtual	status_t			FreeCookie(void* cookie);
29 
30 	virtual	status_t			GetStreamInfo(void* cookie, int64* frameCount,
31 									bigtime_t* duration, media_format* format,
32 									const void** infoBuffer,
33 									size_t* infoSize);
34 
35 	virtual	status_t			Seek(void* cookie, uint32 flags, int64* frame,
36 									bigtime_t* time);
37 	virtual	status_t			FindKeyFrame(void* cookie, uint32 flags,
38 									int64* frame, bigtime_t* time);
39 
40 	virtual	status_t			GetNextChunk(void* cookie,
41 									const void** chunkBuffer, size_t* chunkSize,
42 									media_header* mediaHeader);
43 
44 private:
45 	static	int				_ReadPacket(void* cookie,
46 									uint8* buffer, int bufferSize);
47 
48 	static	off_t				_Seek(void* cookie,
49 									off_t offset, int whence);
50 
51 			AVFormatContext*	fContext;
52 };
53 
54 
55 #endif // AV_FORMAT_READER_H
56