BParameterWeb	*VideoRecorderNode::GetParameterWeb(void)
{
	int32 cookie = 0;
	bool first=true;
	media_file_format *mff=new media_file_format;
//	if (web) delete web;
	web = new BParameterWeb();
	BParameterGroup *videoFormat=web->MakeGroup("VideoFormat");
	BParameterGroup *formatGroup = videoFormat->MakeGroup("Fileformat");
	format = formatGroup->MakeDiscreteParameter(VIDEO_FORMAT, B_MEDIA_RAW_VIDEO, "VideoFileFormat", "FileFormat");
	BParameterGroup *codecGroup = videoFormat->MakeGroup("Codec");
	codec = codecGroup->MakeDiscreteParameter(VIDEO_CODEC, B_MEDIA_RAW_VIDEO, "Codec", "Codec");
	BParameterGroup *qualityGroup = videoFormat->MakeGroup("Quality");
	quality = qualityGroup->MakeContinuousParameter(VIDEO_QUALITY, B_MEDIA_RAW_VIDEO, "Video Quality", B_QUALITY,"",0,1.0,0.005);
	while (get_next_file_format(&cookie, mff) == B_OK)
	{
		if (mff->capabilities & media_file_format::B_KNOWS_ENCODED_VIDEO)
		{
//			format->AddItem(formatList->CountItems(), mff->pretty_name);
			format->AddItem((uint32)mff->family, mff->pretty_name);

			formatList->AddItem(&(mff->family));
			if (first)
			{
				videoFileFormat=*mff;
				BuildCodecMenu(videoFileFormat.family);
				first=false;
			}
		}
	}
	videoQuality=1.0;
	return web;	
}
Ejemplo n.º 2
0
// utility - build the ToneProducer's parameter web
static BParameterWeb* make_parameter_web()
{
	FPRINTF(stderr, "make_parameter_web() called\n");

	BParameterWeb* web = new BParameterWeb;
	BParameterGroup* mainGroup = web->MakeGroup("Tone Generator Parameters");

	BParameterGroup* group = mainGroup->MakeGroup("Frequency");
	BParameter* nullParam = group->MakeNullParameter(FREQUENCY_NULL_PARAM, B_MEDIA_NO_TYPE, "Frequency", B_GENERIC);
	BContinuousParameter* param = group->MakeContinuousParameter(FREQUENCY_PARAM, B_MEDIA_NO_TYPE, "", B_GAIN, "Hz", 0, 2500, 0.1);
	nullParam->AddOutput(param);
	param->AddInput(nullParam);

	group = mainGroup->MakeGroup("Amplitude");
	nullParam = group->MakeNullParameter(GAIN_NULL_PARAM, B_MEDIA_NO_TYPE, "Amplitude", B_GENERIC);
	param = group->MakeContinuousParameter(GAIN_PARAM, B_MEDIA_NO_TYPE, "", B_GAIN, "", 0, 1, 0.01);
	nullParam->AddOutput(param);
	param->AddInput(nullParam);

	group = mainGroup->MakeGroup("Waveform");
	nullParam = group->MakeNullParameter(WAVEFORM_NULL_PARAM, B_MEDIA_NO_TYPE, "Waveform", B_GENERIC);
	BDiscreteParameter* waveParam = group->MakeDiscreteParameter(WAVEFORM_PARAM, B_MEDIA_NO_TYPE, "", B_GENERIC);
	waveParam->AddItem(SINE_WAVE, "Sine wave");
	waveParam->AddItem(TRIANGLE_WAVE, "Triangle");
	waveParam->AddItem(SAWTOOTH_WAVE, "Sawtooth");
	nullParam->AddOutput(waveParam);
	waveParam->AddInput(nullParam);

	return web;
}
Ejemplo n.º 3
0
// build the LoggingConsumer's BParameterWeb
static BParameterWeb* build_parameter_web()
{
	BParameterWeb* web = new BParameterWeb;

	BParameterGroup* mainGroup = web->MakeGroup("LoggingConsumer Parameters");
	BParameterGroup* group = mainGroup->MakeGroup("Latency control");
	BParameter* nullParam = group->MakeNullParameter(INPUT_NULL_PARAM, B_MEDIA_NO_TYPE, "Latency", B_GENERIC);
	BParameter* latencyParam = group->MakeContinuousParameter(LATENCY_PARAM, B_MEDIA_NO_TYPE, "",
		B_GAIN, "ms", 5, 100, 5);
	nullParam->AddOutput(latencyParam);
	latencyParam->AddInput(nullParam);

	group = mainGroup->MakeGroup("CPU percentage");
	nullParam = group->MakeNullParameter(CPU_NULL_PARAM, B_MEDIA_NO_TYPE, "CPU spin percentage", B_GENERIC);
	BContinuousParameter* cpuParam = group->MakeContinuousParameter(CPU_SPIN_PARAM, B_MEDIA_NO_TYPE, "",
		B_GAIN, "percent", 5, 80, 5);
	nullParam->AddOutput(cpuParam);
	cpuParam->AddInput(nullParam);

	group = mainGroup->MakeGroup("Priority");
	nullParam = group->MakeNullParameter(PRIO_NULL_PARAM, B_MEDIA_NO_TYPE, "Thread priority", B_GENERIC);
	BDiscreteParameter* prioParam = group->MakeDiscreteParameter(PRIORITY_PARAM, B_MEDIA_NO_TYPE, "", B_GENERIC);
	prioParam->AddItem(5, "B_LOW_PRIORITY");
	prioParam->AddItem(10, "B_NORMAL_PRIORITY");
	prioParam->AddItem(15, "B_DISPLAY_PRIORITY");
	prioParam->AddItem(20, "B_URGENT_DISPLAY_PRIORITY");
	prioParam->AddItem(100, "B_REAL_TIME_DISPLAY_PRIORITY");
	prioParam->AddItem(110, "B_URGENT_PRIORITY");
	prioParam->AddItem(120, "B_REAL_TIME_PRIORITY");

	return web;
}
Ejemplo n.º 4
0
void
EqualizerNode::InitParameterWeb(void)
{
    fWeb = new BParameterWeb();

    BParameterGroup* fParamGroup = fWeb->MakeGroup("EqualizerNode Parameters");
    BParameterGroup* fFControlGroup = fParamGroup->MakeGroup("FilterControl");

    fFControlGroup->MakeDiscreteParameter(P_MUTE,B_MEDIA_NO_TYPE,"Mute",
                                          B_ENABLE);
    fFControlGroup->MakeDiscreteParameter(P_BYPASS,B_MEDIA_NO_TYPE,"ByPass",
                                          B_ENABLE);

    BNullParameter* label;
    BParameterGroup* group;
    BContinuousParameter* value;

    group = fParamGroup->MakeGroup("Pre Amp");
    label = group->MakeNullParameter(P_PREAMP_LABEL, B_MEDIA_NO_TYPE, "Pre Amp",
                                     B_GENERIC);
    value = group->MakeContinuousParameter(P_PREAMP, B_MEDIA_NO_TYPE, "",
                                           B_GAIN, "dB", -8.0, 8.0, 0.1);
    label->AddOutput(value);
    value->AddInput(label);

    for (int i = 0; i < fEqualizer.BandCount(); i++) {
        char freq[32];
        sprintf(freq,"%gHz",fEqualizer.BandFrequency(i));
        group = fParamGroup->MakeGroup(freq);
        label = group->MakeNullParameter(P_BAND_LABELS + i, B_MEDIA_NO_TYPE,
                                         freq, B_GENERIC);
        value = group->MakeContinuousParameter(P_BANDS + i, B_MEDIA_NO_TYPE,
                                               "", B_GAIN, "dB", -16.0, 16.0, 0.1);
        label->AddOutput(value);
        value->AddInput(label);
    }

    SetParameterWeb(fWeb);
}
Ejemplo n.º 5
0
FlipTransition::FlipTransition(BMediaAddOn* pAddOn) :
	// * init base classes
	BMediaNode(s_nodeName), // (virtual base)
	BBufferConsumer(B_MEDIA_RAW_VIDEO),
	BBufferProducer(B_MEDIA_RAW_VIDEO),
	BControllable(),
	BMediaEventLooper(),
	
	// * init connection state
	m_outputEnabled(true),
	m_downstreamLatency(0),
	m_processingLatency(0),
	
	// * init add-on stuff
	m_pAddOn(pAddOn)
{	
	// the rest of the initialization happens in NodeRegistered().
	BParameterWeb *web = new BParameterWeb();
	BParameterGroup *main = web->MakeGroup(Name());
	
	BContinuousParameter *pstate = main->MakeContinuousParameter(P_STATE,B_MEDIA_RAW_VIDEO,"State (%)","","",0.0,100.0,1.0);
	BContinuousParameter *pdx = main->MakeContinuousParameter(P_X,B_MEDIA_RAW_VIDEO,"X offset (%)","","",0.0,100.0,1.0);
	BContinuousParameter *pdy = main->MakeContinuousParameter(P_Y,B_MEDIA_RAW_VIDEO,"Y offset (%)","","",0.0,100.0,1.0);
	BContinuousParameter *pr = main->MakeContinuousParameter(P_RED,B_MEDIA_RAW_VIDEO,"Background Redness","","",0.0,255.0,1.0);
	BContinuousParameter *pg = main->MakeContinuousParameter(P_GREEN,B_MEDIA_RAW_VIDEO,"Background Greeness","","",0.0,255.0,1.0);
	BContinuousParameter *pb = main->MakeContinuousParameter(P_BLUE,B_MEDIA_RAW_VIDEO,"Background Blueness","","",0.0,255.0,1.0);
	BDiscreteParameter	*pmode = main->MakeDiscreteParameter(P_MODE,B_MEDIA_RAW_VIDEO,"Mode","");
		pmode->AddItem(0,"Horizontal");
		pmode->AddItem(1,"Vertical");
		pmode->AddItem(2,"Both");
		
	TState = 0;
	Mode = 0;
	Red=Green=Blue=0;
	Dx=Dy=50;
	
	fLastStateChange = system_time();

	firstInputBufferHere = false;
	secondInputBufferHere = false;
	buffers = NULL;
	transitionBuffer = NULL;
	/* After this call, the BControllable owns the BParameterWeb object and
	 * will delete it for you */
	SetParameterWeb(web);
	fRoster = BMediaRoster::Roster();
	fRoster->RegisterNode(this);
}
Ejemplo n.º 6
0
BParameterWeb* 
ESDSinkNode::MakeParameterWeb()
{
	CALLED();
	BParameterWeb* web = new BParameterWeb;
	BParameterGroup *group = web->MakeGroup("Server");
	BParameter *p;
	// XXX: use B_MEDIA_UNKNOWN_TYPE or _NO_TYPE ?
	// keep in sync with enum { PARAM_* } !
	p = group->MakeDiscreteParameter(PARAM_ENABLED, B_MEDIA_RAW_AUDIO, "Enable", B_ENABLE);
#if defined(B_BEOS_VERSION_DANO) || defined(__HAIKU__)
	p = group->MakeTextParameter(PARAM_HOST, B_MEDIA_RAW_AUDIO, "Hostname", B_GENERIC, 128);
	p = group->MakeTextParameter(PARAM_PORT, B_MEDIA_RAW_AUDIO, "Port", B_GENERIC, 16);
#endif
	return web;
}
Ejemplo n.º 7
0
void
UVCCamDevice::_AddProcessingParameter(BParameterGroup* group,
	int32 index, const usbvc_processing_unit_descriptor* descriptor)
{
	BParameterGroup* subgroup;
	BContinuousParameter* p;
	uint16 wValue = 0; // Control Selector
	float minValue = 0.0;
	float maxValue = 100.0;
	if (descriptor->controlSize >= 1) {
		if (descriptor->controls[0] & 1) {
			// debug_printf("\tBRIGHTNESS\n");
			fBrightness = _AddParameter(group, &subgroup, index,
				PU_BRIGHTNESS_CONTROL, "Brightness");
		}
		if (descriptor->controls[0] & 2) {
			// debug_printf("\tCONSTRAST\n");
			fContrast = _AddParameter(group, &subgroup, index + 1,
				PU_CONTRAST_CONTROL, "Contrast");
		}
		if (descriptor->controls[0] & 4) {
			// debug_printf("\tHUE\n");
			fHue = _AddParameter(group, &subgroup, index + 2,
				PU_HUE_CONTROL, "Hue");
			if (descriptor->controlSize >= 2) {
				if (descriptor->controls[1] & 8) {
					fHueAuto = _AddAutoParameter(subgroup, index + 3,
						PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL);
				}
			}
		}
		if (descriptor->controls[0] & 8) {
			// debug_printf("\tSATURATION\n");
			fSaturation = _AddParameter(group, &subgroup, index + 4,
				PU_SATURATION_CONTROL, "Saturation");
		}
		if (descriptor->controls[0] & 16) {
			// debug_printf("\tSHARPNESS\n");
			fSharpness = _AddParameter(group, &subgroup, index + 5,
				PU_SHARPNESS_CONTROL, "Sharpness");
		}
		if (descriptor->controls[0] & 32) {
			// debug_printf("\tGamma\n");
			fGamma = _AddParameter(group, &subgroup, index + 6,
				PU_GAMMA_CONTROL, "Gamma");
		}
		if (descriptor->controls[0] & 64) {
			// debug_printf("\tWHITE BALANCE TEMPERATURE\n");
			fWBTemp = _AddParameter(group, &subgroup, index + 7,
				PU_WHITE_BALANCE_TEMPERATURE_CONTROL, "WB Temperature");
			if (descriptor->controlSize >= 2) {
				if (descriptor->controls[1] & 16) {
					fWBTempAuto = _AddAutoParameter(subgroup, index + 8,
						PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL);
				}
			}
		}
		if (descriptor->controls[0] & 128) {
			// debug_printf("\tWhite Balance Component\n");
			fWBComponent = _AddParameter(group, &subgroup, index + 9,
				PU_WHITE_BALANCE_COMPONENT_CONTROL, "WB Component");
			if (descriptor->controlSize >= 2) {
				if (descriptor->controls[1] & 32) {
					fWBTempAuto = _AddAutoParameter(subgroup, index + 10,
						PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL);
				}
			}
		}
	}
	if (descriptor->controlSize >= 2) {
		if (descriptor->controls[1] & 1) {
			// debug_printf("\tBACKLIGHT COMPENSATION\n");
			int16 data;
			wValue = PU_BACKLIGHT_COMPENSATION_CONTROL << 8;
			fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN,
				GET_MAX, wValue, fControlRequestIndex, sizeof(data), &data);
			maxValue = (float)data;
			fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN,
				GET_MIN, wValue, fControlRequestIndex, sizeof(data), &data);
			minValue = (float)data;
			fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN,
				GET_CUR, wValue, fControlRequestIndex, sizeof(data), &data);
			fBacklightCompensation = (float)data;
			subgroup = group->MakeGroup("Backlight Compensation");
			if (maxValue - minValue == 1) { // Binary Switch
				fBinaryBacklightCompensation = true;
				subgroup->MakeDiscreteParameter(index + 11,
					B_MEDIA_RAW_VIDEO, "Backlight Compensation",
					B_ENABLE);
			} else { // Range of values
				fBinaryBacklightCompensation = false;
				p = subgroup->MakeContinuousParameter(index + 11,
				B_MEDIA_RAW_VIDEO, "Backlight Compensation",
				B_GAIN, "", minValue, maxValue, 1.0 / (maxValue - minValue));
			}
		}
		if (descriptor->controls[1] & 2) {
			// debug_printf("\tGAIN\n");
			fGain = _AddParameter(group, &subgroup, index + 12, PU_GAIN_CONTROL,
				"Gain");
		}
		if (descriptor->controls[1] & 4) {
			// debug_printf("\tPOWER LINE FREQUENCY\n");
			wValue = PU_POWER_LINE_FREQUENCY_CONTROL << 8;
			int8 data;
			if (fDevice->ControlTransfer(USB_REQTYPE_CLASS | USB_REQTYPE_INTERFACE_IN,
				GET_CUR, wValue, fControlRequestIndex, sizeof(data), &data) == sizeof(data)) {
				fPowerlineFrequency = data;
			}
			subgroup = group->MakeGroup("Power Line Frequency");
			p = subgroup->MakeContinuousParameter(index + 13,
				B_MEDIA_RAW_VIDEO, "Frequency", B_GAIN, "", 0, 60.0, 1.0 / 60.0);
		}
		// TODO Determine whether controls apply to these
		/*
		if (descriptor->controls[1] & 64)
			debug_printf("\tDigital Multiplier\n");
		if (descriptor->controls[1] & 128)
			debug_printf("\tDigital Multiplier Limit\n");
		*/
	}
	// TODO Determine whether controls apply to these
	/*
	if (descriptor->controlSize >= 3) {
		if (descriptor->controls[2] & 1)
			debug_printf("\tAnalog Video Standard\n");
		if (descriptor->controls[2] & 2)
			debug_printf("\tAnalog Video Lock Status\n");
	}
	*/

}
Ejemplo n.º 8
0
void _AudioAdapterParams::populateGroup(
	BParameterGroup* 				group) {
	
	BParameterGroup* inputGroup = group->MakeGroup("Input Format");
	
	BNullParameter* groupName;
	BDiscreteParameter* param;

	groupName = inputGroup->MakeNullParameter(
		0, B_MEDIA_NO_TYPE, "Input Format", B_GENERIC);

	param = inputGroup->MakeDiscreteParameter(
		P_INPUT_FORMAT,
		B_MEDIA_NO_TYPE,
		"Sample format:",
		B_GENERIC);
	param->AddItem(
		0,
		"*");
	param->AddItem(
		media_multi_audio_format::B_AUDIO_FLOAT,
		"float");
	param->AddItem(
		media_multi_audio_format::B_AUDIO_SHORT,
		"short");
	param->AddItem(
		media_multi_audio_format::B_AUDIO_INT,
		"int32");
	param->AddItem(
		media_multi_audio_format::B_AUDIO_UCHAR,
		"uint8");
	
	param = inputGroup->MakeDiscreteParameter(
		P_INPUT_CHANNEL_COUNT,
		B_MEDIA_NO_TYPE,
		"Channels:",
		B_GENERIC);
	param->AddItem(
		0,
		"*");
	param->AddItem(
		1,
		"mono");
	param->AddItem(
		2,
		"stereo");
	param->AddItem(
		4,
		"4");
	param->AddItem(
		8,
		"8");

	BParameterGroup* outputGroup = group->MakeGroup("Output Format");

	groupName = outputGroup->MakeNullParameter(
		0, B_MEDIA_NO_TYPE, "Output Format", B_GENERIC);

	param = outputGroup->MakeDiscreteParameter(
		P_OUTPUT_FORMAT,
		B_MEDIA_NO_TYPE,
		"Sample format:",
		B_GENERIC);
	param->AddItem(
		0,
		"*");
	param->AddItem(
		media_multi_audio_format::B_AUDIO_FLOAT,
		"float");
	param->AddItem(
		media_multi_audio_format::B_AUDIO_SHORT,
		"short");
	param->AddItem(
		media_multi_audio_format::B_AUDIO_INT,
		"int32");
	param->AddItem(
		media_multi_audio_format::B_AUDIO_UCHAR,
		"uint8");
	
	param = outputGroup->MakeDiscreteParameter(
		P_OUTPUT_CHANNEL_COUNT,
		B_MEDIA_NO_TYPE,
		"Channels:",
		B_GENERIC);
	param->AddItem(
		0,
		"*");
	param->AddItem(
		1,
		"mono");
	param->AddItem(
		2,
		"stereo");
	param->AddItem(
		4,
		"4");
	param->AddItem(
		8,
		"8");
}