1/*****************************************************************************/
2// LegacyAudioDevice class
3//
4// [Class Description]
5//
6//
7// Copyright (c) 2002 OpenBeOS Project
8//
9// Permission is hereby granted, free of charge, to any person obtaining a
10// copy of this software and associated documentation files (the "Software"),
11// to deal in the Software without restriction, including without limitation
12// the rights to use, copy, modify, merge, publish, distribute, sublicense,
13// and/or sell copies of the Software, and to permit persons to whom the
14// Software is furnished to do so, subject to the following conditions:
15//
16// The above copyright notice and this permission notice shall be included
17// in all copies or substantial portions of the Software.
18//
19// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25// DEALINGS IN THE SOFTWARE.
26/*****************************************************************************/
27
28#ifndef _LEGACY_AUDIO_DEVICE_H
29#define _LEGACY_AUDIO_DEVICE_H
30
31#include <media/MediaAddOn.h>
32#include <media/MediaFormats.h>
33
34class LegacyAudioDevice
35{
36	public:
37						LegacyAudioDevice( const char *name, int32 id );
38						~LegacyAudioDevice();
39
40		bool			CheckInit()
41						{ return fInitOK; }
42
43		flavor_info		*GetInputFlavor()
44						{ return &input_flavor; }
45
46		flavor_info		*GetOutputFlavor()
47						{ return &output_flavor; }
48
49		media_format	*GetInputFormat()
50						{ return &input_format; }
51
52		media_format	*GetOutputFormat()
53						{ return &output_format; }
54
55
56	protected:
57		int32			Input_Thread();
58		int32			Output_Thread();
59
60	private:
61		bool			fInitOK;
62
63		int				fd;				//file-descriptor of hw device
64
65		flavor_info 	input_flavor;
66		media_format	input_format;
67		sem_id			in_sem; 		//input completion semaphore
68		thread_id		input_thread; 	//input thread
69
70		flavor_info 	output_flavor;
71		media_format	output_format;
72		sem_id			out_sem; 		//output completion semaphore
73		thread_id		output_thread;	//output thread
74};
75
76#endif
77