Esempio n. 1
0
void
OutputView::MessageReceived(BMessage *message)
{
	switch (message->what) {
		case kCheckBoxAreaSelectionChanged:
			_UpdatePreview(NULL);
			break;	
		
		case kMsgControllerVideoDepthChanged:
			UpdateSettings();
			break;
			
		case kRebuildCodec:
		case kFileTypeChanged:
			fController->SetMediaFormatFamily(FormatFamily());
			UpdateSettings();
			break;
				
		case kFileNameChanged:
			fController->SetOutputFileName(fFileName->Text());
			break;
		
		case kMinimizeOnRecording:
			Settings().SetMinimizeOnRecording(fMinimizeOnStart->Value() == B_CONTROL_ON);
			break;
		
		case kCodecChanged:
		{
			media_codec_info *info;
			ssize_t size;
			if (message->FindData(kCodecData, B_SIMPLE_DATA,
					(const void **)&info, &size) == B_OK)
				fController->SetMediaCodecInfo(*info);
			break;				
		}
		
		case B_OBSERVER_NOTICE_CHANGE:
		{
			int32 code;
			message->FindInt32("be:observe_change_what", &code);
			switch (code) {
				case kSelectionWindowClosed:
				case kMsgControllerTargetFrameChanged:
				case kClipSizeChanged:
					_UpdatePreview(message);
					break;
				default:
					break;
			}
			break;
		}
					
		default:
			BView::MessageReceived(message);
			break;
	}
}
Esempio n. 2
0
// XMLStore
status_t
RenderPreset::XMLStore(XMLHelper& xmlHelper) const
{
	status_t error = B_OK;
	xmlHelper.SetAttribute("name", Name());
	xmlHelper.SetAttribute("preview", fRenderPreview);
	xmlHelper.SetAttribute("use_alpha", fUseAlpha);
	if ((error = xmlHelper.CreateTag("FILE_FORMAT")) == B_OK) {
		xmlHelper.SetAttribute("name", FormatFamily());
		xmlHelper.CloseTag();	// FILE_FORMAT
	}
	if ((error = xmlHelper.CreateTag("VIDEO")) == B_OK) {
		xmlHelper.SetAttribute("on", fHasVideoTrack);
		if ((error = xmlHelper.CreateTag("VIDEO_FORMAT")) == B_OK) {
			xmlHelper.SetAttribute("line_width", fLineWidth);
			xmlHelper.SetAttribute("line_count", fLineCount);
			xmlHelper.SetAttribute("color_space", (int32)fColorSpace);
			xmlHelper.CloseTag();	// VIDEO_FORMAT
		}
		if ((error = xmlHelper.CreateTag("VIDEO_CODEC")) == B_OK) {
			xmlHelper.SetAttribute("name", fVideoCodecName);
			xmlHelper.CloseTag();	// VIDEO_CODEC
		}
		if ((error = xmlHelper.CreateTag("QUALITY")) == B_OK) {
			xmlHelper.SetAttribute("value", fVideoQuality);
			xmlHelper.CloseTag();	// QUALITY
		}
		xmlHelper.CloseTag();	// VIDEO
	}
	if ((error = xmlHelper.CreateTag("AUDIO")) == B_OK) {
		xmlHelper.SetAttribute("on", fHasAudioTrack);
		if ((error = xmlHelper.CreateTag("AUDIO_CODEC")) == B_OK) {
			xmlHelper.SetAttribute("name", fAudioCodecName);
			xmlHelper.SetAttribute("frame_rate", fAudioFrameRate);
			xmlHelper.SetAttribute("channels", fAudioChannelCount);
			xmlHelper.CloseTag();	// AUDIO_CODEC
		}
		xmlHelper.CloseTag();	// AUDIO
	}
	if ((error = xmlHelper.CreateTag("COPYRIGHT")) == B_OK) {
		xmlHelper.SetAttribute("string", fCopyright);
		xmlHelper.CloseTag();	// COPYRIGHT
	}
	if ((error = xmlHelper.CreateTag("TIMECODE")) == B_OK) {
		xmlHelper.SetAttribute("visible", fTimeCodeOverlay);
		xmlHelper.SetAttribute("transparency", fTimeCodeTransparency);
		xmlHelper.SetAttribute("scale", fTimeCodeScale);
		xmlHelper.CloseTag();	// TIMECODE
	}
	// Who cares about errors?
	return B_OK;
}
Esempio n. 3
0
void
OutputView::UpdateSettings()
{
	Settings settings;
	
	if (fWholeScreen->Value() == B_CONTROL_ON)
		settings.SetCaptureArea(BScreen().Frame());
		
	//BRect captureRect = settings.CaptureArea();
	//const float factor = 100;
	
	//  TODO: set the frame
	//settings.SetClipFrame(GetScaledRect(captureRect, factor));
	
	UpdatePreviewFromSettings();
	
	BuildCodecMenu(FormatFamily());
	
	fController->SetMediaFormat(fFormat);
}
Esempio n. 4
0
OutputView::OutputView(Controller *controller)
	:
	BView("Capture Options", B_WILL_DRAW),
	fController(controller)
{
	SetLayout(new BGroupLayout(B_VERTICAL));
	
	BBox *selectBox = new BBox("selection");
	selectBox->SetLabel("Selection");
	selectBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
	AddChild(selectBox);
	
	BBox *outputBox = new BBox("output");
	outputBox->SetLabel("Output");
	outputBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
	AddChild(outputBox);

	Settings settings;
	
	const char *kTCLabel = "File name:"; 
	const char *fileName = NULL;
	settings.GetOutputFileName(&fileName);
	fFileName = new BTextControl("file name",
			kTCLabel, fileName, new BMessage(kFileNameChanged));
	
	const char *kOutputMenuLabel = "Output Format:";
	fOutputFileType = new BOptionPopUp("OutFormat",
			kOutputMenuLabel, new BMessage(kFileTypeChanged));
						
	const char *kCodecMenuLabel = "Codec:";
	BPopUpMenu *popUpMenu = new BPopUpMenu("Codecs");
	fCodecMenu = new BMenuField("OutCodec", kCodecMenuLabel, popUpMenu);
	
	fWholeScreen = new BRadioButton("screen frame", "Whole screen",
		new BMessage(kCheckBoxAreaSelectionChanged));
	fCustomArea = new BRadioButton("custom area",
		"Custom Area", new BMessage(kCheckBoxAreaSelectionChanged));
	fSelectArea = new BButton("select area", "Select", new BMessage(kSelectArea));
	fSelectArea->SetEnabled(false);
	
	fMinimizeOnStart = new BCheckBox("Minimize on start",
		"Minimize on recording", new BMessage(kMinimizeOnRecording));
	
	fRectView = new PreviewView();
	
	BView *layoutView = BLayoutBuilder::Group<>()
		.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
			B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
		.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING)
			.Add(fFileName)
			.Add(fOutputFileType)
			.Add(fCodecMenu)
			.Add(fMinimizeOnStart)
		.End()	
		.View();

	outputBox->AddChild(layoutView);

	layoutView = BLayoutBuilder::Group<>()
		.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
			B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
		.AddGroup(B_VERTICAL)
			.AddGroup(B_HORIZONTAL)
				.AddGroup(B_VERTICAL, 0)
					.Add(fWholeScreen)
					.Add(fCustomArea)
				.End()
				.AddGroup(B_VERTICAL)
					.AddGlue()
					.Add(fSelectArea)
				.End()
			.End()
			.Add(fRectView)
		.End()
		.View();
	
	selectBox->AddChild(layoutView);

	fMinimizeOnStart->SetValue(settings.MinimizeOnRecording() ? B_CONTROL_ON : B_CONTROL_OFF);
	
	// fill in the list of available file formats
	media_file_format mff;
	
	int32 cookie = 0;
	bool firstFound = true;
	while (get_next_file_format(&cookie, &mff) == B_OK) {
		if (mff.capabilities & media_file_format::B_KNOWS_ENCODED_VIDEO) {
			fOutputFileType->AddOption(mff.pretty_name, mff.family);
			if (firstFound) {
				fOutputFileType->MenuField()->Menu()->ItemAt(0)->SetMarked(true);
				firstFound = false;
			}
		}	
	}
	
	fWholeScreen->SetValue(B_CONTROL_ON);
	
	UpdateSettings();
	
	fController->SetCaptureArea(BScreen(Window()).Frame());
	fController->SetMediaFormatFamily(FormatFamily());
	fController->SetOutputFileName(fFileName->Text());
}