StepMotionBlurFilter::StepMotionBlurFilter(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 *pimpact = main->MakeContinuousParameter(P_IMPACT, B_MEDIA_RAW_VIDEO, "Blur latency (%)", "MotionBalance", "", 0.0, 100.0, 1.0);
	BContinuousParameter *pstep = main->MakeContinuousParameter(P_STEP, B_MEDIA_RAW_VIDEO, "Step period (frames)", "MotionBalance", "", 1, 30, 1.0);
	
	impact=50;
	step_period = 5;
	tmp_buffer=NULL;
	count=0;
	fLastImpactChange = system_time();

	/* After this call, the BControllable owns the BParameterWeb object and
	 * will delete it for you */
	SetParameterWeb(web);
	fRoster = BMediaRoster::Roster();
	fRoster->RegisterNode(this);
}
void 
VideoRecorderNode::NodeRegistered()
{
	INFO("VideoRecorderNode::NodeRegistered()\n");
	if (initStatus != B_OK) 
	{
		ReportError(B_NODE_IN_DISTRESS);
		return;
	}
	filterInput.destination.port = ControlPort();
	filterInput.destination.id = 0;
	filterInput.source = media_source::null;
	filterInput.node = Node();
	strcpy(filterInput.name, "VideoRecorderNode Input");	
	filterInput.format.type = B_MEDIA_RAW_VIDEO;
	filterInput.format.u.raw_video = media_raw_video_format::wildcard;
	//**replace with wildcard
	filterInput.format.u.raw_video.display.format=B_RGB32;
	SetParameterWeb(GetParameterWeb());
	Run();
	INFO("ERROR CODES\n");
/*	INFO("\tB_BAD_VALUE=%ld\n",B_BAD_VALUE);
	INFO("\tB_NO_INIT=%ld\n",B_NO_INIT);
	INFO("\tB_MISMATCHED_VALUES=%ld\n",B_MISMATCHED_VALUES);*/
//	INFO("\tB_NO_INIT=%ld\n",B_NO_INIT);	

}
Пример #3
0
OffsetFilter::OffsetFilter(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 *pDELTA_X = main->MakeContinuousParameter(P_DELTA_X, B_MEDIA_RAW_VIDEO, "X Offset", "OffSetBalance", "", 0, 1000.0, 1.0);
	BContinuousParameter *pDELTA_Y = main->MakeContinuousParameter(P_DELTA_Y, B_MEDIA_RAW_VIDEO, "Y Offset", "OffSetBalance", "", 0, 1000.0, 1.0);
	
	DELTA_X=0;
	DELTA_Y=0;
	fLastOffSetChange = system_time();

	/* After this call, the BControllable owns the BParameterWeb object and
	 * will delete it for you */
	SetParameterWeb(web);
	fRoster = BMediaRoster::Roster();
	fRoster->RegisterNode(this);
}
Пример #4
0
void
FireWireDVNode::RefreshParameterWeb()
{
	TRACE("FireWireDVNode::RefreshParameterWeb enter\n");
	fWeb = CreateParameterWeb();
	SetParameterWeb(fWeb);
	TRACE("FireWireDVNode::RefreshParameterWeb finished\n");
}
Пример #5
0
// create and register a parameter web
void AudioFilterNode::initParameterWeb() {
	ASSERT(m_parameterSet);
	
	BParameterWeb* web = new BParameterWeb();
	BString groupName = Name();
	groupName << " Parameters";
	BParameterGroup* group = web->MakeGroup(groupName.String());
	m_parameterSet->populateGroup(group);
	
	SetParameterWeb(web);
}
void AbstractFileInterfaceNode::NodeRegistered(void)
{
	CALLED();
	
	// set up our parameter web
	SetParameterWeb(MakeParameterWeb());
	
	// start the BMediaEventLooper thread
	SetPriority(B_REAL_TIME_PRIORITY);
	Run();
}
Пример #7
0
void ESDSinkNode::NodeRegistered(void)
{
	CALLED();
	
	if (fInitCheckStatus != B_OK) {
		ReportError(B_NODE_IN_DISTRESS);
		return;
	}
	
//	media_input *input = new media_input;

	fInput.format = fPreferredFormat;
	fInput.destination.port = ControlPort();
	fInput.destination.id = 0;
	fInput.node = Node();
	sprintf(fInput.name, "output %ld", fInput.destination.id);
		
	fOutput.format = fPreferredFormat;
	fOutput.destination = media_destination::null;
	fOutput.source.port = ControlPort();
	fOutput.source.id = 0;
	fOutput.node = Node();
	sprintf(fOutput.name, "input %ld", fOutput.source.id);
		
	// Set up our parameter web
	fWeb = MakeParameterWeb();
	SetParameterWeb(fWeb);
	
	/* apply configuration */
#ifdef PRINTING
	bigtime_t start = system_time();
#endif
		
	int32 index = 0;
	int32 parameterID = 0;
	const void *data;
	ssize_t size;
	while(fConfig.FindInt32("parameterID", index, &parameterID) == B_OK) {
		if(fConfig.FindData("parameterData", B_RAW_TYPE, index, &data, &size) == B_OK)
			SetParameterValue(parameterID, TimeSource()->Now(), data, size);
		index++;
	}
	
#ifdef PRINTING
	PRINT(("apply configuration in : %lld\n", system_time() - start));
#endif

	SetPriority(B_REAL_TIME_PRIORITY);
	Run();
}
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);
}
Пример #9
0
// BMediaEventLooper methods
void
ToneProducer::NodeRegistered()
{
	FPRINTF(stderr, "ToneProducer::NodeRegistered\n");

	// output init moved to ctor
	// e.moon [4jun99]

	// Set up our parameter web
	mWeb = make_parameter_web();
	SetParameterWeb(mWeb);

	// Start the BMediaEventLooper thread
	SetPriority(B_REAL_TIME_PRIORITY);
	Run();
}
Пример #10
0
void 
LoggingConsumer::NodeRegistered()
{
	log_message logMsg;
	logMsg.now = TimeSource()->Now();
	mLogger->Log(LOG_REGISTERED, logMsg);

	// publish our parameter web
	mWeb = build_parameter_web();
	SetParameterWeb(mWeb);

	// Set our priority and start the BMediaEventLooper's thread
	SetPriority(mPriority);
	Run();

	// Initialize as much of our input as we can, now that the Media Kit really "knows" about us
	mInput.destination.port = ControlPort();
	mInput.destination.id = 0;
	mInput.node = Node();
	strcpy(mInput.name, "Logged input");
}
Пример #11
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);
}
void 
VideoRecorderNode::SetParameterValue(int32 id, bigtime_t when,
							const void *value, size_t size)
{
//	*last_change = fLastSelectionChange;
	if (id == VIDEO_FORMAT)
	{
		if (size == sizeof(uint32))
		{
			
			videoFormat=*((uint32 *)value);
			media_format_family	mffFamily=(media_format_family)videoFormat;

			INFO("%ld selected\n",videoFormat);
		//	media_format_family	mffFamily=*((media_format_family *)formatList->ItemAt(videoFormat));
			//videoFileFormat=*((media_file_format *)formatList->ItemAt(videoFormat));
		//	INFO("build codec with %s\n",videoFileFormat.pretty_name);
//			BuildCodecMenu(videoFileFormat.family);		
			BuildCodecMenu(mffFamily);		
			SetParameterWeb(web);
//			StartControlPanel(NULL);
		}
		
	}
	else if (id == VIDEO_CODEC)
	{
		if (size == sizeof(int32))
			videoCodec= *((uint32 *)value);
	}
	else if (id = VIDEO_QUALITY)
	{
		if (size == sizeof(float))
		INFO("QUALITY=%lf\n",*((float *)value));
			videoQuality=*((float *)value);
	}
}
Пример #13
0
void
VideoProducer::NodeRegistered()
{
	if (fInitStatus != B_OK) {
		ReportError(B_NODE_IN_DISTRESS);
		return;
	}

	/* Set up the parameter web */

	//TODO: remove and put sensible stuff there
	BParameterWeb *web = new BParameterWeb();
	BParameterGroup *main = web->MakeGroup(Name());
	BParameterGroup *g;

	/*
	g = main->MakeGroup("Color");
	BDiscreteParameter *state = g->MakeDiscreteParameter(
			P_COLOR, B_MEDIA_RAW_VIDEO, "Color", "Color");
	state->AddItem(B_HOST_TO_LENDIAN_INT32(0x00ff0000), "Red");
	state->AddItem(B_HOST_TO_LENDIAN_INT32(0x0000ff00), "Green");
	state->AddItem(B_HOST_TO_LENDIAN_INT32(0x000000ff), "Blue");
	*/

	BParameter *p;
	g = main->MakeGroup("Info");
	p = g->MakeTextParameter(
		P_INFO, B_MEDIA_RAW_VIDEO, "", "Info", 256);

	int32 id = P_LAST;
	if (fCamDevice) {
#ifndef SINGLE_PARAMETER_GROUP
		main = web->MakeGroup("Device");
#endif
		fCamDevice->AddParameters(main, id);
		if (fCamDevice->Sensor()) {
#ifndef SINGLE_PARAMETER_GROUP
			main = web->MakeGroup("Sensor");
#endif
			fCamDevice->Sensor()->AddParameters(main, id);
		}
	}

	fColor = B_HOST_TO_LENDIAN_INT32(0x00ff0000);
	fLastColorChange = system_time();

	/* After this call, the BControllable owns the BParameterWeb object and
	 * will delete it for you */
	SetParameterWeb(web);

	fOutput.node = Node();
	fOutput.source.port = ControlPort();
	fOutput.source.id = 0;
	fOutput.destination = media_destination::null;
	strcpy(fOutput.name, Name());

	/* Tailor these for the output of your device */
	fOutput.format.type = B_MEDIA_RAW_VIDEO;
	fOutput.format.u.raw_video = media_raw_video_format::wildcard;
	fOutput.format.u.raw_video.interlace = 1;
	fOutput.format.u.raw_video.display.format = B_RGB32;
	fOutput.format.u.raw_video.field_rate = FIELD_RATE; // XXX: mmu

	/* Start the BMediaEventLooper control loop running */
	Run();
}
Пример #14
0
// create and register a parameter web
void FlangerNode::initParameterWeb() {
	BParameterWeb* pWeb = new BParameterWeb();
	BParameterGroup* pTopGroup = pWeb->MakeGroup("FlangerNode Parameters");

	BNullParameter* label;
	BContinuousParameter* value;
	BParameterGroup* g;

	// mix ratio
	g = pTopGroup->MakeGroup("Mix ratio");
	label = g->MakeNullParameter(
		P_MIX_RATIO_LABEL,
		B_MEDIA_NO_TYPE,
		"Mix ratio",
		B_GENERIC);

	value = g->MakeContinuousParameter(
		P_MIX_RATIO,
		B_MEDIA_NO_TYPE,
		"",
		B_GAIN, "", 0.0, 1.0, 0.05);
	label->AddOutput(value);
	value->AddInput(label);

	// sweep rate
	g = pTopGroup->MakeGroup("Sweep rate");
	label = g->MakeNullParameter(
		P_SWEEP_RATE_LABEL,
		B_MEDIA_NO_TYPE,
		"Sweep rate",
		B_GENERIC);

	value = g->MakeContinuousParameter(
		P_SWEEP_RATE,
		B_MEDIA_NO_TYPE,
		"",
		B_GAIN, "Hz", 0.01, 10.0, 0.01);
	label->AddOutput(value);
	value->AddInput(label);

	// sweep range: minimum delay
	g = pTopGroup->MakeGroup("Delay");
	label = g->MakeNullParameter(
		P_DELAY_LABEL,
		B_MEDIA_NO_TYPE,
		"Delay",
		B_GENERIC);

	value = g->MakeContinuousParameter(
		P_DELAY,
		B_MEDIA_NO_TYPE,
		"",
		B_GAIN, "ms", 0.1, s_fMaxDelay/2.0, 0.1);
	label->AddOutput(value);
	value->AddInput(label);

	// sweep range: maximum
	g = pTopGroup->MakeGroup("Depth");
	label = g->MakeNullParameter(
		P_DEPTH_LABEL,
		B_MEDIA_NO_TYPE,
		"Depth",
		B_GENERIC);

	value = g->MakeContinuousParameter(
		P_DEPTH,
		B_MEDIA_NO_TYPE,
		"",
		B_GAIN, "ms", 1.0, s_fMaxDelay/4.0, 0.1);
	label->AddOutput(value);
	value->AddInput(label);

	// feedback
	g = pTopGroup->MakeGroup("Feedback");
	label = g->MakeNullParameter(
		P_FEEDBACK_LABEL,
		B_MEDIA_NO_TYPE,
		"Feedback",
		B_GENERIC);

	value = g->MakeContinuousParameter(
		P_FEEDBACK,
		B_MEDIA_NO_TYPE,
		"",
		B_GAIN, "", 0.0, 1.0, 0.01);
	label->AddOutput(value);
	value->AddInput(label);

	// * Install parameter web
	SetParameterWeb(pWeb);
}