xref: /haiku/src/add-ons/media/media-add-ons/opensound/OpenSoundAddOn.h (revision 1214ef1b2100f2b3299fc9d8d6142e46f70a4c3f)
1 /*
2  * OpenSound media addon for BeOS and Haiku
3  *
4  * Copyright (c) 2007, François Revol (revol@free.fr)
5  * Distributed under the terms of the MIT License.
6  *
7  * Based on MultiAudio media addon
8  * Copyright (c) 2002, 2003 Jerome Duval (jerome.duval@free.fr)
9  */
10 
11 #ifndef _OPENSOUNDADDON_H
12 #define _OPENSOUNDADDON_H
13 
14 #include <MediaDefs.h>
15 #include <MediaFormats.h>
16 #include <MediaAddOn.h>
17 
18 #define SETTINGS_FILE					"Media/oss_audio_settings"
19 
20 class OpenSoundAddOn :
21 	public BMediaAddOn
22 {
23 	public:
24 		virtual ~OpenSoundAddOn(void);
25 		explicit OpenSoundAddOn(image_id image);
26 
27 		/**************************/
28 		/* begin from BMediaAddOn */
29 	public:
30 		virtual	status_t InitCheck(
31 			const char ** out_failure_text);
32 		virtual	int32 CountFlavors(void);
33 		virtual	status_t GetFlavorAt(
34 			int32 n,
35 			const flavor_info ** out_info);
36 		virtual	BMediaNode * InstantiateNodeFor(
37 			const flavor_info * info,
38 			BMessage * config,
39 			status_t * out_error);
40 		virtual	status_t GetConfigurationFor(
41 			BMediaNode * your_node,
42 			BMessage * into_message);
43 		virtual	bool WantsAutoStart(void);
44 		virtual	status_t AutoStart(
45 			int in_count,
46 			BMediaNode ** out_node,
47 			int32 * out_internal_id,
48 			bool * out_has_more);
49 
50 		/* end from BMediaAddOn */
51 		/************************/
52 
53 	private:
54 		status_t RecursiveScan(char* path, BEntry *rootEntry = NULL);
55 		void SaveSettings(void);
56 		void LoadSettings(void);
57 
58 		void RegisterMediaFormats(void);
59 
60 		status_t 		fInitCheckStatus;
61 		BList			fDevices;
62 
63 		BMessage fSettings;				// settings loaded from settings directory
64 };
65 
66 extern "C" _EXPORT BMediaAddOn *make_media_addon(image_id you);
67 
68 #endif /* _OPENSOUNDADDON_H */
69