xref: /haiku/src/servers/media_addon/MediaFilePlayer.h (revision 1363ef8d859de3956bcad53a2c9ef6430938fe89)
1 /*
2  * Copyright (c) 2004, Marcus Overhagen <marcus@overhagen.de>. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _MEDIA_FILE_PLAYER_H
6 #define _MEDIA_FILE_PLAYER_H
7 
8 
9 #include <Entry.h>
10 #include <MediaDefs.h>
11 #include <MediaFile.h>
12 #include <MediaTrack.h>
13 #include <SoundPlayer.h>
14 #include <String.h>
15 
16 
17 void PlayMediaFile(const char* media_type, const char* media_name);
18 
19 
20 class MediaFilePlayer
21 {
22 public:
23 							MediaFilePlayer(const char* media_type,
24 								const char* media_name,
25 								entry_ref* ref);
26 							~MediaFilePlayer();
27 
28 	status_t				InitCheck();
29 
30 	bool					IsPlaying();
31 	void					Restart();
32 	void					Stop();
33 
34 	const char*				Name();
35 	const entry_ref*		Ref();
36 
37 	static void				PlayFunction(void* cookie, void* buffer,
38 								size_t size,
39 								const media_raw_audio_format& format);
40 
41 private:
42 	BString					fName;
43 	status_t				fInitCheck;
44 	entry_ref				fRef;
45 	BSoundPlayer*			fSoundPlayer;
46 	BMediaFile*				fPlayFile;
47 	BMediaTrack*			fPlayTrack;
48 	media_format			fPlayFormat;
49 };
50 
51 #endif // _MEDIA_FILE_PLAYER_H
52