3rdparty/licenseReport: Add seperate LGPL checks
[haiku.git] / src / add-ons / media / media-add-ons / mixer / MixerAddOn.cpp
blob18c6eec252bf7e38bb17da3e17eed380cfa684c8
1 /*
2 * Copyright 2002 David Shipman,
3 * Copyright 2003-2007 Marcus Overhagen
4 * Copyright 2007 Haiku Inc. All rights reserved.
5 * Distributed under the terms of the MIT License.
6 */
9 #include "MixerAddOn.h"
11 #include <stdio.h>
12 #include <string.h>
14 #include <MediaRoster.h>
15 #include <MediaNode.h>
17 #include "AudioMixer.h"
20 // instantiation function
21 extern "C" _EXPORT BMediaAddOn* make_media_addon(image_id image) {
22 return new AudioMixerAddon(image);
26 AudioMixerAddon::AudioMixerAddon(image_id image)
28 BMediaAddOn(image),
29 fFormat(new media_format),
30 fInfo(new flavor_info)
32 memset(fFormat, 0, sizeof(*fFormat));
33 fFormat->type = B_MEDIA_RAW_AUDIO;
34 fFormat->u.raw_audio = media_raw_audio_format::wildcard;
36 fInfo->internal_id = 0;
37 fInfo->name = (char *)"Audio Mixer (Haiku)";
38 fInfo->info = (char *)"Haiku Audio Mixer media addon";
39 fInfo->kinds = B_BUFFER_PRODUCER | B_BUFFER_CONSUMER | B_SYSTEM_MIXER | B_CONTROLLABLE;
40 fInfo->flavor_flags = 0; // 0 = global or local instantiation allowed, no restrictions
41 fInfo->possible_count = 0; // 0 = infinite
42 fInfo->in_format_count = 1;
43 fInfo->in_formats = fFormat;
44 fInfo->out_format_count = 1;
45 fInfo->out_formats = fFormat;
49 AudioMixerAddon::~AudioMixerAddon()
51 delete fFormat;
52 delete fInfo;
56 // #pragma mark - BMediaAddOn implementation
59 status_t
60 AudioMixerAddon::InitCheck(const char** out_failure_text)
62 return B_OK;
66 int32
67 AudioMixerAddon::CountFlavors()
69 return 1;
73 status_t
74 AudioMixerAddon::GetFlavorAt(int32 n, const flavor_info** out_info)
76 // only the 0th flavor exists
77 if (n != 0)
78 return B_ERROR;
80 *out_info = fInfo;
81 return B_OK;
85 BMediaNode *
86 AudioMixerAddon::InstantiateNodeFor(const flavor_info* info, BMessage* config,
87 status_t* out_error)
89 return new AudioMixer(this, false);
93 status_t
94 AudioMixerAddon::GetConfigurationFor(BMediaNode* your_node,
95 BMessage* into_message)
97 // no config yet
98 return B_ERROR;
102 bool
103 AudioMixerAddon::WantsAutoStart()
105 return true;
109 status_t
110 AudioMixerAddon::AutoStart(int in_index, BMediaNode **out_node,
111 int32 *out_internal_id, bool *out_has_more)
113 *out_has_more = false;
115 if (in_index != 0)
116 return B_ERROR;
118 *out_internal_id = 0;
119 AudioMixer *mixer = new AudioMixer(this, true);
120 *out_node = mixer;
122 return B_OK;