196263Sobrien/* 2169689Skan * Copyright (c) 1999-2000, Eric Moon. 396263Sobrien * All rights reserved. 496263Sobrien * 596263Sobrien * Redistribution and use in source and binary forms, with or without 696263Sobrien * modification, are permitted provided that the following conditions 796263Sobrien * are met: 896263Sobrien * 996263Sobrien * 1. Redistributions of source code must retain the above copyright 1096263Sobrien * notice, this list of conditions, and the following disclaimer. 1196263Sobrien * 1296263Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1396263Sobrien * notice, this list of conditions, and the following disclaimer in the 1496263Sobrien * documentation and/or other materials provided with the distribution. 1596263Sobrien * 16169689Skan * 3. The name of the author may not be used to endorse or promote products 1796263Sobrien * derived from this software without specific prior written permission. 1896263Sobrien * 1996263Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR 2096263Sobrien * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2196263Sobrien * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22102780Skan * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 23102780Skan * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24102780Skan * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25169689Skan * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 26169689Skan * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 27132718Skan * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28169689Skan * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29132718Skan */ 30169689Skan 31169689Skan 32169689Skan// AudioAdapterAddOn.cpp 33132718Skan 34132718Skan#include "AudioAdapterAddOn.h" 35132718Skan 36132718Skan#include "AudioAdapterNode.h" 37132718Skan//#include "AudioFilterNode.h" 38132718Skan#include "AudioAdapterOp.h" 39132718Skan 40132718Skan#include <Entry.h> 41132718Skan#include <Debug.h> 42132718Skan#include <cstring> 43169689Skan#include <cstdlib> 44169689Skan#include <cstdio> 45169689Skan 46117395Skan// -------------------------------------------------------- // 47132718Skan// instantiation function 48169689Skan// -------------------------------------------------------- // 49132718Skan 50132718Skanextern "C" _EXPORT BMediaAddOn* make_media_addon(image_id image) { 51132718Skan return new AudioAdapterAddOn(image); 52102780Skan} 53169689Skan 54132718Skan// -------------------------------------------------------- // 55132718Skan// main() stub 56132718Skan// -------------------------------------------------------- // 57132718Skan 58117395Skanint main() { 59169689Skan fputs("[AudioAdapter.media_addon]", stderr); 60169689Skan return 1; 61169689Skan} 62169689Skan 63132718Skan// -------------------------------------------------------- // 64117395Skan// ctor/dtor 65132718Skan// -------------------------------------------------------- // 66132718Skan 67132718Skan//AudioAdapterAddOn::~AudioAdapterAddOn() {} 68132718SkanAudioAdapterAddOn::AudioAdapterAddOn(image_id id) : 69132718Skan BMediaAddOn(id) {} 70132718Skan 71169689Skan// -------------------------------------------------------- // 72146895Skan// BMediaAddOn impl 73169689Skan// -------------------------------------------------------- // 74169689Skan 75169689Skanstatus_t AudioAdapterAddOn::InitCheck( 76169689Skan const char** out_failure_text) { 77102780Skan return B_OK; 78} 79 80int32 AudioAdapterAddOn::CountFlavors() { 81 return 1; 82} 83 84status_t AudioAdapterAddOn::GetFlavorAt( 85 int32 n, 86 const flavor_info** out_info) { 87 if(n) 88 return B_ERROR; 89 90 flavor_info* pInfo = new flavor_info; 91 pInfo->internal_id = n; 92 pInfo->name = "AudioAdapter"; 93 pInfo->info = "AudioAdapter (generic raw-audio format conversion).\n" 94 "by Eric Moon (8 September 1999)"; 95 pInfo->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER | B_CONTROLLABLE; 96 pInfo->flavor_flags = 0; 97 pInfo->possible_count = 0; 98 99 pInfo->in_format_count = 1; 100 media_format* pFormat = new media_format; 101 pFormat->type = B_MEDIA_RAW_AUDIO; 102 pFormat->u.raw_audio = media_raw_audio_format::wildcard; 103 pInfo->in_formats = pFormat; 104 105 pInfo->out_format_count = 1; 106 pFormat = new media_format; 107 pFormat->type = B_MEDIA_RAW_AUDIO; 108 pFormat->u.raw_audio = media_raw_audio_format::wildcard; 109 pInfo->out_formats = pFormat; 110 111 *out_info = pInfo; 112 return B_OK; 113} 114 115BMediaNode* AudioAdapterAddOn::InstantiateNodeFor( 116 const flavor_info* info, 117 BMessage* config, 118 status_t* out_error) { 119 120 return new _AudioAdapterNode( 121 "AudioAdapter", 122 new AudioAdapterOpFactory(), 123 this); 124} 125 126status_t AudioAdapterAddOn::GetConfigurationFor( 127 BMediaNode* your_node, 128 BMessage* into_message) { 129 130 // no config yet 131 return B_OK; 132} 133 134 135// END -- AudioAdapterAddOn.cpp -- 136