1c284bb0fSMatt Madia /*
2c284bb0fSMatt Madia * Copyright (c) 1999-2000, Eric Moon.
3c284bb0fSMatt Madia * All rights reserved.
4c284bb0fSMatt Madia *
5c284bb0fSMatt Madia * Redistribution and use in source and binary forms, with or without
6c284bb0fSMatt Madia * modification, are permitted provided that the following conditions
7c284bb0fSMatt Madia * are met:
8c284bb0fSMatt Madia *
9c284bb0fSMatt Madia * 1. Redistributions of source code must retain the above copyright
10c284bb0fSMatt Madia * notice, this list of conditions, and the following disclaimer.
11c284bb0fSMatt Madia *
12c284bb0fSMatt Madia * 2. Redistributions in binary form must reproduce the above copyright
13c284bb0fSMatt Madia * notice, this list of conditions, and the following disclaimer in the
14c284bb0fSMatt Madia * documentation and/or other materials provided with the distribution.
15c284bb0fSMatt Madia *
16c284bb0fSMatt Madia * 3. The name of the author may not be used to endorse or promote products
17c284bb0fSMatt Madia * derived from this software without specific prior written permission.
18c284bb0fSMatt Madia *
19c284bb0fSMatt Madia * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
20c284bb0fSMatt Madia * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21c284bb0fSMatt Madia * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22c284bb0fSMatt Madia * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23c284bb0fSMatt Madia * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24c284bb0fSMatt Madia * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25c284bb0fSMatt Madia * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26c284bb0fSMatt Madia * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
27c284bb0fSMatt Madia * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28c284bb0fSMatt Madia * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29c284bb0fSMatt Madia */
30c284bb0fSMatt Madia
31c284bb0fSMatt Madia
32a0795c6fSMarcus Overhagen // AudioAdapterAddOn.cpp
33a0795c6fSMarcus Overhagen
34a0795c6fSMarcus Overhagen #include "AudioAdapterAddOn.h"
35a0795c6fSMarcus Overhagen
36a0795c6fSMarcus Overhagen #include "AudioAdapterNode.h"
37a0795c6fSMarcus Overhagen //#include "AudioFilterNode.h"
38a0795c6fSMarcus Overhagen #include "AudioAdapterOp.h"
39a0795c6fSMarcus Overhagen
40a0795c6fSMarcus Overhagen #include <Entry.h>
41a0795c6fSMarcus Overhagen #include <Debug.h>
42a0795c6fSMarcus Overhagen #include <cstring>
43a0795c6fSMarcus Overhagen #include <cstdlib>
44a0795c6fSMarcus Overhagen #include <cstdio>
45a0795c6fSMarcus Overhagen
46a0795c6fSMarcus Overhagen // -------------------------------------------------------- //
47a0795c6fSMarcus Overhagen // instantiation function
48a0795c6fSMarcus Overhagen // -------------------------------------------------------- //
49a0795c6fSMarcus Overhagen
make_media_addon(image_id image)50a0795c6fSMarcus Overhagen extern "C" _EXPORT BMediaAddOn* make_media_addon(image_id image) {
51a0795c6fSMarcus Overhagen return new AudioAdapterAddOn(image);
52a0795c6fSMarcus Overhagen }
53a0795c6fSMarcus Overhagen
54a0795c6fSMarcus Overhagen // -------------------------------------------------------- //
55a0795c6fSMarcus Overhagen // main() stub
56a0795c6fSMarcus Overhagen // -------------------------------------------------------- //
57a0795c6fSMarcus Overhagen
main()58a0795c6fSMarcus Overhagen int main() {
59a0795c6fSMarcus Overhagen fputs("[AudioAdapter.media_addon]", stderr);
60a0795c6fSMarcus Overhagen return 1;
61a0795c6fSMarcus Overhagen }
62a0795c6fSMarcus Overhagen
63a0795c6fSMarcus Overhagen // -------------------------------------------------------- //
64a0795c6fSMarcus Overhagen // ctor/dtor
65a0795c6fSMarcus Overhagen // -------------------------------------------------------- //
66a0795c6fSMarcus Overhagen
67a0795c6fSMarcus Overhagen //AudioAdapterAddOn::~AudioAdapterAddOn() {}
AudioAdapterAddOn(image_id id)68a0795c6fSMarcus Overhagen AudioAdapterAddOn::AudioAdapterAddOn(image_id id) :
69a0795c6fSMarcus Overhagen BMediaAddOn(id) {}
70a0795c6fSMarcus Overhagen
71a0795c6fSMarcus Overhagen // -------------------------------------------------------- //
72a0795c6fSMarcus Overhagen // BMediaAddOn impl
73a0795c6fSMarcus Overhagen // -------------------------------------------------------- //
74a0795c6fSMarcus Overhagen
InitCheck(const char ** out_failure_text)75a0795c6fSMarcus Overhagen status_t AudioAdapterAddOn::InitCheck(
76a0795c6fSMarcus Overhagen const char** out_failure_text) {
77a0795c6fSMarcus Overhagen return B_OK;
78a0795c6fSMarcus Overhagen }
79a0795c6fSMarcus Overhagen
CountFlavors()80a0795c6fSMarcus Overhagen int32 AudioAdapterAddOn::CountFlavors() {
81a0795c6fSMarcus Overhagen return 1;
82a0795c6fSMarcus Overhagen }
83a0795c6fSMarcus Overhagen
GetFlavorAt(int32 n,const flavor_info ** out_info)84a0795c6fSMarcus Overhagen status_t AudioAdapterAddOn::GetFlavorAt(
85a0795c6fSMarcus Overhagen int32 n,
86a0795c6fSMarcus Overhagen const flavor_info** out_info) {
87a0795c6fSMarcus Overhagen if(n)
88a0795c6fSMarcus Overhagen return B_ERROR;
89a0795c6fSMarcus Overhagen
90a0795c6fSMarcus Overhagen flavor_info* pInfo = new flavor_info;
91a0795c6fSMarcus Overhagen pInfo->internal_id = n;
92*fb5c24d8SAdrien Destugues pInfo->name = "AudioAdapter";
93*fb5c24d8SAdrien Destugues pInfo->info = "AudioAdapter (generic raw-audio format conversion).\n"
94a0795c6fSMarcus Overhagen "by Eric Moon (8 September 1999)";
95a0795c6fSMarcus Overhagen pInfo->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_CONTROLLABLE;
96a0795c6fSMarcus Overhagen pInfo->flavor_flags = 0;
97a0795c6fSMarcus Overhagen pInfo->possible_count = 0;
98a0795c6fSMarcus Overhagen
99a0795c6fSMarcus Overhagen pInfo->in_format_count = 1;
100a0795c6fSMarcus Overhagen media_format* pFormat = new media_format;
101a0795c6fSMarcus Overhagen pFormat->type = B_MEDIA_RAW_AUDIO;
102a0795c6fSMarcus Overhagen pFormat->u.raw_audio = media_raw_audio_format::wildcard;
103a0795c6fSMarcus Overhagen pInfo->in_formats = pFormat;
104a0795c6fSMarcus Overhagen
105a0795c6fSMarcus Overhagen pInfo->out_format_count = 1;
106a0795c6fSMarcus Overhagen pFormat = new media_format;
107a0795c6fSMarcus Overhagen pFormat->type = B_MEDIA_RAW_AUDIO;
108a0795c6fSMarcus Overhagen pFormat->u.raw_audio = media_raw_audio_format::wildcard;
109a0795c6fSMarcus Overhagen pInfo->out_formats = pFormat;
110a0795c6fSMarcus Overhagen
111a0795c6fSMarcus Overhagen *out_info = pInfo;
112a0795c6fSMarcus Overhagen return B_OK;
113a0795c6fSMarcus Overhagen }
114a0795c6fSMarcus Overhagen
InstantiateNodeFor(const flavor_info * info,BMessage * config,status_t * out_error)115a0795c6fSMarcus Overhagen BMediaNode* AudioAdapterAddOn::InstantiateNodeFor(
116a0795c6fSMarcus Overhagen const flavor_info* info,
117a0795c6fSMarcus Overhagen BMessage* config,
118a0795c6fSMarcus Overhagen status_t* out_error) {
119a0795c6fSMarcus Overhagen
120a0795c6fSMarcus Overhagen return new _AudioAdapterNode(
121a0795c6fSMarcus Overhagen "AudioAdapter",
122a0795c6fSMarcus Overhagen new AudioAdapterOpFactory(),
123a0795c6fSMarcus Overhagen this);
124a0795c6fSMarcus Overhagen }
125a0795c6fSMarcus Overhagen
GetConfigurationFor(BMediaNode * your_node,BMessage * into_message)126a0795c6fSMarcus Overhagen status_t AudioAdapterAddOn::GetConfigurationFor(
127a0795c6fSMarcus Overhagen BMediaNode* your_node,
128a0795c6fSMarcus Overhagen BMessage* into_message) {
129a0795c6fSMarcus Overhagen
130a0795c6fSMarcus Overhagen // no config yet
131a0795c6fSMarcus Overhagen return B_OK;
132a0795c6fSMarcus Overhagen }
133a0795c6fSMarcus Overhagen
134a0795c6fSMarcus Overhagen
135a0795c6fSMarcus Overhagen // END -- AudioAdapterAddOn.cpp --
136