xref: /haiku/src/servers/media_addon/MediaFilePlayer.h (revision c90684742e7361651849be4116d0e5de3a817194)
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 #include <Entry.h>
9 #include <SoundPlayer.h>
10 #include <MediaFile.h>
11 #include <MediaTrack.h>
12 #include <MediaDefs.h>
13 
14 
15 void PlayMediaFile(const char *media_type, const char *media_name);
16 
17 
18 class MediaFilePlayer
19 {
20 public:
21 	MediaFilePlayer(const char *media_type, const char *media_name,
22 		entry_ref *ref);
23 	~MediaFilePlayer();
24 
25 	bool IsPlaying();
26 	void Restart();
27 	void Stop();
28 	status_t InitCheck();
29 	const char *Name() { return fName; };
30 	const entry_ref *Ref() { return &fRef; };
31 
32 	static void PlayFunction(void *cookie, void * buffer,
33 		size_t size, const media_raw_audio_format & format);
34 
35 private:
36 	char 		*fName;
37 	status_t	fInitCheck;
38 	entry_ref	fRef;
39 	BSoundPlayer *fSoundPlayer;
40 	BMediaFile *fPlayFile;
41 	BMediaTrack	*fPlayTrack;
42 	media_format fPlayFormat;
43 };
44 
45 #endif // _MEDIA_FILE_PLAYER_H
46