From 3050b1b639e9d56221418f59c5d2851876f8bf20 Mon Sep 17 00:00:00 2001 From: bill auger Date: Sep 26 2015 06:07:22 +0000 Subject: refactor GstreamerVideo class to be more self-contained * GstreamerVideos now manage their own visibility and positioning * passed MainWindow instance through to OutputConfig for GstreamerVideos * removed GstreamerVideos instances from GUI builder --- diff --git a/Source/AvCaster.cpp b/Source/AvCaster.cpp index cef6652..2fb4559 100644 --- a/Source/AvCaster.cpp +++ b/Source/AvCaster.cpp @@ -39,7 +39,7 @@ DBG("AvCaster::Shutdown()") ; Alerts.clear() ; - if (!MuxStream->stopThread(2000)) { DBG("AvCaster::Shutdown() forcefully killing all avconv processes") ; system("killall avconv") ; } + if (!MuxStream->stopThread(2000)) { DBG("AvCaster::Shutdown() forcefully killing all avconv processes") ; int retval = system("killall avconv") ; } // App = nullptr ; MuxStream = nullptr ; } @@ -63,6 +63,11 @@ void AvCaster::HandleTimer(int timer_id) } break ; case APP::GUI_TIMER_LO_ID: + +#ifndef DEBUG_NO_INSTANTIATE_MONITORS +if (!MuxStream->isThreadRunning()) AvCaster::StartOutputMonitor() ; +#endif // DEBUG_NO_INSTANTIATE_MONITORS + if (!MuxStream->isThreadRunning()) MuxStream->startThread() ; break ; } @@ -116,14 +121,11 @@ void AvStream::run() sanitizeParams() ; - -AvCaster::StartOutputMonitor() ; #ifdef NO_STREAM_OUT while (!threadShouldExit()) sleep(APP::MUX_THREAD_SLEEP) ; return ; #endif // NO_STREAM_OUT DBG("AvStream::run() cmd='" + buildAvconvMuxCommand() + "'") ; - // start avconv process and restart if it dies unexpectedly while (!threadShouldExit()) { diff --git a/Source/Constants.h b/Source/Constants.h index 03c8edd..16ae9ab 100644 --- a/Source/Constants.h +++ b/Source/Constants.h @@ -71,16 +71,15 @@ namespace GUI static const int CONTENT_H = 720 - BORDERS_W - TITLEBAR_H ; // OutputConfig - static const String OUTPUT_GUI_ID = "output-config-gui" ; -// static const int MONITORS_W = 160 ; // unused -// static const int MONITORS_H = 120 ; // unused - static const int MONITORS_Y = 504 ; - static const int SCREENCAP_MONITOR_X = 40 ; - static const int CAMERA_MONITOR_X = 224 ; - static const int OUTPUT_MONITOR_X = 408 ; - static const Point* SCREENCAP_MONITOR_POS = new Point(GUI::SCREENCAP_MONITOR_X , GUI::MONITORS_Y) ; - static const Point* CAMERA_MONITOR_POS = new Point(GUI::CAMERA_MONITOR_X , GUI::MONITORS_Y) ; - static const Point* OUTPUT_MONITOR_POS = new Point(GUI::OUTPUT_MONITOR_X , GUI::MONITORS_Y) ; + static const String OUTPUT_GUI_ID = "output-config-gui" ; +// static const int MONITORS_W = 160 ; // unused +// static const int MONITORS_H = 120 ; // unused + static const int MONITOR_W = 160 ; + static const int MONITOR_H = 120 ; + static const int MONITORS_Y = 504 ; + static const int SCREENCAP_MONITOR_X = 40 ; + static const int CAMERA_MONITOR_X = 224 ; + static const int OUTPUT_MONITOR_X = 408 ; // StatusBar static const String STATUS_GUI_ID = "statusbar-gui" ; diff --git a/Source/GstreamerVideo.cpp b/Source/GstreamerVideo.cpp index 33f501d..f437c27 100644 --- a/Source/GstreamerVideo.cpp +++ b/Source/GstreamerVideo.cpp @@ -1,62 +1,94 @@ -/* - ============================================================================== - - GstreamerVideo.cpp - Created: 19 Sep 2015 4:30:31am - Author: bill-auger - - ============================================================================== -*/ - -#include - -#include "AvCaster.h" -#include "GstreamerVideo.h" - - -GstreamerVideo::GstreamerVideo() -{ - //GstBus *bus; - // initialize gStreamer - int argc = 0 ; char** argv = {0} ; gst_init(&argc , &argv) ; - this->gstElement = gst_element_factory_make("playbin2" , "playbin2") ; - if (!this->gstElement) - { - AvCaster::Error(GUI::GST_INIT_ERROR_MSG) ; - throw (new GstreamerInitException()) ; - } - -// setBufferedToImage(true) ; - setOpaque(true) ; - setAlwaysOnTop(true) ; -} - -GstreamerVideo::~GstreamerVideo() -{ - gst_element_set_state(this->gstElement , GST_STATE_NULL) ; - gst_object_unref(this->gstElement) ; -} - -void GstreamerVideo::paint(Graphics& g) { } - -void GstreamerVideo::resized() { } - -bool GstreamerVideo::start(String uri) -{ - if (!isOnDesktop()) attachNativeWindow() ; - if (uri.isEmpty()) return false ; - - // attach media and begin rolling - g_object_set(this->gstElement , "uri" , uri.toStdString().c_str() , NULL) ; - if (gst_element_set_state(this->gstElement , GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) - { AvCaster::Error(GUI::GST_STATE_ERROR_MSG) ; return false ; } - - return true ; -} - -bool GstreamerVideo::attachNativeWindow() -{ - addToDesktop(0) ; // ComponentPeer::windowRepaintedExplictly - guintptr window_handle = (guintptr)(getWindowHandle()) ; - gst_x_overlay_set_window_handle(GST_X_OVERLAY(this->gstElement) , window_handle) ; -} +/* + ============================================================================== + + GstreamerVideo.cpp + Created: 19 Sep 2015 4:30:31am + Author: bill-auger + + ============================================================================== +*/ + +#include + +#include "Trace/Trace.h" +#include "AvCaster.h" +#include "GstreamerVideo.h" + + +GstreamerVideo::GstreamerVideo(Component* follow_window , int local_x , int local_y) +{ + //GstBus *bus; + // initialize gStreamer + int argc = 0 ; char** argv = {0} ; gst_init(&argc , &argv) ; + this->gstElement = gst_element_factory_make("playbin2" , "playbin2") ; + if (!this->gstElement) + { + AvCaster::Error(GUI::GST_INIT_ERROR_MSG) ; throw (new GstreamerInitException()) ; + } + + // initialize GUI + this->followWindow = follow_window ; + this->localPosition = new Point(local_x , local_y + GUI::TITLEBAR_H) ; +// setBufferedToImage(true) ; + setSize(GUI::MONITOR_W , GUI::MONITOR_H) ; + setOpaque(true) ; + setAlwaysOnTop(true) ; + +// DBG("GstreamerVideo::GstreamerVideo() this->outputMonitor->getBounds()=" + getBounds().toString()) ; +// DBG("GstreamerVideo::GstreamerVideo() this->local_position=" + String(local_x) + "x" + String(local_y)) ; +// DBG("GstreamerVideo::GstreamerVideo() this->localPosition=" + this->localPosition->toString()) ; +} + +GstreamerVideo::~GstreamerVideo() +{ + gst_element_set_state(this->gstElement , GST_STATE_NULL) ; + gst_object_unref( this->gstElement) ; +} + +void GstreamerVideo::paint(Graphics& g) { } + +void GstreamerVideo::resized() { } + +void GstreamerVideo::componentMovedOrResized(Component& a_component , bool wasMoved , + bool wasResized) +{ + setPosition() ; +} + +void GstreamerVideo::setPosition() +{ +// DBG("this->localPosition=" + this->localPosition->toString()) ; +// DBG("localPointToGlobal=" + followWindow->localPointToGlobal(*this->localPosition).toString()) ; + + this->setTopLeftPosition(followWindow->localPointToGlobal(*this->localPosition)) ; +} + +bool GstreamerVideo::start(String uri) +{ +// DEBUG_DUMP_WINDOW_HANDLES + + if (!isOnDesktop()) attachNativeWindow() ; + if (uri.isEmpty()) return false ; + +DBG("GstreamerVideo::start() launching sample") ; + + setPosition() ; setVisible(true) ; + + // attach media and begin rolling + g_object_set(this->gstElement , "uri" , uri.toStdString().c_str() , NULL) ; + if (gst_element_set_state(this->gstElement , GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) + { AvCaster::Error(GUI::GST_STATE_ERROR_MSG) ; return false ; } + + return true ; +} + +bool GstreamerVideo::attachNativeWindow() +{ + // subscribe to follow window position events + this->followWindow->addComponentListener(this) ; + + // detach from main window and pass our handle to gStreamer + addToDesktop(0) ; // ComponentPeer::windowRepaintedExplictly + guintptr window_handle = (guintptr)(getWindowHandle()) ; + gst_x_overlay_set_window_handle(GST_X_OVERLAY(this->gstElement) , window_handle) ; +} diff --git a/Source/GstreamerVideo.h b/Source/GstreamerVideo.h index 8bc518c..43f2f44 100644 --- a/Source/GstreamerVideo.h +++ b/Source/GstreamerVideo.h @@ -1,51 +1,68 @@ -/* - ============================================================================== - - GstreamerVideo.h - Created: 19 Sep 2015 4:30:31am - Author: bill-auger - - ============================================================================== -*/ - -#ifndef GSTREAMERVIDEO_H_INCLUDED -#define GSTREAMERVIDEO_H_INCLUDED - -#include -#include - -#include "Constants.h" -#include "JuceHeader.h" - - -class GstreamerInitException : public std::exception -{ - virtual const char* what() const throw() { return APP::GSTREAMER_INIT_EXCEPTION_MSG ; } -} ; - - -/** -This is a custom JUCE component that hosts a gStreamer video output. -*/ -class GstreamerVideo : public Component -{ -public: - - GstreamerVideo() ; - ~GstreamerVideo() ; - - void paint(Graphics&) ; - void resized() ; - bool start(String uri) ; - bool attachNativeWindow() ; - - -private: - - GstElement* gstElement ; - - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GstreamerVideo) -} ; - -#endif // GSTREAMERVIDEO_H_INCLUDED +/* + ============================================================================== + + GstreamerVideo.h + Created: 19 Sep 2015 4:30:31am + Author: bill-auger + + ============================================================================== +*/ + +#ifndef GSTREAMERVIDEO_H_INCLUDED +#define GSTREAMERVIDEO_H_INCLUDED + +#include +#include + +#include "Constants.h" +#include "JuceHeader.h" + + +class GstreamerInitException : public std::exception +{ + virtual const char* what() const throw() { return APP::GSTREAMER_INIT_EXCEPTION_MSG ; } +} ; + + +/** +This is a custom JUCE component that hosts a gStreamer video output. + +To use this class simply instantiate one, passing in a reference Component* +and the relative X and Y positions for this component. + +The GstreamerVideo component will add itself as a top-level window on the desktop +and will attempt to keep itself positioned at the specified coordinates +'within' the supplied reference component when its position changes +via a ComponentListener registered on the reference component. + + @param follow_window a reference Component* for this GstreamerVideo position + @param local_x X position relative to the reference component + @param local_y Y position relative to the reference component +*/ +class GstreamerVideo : public Component , ComponentListener +{ +public: + + GstreamerVideo(Component* follow_window , int local_x , int local_y) ; + ~GstreamerVideo() ; + + void paint(Graphics&) ; + void resized() ; + void componentMovedOrResized(Component& a_component , bool wasMoved , bool wasResized) ; + + inline void setPosition() ; + bool start(String uri) ; + bool attachNativeWindow() ; + + +private: + + Point* localPosition ; + Component* followWindow ; + GstElement* gstElement ; + + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GstreamerVideo) +} ; + +#endif // GSTREAMERVIDEO_H_INCLUDED diff --git a/Source/Main.cpp b/Source/Main.cpp index adbe2a0..6137642 100644 --- a/Source/Main.cpp +++ b/Source/Main.cpp @@ -1,121 +1,118 @@ -/* - ============================================================================== - - This file was auto-generated by the Introjucer! - - It contains the basic startup code for a Juce application. - - ============================================================================== -*/ - -#include "AvCaster.h" -#include "./Trace/TraceMain.h" - - -//============================================================================== -class AvCasterApplication : public JUCEApplication , public MultiTimer -{ -public: - - AvCasterApplication() {} - - void initialise(const String& command_line) override - { - this->mainWindow = new MainWindow(this) ; - MainContent* main_content = (MainContent*)this->mainWindow->mainContent ; - - if (AvCaster::Initialize(main_content , command_line)) -// if (AvCaster::Initialize(this , main_content , command_line)) - { - // start GUI update timers - startTimer(APP::GUI_TIMER_HI_ID , APP::GUI_UPDATE_HI_IVL) ; - startTimer(APP::GUI_TIMER_MED_ID , APP::GUI_UPDATE_MED_IVL) ; - startTimer(APP::GUI_TIMER_LO_ID , APP::GUI_UPDATE_LO_IVL) ; - } - else quit() ; - } - - void anotherInstanceStarted (const String& commandLine) override - { - // When another instance of the app is launched while this one is running, - // this method is invoked, and the commandLine parameter tells you what - // the other instance's command-line arguments were. - } - - void shutdown() override - { -DEBUG_TRACE_SHUTDOWN_IN - - AvCaster::Shutdown() ; - - this->mainWindow = nullptr ; - -DEBUG_TRACE_SHUTDOWN_OUT - } - - void systemRequestedQuit() override { this->quit() ; } - const String getApplicationName() override { return ProjectInfo::projectName ; } - const String getApplicationVersion() override { return ProjectInfo::versionString ; } - bool moreThanOneInstanceAllowed() override { return false ; } - - - //============================================================================== - /* - This class implements the desktop window that contains an instance of - our MainContent class. - */ - class MainWindow : public DocumentWindow - { - friend class AvCasterApplication ; - - - public: - - MainWindow(AvCasterApplication* app) : DocumentWindow(APP::APP_NAME , - Colour(0xff202020) , - DocumentWindow::allButtons) - { - this->app = app ; - - // main content - this->mainContent = new MainContent(this) ; - this->mainContent->setComponentID(GUI::CONTENT_GUI_ID) ; - setContentOwned(this->mainContent , true) ; - - // this main desktop window -#ifdef _MAC - setTitleBarButtonsRequired(DocumentWindow::allButtons , true) ; -#endif // _MAC - setTitleBarHeight(GUI::TITLEBAR_H) ; -// setIcon(const Image &imageToUse) ; - centreWithSize(getWidth() , getHeight()) ; - setVisible(true) ; - } - - ~MainWindow() { this->mainContent = nullptr ; } - - void closeButtonPressed() override { this->app->systemRequestedQuit() ; } - - // TODO: docs say we should call the superclass implementation here - but does not seem necessary - void moved() override { this->mainContent->mainWindowMoved() ; } - - - private: - - AvCasterApplication* app ; - ScopedPointer mainContent ; - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MainWindow) - } ; - - -private: - - void timerCallback(int timer_id) override { AvCaster::HandleTimer(timer_id) ; } - - ScopedPointer mainWindow ; -} ; - -//============================================================================== -// This macro generates the main() routine that launches the app. -START_JUCE_APPLICATION(AvCasterApplication) +/* + ============================================================================== + + This file was auto-generated by the Introjucer! + + It contains the basic startup code for a Juce application. + + ============================================================================== +*/ + +#include "AvCaster.h" +#include "./Trace/TraceMain.h" + + +//============================================================================== +class AvCasterApplication : public JUCEApplication , public MultiTimer +{ +public: + + AvCasterApplication() {} + + void initialise(const String& command_line) override + { + this->mainWindow = new MainWindow(this) ; + MainContent* main_content = (MainContent*)this->mainWindow->mainContent ; + + if (AvCaster::Initialize(main_content , command_line)) +// if (AvCaster::Initialize(this , main_content , command_line)) + { + // start GUI update timers + startTimer(APP::GUI_TIMER_HI_ID , APP::GUI_UPDATE_HI_IVL) ; + startTimer(APP::GUI_TIMER_MED_ID , APP::GUI_UPDATE_MED_IVL) ; + startTimer(APP::GUI_TIMER_LO_ID , APP::GUI_UPDATE_LO_IVL) ; + } + else quit() ; + } + + void anotherInstanceStarted (const String& commandLine) override + { + // When another instance of the app is launched while this one is running, + // this method is invoked, and the commandLine parameter tells you what + // the other instance's command-line arguments were. + } + + void shutdown() override + { +DEBUG_TRACE_SHUTDOWN_IN + + AvCaster::Shutdown() ; + + this->mainWindow = nullptr ; + +DEBUG_TRACE_SHUTDOWN_OUT + } + + void systemRequestedQuit() override { this->quit() ; } + const String getApplicationName() override { return ProjectInfo::projectName ; } + const String getApplicationVersion() override { return ProjectInfo::versionString ; } + bool moreThanOneInstanceAllowed() override { return false ; } + + + //============================================================================== + /* + This class implements the desktop window that contains an instance of + our MainContent class. + */ + class MainWindow : public DocumentWindow + { + friend class AvCasterApplication ; + + + public: + + MainWindow(AvCasterApplication* app) : DocumentWindow(APP::APP_NAME , + Colour(0xff202020) , + DocumentWindow::allButtons) + { + this->app = app ; + + // main content + this->mainContent = new MainContent(this) ; + this->mainContent->setComponentID(GUI::CONTENT_GUI_ID) ; + setContentOwned(this->mainContent , true) ; + + // this main desktop window +#ifdef _MAC + setTitleBarButtonsRequired(DocumentWindow::allButtons , true) ; +#endif // _MAC + setTitleBarHeight(GUI::TITLEBAR_H) ; +// setIcon(const Image &imageToUse) ; + centreWithSize(getWidth() , getHeight()) ; + setVisible(true) ; + } + + ~MainWindow() { this->mainContent = nullptr ; } + + void closeButtonPressed() override { this->app->systemRequestedQuit() ; } + + + private: + + AvCasterApplication* app ; + ScopedPointer mainContent ; + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MainWindow) + } ; + + +private: + + void timerCallback(int timer_id) override { AvCaster::HandleTimer(timer_id) ; } + + ScopedPointer mainWindow ; +} ; + +//============================================================================== +// This macro generates the main() routine that launches the app. +START_JUCE_APPLICATION(AvCasterApplication) diff --git a/Source/MainContent.cpp b/Source/MainContent.cpp index 6538a6e..974efe6 100644 --- a/Source/MainContent.cpp +++ b/Source/MainContent.cpp @@ -1,121 +1,94 @@ - -#include "AvCaster.h" -#include "MainContent.h" -#include "Trace/Trace.h" - - -MainContent::MainContent(DocumentWindow* main_window) -{ - // MainWindow - this->mainWindow = main_window ; - - // MainContent - setName("MainContent") ; - setSize(GUI::CONTENT_W , GUI::CONTENT_H) ; - - // output configuration - this->outputConfig = new OutputConfig() ; - this->addChildAndSetID(this->outputConfig , GUI::OUTPUT_GUI_ID) ; - - // statusbar - this->statusbar = new Statusbar() ; - this->addChildAndSetID(this->statusbar , GUI::STATUS_GUI_ID) ; - this->statusbar->setAlwaysOnTop(true) ; - this->statusbar->setStatusL(GUI::INIT_STATUS_TEXT) ; -} - -MainContent::~MainContent() -{ - this->outputConfig = nullptr ; - this->statusbar = nullptr ; -} - -void MainContent::paint(Graphics& g) -{ - g.fillAll (Colour (0xff202020)); - g.setFont (Font (16.0f)); - g.setColour (Colours::black); -} - -void MainContent::resized() -{ - if (this->statusbar == nullptr) return ; - - int window_w = getWidth() ; - int window_h = getHeight() ; - - // content - int content_w = window_w - GUI::PAD2 ; - int content_h = window_h - GUI::STATUSBAR_H - GUI::PAD3 ; - - // output config - int output_x = GUI::PAD ; - int output_y = GUI::PAD ; - int output_w = content_w ; - int output_h = content_h ; - - // statusbar - int status_x = GUI::PAD ; - int status_y = window_h - GUI::STATUSBAR_H - GUI::PAD ; - int status_w = content_w ; - int status_h = GUI::STATUSBAR_H ; - - this->outputConfig->setBounds(output_x , output_y , output_w , output_h) ; - this->statusbar ->setBounds(status_x , status_y , status_w , status_h) ; -} - -void MainContent::startMonitors() -{ -String SampleVideo = "http://docs.gstreamer.com/media/sintel_trailer-480p.webm" ; - this->outputConfig->screencapMonitor->start(String::empty) ; // TODO: - this->outputConfig->cameratMonitor ->start(String::empty) ; // TODO: - this->outputConfig->outputMonitor ->start(SampleVideo) ; -} - -void MainContent::mainWindowMoved() -{ -// (see also ComponentListener::componentMovedOrResized()) - - bool are_detached = this->outputConfig->screencapMonitor->isOnDesktop() && - this->outputConfig->cameratMonitor ->isOnDesktop() && - this->outputConfig->outputMonitor ->isOnDesktop() ; - - Point screencap_pos = (are_detached) ? localPointToGlobal(*GUI::SCREENCAP_MONITOR_POS) : - *GUI::SCREENCAP_MONITOR_POS ; - Point camera_pos = (are_detached) ? localPointToGlobal(*GUI::CAMERA_MONITOR_POS ) : - *GUI::CAMERA_MONITOR_POS ; - Point output_pos = (are_detached) ? localPointToGlobal(*GUI::OUTPUT_MONITOR_POS ) : - *GUI::OUTPUT_MONITOR_POS ; - -// DBG("SCREENCAP_MONITOR_POS=" + GUI::SCREENCAP_MONITOR_POS->toString()) ; -// DBG("screencap_pos=" + screencap_pos.toString()) ; -// DBG("CAMERA_MONITOR_POS=" + GUI::CAMERA_MONITOR_POS->toString()) ; -// DBG("camera_pos=" + camera_pos.toString()) ; -// DBG("OUTPUT_MONITOR_POS=" + GUI::OUTPUT_MONITOR_POS->toString()) ; -// DBG("output_pos=" + output_pos.toString()) ; - - this->outputConfig->screencapMonitor->setTopLeftPosition(screencap_pos) ; - this->outputConfig->cameratMonitor ->setTopLeftPosition(camera_pos ) ; - this->outputConfig->outputMonitor ->setTopLeftPosition(output_pos ) ; -} - -void MainContent::setTitle(String title_text) -{ - this->mainWindow->setName(APP::APP_NAME + " - " + title_text) ; -} - -void MainContent::warning(String message_text) -{ - Trace::TraceWarning(message_text) ; - AlertWindow::showMessageBoxAsync(AlertWindow::InfoIcon , GUI::MODAL_WARNING_TITLE , - message_text , String::empty , - nullptr , AvCaster::GetModalCb() ) ; -} - -void MainContent::error(String message_text) -{ - Trace::TraceError(message_text) ; - AlertWindow::showMessageBoxAsync(AlertWindow::WarningIcon , GUI::MODAL_ERROR_TITLE , - message_text , String::empty , - nullptr , AvCaster::GetModalCb() ) ; -} + +#include "AvCaster.h" +#include "MainContent.h" +#include "Trace/Trace.h" + + +MainContent::MainContent(DocumentWindow* main_window) +{ + // MainWindow + this->mainWindow = main_window ; + + // MainContent + setName("MainContent") ; + setSize(GUI::CONTENT_W , GUI::CONTENT_H) ; + + // configuration + this->outputConfig = new OutputConfig(main_window) ; + this->addChildAndSetID(this->outputConfig , GUI::OUTPUT_GUI_ID) ; + + // statusbar + this->statusbar = new Statusbar() ; + this->addChildAndSetID(this->statusbar , GUI::STATUS_GUI_ID) ; + this->statusbar->setAlwaysOnTop(true) ; + this->statusbar->setStatusL(GUI::INIT_STATUS_TEXT) ; +} + +MainContent::~MainContent() +{ + this->outputConfig = nullptr ; + this->statusbar = nullptr ; +} + +void MainContent::paint(Graphics& g) +{ + g.fillAll (Colour (0xff202020)); + g.setFont (Font (16.0f)); + g.setColour (Colours::black); +} + +void MainContent::resized() +{ + if (this->statusbar == nullptr) return ; + + int window_w = getWidth() ; + int window_h = getHeight() ; + + // content + int content_w = window_w - GUI::PAD2 ; + int content_h = window_h - GUI::STATUSBAR_H - GUI::PAD3 ; + + // output config + int output_x = GUI::PAD ; + int output_y = GUI::PAD ; + int output_w = content_w ; + int output_h = content_h ; + + // statusbar + int status_x = GUI::PAD ; + int status_y = window_h - GUI::STATUSBAR_H - GUI::PAD ; + int status_w = content_w ; + int status_h = GUI::STATUSBAR_H ; + + this->outputConfig->setBounds(output_x , output_y , output_w , output_h) ; + this->statusbar ->setBounds(status_x , status_y , status_w , status_h) ; +} + +void MainContent::startMonitors() +{ +String SampleVideo = "http://docs.gstreamer.com/media/sintel_trailer-480p.webm" ; + this->outputConfig->screencapMonitor->start(String::empty) ; // TODO: + this->outputConfig->cameratMonitor ->start(String::empty) ; // TODO: + this->outputConfig->outputMonitor ->start(SampleVideo) ; +} + +void MainContent::setTitle(String title_text) +{ + this->mainWindow->setName(APP::APP_NAME + " - " + title_text) ; +} + +void MainContent::warning(String message_text) +{ + Trace::TraceWarning(message_text) ; + AlertWindow::showMessageBoxAsync(AlertWindow::InfoIcon , GUI::MODAL_WARNING_TITLE , + message_text , String::empty , + nullptr , AvCaster::GetModalCb() ) ; +} + +void MainContent::error(String message_text) +{ + Trace::TraceError(message_text) ; + AlertWindow::showMessageBoxAsync(AlertWindow::WarningIcon , GUI::MODAL_ERROR_TITLE , + message_text , String::empty , + nullptr , AvCaster::GetModalCb() ) ; +} diff --git a/Source/MainContent.h b/Source/MainContent.h index a453187..8fefcf7 100644 --- a/Source/MainContent.h +++ b/Source/MainContent.h @@ -1,47 +1,45 @@ -/* - ============================================================================== - - This file was auto-generated! - - ============================================================================== -*/ - -#ifndef MAINCONTENT_H_INCLUDED -#define MAINCONTENT_H_INCLUDED - -#include "OutputConfig.h" -#include "Statusbar.h" - - -/** this is the main GUI container class */ -class MainContent : public Component -{ - friend class AvCasterApplication ; - friend class AvCaster ; - - -public: - - MainContent(DocumentWindow* main_window) ; - ~MainContent(); - - void paint(Graphics&) ; - void resized() ; - void startMonitors() ; - void mainWindowMoved() ; - - -private: - - DocumentWindow* mainWindow ; - ScopedPointer outputConfig ; - ScopedPointer statusbar ; - - void setTitle(String title_text) ; - void warning( String message_text) ; - void error( String message_text) ; - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MainContent) -} ; - -#endif // MAINCONTENT_H_INCLUDED +/* + ============================================================================== + + This file was auto-generated! + + ============================================================================== +*/ + +#ifndef MAINCONTENT_H_INCLUDED +#define MAINCONTENT_H_INCLUDED + +#include "OutputConfig.h" +#include "Statusbar.h" + + +/** this is the main GUI container class */ +class MainContent : public Component +{ + friend class AvCaster ; + + +public: + + MainContent(DocumentWindow* main_window) ; + ~MainContent(); + + void paint(Graphics&) ; + void resized() ; + void startMonitors() ; + + +private: + + DocumentWindow* mainWindow ; + ScopedPointer outputConfig ; + ScopedPointer statusbar ; + + void setTitle(String title_text) ; + void warning( String message_text) ; + void error( String message_text) ; + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MainContent) +} ; + +#endif // MAINCONTENT_H_INCLUDED diff --git a/Source/OutputConfig.cpp b/Source/OutputConfig.cpp index 4a81225..875f201 100644 --- a/Source/OutputConfig.cpp +++ b/Source/OutputConfig.cpp @@ -1,861 +1,847 @@ -/* - ============================================================================== - - This is an automatically generated GUI class created by the Introjucer! - - Be careful when adding custom code to these files, as only the code within - the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded - and re-saved. - - Created with Introjucer version: 3.2.0 - - ------------------------------------------------------------------------------ - - The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions" - Copyright (c) 2015 - ROLI Ltd. - - ============================================================================== -*/ - -//[Headers] You can add your own extra header files here... - -#include "Constants.h" - -//[/Headers] - -#include "OutputConfig.h" - - -//[MiscUserDefs] You can add your own user definitions and misc code here... -//[/MiscUserDefs] - -//============================================================================== -OutputConfig::OutputConfig () -{ - //[Constructor_pre] You can add your own custom stuff here.. - //[/Constructor_pre] - - addAndMakeVisible (screenGroup = new GroupComponent ("screenGroup", - TRANS("Screen"))); - screenGroup->setColour (GroupComponent::outlineColourId, Colours::white); - screenGroup->setColour (GroupComponent::textColourId, Colours::white); - - addAndMakeVisible (displayLabel = new Label ("displayLabel", - TRANS("Display #:"))); - displayLabel->setFont (Font (15.00f, Font::plain)); - displayLabel->setJustificationType (Justification::centredLeft); - displayLabel->setEditable (false, false, false); - displayLabel->setColour (Label::textColourId, Colours::white); - displayLabel->setColour (TextEditor::textColourId, Colours::black); - displayLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (displaySlider = new Slider ("displaySlider")); - displaySlider->setExplicitFocusOrder (1); - displaySlider->setRange (0, 10, 0); - displaySlider->setSliderStyle (Slider::IncDecButtons); - displaySlider->setTextBoxStyle (Slider::TextBoxLeft, false, 24, 20); - displaySlider->addListener (this); - - addAndMakeVisible (screenLabel = new Label ("screenLabel", - TRANS("Screen #:"))); - screenLabel->setFont (Font (15.00f, Font::plain)); - screenLabel->setJustificationType (Justification::centredLeft); - screenLabel->setEditable (false, false, false); - screenLabel->setColour (Label::textColourId, Colours::white); - screenLabel->setColour (TextEditor::textColourId, Colours::black); - screenLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (screenSlider = new Slider ("screenSlider")); - screenSlider->setExplicitFocusOrder (2); - screenSlider->setRange (0, 10, 0); - screenSlider->setSliderStyle (Slider::IncDecButtons); - screenSlider->setTextBoxStyle (Slider::TextBoxLeft, false, 24, 20); - screenSlider->addListener (this); - - addAndMakeVisible (screenWidthLabel = new Label ("screenWidthLabel", - TRANS("Width:"))); - screenWidthLabel->setFont (Font (15.00f, Font::plain)); - screenWidthLabel->setJustificationType (Justification::centredLeft); - screenWidthLabel->setEditable (false, false, false); - screenWidthLabel->setColour (Label::textColourId, Colours::white); - screenWidthLabel->setColour (TextEditor::textColourId, Colours::black); - screenWidthLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (screenWidthText = new TextEditor ("screenWidthText")); - screenWidthText->setExplicitFocusOrder (3); - screenWidthText->setMultiLine (false); - screenWidthText->setReturnKeyStartsNewLine (false); - screenWidthText->setReadOnly (false); - screenWidthText->setScrollbarsShown (false); - screenWidthText->setCaretVisible (true); - screenWidthText->setPopupMenuEnabled (true); - screenWidthText->setText (String::empty); - - addAndMakeVisible (screenHeightLabel = new Label ("screenHeightLabel", - TRANS("Height:"))); - screenHeightLabel->setFont (Font (15.00f, Font::plain)); - screenHeightLabel->setJustificationType (Justification::centredLeft); - screenHeightLabel->setEditable (false, false, false); - screenHeightLabel->setColour (Label::textColourId, Colours::white); - screenHeightLabel->setColour (TextEditor::textColourId, Colours::black); - screenHeightLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (screenHeightText = new TextEditor ("screenHeightText")); - screenHeightText->setExplicitFocusOrder (4); - screenHeightText->setMultiLine (false); - screenHeightText->setReturnKeyStartsNewLine (false); - screenHeightText->setReadOnly (false); - screenHeightText->setScrollbarsShown (false); - screenHeightText->setCaretVisible (true); - screenHeightText->setPopupMenuEnabled (true); - screenHeightText->setText (String::empty); - - addAndMakeVisible (xOffsetLabel = new Label ("xOffsetLabel", - TRANS("Offset X:"))); - xOffsetLabel->setFont (Font (15.00f, Font::plain)); - xOffsetLabel->setJustificationType (Justification::centredLeft); - xOffsetLabel->setEditable (false, false, false); - xOffsetLabel->setColour (Label::textColourId, Colours::white); - xOffsetLabel->setColour (TextEditor::textColourId, Colours::black); - xOffsetLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (xOffsetText = new TextEditor ("xOffsetText")); - xOffsetText->setExplicitFocusOrder (5); - xOffsetText->setMultiLine (false); - xOffsetText->setReturnKeyStartsNewLine (false); - xOffsetText->setReadOnly (false); - xOffsetText->setScrollbarsShown (true); - xOffsetText->setCaretVisible (true); - xOffsetText->setPopupMenuEnabled (true); - xOffsetText->setText (String::empty); - - addAndMakeVisible (yOffsetLabel = new Label ("yOffsetLabel", - TRANS("Offset Y:"))); - yOffsetLabel->setFont (Font (15.00f, Font::plain)); - yOffsetLabel->setJustificationType (Justification::centredLeft); - yOffsetLabel->setEditable (false, false, false); - yOffsetLabel->setColour (Label::textColourId, Colours::white); - yOffsetLabel->setColour (TextEditor::textColourId, Colours::black); - yOffsetLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (yOffsetText = new TextEditor ("yOffsetText")); - yOffsetText->setExplicitFocusOrder (6); - yOffsetText->setMultiLine (false); - yOffsetText->setReturnKeyStartsNewLine (false); - yOffsetText->setReadOnly (false); - yOffsetText->setScrollbarsShown (true); - yOffsetText->setCaretVisible (true); - yOffsetText->setPopupMenuEnabled (true); - yOffsetText->setText (String::empty); - - addAndMakeVisible (cameraGroup = new GroupComponent ("cameraGroup", - TRANS("Camera"))); - cameraGroup->setColour (GroupComponent::outlineColourId, Colours::white); - cameraGroup->setColour (GroupComponent::textColourId, Colours::white); - - addAndMakeVisible (cameraDevLabel = new Label ("cameraDevLabel", - TRANS("Device:"))); - cameraDevLabel->setFont (Font (15.00f, Font::plain)); - cameraDevLabel->setJustificationType (Justification::centredLeft); - cameraDevLabel->setEditable (false, false, false); - cameraDevLabel->setColour (Label::textColourId, Colours::white); - cameraDevLabel->setColour (TextEditor::textColourId, Colours::black); - cameraDevLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (cameraDevCombo = new ComboBox ("cameraDevCombo")); - cameraDevCombo->setExplicitFocusOrder (7); - cameraDevCombo->setEditableText (false); - cameraDevCombo->setJustificationType (Justification::centredLeft); - cameraDevCombo->setTextWhenNothingSelected (TRANS("(no devices)")); - cameraDevCombo->setTextWhenNoChoicesAvailable (TRANS("(no devices)")); - cameraDevCombo->addListener (this); - - addAndMakeVisible (cameraResLabel = new Label ("cameraResLabel", - TRANS("Resolution:"))); - cameraResLabel->setFont (Font (15.00f, Font::plain)); - cameraResLabel->setJustificationType (Justification::centredLeft); - cameraResLabel->setEditable (false, false, false); - cameraResLabel->setColour (Label::textColourId, Colours::white); - cameraResLabel->setColour (TextEditor::textColourId, Colours::black); - cameraResLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (cameraResCombo = new ComboBox ("cameraResCombo")); - cameraResCombo->setExplicitFocusOrder (8); - cameraResCombo->setEditableText (false); - cameraResCombo->setJustificationType (Justification::centredLeft); - cameraResCombo->setTextWhenNothingSelected (String::empty); - cameraResCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); - cameraResCombo->addListener (this); - - addAndMakeVisible (textGroup2 = new GroupComponent ("textGroup", - TRANS("Audio"))); - textGroup2->setColour (GroupComponent::outlineColourId, Colours::white); - textGroup2->setColour (GroupComponent::textColourId, Colours::white); - - addAndMakeVisible (audioApiLabel = new Label ("audioApiLabel", - TRANS("Interface:"))); - audioApiLabel->setFont (Font (15.00f, Font::plain)); - audioApiLabel->setJustificationType (Justification::centredLeft); - audioApiLabel->setEditable (false, false, false); - audioApiLabel->setColour (Label::textColourId, Colours::white); - audioApiLabel->setColour (TextEditor::textColourId, Colours::black); - audioApiLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (audioApiCombo = new ComboBox ("audioApiCombo")); - audioApiCombo->setExplicitFocusOrder (9); - audioApiCombo->setEditableText (false); - audioApiCombo->setJustificationType (Justification::centredLeft); - audioApiCombo->setTextWhenNothingSelected (String::empty); - audioApiCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); - audioApiCombo->addListener (this); - - addAndMakeVisible (nChannelsLabel = new Label ("nChannelsLabel", - TRANS("Channels:"))); - nChannelsLabel->setFont (Font (15.00f, Font::plain)); - nChannelsLabel->setJustificationType (Justification::centredLeft); - nChannelsLabel->setEditable (false, false, false); - nChannelsLabel->setColour (Label::textColourId, Colours::white); - nChannelsLabel->setColour (TextEditor::textColourId, Colours::black); - nChannelsLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (nChannelsSlider = new Slider ("nChannelsSlider")); - nChannelsSlider->setExplicitFocusOrder (10); - nChannelsSlider->setRange (0, 10, 0); - nChannelsSlider->setSliderStyle (Slider::IncDecButtons); - nChannelsSlider->setTextBoxStyle (Slider::TextBoxLeft, false, 24, 20); - nChannelsSlider->addListener (this); - - addAndMakeVisible (samplerateLabel = new Label ("samplerateLabel", - TRANS("Samplerate:"))); - samplerateLabel->setFont (Font (15.00f, Font::plain)); - samplerateLabel->setJustificationType (Justification::centredLeft); - samplerateLabel->setEditable (false, false, false); - samplerateLabel->setColour (Label::textColourId, Colours::white); - samplerateLabel->setColour (TextEditor::textColourId, Colours::black); - samplerateLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (samplerateCombo = new ComboBox ("samplerateCombo")); - samplerateCombo->setExplicitFocusOrder (11); - samplerateCombo->setEditableText (false); - samplerateCombo->setJustificationType (Justification::centredLeft); - samplerateCombo->setTextWhenNothingSelected (String::empty); - samplerateCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); - samplerateCombo->addListener (this); - - addAndMakeVisible (audioBitrateLabel = new Label ("audioBitrateLabel", - TRANS("Bitrate:"))); - audioBitrateLabel->setFont (Font (15.00f, Font::plain)); - audioBitrateLabel->setJustificationType (Justification::centredLeft); - audioBitrateLabel->setEditable (false, false, false); - audioBitrateLabel->setColour (Label::textColourId, Colours::white); - audioBitrateLabel->setColour (TextEditor::textColourId, Colours::black); - audioBitrateLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (audioBitrateCombo = new ComboBox ("audioBitrateCombo")); - audioBitrateCombo->setExplicitFocusOrder (12); - audioBitrateCombo->setEditableText (false); - audioBitrateCombo->setJustificationType (Justification::centredLeft); - audioBitrateCombo->setTextWhenNothingSelected (String::empty); - audioBitrateCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); - audioBitrateCombo->addListener (this); - - addAndMakeVisible (textGroup = new GroupComponent ("textGroup", - TRANS("Text"))); - textGroup->setColour (GroupComponent::outlineColourId, Colours::white); - textGroup->setColour (GroupComponent::textColourId, Colours::white); - - addAndMakeVisible (messageLabel = new Label ("messageLabel", - TRANS("Message:"))); - messageLabel->setFont (Font (15.00f, Font::plain)); - messageLabel->setJustificationType (Justification::centredLeft); - messageLabel->setEditable (false, false, false); - messageLabel->setColour (Label::textColourId, Colours::white); - messageLabel->setColour (TextEditor::textColourId, Colours::black); - messageLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (messageText = new TextEditor ("messageText")); - messageText->setExplicitFocusOrder (13); - messageText->setMultiLine (false); - messageText->setReturnKeyStartsNewLine (false); - messageText->setReadOnly (false); - messageText->setScrollbarsShown (true); - messageText->setCaretVisible (true); - messageText->setPopupMenuEnabled (true); - messageText->setText (String::empty); - - addAndMakeVisible (textStyleLabel = new Label ("textStyleLabel", - TRANS("Style:"))); - textStyleLabel->setFont (Font (15.00f, Font::plain)); - textStyleLabel->setJustificationType (Justification::centredLeft); - textStyleLabel->setEditable (false, false, false); - textStyleLabel->setColour (Label::textColourId, Colours::white); - textStyleLabel->setColour (TextEditor::textColourId, Colours::black); - textStyleLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (textStyleCombo = new ComboBox ("textStyleCombo")); - textStyleCombo->setExplicitFocusOrder (14); - textStyleCombo->setEditableText (false); - textStyleCombo->setJustificationType (Justification::centredLeft); - textStyleCombo->setTextWhenNothingSelected (String::empty); - textStyleCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); - textStyleCombo->addListener (this); - - addAndMakeVisible (textPosLabel = new Label ("textPosLabel", - TRANS("Position:"))); - textPosLabel->setFont (Font (15.00f, Font::plain)); - textPosLabel->setJustificationType (Justification::centredLeft); - textPosLabel->setEditable (false, false, false); - textPosLabel->setColour (Label::textColourId, Colours::white); - textPosLabel->setColour (TextEditor::textColourId, Colours::black); - textPosLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (textPosCombo = new ComboBox ("textPosCombo")); - textPosCombo->setExplicitFocusOrder (15); - textPosCombo->setEditableText (false); - textPosCombo->setJustificationType (Justification::centredLeft); - textPosCombo->setTextWhenNothingSelected (String::empty); - textPosCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); - textPosCombo->addListener (this); - - addAndMakeVisible (outputGroup = new GroupComponent ("outputGroup", - TRANS("Output"))); - outputGroup->setColour (GroupComponent::outlineColourId, Colours::white); - outputGroup->setColour (GroupComponent::textColourId, Colours::white); - - addAndMakeVisible (outputResLabel = new Label ("outputResLabel", - TRANS("Resolution:"))); - outputResLabel->setFont (Font (15.00f, Font::plain)); - outputResLabel->setJustificationType (Justification::centredLeft); - outputResLabel->setEditable (false, false, false); - outputResLabel->setColour (Label::textColourId, Colours::white); - outputResLabel->setColour (TextEditor::textColourId, Colours::black); - outputResLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (outputResCombo = new ComboBox ("outputResCombo")); - outputResCombo->setExplicitFocusOrder (16); - outputResCombo->setEditableText (false); - outputResCombo->setJustificationType (Justification::centredLeft); - outputResCombo->setTextWhenNothingSelected (String::empty); - outputResCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); - outputResCombo->addListener (this); - - addAndMakeVisible (qualityLabel = new Label ("qualityLabel", - TRANS("Quality:"))); - qualityLabel->setFont (Font (15.00f, Font::plain)); - qualityLabel->setJustificationType (Justification::centredLeft); - qualityLabel->setEditable (false, false, false); - qualityLabel->setColour (Label::textColourId, Colours::white); - qualityLabel->setColour (TextEditor::textColourId, Colours::black); - qualityLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (qualityCombo = new ComboBox ("qualityCombo")); - qualityCombo->setExplicitFocusOrder (17); - qualityCombo->setEditableText (false); - qualityCombo->setJustificationType (Justification::centredLeft); - qualityCombo->setTextWhenNothingSelected (String::empty); - qualityCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); - qualityCombo->addListener (this); - - addAndMakeVisible (fpsLabel = new Label ("fpsLabel", - TRANS("FPS:"))); - fpsLabel->setFont (Font (15.00f, Font::plain)); - fpsLabel->setJustificationType (Justification::centredLeft); - fpsLabel->setEditable (false, false, false); - fpsLabel->setColour (Label::textColourId, Colours::white); - fpsLabel->setColour (TextEditor::textColourId, Colours::black); - fpsLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (fpsCombo = new ComboBox ("fpsCombo")); - fpsCombo->setExplicitFocusOrder (18); - fpsCombo->setEditableText (false); - fpsCombo->setJustificationType (Justification::centredLeft); - fpsCombo->setTextWhenNothingSelected (String::empty); - fpsCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); - fpsCombo->addListener (this); - - addAndMakeVisible (bitrateLabel = new Label ("bitrateLabel", - TRANS("Bitrate:"))); - bitrateLabel->setFont (Font (15.00f, Font::plain)); - bitrateLabel->setJustificationType (Justification::centredLeft); - bitrateLabel->setEditable (false, false, false); - bitrateLabel->setColour (Label::textColourId, Colours::white); - bitrateLabel->setColour (TextEditor::textColourId, Colours::black); - bitrateLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - - addAndMakeVisible (bitrateCombo = new ComboBox ("bitrateCombo")); - bitrateCombo->setExplicitFocusOrder (19); - bitrateCombo->setEditableText (false); - bitrateCombo->setJustificationType (Justification::centredLeft); - bitrateCombo->setTextWhenNothingSelected (String::empty); - bitrateCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); - bitrateCombo->addListener (this); - - addAndMakeVisible (monitorsGroup = new GroupComponent ("monitorsGroup", - TRANS("Monitors"))); - monitorsGroup->setColour (GroupComponent::outlineColourId, Colours::white); - monitorsGroup->setColour (GroupComponent::textColourId, Colours::white); - - addAndMakeVisible (screencapMonitor = new GstreamerVideo()); - screencapMonitor->setExplicitFocusOrder (20); - screencapMonitor->setName ("screencapMonitor"); - - addAndMakeVisible (cameratMonitor = new GstreamerVideo()); - cameratMonitor->setExplicitFocusOrder (21); - cameratMonitor->setName ("cameratMonitor"); - - addAndMakeVisible (outputMonitor = new GstreamerVideo()); - outputMonitor->setExplicitFocusOrder (22); - outputMonitor->setName ("outputMonitor"); - - - //[UserPreSize] - //[/UserPreSize] - - setSize (600, 400); - - - //[Constructor] You can add your own custom stuff here.. - //[/Constructor] -} - -OutputConfig::~OutputConfig() -{ - //[Destructor_pre]. You can add your own custom destruction code here.. - //[/Destructor_pre] - - screenGroup = nullptr; - displayLabel = nullptr; - displaySlider = nullptr; - screenLabel = nullptr; - screenSlider = nullptr; - screenWidthLabel = nullptr; - screenWidthText = nullptr; - screenHeightLabel = nullptr; - screenHeightText = nullptr; - xOffsetLabel = nullptr; - xOffsetText = nullptr; - yOffsetLabel = nullptr; - yOffsetText = nullptr; - cameraGroup = nullptr; - cameraDevLabel = nullptr; - cameraDevCombo = nullptr; - cameraResLabel = nullptr; - cameraResCombo = nullptr; - textGroup2 = nullptr; - audioApiLabel = nullptr; - audioApiCombo = nullptr; - nChannelsLabel = nullptr; - nChannelsSlider = nullptr; - samplerateLabel = nullptr; - samplerateCombo = nullptr; - audioBitrateLabel = nullptr; - audioBitrateCombo = nullptr; - textGroup = nullptr; - messageLabel = nullptr; - messageText = nullptr; - textStyleLabel = nullptr; - textStyleCombo = nullptr; - textPosLabel = nullptr; - textPosCombo = nullptr; - outputGroup = nullptr; - outputResLabel = nullptr; - outputResCombo = nullptr; - qualityLabel = nullptr; - qualityCombo = nullptr; - fpsLabel = nullptr; - fpsCombo = nullptr; - bitrateLabel = nullptr; - bitrateCombo = nullptr; - monitorsGroup = nullptr; - screencapMonitor = nullptr; - cameratMonitor = nullptr; - outputMonitor = nullptr; - - - //[Destructor]. You can add your own custom destruction code here.. - //[/Destructor] -} - -//============================================================================== -void OutputConfig::paint (Graphics& g) -{ - //[UserPrePaint] Add your own custom painting code here.. - //[/UserPrePaint] - - g.fillAll (Colour (0xff101010)); - - g.setColour (Colour (0xff202020)); - g.fillRoundedRectangle (8.0f, 8.0f, static_cast (getWidth() - 16), static_cast (getHeight() - 16), 10.000f); - - g.setColour (Colours::white); - g.drawRoundedRectangle (8.0f, 8.0f, static_cast (getWidth() - 16), static_cast (getHeight() - 16), 10.000f, 1.000f); - - //[UserPaint] Add your own custom painting code here.. - //[/UserPaint] -} - -void OutputConfig::resized() -{ - //[UserPreResize] Add your own custom resize code here.. - //[/UserPreResize] - - screenGroup->setBounds (16, 8, getWidth() - 32, 100); - displayLabel->setBounds (32, 32, 80, 24); - displaySlider->setBounds (120, 32, 64, 24); - screenLabel->setBounds (32, 64, 80, 24); - screenSlider->setBounds (120, 64, 64, 24); - screenWidthLabel->setBounds (200, 32, 64, 24); - screenWidthText->setBounds (264, 32, 48, 24); - screenHeightLabel->setBounds (200, 64, 64, 24); - screenHeightText->setBounds (264, 64, 48, 24); - xOffsetLabel->setBounds (326, 32, 64, 24); - xOffsetText->setBounds (390, 32, 48, 24); - yOffsetLabel->setBounds (326, 64, 64, 24); - yOffsetText->setBounds (390, 64, 48, 24); - cameraGroup->setBounds (16, 116, getWidth() - 32, 100); - cameraDevLabel->setBounds (32, 140, 80, 24); - cameraDevCombo->setBounds (120, 140, 200, 24); - cameraResLabel->setBounds (32, 172, 80, 24); - cameraResCombo->setBounds (120, 172, 200, 24); - textGroup2->setBounds (16, 224, getWidth() - 32, 64); - audioApiLabel->setBounds (32, 248, 64, 24); - audioApiCombo->setBounds (120, 248, 96, 24); - nChannelsLabel->setBounds (245, 248, 80, 24); - nChannelsSlider->setBounds (333, 248, 64, 24); - samplerateLabel->setBounds (408, 248, 76, 24); - samplerateCombo->setBounds (480, 248, 80, 24); - audioBitrateLabel->setBounds (568, 248, 64, 24); - audioBitrateCombo->setBounds (632, 248, 80, 24); - textGroup->setBounds (16, 296, getWidth() - 32, 64); - messageLabel->setBounds (32, 320, 80, 24); - messageText->setBounds (120, 320, 284, 24); - textStyleLabel->setBounds (420, 320, 52, 24); - textStyleCombo->setBounds (480, 320, 80, 24); - textPosLabel->setBounds (568, 320, 64, 24); - textPosCombo->setBounds (632, 320, 80, 24); - outputGroup->setBounds (16, 368, getWidth() - 32, 100); - outputResLabel->setBounds (32, 392, 80, 24); - outputResCombo->setBounds (120, 392, 200, 24); - qualityLabel->setBounds (32, 424, 80, 24); - qualityCombo->setBounds (120, 424, 200, 24); - fpsLabel->setBounds (340, 392, 64, 24); - fpsCombo->setBounds (404, 392, 48, 24); - bitrateLabel->setBounds (340, 424, 64, 24); - bitrateCombo->setBounds (404, 424, 80, 24); - monitorsGroup->setBounds (16, 476, getWidth() - 32, 164); - screencapMonitor->setBounds (40, 504, 160, 120); - cameratMonitor->setBounds (224, 504, 160, 120); - outputMonitor->setBounds (408, 504, 160, 120); - //[UserResized] Add your own custom resize handling here.. - //[/UserResized] -} - -void OutputConfig::sliderValueChanged (Slider* sliderThatWasMoved) -{ - //[UsersliderValueChanged_Pre] - //[/UsersliderValueChanged_Pre] - - if (sliderThatWasMoved == displaySlider) - { - //[UserSliderCode_displaySlider] -- add your slider handling code here.. - //[/UserSliderCode_displaySlider] - } - else if (sliderThatWasMoved == screenSlider) - { - //[UserSliderCode_screenSlider] -- add your slider handling code here.. - //[/UserSliderCode_screenSlider] - } - else if (sliderThatWasMoved == nChannelsSlider) - { - //[UserSliderCode_nChannelsSlider] -- add your slider handling code here.. - //[/UserSliderCode_nChannelsSlider] - } - - //[UsersliderValueChanged_Post] - //[/UsersliderValueChanged_Post] -} - -void OutputConfig::comboBoxChanged (ComboBox* comboBoxThatHasChanged) -{ - //[UsercomboBoxChanged_Pre] - //[/UsercomboBoxChanged_Pre] - - if (comboBoxThatHasChanged == cameraDevCombo) - { - //[UserComboBoxCode_cameraDevCombo] -- add your combo box handling code here.. - //[/UserComboBoxCode_cameraDevCombo] - } - else if (comboBoxThatHasChanged == cameraResCombo) - { - //[UserComboBoxCode_cameraResCombo] -- add your combo box handling code here.. - //[/UserComboBoxCode_cameraResCombo] - } - else if (comboBoxThatHasChanged == audioApiCombo) - { - //[UserComboBoxCode_audioApiCombo] -- add your combo box handling code here.. - //[/UserComboBoxCode_audioApiCombo] - } - else if (comboBoxThatHasChanged == samplerateCombo) - { - //[UserComboBoxCode_samplerateCombo] -- add your combo box handling code here.. - //[/UserComboBoxCode_samplerateCombo] - } - else if (comboBoxThatHasChanged == audioBitrateCombo) - { - //[UserComboBoxCode_audioBitrateCombo] -- add your combo box handling code here.. - //[/UserComboBoxCode_audioBitrateCombo] - } - else if (comboBoxThatHasChanged == textStyleCombo) - { - //[UserComboBoxCode_textStyleCombo] -- add your combo box handling code here.. - //[/UserComboBoxCode_textStyleCombo] - } - else if (comboBoxThatHasChanged == textPosCombo) - { - //[UserComboBoxCode_textPosCombo] -- add your combo box handling code here.. - //[/UserComboBoxCode_textPosCombo] - } - else if (comboBoxThatHasChanged == outputResCombo) - { - //[UserComboBoxCode_outputResCombo] -- add your combo box handling code here.. - //[/UserComboBoxCode_outputResCombo] - } - else if (comboBoxThatHasChanged == qualityCombo) - { - //[UserComboBoxCode_qualityCombo] -- add your combo box handling code here.. - //[/UserComboBoxCode_qualityCombo] - } - else if (comboBoxThatHasChanged == fpsCombo) - { - //[UserComboBoxCode_fpsCombo] -- add your combo box handling code here.. - //[/UserComboBoxCode_fpsCombo] - } - else if (comboBoxThatHasChanged == bitrateCombo) - { - //[UserComboBoxCode_bitrateCombo] -- add your combo box handling code here.. - //[/UserComboBoxCode_bitrateCombo] - } - - //[UsercomboBoxChanged_Post] - //[/UsercomboBoxChanged_Post] -} - - - -//[MiscUserCode] You can add your own definitions of your custom methods or any other code here... -//[/MiscUserCode] - - -//============================================================================== -#if 0 -/* -- Introjucer information section -- - - This is where the Introjucer stores the metadata that describe this GUI layout, so - make changes in here at your peril! - -BEGIN_JUCER_METADATA - - - - - - - - -END_JUCER_METADATA -*/ -#endif - - -//[EndFile] You can add extra defines here... -//[/EndFile] +/* + ============================================================================== + + This is an automatically generated GUI class created by the Introjucer! + + Be careful when adding custom code to these files, as only the code within + the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded + and re-saved. + + Created with Introjucer version: 3.2.0 + + ------------------------------------------------------------------------------ + + The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions" + Copyright (c) 2015 - ROLI Ltd. + + ============================================================================== +*/ + +//[Headers] You can add your own extra header files here... + +#include "Constants.h" + +//[/Headers] + +#include "OutputConfig.h" + + +//[MiscUserDefs] You can add your own user definitions and misc code here... +//[/MiscUserDefs] + +//============================================================================== +OutputConfig::OutputConfig (Component* main_window) +{ + //[Constructor_pre] You can add your own custom stuff here.. + //[/Constructor_pre] + + addAndMakeVisible (screenGroup = new GroupComponent ("screenGroup", + TRANS("Screen"))); + screenGroup->setColour (GroupComponent::outlineColourId, Colours::white); + screenGroup->setColour (GroupComponent::textColourId, Colours::white); + + addAndMakeVisible (displayLabel = new Label ("displayLabel", + TRANS("Display #:"))); + displayLabel->setFont (Font (15.00f, Font::plain)); + displayLabel->setJustificationType (Justification::centredLeft); + displayLabel->setEditable (false, false, false); + displayLabel->setColour (Label::textColourId, Colours::white); + displayLabel->setColour (TextEditor::textColourId, Colours::black); + displayLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (displaySlider = new Slider ("displaySlider")); + displaySlider->setExplicitFocusOrder (1); + displaySlider->setRange (0, 10, 0); + displaySlider->setSliderStyle (Slider::IncDecButtons); + displaySlider->setTextBoxStyle (Slider::TextBoxLeft, false, 24, 20); + displaySlider->addListener (this); + + addAndMakeVisible (screenLabel = new Label ("screenLabel", + TRANS("Screen #:"))); + screenLabel->setFont (Font (15.00f, Font::plain)); + screenLabel->setJustificationType (Justification::centredLeft); + screenLabel->setEditable (false, false, false); + screenLabel->setColour (Label::textColourId, Colours::white); + screenLabel->setColour (TextEditor::textColourId, Colours::black); + screenLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (screenSlider = new Slider ("screenSlider")); + screenSlider->setExplicitFocusOrder (2); + screenSlider->setRange (0, 10, 0); + screenSlider->setSliderStyle (Slider::IncDecButtons); + screenSlider->setTextBoxStyle (Slider::TextBoxLeft, false, 24, 20); + screenSlider->addListener (this); + + addAndMakeVisible (screenWidthLabel = new Label ("screenWidthLabel", + TRANS("Width:"))); + screenWidthLabel->setFont (Font (15.00f, Font::plain)); + screenWidthLabel->setJustificationType (Justification::centredLeft); + screenWidthLabel->setEditable (false, false, false); + screenWidthLabel->setColour (Label::textColourId, Colours::white); + screenWidthLabel->setColour (TextEditor::textColourId, Colours::black); + screenWidthLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (screenWidthText = new TextEditor ("screenWidthText")); + screenWidthText->setExplicitFocusOrder (3); + screenWidthText->setMultiLine (false); + screenWidthText->setReturnKeyStartsNewLine (false); + screenWidthText->setReadOnly (false); + screenWidthText->setScrollbarsShown (false); + screenWidthText->setCaretVisible (true); + screenWidthText->setPopupMenuEnabled (true); + screenWidthText->setText (String::empty); + + addAndMakeVisible (screenHeightLabel = new Label ("screenHeightLabel", + TRANS("Height:"))); + screenHeightLabel->setFont (Font (15.00f, Font::plain)); + screenHeightLabel->setJustificationType (Justification::centredLeft); + screenHeightLabel->setEditable (false, false, false); + screenHeightLabel->setColour (Label::textColourId, Colours::white); + screenHeightLabel->setColour (TextEditor::textColourId, Colours::black); + screenHeightLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (screenHeightText = new TextEditor ("screenHeightText")); + screenHeightText->setExplicitFocusOrder (4); + screenHeightText->setMultiLine (false); + screenHeightText->setReturnKeyStartsNewLine (false); + screenHeightText->setReadOnly (false); + screenHeightText->setScrollbarsShown (false); + screenHeightText->setCaretVisible (true); + screenHeightText->setPopupMenuEnabled (true); + screenHeightText->setText (String::empty); + + addAndMakeVisible (xOffsetLabel = new Label ("xOffsetLabel", + TRANS("Offset X:"))); + xOffsetLabel->setFont (Font (15.00f, Font::plain)); + xOffsetLabel->setJustificationType (Justification::centredLeft); + xOffsetLabel->setEditable (false, false, false); + xOffsetLabel->setColour (Label::textColourId, Colours::white); + xOffsetLabel->setColour (TextEditor::textColourId, Colours::black); + xOffsetLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (xOffsetText = new TextEditor ("xOffsetText")); + xOffsetText->setExplicitFocusOrder (5); + xOffsetText->setMultiLine (false); + xOffsetText->setReturnKeyStartsNewLine (false); + xOffsetText->setReadOnly (false); + xOffsetText->setScrollbarsShown (true); + xOffsetText->setCaretVisible (true); + xOffsetText->setPopupMenuEnabled (true); + xOffsetText->setText (String::empty); + + addAndMakeVisible (yOffsetLabel = new Label ("yOffsetLabel", + TRANS("Offset Y:"))); + yOffsetLabel->setFont (Font (15.00f, Font::plain)); + yOffsetLabel->setJustificationType (Justification::centredLeft); + yOffsetLabel->setEditable (false, false, false); + yOffsetLabel->setColour (Label::textColourId, Colours::white); + yOffsetLabel->setColour (TextEditor::textColourId, Colours::black); + yOffsetLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (yOffsetText = new TextEditor ("yOffsetText")); + yOffsetText->setExplicitFocusOrder (6); + yOffsetText->setMultiLine (false); + yOffsetText->setReturnKeyStartsNewLine (false); + yOffsetText->setReadOnly (false); + yOffsetText->setScrollbarsShown (true); + yOffsetText->setCaretVisible (true); + yOffsetText->setPopupMenuEnabled (true); + yOffsetText->setText (String::empty); + + addAndMakeVisible (cameraGroup = new GroupComponent ("cameraGroup", + TRANS("Camera"))); + cameraGroup->setColour (GroupComponent::outlineColourId, Colours::white); + cameraGroup->setColour (GroupComponent::textColourId, Colours::white); + + addAndMakeVisible (cameraDevLabel = new Label ("cameraDevLabel", + TRANS("Device:"))); + cameraDevLabel->setFont (Font (15.00f, Font::plain)); + cameraDevLabel->setJustificationType (Justification::centredLeft); + cameraDevLabel->setEditable (false, false, false); + cameraDevLabel->setColour (Label::textColourId, Colours::white); + cameraDevLabel->setColour (TextEditor::textColourId, Colours::black); + cameraDevLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (cameraDevCombo = new ComboBox ("cameraDevCombo")); + cameraDevCombo->setExplicitFocusOrder (7); + cameraDevCombo->setEditableText (false); + cameraDevCombo->setJustificationType (Justification::centredLeft); + cameraDevCombo->setTextWhenNothingSelected (TRANS("(no devices)")); + cameraDevCombo->setTextWhenNoChoicesAvailable (TRANS("(no devices)")); + cameraDevCombo->addListener (this); + + addAndMakeVisible (cameraResLabel = new Label ("cameraResLabel", + TRANS("Resolution:"))); + cameraResLabel->setFont (Font (15.00f, Font::plain)); + cameraResLabel->setJustificationType (Justification::centredLeft); + cameraResLabel->setEditable (false, false, false); + cameraResLabel->setColour (Label::textColourId, Colours::white); + cameraResLabel->setColour (TextEditor::textColourId, Colours::black); + cameraResLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (cameraResCombo = new ComboBox ("cameraResCombo")); + cameraResCombo->setExplicitFocusOrder (8); + cameraResCombo->setEditableText (false); + cameraResCombo->setJustificationType (Justification::centredLeft); + cameraResCombo->setTextWhenNothingSelected (String::empty); + cameraResCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); + cameraResCombo->addListener (this); + + addAndMakeVisible (textGroup2 = new GroupComponent ("textGroup", + TRANS("Audio"))); + textGroup2->setColour (GroupComponent::outlineColourId, Colours::white); + textGroup2->setColour (GroupComponent::textColourId, Colours::white); + + addAndMakeVisible (audioApiLabel = new Label ("audioApiLabel", + TRANS("Interface:"))); + audioApiLabel->setFont (Font (15.00f, Font::plain)); + audioApiLabel->setJustificationType (Justification::centredLeft); + audioApiLabel->setEditable (false, false, false); + audioApiLabel->setColour (Label::textColourId, Colours::white); + audioApiLabel->setColour (TextEditor::textColourId, Colours::black); + audioApiLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (audioApiCombo = new ComboBox ("audioApiCombo")); + audioApiCombo->setExplicitFocusOrder (9); + audioApiCombo->setEditableText (false); + audioApiCombo->setJustificationType (Justification::centredLeft); + audioApiCombo->setTextWhenNothingSelected (String::empty); + audioApiCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); + audioApiCombo->addListener (this); + + addAndMakeVisible (nChannelsLabel = new Label ("nChannelsLabel", + TRANS("Channels:"))); + nChannelsLabel->setFont (Font (15.00f, Font::plain)); + nChannelsLabel->setJustificationType (Justification::centredLeft); + nChannelsLabel->setEditable (false, false, false); + nChannelsLabel->setColour (Label::textColourId, Colours::white); + nChannelsLabel->setColour (TextEditor::textColourId, Colours::black); + nChannelsLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (nChannelsSlider = new Slider ("nChannelsSlider")); + nChannelsSlider->setExplicitFocusOrder (10); + nChannelsSlider->setRange (0, 10, 0); + nChannelsSlider->setSliderStyle (Slider::IncDecButtons); + nChannelsSlider->setTextBoxStyle (Slider::TextBoxLeft, false, 24, 20); + nChannelsSlider->addListener (this); + + addAndMakeVisible (samplerateLabel = new Label ("samplerateLabel", + TRANS("Samplerate:"))); + samplerateLabel->setFont (Font (15.00f, Font::plain)); + samplerateLabel->setJustificationType (Justification::centredLeft); + samplerateLabel->setEditable (false, false, false); + samplerateLabel->setColour (Label::textColourId, Colours::white); + samplerateLabel->setColour (TextEditor::textColourId, Colours::black); + samplerateLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (samplerateCombo = new ComboBox ("samplerateCombo")); + samplerateCombo->setExplicitFocusOrder (11); + samplerateCombo->setEditableText (false); + samplerateCombo->setJustificationType (Justification::centredLeft); + samplerateCombo->setTextWhenNothingSelected (String::empty); + samplerateCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); + samplerateCombo->addListener (this); + + addAndMakeVisible (audioBitrateLabel = new Label ("audioBitrateLabel", + TRANS("Bitrate:"))); + audioBitrateLabel->setFont (Font (15.00f, Font::plain)); + audioBitrateLabel->setJustificationType (Justification::centredLeft); + audioBitrateLabel->setEditable (false, false, false); + audioBitrateLabel->setColour (Label::textColourId, Colours::white); + audioBitrateLabel->setColour (TextEditor::textColourId, Colours::black); + audioBitrateLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (audioBitrateCombo = new ComboBox ("audioBitrateCombo")); + audioBitrateCombo->setExplicitFocusOrder (12); + audioBitrateCombo->setEditableText (false); + audioBitrateCombo->setJustificationType (Justification::centredLeft); + audioBitrateCombo->setTextWhenNothingSelected (String::empty); + audioBitrateCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); + audioBitrateCombo->addListener (this); + + addAndMakeVisible (textGroup = new GroupComponent ("textGroup", + TRANS("Text"))); + textGroup->setColour (GroupComponent::outlineColourId, Colours::white); + textGroup->setColour (GroupComponent::textColourId, Colours::white); + + addAndMakeVisible (messageLabel = new Label ("messageLabel", + TRANS("Message:"))); + messageLabel->setFont (Font (15.00f, Font::plain)); + messageLabel->setJustificationType (Justification::centredLeft); + messageLabel->setEditable (false, false, false); + messageLabel->setColour (Label::textColourId, Colours::white); + messageLabel->setColour (TextEditor::textColourId, Colours::black); + messageLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (messageText = new TextEditor ("messageText")); + messageText->setExplicitFocusOrder (13); + messageText->setMultiLine (false); + messageText->setReturnKeyStartsNewLine (false); + messageText->setReadOnly (false); + messageText->setScrollbarsShown (true); + messageText->setCaretVisible (true); + messageText->setPopupMenuEnabled (true); + messageText->setText (String::empty); + + addAndMakeVisible (textStyleLabel = new Label ("textStyleLabel", + TRANS("Style:"))); + textStyleLabel->setFont (Font (15.00f, Font::plain)); + textStyleLabel->setJustificationType (Justification::centredLeft); + textStyleLabel->setEditable (false, false, false); + textStyleLabel->setColour (Label::textColourId, Colours::white); + textStyleLabel->setColour (TextEditor::textColourId, Colours::black); + textStyleLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (textStyleCombo = new ComboBox ("textStyleCombo")); + textStyleCombo->setExplicitFocusOrder (14); + textStyleCombo->setEditableText (false); + textStyleCombo->setJustificationType (Justification::centredLeft); + textStyleCombo->setTextWhenNothingSelected (String::empty); + textStyleCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); + textStyleCombo->addListener (this); + + addAndMakeVisible (textPosLabel = new Label ("textPosLabel", + TRANS("Position:"))); + textPosLabel->setFont (Font (15.00f, Font::plain)); + textPosLabel->setJustificationType (Justification::centredLeft); + textPosLabel->setEditable (false, false, false); + textPosLabel->setColour (Label::textColourId, Colours::white); + textPosLabel->setColour (TextEditor::textColourId, Colours::black); + textPosLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (textPosCombo = new ComboBox ("textPosCombo")); + textPosCombo->setExplicitFocusOrder (15); + textPosCombo->setEditableText (false); + textPosCombo->setJustificationType (Justification::centredLeft); + textPosCombo->setTextWhenNothingSelected (String::empty); + textPosCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); + textPosCombo->addListener (this); + + addAndMakeVisible (outputGroup = new GroupComponent ("outputGroup", + TRANS("Output"))); + outputGroup->setColour (GroupComponent::outlineColourId, Colours::white); + outputGroup->setColour (GroupComponent::textColourId, Colours::white); + + addAndMakeVisible (outputResLabel = new Label ("outputResLabel", + TRANS("Resolution:"))); + outputResLabel->setFont (Font (15.00f, Font::plain)); + outputResLabel->setJustificationType (Justification::centredLeft); + outputResLabel->setEditable (false, false, false); + outputResLabel->setColour (Label::textColourId, Colours::white); + outputResLabel->setColour (TextEditor::textColourId, Colours::black); + outputResLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (outputResCombo = new ComboBox ("outputResCombo")); + outputResCombo->setExplicitFocusOrder (16); + outputResCombo->setEditableText (false); + outputResCombo->setJustificationType (Justification::centredLeft); + outputResCombo->setTextWhenNothingSelected (String::empty); + outputResCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); + outputResCombo->addListener (this); + + addAndMakeVisible (qualityLabel = new Label ("qualityLabel", + TRANS("Quality:"))); + qualityLabel->setFont (Font (15.00f, Font::plain)); + qualityLabel->setJustificationType (Justification::centredLeft); + qualityLabel->setEditable (false, false, false); + qualityLabel->setColour (Label::textColourId, Colours::white); + qualityLabel->setColour (TextEditor::textColourId, Colours::black); + qualityLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (qualityCombo = new ComboBox ("qualityCombo")); + qualityCombo->setExplicitFocusOrder (17); + qualityCombo->setEditableText (false); + qualityCombo->setJustificationType (Justification::centredLeft); + qualityCombo->setTextWhenNothingSelected (String::empty); + qualityCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); + qualityCombo->addListener (this); + + addAndMakeVisible (fpsLabel = new Label ("fpsLabel", + TRANS("FPS:"))); + fpsLabel->setFont (Font (15.00f, Font::plain)); + fpsLabel->setJustificationType (Justification::centredLeft); + fpsLabel->setEditable (false, false, false); + fpsLabel->setColour (Label::textColourId, Colours::white); + fpsLabel->setColour (TextEditor::textColourId, Colours::black); + fpsLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (fpsCombo = new ComboBox ("fpsCombo")); + fpsCombo->setExplicitFocusOrder (18); + fpsCombo->setEditableText (false); + fpsCombo->setJustificationType (Justification::centredLeft); + fpsCombo->setTextWhenNothingSelected (String::empty); + fpsCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); + fpsCombo->addListener (this); + + addAndMakeVisible (bitrateLabel = new Label ("bitrateLabel", + TRANS("Bitrate:"))); + bitrateLabel->setFont (Font (15.00f, Font::plain)); + bitrateLabel->setJustificationType (Justification::centredLeft); + bitrateLabel->setEditable (false, false, false); + bitrateLabel->setColour (Label::textColourId, Colours::white); + bitrateLabel->setColour (TextEditor::textColourId, Colours::black); + bitrateLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (bitrateCombo = new ComboBox ("bitrateCombo")); + bitrateCombo->setExplicitFocusOrder (19); + bitrateCombo->setEditableText (false); + bitrateCombo->setJustificationType (Justification::centredLeft); + bitrateCombo->setTextWhenNothingSelected (String::empty); + bitrateCombo->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); + bitrateCombo->addListener (this); + + addAndMakeVisible (monitorsGroup = new GroupComponent ("monitorsGroup", + TRANS("Monitors"))); + monitorsGroup->setColour (GroupComponent::outlineColourId, Colours::white); + monitorsGroup->setColour (GroupComponent::textColourId, Colours::white); + + + //[UserPreSize] + +#ifndef DEBUG_NO_INSTANTIATE_MONITORS + // video monitors + this->screencapMonitor = new GstreamerVideo(main_window , GUI::SCREENCAP_MONITOR_X , GUI::MONITORS_Y) ; + this->cameratMonitor = new GstreamerVideo(main_window , GUI::CAMERA_MONITOR_X , GUI::MONITORS_Y) ; + this->outputMonitor = new GstreamerVideo(main_window , GUI::OUTPUT_MONITOR_X , GUI::MONITORS_Y) ; +#endif // DEBUG_NO_INSTANTIATE_MONITORS + + //[/UserPreSize] + + setSize (600, 400); + + + //[Constructor] You can add your own custom stuff here.. + //[/Constructor] +} + +OutputConfig::~OutputConfig() +{ + //[Destructor_pre]. You can add your own custom destruction code here.. + //[/Destructor_pre] + + screenGroup = nullptr; + displayLabel = nullptr; + displaySlider = nullptr; + screenLabel = nullptr; + screenSlider = nullptr; + screenWidthLabel = nullptr; + screenWidthText = nullptr; + screenHeightLabel = nullptr; + screenHeightText = nullptr; + xOffsetLabel = nullptr; + xOffsetText = nullptr; + yOffsetLabel = nullptr; + yOffsetText = nullptr; + cameraGroup = nullptr; + cameraDevLabel = nullptr; + cameraDevCombo = nullptr; + cameraResLabel = nullptr; + cameraResCombo = nullptr; + textGroup2 = nullptr; + audioApiLabel = nullptr; + audioApiCombo = nullptr; + nChannelsLabel = nullptr; + nChannelsSlider = nullptr; + samplerateLabel = nullptr; + samplerateCombo = nullptr; + audioBitrateLabel = nullptr; + audioBitrateCombo = nullptr; + textGroup = nullptr; + messageLabel = nullptr; + messageText = nullptr; + textStyleLabel = nullptr; + textStyleCombo = nullptr; + textPosLabel = nullptr; + textPosCombo = nullptr; + outputGroup = nullptr; + outputResLabel = nullptr; + outputResCombo = nullptr; + qualityLabel = nullptr; + qualityCombo = nullptr; + fpsLabel = nullptr; + fpsCombo = nullptr; + bitrateLabel = nullptr; + bitrateCombo = nullptr; + monitorsGroup = nullptr; + + + //[Destructor]. You can add your own custom destruction code here.. + + screencapMonitor = nullptr ; + cameratMonitor = nullptr ; + outputMonitor = nullptr ; + + //[/Destructor] +} + +//============================================================================== +void OutputConfig::paint (Graphics& g) +{ + //[UserPrePaint] Add your own custom painting code here.. + //[/UserPrePaint] + + g.fillAll (Colour (0xff101010)); + + g.setColour (Colour (0xff202020)); + g.fillRoundedRectangle (8.0f, 8.0f, static_cast (getWidth() - 16), static_cast (getHeight() - 16), 10.000f); + + g.setColour (Colours::white); + g.drawRoundedRectangle (8.0f, 8.0f, static_cast (getWidth() - 16), static_cast (getHeight() - 16), 10.000f, 1.000f); + + //[UserPaint] Add your own custom painting code here.. + //[/UserPaint] +} + +void OutputConfig::resized() +{ + //[UserPreResize] Add your own custom resize code here.. + //[/UserPreResize] + + screenGroup->setBounds (16, 8, getWidth() - 32, 100); + displayLabel->setBounds (32, 32, 80, 24); + displaySlider->setBounds (120, 32, 64, 24); + screenLabel->setBounds (32, 64, 80, 24); + screenSlider->setBounds (120, 64, 64, 24); + screenWidthLabel->setBounds (200, 32, 64, 24); + screenWidthText->setBounds (264, 32, 48, 24); + screenHeightLabel->setBounds (200, 64, 64, 24); + screenHeightText->setBounds (264, 64, 48, 24); + xOffsetLabel->setBounds (326, 32, 64, 24); + xOffsetText->setBounds (390, 32, 48, 24); + yOffsetLabel->setBounds (326, 64, 64, 24); + yOffsetText->setBounds (390, 64, 48, 24); + cameraGroup->setBounds (16, 116, getWidth() - 32, 100); + cameraDevLabel->setBounds (32, 140, 80, 24); + cameraDevCombo->setBounds (120, 140, 200, 24); + cameraResLabel->setBounds (32, 172, 80, 24); + cameraResCombo->setBounds (120, 172, 200, 24); + textGroup2->setBounds (16, 224, getWidth() - 32, 64); + audioApiLabel->setBounds (32, 248, 64, 24); + audioApiCombo->setBounds (120, 248, 96, 24); + nChannelsLabel->setBounds (245, 248, 80, 24); + nChannelsSlider->setBounds (333, 248, 64, 24); + samplerateLabel->setBounds (408, 248, 76, 24); + samplerateCombo->setBounds (480, 248, 80, 24); + audioBitrateLabel->setBounds (568, 248, 64, 24); + audioBitrateCombo->setBounds (632, 248, 80, 24); + textGroup->setBounds (16, 296, getWidth() - 32, 64); + messageLabel->setBounds (32, 320, 80, 24); + messageText->setBounds (120, 320, 284, 24); + textStyleLabel->setBounds (420, 320, 52, 24); + textStyleCombo->setBounds (480, 320, 80, 24); + textPosLabel->setBounds (568, 320, 64, 24); + textPosCombo->setBounds (632, 320, 80, 24); + outputGroup->setBounds (16, 368, getWidth() - 32, 100); + outputResLabel->setBounds (32, 392, 80, 24); + outputResCombo->setBounds (120, 392, 200, 24); + qualityLabel->setBounds (32, 424, 80, 24); + qualityCombo->setBounds (120, 424, 200, 24); + fpsLabel->setBounds (340, 392, 64, 24); + fpsCombo->setBounds (404, 392, 48, 24); + bitrateLabel->setBounds (340, 424, 64, 24); + bitrateCombo->setBounds (404, 424, 80, 24); + monitorsGroup->setBounds (16, 476, getWidth() - 32, 164); + //[UserResized] Add your own custom resize handling here.. + //[/UserResized] +} + +void OutputConfig::sliderValueChanged (Slider* sliderThatWasMoved) +{ + //[UsersliderValueChanged_Pre] + //[/UsersliderValueChanged_Pre] + + if (sliderThatWasMoved == displaySlider) + { + //[UserSliderCode_displaySlider] -- add your slider handling code here.. + //[/UserSliderCode_displaySlider] + } + else if (sliderThatWasMoved == screenSlider) + { + //[UserSliderCode_screenSlider] -- add your slider handling code here.. + //[/UserSliderCode_screenSlider] + } + else if (sliderThatWasMoved == nChannelsSlider) + { + //[UserSliderCode_nChannelsSlider] -- add your slider handling code here.. + //[/UserSliderCode_nChannelsSlider] + } + + //[UsersliderValueChanged_Post] + //[/UsersliderValueChanged_Post] +} + +void OutputConfig::comboBoxChanged (ComboBox* comboBoxThatHasChanged) +{ + //[UsercomboBoxChanged_Pre] + //[/UsercomboBoxChanged_Pre] + + if (comboBoxThatHasChanged == cameraDevCombo) + { + //[UserComboBoxCode_cameraDevCombo] -- add your combo box handling code here.. + //[/UserComboBoxCode_cameraDevCombo] + } + else if (comboBoxThatHasChanged == cameraResCombo) + { + //[UserComboBoxCode_cameraResCombo] -- add your combo box handling code here.. + //[/UserComboBoxCode_cameraResCombo] + } + else if (comboBoxThatHasChanged == audioApiCombo) + { + //[UserComboBoxCode_audioApiCombo] -- add your combo box handling code here.. + //[/UserComboBoxCode_audioApiCombo] + } + else if (comboBoxThatHasChanged == samplerateCombo) + { + //[UserComboBoxCode_samplerateCombo] -- add your combo box handling code here.. + //[/UserComboBoxCode_samplerateCombo] + } + else if (comboBoxThatHasChanged == audioBitrateCombo) + { + //[UserComboBoxCode_audioBitrateCombo] -- add your combo box handling code here.. + //[/UserComboBoxCode_audioBitrateCombo] + } + else if (comboBoxThatHasChanged == textStyleCombo) + { + //[UserComboBoxCode_textStyleCombo] -- add your combo box handling code here.. + //[/UserComboBoxCode_textStyleCombo] + } + else if (comboBoxThatHasChanged == textPosCombo) + { + //[UserComboBoxCode_textPosCombo] -- add your combo box handling code here.. + //[/UserComboBoxCode_textPosCombo] + } + else if (comboBoxThatHasChanged == outputResCombo) + { + //[UserComboBoxCode_outputResCombo] -- add your combo box handling code here.. + //[/UserComboBoxCode_outputResCombo] + } + else if (comboBoxThatHasChanged == qualityCombo) + { + //[UserComboBoxCode_qualityCombo] -- add your combo box handling code here.. + //[/UserComboBoxCode_qualityCombo] + } + else if (comboBoxThatHasChanged == fpsCombo) + { + //[UserComboBoxCode_fpsCombo] -- add your combo box handling code here.. + //[/UserComboBoxCode_fpsCombo] + } + else if (comboBoxThatHasChanged == bitrateCombo) + { + //[UserComboBoxCode_bitrateCombo] -- add your combo box handling code here.. + //[/UserComboBoxCode_bitrateCombo] + } + + //[UsercomboBoxChanged_Post] + //[/UsercomboBoxChanged_Post] +} + + + +//[MiscUserCode] You can add your own definitions of your custom methods or any other code here... +//[/MiscUserCode] + + +//============================================================================== +#if 0 +/* -- Introjucer information section -- + + This is where the Introjucer stores the metadata that describe this GUI layout, so + make changes in here at your peril! + +BEGIN_JUCER_METADATA + + + + + + + + +END_JUCER_METADATA +*/ +#endif + + +//[EndFile] You can add extra defines here... +//[/EndFile] diff --git a/Source/OutputConfig.h b/Source/OutputConfig.h index 53da84a..d984a95 100644 --- a/Source/OutputConfig.h +++ b/Source/OutputConfig.h @@ -1,124 +1,126 @@ -/* - ============================================================================== - - This is an automatically generated GUI class created by the Introjucer! - - Be careful when adding custom code to these files, as only the code within - the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded - and re-saved. - - Created with Introjucer version: 3.2.0 - - ------------------------------------------------------------------------------ - - The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions" - Copyright (c) 2015 - ROLI Ltd. - - ============================================================================== -*/ - -#ifndef OUTPUTCONFIG_H_INCLUDED -#define OUTPUTCONFIG_H_INCLUDED - -//[Headers] -- You can add your own extra header files here -- - -#include "JuceHeader.h" -#include "GstreamerVideo.h" - -//[/Headers] - - - -//============================================================================== -/** - //[Comments] - An auto-generated component, created by the Introjucer. - - Describe your class and how it works here! - //[/Comments] -*/ -class OutputConfig : public Component, - public SliderListener, - public ComboBoxListener -{ - friend class MainContent ; - - -public: - //============================================================================== - OutputConfig (); - ~OutputConfig(); - - //============================================================================== - //[UserMethods] -- You can add your own custom methods in this section. - //[/UserMethods] - - void paint (Graphics& g); - void resized(); - void sliderValueChanged (Slider* sliderThatWasMoved); - void comboBoxChanged (ComboBox* comboBoxThatHasChanged); - - - -private: - //[UserVariables] -- You can add your own custom variables in this section. - //[/UserVariables] - - //============================================================================== - ScopedPointer screenGroup; - ScopedPointer