xref: /haiku/src/add-ons/media/plugins/dvd_streamer/DVDMediaIO.h (revision c237c4ce593ee823d9867fd997e51e4c447f5623)
1 /*
2  * Copyright 2019, Dario Casalinuovo. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _DVD_MEDIA_IO_H
6 #define _DVD_MEDIA_IO_H
7 
8 
9 #include <AdapterIO.h>
10 #include <String.h>
11 #include <Url.h>
12 
13 #include <dvdnav/dvdnav.h>
14 
15 
16 class DVDMediaIO : public BAdapterIO
17 {
18 public:
19 										DVDMediaIO(const char* path);
20 	virtual								~DVDMediaIO();
21 
22 	virtual	ssize_t						WriteAt(off_t position,
23 											const void* buffer,
24 											size_t size);
25 
26 	virtual	status_t					SetSize(off_t size);
27 
28 	virtual status_t					Open();
29 
30 			void						LoopThread();
31 
32 	virtual	status_t					SeekRequested(off_t position);
33 
34 			void						HandleDVDEvent(int event, int len);
35 
36 			void						MouseMoved(uint32 x, uint32 y);
37 			void						MouseDown(uint32 x, uint32 y);
38 
39 private:
40 			static int32				_LoopThread(void* data);
41 
42 			thread_id					fLoopThread;
43 			bool						fExit;
44 
45 			BInputAdapter*				fInputAdapter;
46 
47 			const char*					fPath;
48 			dvdnav_t*					fDvdNav;
49 			uint8_t*					fBuffer;
50 };
51 
52 
53 #endif
54