output object should have now Raw data

master
Steffen Pohle 1 year ago
parent 052b61e5d3
commit 9670beb903

@ -168,7 +168,7 @@ gboolean cb_thread_detect (gpointer data) {
} }
dout->image->ToPixbuf(detect_pixbuf); dout->image->ToPixbuf(detect_pixbuf);
gdk_window_invalidate_rect(gtk_widget_get_window(detect_da), NULL, true); gdk_window_invalidate_rect(gtk_widget_get_window(detect_da), NULL, true);
output.NewFrame(dout->image, dout->posx, dout->posy); output.NewFrame(dout->rawimage);
detect.UnLockImageMutex(); detect.UnLockImageMutex();
@ -250,59 +250,6 @@ void cb_detect_btnsetsize (GtkWidget *widget, gpointer data) {
/*
void cb_output_btnsave (GtkWidget *widget, gpointer data) {
GtkBuilder *builder = (GtkBuilder *) data;
GtkWindow *window = GTK_WINDOW (gtk_builder_get_object (builder, "window-main"));
GtkWidget *dialog;
GtkFileChooser *chooser;
GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SAVE;
GtkFileFilter *filter;
gint res;
if (image_pixbuf == NULL) return;
dialog = gtk_file_chooser_dialog_new ("Save File",
window,
action,
"_Cancel",
GTK_RESPONSE_CANCEL,
"_Save",
GTK_RESPONSE_ACCEPT,
NULL);
chooser = GTK_FILE_CHOOSER (dialog);
filter = gtk_file_filter_new();
gtk_file_filter_add_pattern(filter, "*.png");
gtk_file_filter_set_name(filter, "PNG File");
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
filter = gtk_file_filter_new();
gtk_file_filter_add_pattern(filter, "*.*");
gtk_file_filter_set_name(filter, "All Files");
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);
if (filename.length () == 0)
gtk_file_chooser_set_current_name (chooser, "capture-001.png");
else
gtk_file_chooser_set_filename (chooser, filename.c_str());
res = gtk_dialog_run (GTK_DIALOG (dialog));
if (res == GTK_RESPONSE_ACCEPT) {
char *filename;
filename = gtk_file_chooser_get_filename (chooser);
gdk_pixbuf_save(image_pixbuf, filename, "png", NULL, "quality", "100", NULL);
g_free (filename);
}
gtk_widget_destroy (dialog);
};
*/
void cb_detect_bright (GtkRange *range, gpointer data) { void cb_detect_bright (GtkRange *range, gpointer data) {
double value; double value;
@ -344,14 +291,6 @@ void cb_detect_btnsetpos (GtkWidget *widget, gpointer data) {
}; };
void cb_output_show_window (GtkWidget *widget, gpointer data) {
printf ("%s:%d %s\n", __FILE__, __LINE__, __FUNCTION__);
GtkWidget *wnd = GTK_WIDGET(gtk_builder_get_object (GTK_BUILDER(_builder_), "window-output"));
gtk_widget_show(wnd);
};
void cb_detect_show_window (GtkWidget *widget, gpointer data) { void cb_detect_show_window (GtkWidget *widget, gpointer data) {
printf ("%s:%d %s\n", __FILE__, __LINE__, __FUNCTION__); printf ("%s:%d %s\n", __FILE__, __LINE__, __FUNCTION__);

@ -165,7 +165,6 @@ G_MODULE_EXPORT gboolean cb_thread_detect (gpointer data);
G_MODULE_EXPORT gboolean cb_thread_posctl (gpointer data); G_MODULE_EXPORT gboolean cb_thread_posctl (gpointer data);
G_MODULE_EXPORT void cb_image_btnnew (GtkWidget *widget, gpointer data); G_MODULE_EXPORT void cb_image_btnnew (GtkWidget *widget, gpointer data);
G_MODULE_EXPORT void cb_image_btnsave (GtkWidget *widget, gpointer data); G_MODULE_EXPORT void cb_image_btnsave (GtkWidget *widget, gpointer data);
G_MODULE_EXPORT void cb_output_show_window (GtkWidget *widget, gpointer data);
// //

@ -2,6 +2,7 @@
#include <unistd.h> #include <unistd.h>
#include "convert.h"
#include "config.h" #include "config.h"
#include "gui.h" #include "gui.h"
#include "output.h" #include "output.h"
@ -26,7 +27,7 @@ Output::Output() { // @suppress("Class members should be properly initialized")
g_mutex_init (&mutextmp); g_mutex_init (&mutextmp);
g_mutex_init (&mutex); g_mutex_init (&mutex);
running = 1; running = 1;
inFrame.SetSize(64, 64); inFrame.Delete();
thread = NULL; thread = NULL;
thread = g_thread_new("Output", _OutputThread, NULL); thread = g_thread_new("Output", _OutputThread, NULL);
}; };
@ -43,13 +44,13 @@ Output::~Output() {
int Output::NewFrame(VideoFrame *newframe, int posx, int posy) { int Output::NewFrame(VideoFrameRaw *rawframe) {
if (newframe == NULL || posx == -1 || posy == -1) return -1; if (rawframe == NULL) return -1;
// printf ("%s:%d Output::NewFrame Frame w:%d h:%d posx:%d posy:%d\n", __FILE__, __LINE__, newframe->w, newframe->h, posx, posy); printf ("%s:%d Output::NewFrame Frame Raw: %d x %d Type: %s\n", __FILE__, __LINE__, rawframe->w, rawframe->h, convert_from_pixelformat(rawframe->pixfmt).c_str());
LockInMutex(); LockInMutex();
inFrame.CopyFrom(newframe); inFrame.CopyFrom(rawframe);
inFrameNew = 1; inFrameNew = 1;
UnLockInMutex(); UnLockInMutex();
return 0; return 0;
@ -57,7 +58,7 @@ int Output::NewFrame(VideoFrame *newframe, int posx, int posy) {
void Output::NewImage() { void Output::NewImage() {
newimage = 1; // newimage = 1;
} }

@ -17,7 +17,7 @@
class Output { class Output {
private: private:
int running; int running;
VideoFrame inFrame; // input frame VideoFrameRaw inFrame; // input frame
int inFrameNew; // new input frame; int inFrameNew; // new input frame;
GMutex muteximage; GMutex muteximage;
GMutex mutexin; GMutex mutexin;
@ -25,7 +25,7 @@ private:
GMutex mutex; // general mutex for changing settings GMutex mutex; // general mutex for changing settings
GThread *thread; GThread *thread;
int newimage; // int newimage;
void ComposeOutput(); void ComposeOutput();
@ -33,7 +33,7 @@ public:
Output(); Output();
~Output(); ~Output();
int NewFrame (VideoFrame *newframe, int posx, int posy); int NewFrame (VideoFrameRaw *rawframe);
void NewImage (); void NewImage ();
// //
// Thread Releated Functions (maybe soon private?) // Thread Releated Functions (maybe soon private?)
@ -48,7 +48,6 @@ public:
void LockMutex() { g_mutex_lock(&mutex);}; void LockMutex() { g_mutex_lock(&mutex);};
void UnLockMutex() { g_mutex_unlock(&mutex);}; void UnLockMutex() { g_mutex_unlock(&mutex);};
// //
// Object functions // Object functions
void SetObjectSize (int neww, int newh); void SetObjectSize (int neww, int newh);

@ -2687,15 +2687,6 @@
<signal name="activate" handler="cb_input_show_window" swapped="no"/> <signal name="activate" handler="cb_input_show_window" swapped="no"/>
</object> </object>
</child> </child>
<child>
<object class="GtkMenuItem">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">_Output</property>
<property name="use-underline">True</property>
<signal name="activate" handler="cb_output_show_window" swapped="no"/>
</object>
</child>
<child> <child>
<object class="GtkMenuItem"> <object class="GtkMenuItem">
<property name="visible">True</property> <property name="visible">True</property>

Loading…
Cancel
Save