From 6063b1da97fb2f84ce5e6bd6d013f03b1662e740 Mon Sep 17 00:00:00 2001 From: Edgard Lima Date: Thu, 7 Feb 2008 13:59:41 +0000 Subject: Add more tags. Improve test app. Original commit message from CVS: Add more tags. Improve test app. --- ChangeLog | 10 ++ ext/metadata/metadata_mapping.htm | 286 ++++++++++++++++++++++------------ ext/metadata/metadataexif.c | 9 ++ ext/metadata/metadatatags.c | 29 +++- ext/metadata/metadatatags.h | 3 + tests/icles/metadata_editor.c | 319 ++++++++++++++++++++++++++++++++++---- tests/icles/metadata_editor.glade | 190 ++++++++++++++++++++++- 7 files changed, 709 insertions(+), 137 deletions(-) diff --git a/ChangeLog b/ChangeLog index 21cadfd8..1120e607 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-02-07 Edgard Lima + + * ext/metadata/metadata_mapping.htm: + * ext/metadata/metadataexif.c: + * ext/metadata/metadatatags.c: + * ext/metadata/metadatatags.h: + * tests/icles/metadata_editor.c: + * tests/icles/metadata_editor.glade: + Add more tags. Improve test app. + 2008-02-07 Stefan Kost * gst/multifile/gstmultifilesink.c: diff --git a/ext/metadata/metadata_mapping.htm b/ext/metadata/metadata_mapping.htm index 0816fca6..4c5508ae 100644 --- a/ext/metadata/metadata_mapping.htm +++ b/ext/metadata/metadata_mapping.htm @@ -7,17 +7,18 @@ - + + @@ -199,24 +200,78 @@

-

-

GST_TAG_CAPTURE_CONTRAST

+

GST_TAG_CAPTURE_COLOR_SPACE

-

"capture-contrast"

+

"capture-color-space"

-

G_TYPE_INT

+

G_TYPE_UINT

+

1- + sRGB;
0xFFFF - Uncalibrated

+ + +

EXIF_TAG_COLOR_SPACE

+ + +

-

+ + +

-

+ + + + +

-

+ + +

GST_TAG_CAPTURE_CONTRAST

+ + +

"capture-contrast"

+ + +

G_TYPE_INT

+ +

from -100 to 100:
[-100, -34] – soft ;
[-33, 33] – normal ;
[34, 100] – hard

- +

EXIF_TAG_CONTRAST
0- normal;
1- soft;
2- hard

+ +

-

+ + +

-

+ + + + +

-

+ + +

GST_TAG_CAPTURE_CUSTOM_RENDERED

+ + +

"capture-custom-rendered"

+ + +

G_TYPE_UINT

+ + +

0- + Normal process;
1- Custom process

+ + +

EXIF_TAG_CUSTOM_RENDERED

+

-

@@ -229,20 +284,20 @@

-

-

GST_TAG_CAPTURE_CUSTOM_RENDERED

+

GST_TAG_CAPTURE_DIGITAL_ZOOM

-

"capture-custom-rendered"

+

"capture-digital-zoom"

-

G_TYPE_UINT

+

GST_TYPE_FRACTION

-

0- - Normal process;
1- Custom process

+

Digital + zoom ratio"
(zero, means digital zoom not used)

-

EXIF_TAG_CUSTOM_RENDERED

+

EXIF_TAG_DIGITAL_ZOOM_RATIO

-

@@ -256,20 +311,22 @@

-

-

GST_TAG_CAPTURE_DIGITAL_ZOOM

+

GST_TAG_CAPTURE_EXPOSURE_MODE

-

"capture-digital-zoom"

+

"capture-exposure-mode"

-

GST_TYPE_FRACTION

+

G_TYPE_UINT

-

Digital - zoom ratio"
(zero, means digital zoom not used)

+

0- + Auto exposure;
1- Manual exposure;
2- Auto bracket (the + camera shoots a series of frames of the same scene at different + exposure settings)

-

EXIF_TAG_DIGITAL_ZOOM_RATIO

+

EXIF_TAG_EXPOSURE_MODE

-

@@ -607,20 +664,20 @@

-

-

GST_TAG_CAPTURE_SHUTTER_SPEED

+

GST_TAG_CAPTURE_SCENE_CAPTURE_TYPE

-

"capture-shutter-speed"

+

"capture-scene-capture-type"

-

GST_TYPE_FRACTION

+

G_TYPE_UINT

-

Saturation
(in - APEX units)

+

0- + Standard;
1- Landscape;
2- Portrait;
3- Night scene

-

EXIF_TAG_SHUTTER_SPEED_VALUE

+

EXIF_TAG_SCENE_CAPTURE_TYPE

-

@@ -634,29 +691,20 @@

-

-

GST_TAG_CAPTURE_WHITE_BALANCE

+

GST_TAG_CAPTURE_SHUTTER_SPEED

-

"capture-white-balance"

+

"capture-shutter-speed"

-

G_TYPE_UINT

+

GST_TYPE_FRACTION

-

0- - Auto; 1- Off -

-

*** - exif is until here *** -

-

2- - Sunlight ; 3- Cloudy ; 4- Shade ; 5- Tungsten ; 6- Fluorescent ; - 7- Incandescent; 8- Flash ; 9- Horizon (sun on the horizon)

+

Saturation
(in + APEX units)

-

EXIF_TAG_WHITE_BALANCE

-

(only - 0 and 1)

+

EXIF_TAG_SHUTTER_SPEED_VALUE

-

@@ -670,21 +718,29 @@

-

-

GST_TAG_CREATOR_TOOL

+

GST_TAG_CAPTURE_WHITE_BALANCE

-

"creator-tool"

+

"capture-white-balance"

-

G_TYPE_STRING

+

G_TYPE_UINT

-

The - name of the first known tool used to create the resource. Or - firmware or driver version of device

+

0- + Auto; 1- Off +

+

*** + exif is until here *** +

+

2- + Sunlight ; 3- Cloudy ; 4- Shade ; 5- Tungsten ; 6- Fluorescent ; + 7- Incandescent; 8- Flash ; 9- Horizon (sun on the horizon)

-

EXIF_TAG_SOFTWARE

+

EXIF_TAG_WHITE_BALANCE

+

(only + 0 and 1)

-

@@ -698,20 +754,21 @@

-

-

GST_TAG_DEVICE_MAKE

+

GST_TAG_CREATOR_TOOL

-

"device-make"

+

"creator-tool"

G_TYPE_STRING

The - manufacturer of the recording equipment

+ name of the first known tool used to create the resource. Or + firmware or driver version of device

-

EXIF_TAG_MAKE

+

EXIF_TAG_SOFTWARE

-

@@ -725,20 +782,20 @@

-

-

GST_TAG_DEVICE_MODEL

+

GST_TAG_DEVICE_MAKE

-

"device-model"

+

"device-make"

G_TYPE_STRING

The - model name or model number of the equipment

+ manufacturer of the recording equipment

-

EXIF_TAG_MODEL

+

EXIF_TAG_MAKE

-

@@ -752,20 +809,20 @@

-

-

GST_TAG_IMAGE_HEIGHT

+

GST_TAG_DEVICE_MODEL

-

"image-height"

+

"device-model"

-

G_TYPE_UINT

+

G_TYPE_STRING

-

Image - height in pixels

+

The + model name or model number of the equipment

-

EXIF_TAG_PIXEL_Y_DIMENSION

+

EXIF_TAG_MODEL

-

@@ -779,20 +836,20 @@

-

-

GST_TAG_IMAGE_WIDTH

+

GST_TAG_IMAGE_HEIGHT

-

"image-width"

+

"image-height"

G_TYPE_UINT

Image - width in pixels

+ height in pixels

-

EXIF_TAG_PIXEL_X_DIMENSION

+

EXIF_TAG_PIXEL_Y_DIMENSION

-

@@ -806,21 +863,20 @@

-

-

GST_TAG_IMAGE_XRESOLUTION

+

GST_TAG_IMAGE_WIDTH

-

"image-xresolution"

+

"image-width"

-

GST_TYPE_FRACTION

+

G_TYPE_UINT

-

Horizontal - resolution in pixels per inch.
Here it is always in inches.
In - EXIF it depends on EXIF_TAG_RESOLUTION_UNIT

+

Image + width in pixels

-

EXIF_TAG_X_RESOLUTION

+

EXIF_TAG_PIXEL_X_DIMENSION

-

@@ -834,21 +890,21 @@

-

-

GST_TAG_IMAGE_YRESOLUTION

+

GST_TAG_IMAGE_XRESOLUTION

-

"image-yresolution"

+

"image-xresolution"

GST_TYPE_FRACTION

-

Vertical +

Horizontal resolution in pixels per inch.
Here it is always in inches.
In EXIF it depends on EXIF_TAG_RESOLUTION_UNIT

-

EXIF_TAG_Y_RESOLUTION

+

EXIF_TAG_X_RESOLUTION

-

@@ -859,27 +915,27 @@ -

GST_TAG_COMPOSER

+

-

-

-

+

GST_TAG_IMAGE_YRESOLUTION

-

"composer"

+

"image-yresolution"

-

G_TYPE_STRING

+

GST_TYPE_FRACTION

-

Name - of the creator of the object, e.g. writer, photographer or graphic - artist.

+

Vertical + resolution in pixels per inch.
Here it is always in inches.
In + EXIF it depends on EXIF_TAG_RESOLUTION_UNIT

-

-

+

EXIF_TAG_Y_RESOLUTION

-

IPTC_TAG_BYLINE

+

-

-

@@ -887,82 +943,110 @@ -

GST_TAG_COPYRIGHT

+

GST_TAG_COMPOSER

-

-

"copyright"

+

"composer"

G_TYPE_STRING

-

Any - necessary copyright notice.

+

Name + of the creator of the object, e.g. writer, photographer or graphic + artist.

-

-

IPTC_TAG_COPYRIGHT_NOTICE

+

IPTC_TAG_BYLINE

-

dc:rights”

+

-

-

GST_TAG_DESCRIPTION

+

GST_TAG_COPYRIGHT

-

-

"description"

+

"copyright"

G_TYPE_STRING

-

A - textual description of the data

+

Any + necessary copyright notice.

-

-

IPTC_TAG_CAPTION

+

IPTC_TAG_COPYRIGHT_NOTICE

-

dc:description”

+

dc:rights”

-

GST_TAG_TITLE

+

GST_TAG_DESCRIPTION

-

-

"title"

+

"description"

G_TYPE_STRING

A - shorthand reference for the object.

+ textual description of the data

-

-

IPTC_TAG_OBJECT_NAME

+

IPTC_TAG_CAPTION

+

dc:description”

+ + + + +

GST_TAG_TITLE

+ + +

-

+ + +

"title"

+ + +

G_TYPE_STRING

+ + +

A + shorthand reference for the object.

+ + +

-

+ + +

IPTC_TAG_OBJECT_NAME

+ +

dc:title”

diff --git a/ext/metadata/metadataexif.c b/ext/metadata/metadataexif.c index 33052869..14527fb6 100644 --- a/ext/metadata/metadataexif.c +++ b/ext/metadata/metadataexif.c @@ -146,6 +146,9 @@ static MapIntStr mappedTags[] = { {EXIF_TAG_BRIGHTNESS_VALUE, /*SRATIONAL,*/ EXIF_IFD_EXIF, GST_TAG_CAPTURE_BRIGHTNESS /*GST_TYPE_FRACTION*/}, + {EXIF_TAG_COLOR_SPACE, /*SHORT,*/ EXIF_IFD_EXIF, + GST_TAG_CAPTURE_COLOR_SPACE /*G_TYPE_UINT*/}, + {EXIF_TAG_CONTRAST, /*SHORT,*/ EXIF_IFD_EXIF, GST_TAG_CAPTURE_CONTRAST /*G_TYPE_INT*/}, @@ -158,6 +161,9 @@ static MapIntStr mappedTags[] = { {EXIF_TAG_EXPOSURE_PROGRAM, /*SHORT,*/ EXIF_IFD_EXIF, GST_TAG_CAPTURE_EXPOSURE_PROGRAM /*G_TYPE_UINT*/}, + {EXIF_TAG_EXPOSURE_MODE, /*SHORT,*/ EXIF_IFD_EXIF, + GST_TAG_CAPTURE_EXPOSURE_MODE /*G_TYPE_UINT*/}, + {EXIF_TAG_EXPOSURE_TIME, /*RATIONAL,*/ EXIF_IFD_EXIF, GST_TAG_CAPTURE_EXPOSURE_TIME /*GST_TYPE_FRACTION*/}, @@ -185,6 +191,9 @@ static MapIntStr mappedTags[] = { {EXIF_TAG_SATURATION, /*SHORT,*/ EXIF_IFD_EXIF, GST_TAG_CAPTURE_SATURATION /*G_TYPE_INT*/}, + {EXIF_TAG_SCENE_CAPTURE_TYPE, /*SHORT,*/ EXIF_IFD_EXIF, + GST_TAG_CAPTURE_SCENE_CAPTURE_TYPE /*G_TYPE_UINT*/}, + {EXIF_TAG_SHUTTER_SPEED_VALUE, /*SRATIONAL,*/ EXIF_IFD_EXIF, GST_TAG_CAPTURE_SHUTTER_SPEED /*GST_TYPE_FRACTION*/}, diff --git a/ext/metadata/metadatatags.c b/ext/metadata/metadatatags.c index fd4d27e0..e8b0c1f3 100644 --- a/ext/metadata/metadatatags.c +++ b/ext/metadata/metadatatags.c @@ -126,6 +126,14 @@ metadata_tags_exif_register (void) GST_TYPE_FRACTION, GST_TAG_CAPTURE_BRIGHTNESS, "Brightness (APEX from -99.99 to 99.99)", NULL); + /* + * 1- sRGB + * 0xFFFF - Uncalibrated + */ + + gst_tag_register (GST_TAG_CAPTURE_COLOR_SPACE, GST_TAG_FLAG_META, + G_TYPE_UINT, GST_TAG_CAPTURE_COLOR_SPACE, "Color Space", NULL); + /* from -100 to 100 [-100, -34] - soft @@ -134,7 +142,7 @@ metadata_tags_exif_register (void) *** exif is just 0, 1, 2 (normal, soft and hard) */ gst_tag_register (GST_TAG_CAPTURE_CONTRAST, GST_TAG_FLAG_META, G_TYPE_INT, - GST_TAG_CAPTURE_CONTRAST, "", NULL); + GST_TAG_CAPTURE_CONTRAST, "Contrast", NULL); /* * 0- Normal process @@ -151,6 +159,16 @@ metadata_tags_exif_register (void) GST_TYPE_FRACTION, GST_TAG_CAPTURE_DIGITAL_ZOOM, "Digital zoom ratio", NULL); + /* + * 0 - Auto exposure + * 1 - Manual exposure + * 2 - Auto bracket (the camera shoots a series of frames of the same scene + * at different exposure settings) + */ + + gst_tag_register (GST_TAG_CAPTURE_EXPOSURE_MODE, GST_TAG_FLAG_META, + G_TYPE_UINT, GST_TAG_CAPTURE_EXPOSURE_MODE, "Exposure Mode", NULL); + /* 0 - not defined 1- Manual @@ -310,6 +328,15 @@ metadata_tags_exif_register (void) gst_tag_register (GST_TAG_CAPTURE_SATURATION, GST_TAG_FLAG_META, G_TYPE_INT, GST_TAG_CAPTURE_SATURATION, "The saturation", NULL); + /* + * 0 - Standard + * 1 - Landscape + * 2 - Portrait + * 3 - Night scene + */ + gst_tag_register (GST_TAG_CAPTURE_SCENE_CAPTURE_TYPE, GST_TAG_FLAG_META, + G_TYPE_UINT, GST_TAG_CAPTURE_SCENE_CAPTURE_TYPE, "Scene Type", NULL); + gst_tag_register (GST_TAG_CAPTURE_SHUTTER_SPEED, GST_TAG_FLAG_META, GST_TYPE_FRACTION, GST_TAG_CAPTURE_SHUTTER_SPEED, "Shutter speed (APEX)", NULL); diff --git a/ext/metadata/metadatatags.h b/ext/metadata/metadatatags.h index 0db30c54..1e298166 100644 --- a/ext/metadata/metadatatags.h +++ b/ext/metadata/metadatatags.h @@ -81,9 +81,11 @@ typedef enum { #define GST_TAG_CAPTURE_APERTURE "capture-aperture" #define GST_TAG_CAPTURE_BRIGHTNESS "capture-brightness" +#define GST_TAG_CAPTURE_COLOR_SPACE "capture-color-space" #define GST_TAG_CAPTURE_CONTRAST "capture-contrast" #define GST_TAG_CAPTURE_CUSTOM_RENDERED "capture-custom-rendered" #define GST_TAG_CAPTURE_DIGITAL_ZOOM "capture-digital-zoom" +#define GST_TAG_CAPTURE_EXPOSURE_MODE "capture-exposure-mode" #define GST_TAG_CAPTURE_EXPOSURE_PROGRAM "capture-exposure-program" #define GST_TAG_CAPTURE_EXPOSURE_TIME "capture-exposure-time" #define GST_TAG_CAPTURE_FLASH "capture-flash" @@ -94,6 +96,7 @@ typedef enum { #define GST_TAG_CAPTURE_LIGHT_SOURCE "capture-light-source" #define GST_TAG_CAPTURE_ORIENTATION "capture-orientation" #define GST_TAG_CAPTURE_SATURATION "capture-saturation" +#define GST_TAG_CAPTURE_SCENE_CAPTURE_TYPE "capture-scene-capture-type" #define GST_TAG_CAPTURE_SHUTTER_SPEED "capture-shutter-speed" #define GST_TAG_CAPTURE_WHITE_BALANCE "capture-white-balance" diff --git a/tests/icles/metadata_editor.c b/tests/icles/metadata_editor.c index d59e4cd3..02212bb2 100644 --- a/tests/icles/metadata_editor.c +++ b/tests/icles/metadata_editor.c @@ -62,11 +62,22 @@ enum COL_VALUE, NUM_COLS }; - -#define ENC_ERROR (-1) -#define ENC_DONE (0) +/* *INDENT-OFF* */ +typedef enum _AppOptions { + APP_OPT_DEMUX_EXIF = (1 << 0), + APP_OPT_DEMUX_IPTC = (1 << 1), + APP_OPT_DEMUX_XMP = (1 << 2), + APP_OPT_MUX_EXIF = (1 << 3), + APP_OPT_MUX_IPTC = (1 << 4), + APP_OPT_MUX_XMP = (1 << 5), + APP_OPT_ALL = (1 << 6) - 1, +} AppOptions; + +#define ENC_ERROR (-1) +#define ENC_DONE (0) #define ENC_UNKNOWN (1) +/* *INDENT-OFF* */ /* * functions prototypes @@ -79,7 +90,7 @@ static int me_gst_setup_view_pipeline (const gchar * filename, GdkWindow * window); static int me_gst_setup_capture_pipeline (const gchar * src_file, const gchar * dest_file, - gint * encode_status); + gint * encode_status, gboolean use_v4l2); static int me_gst_setup_encode_pipeline (const gchar * src_file, const gchar * dest_file, gint * encode_status); @@ -87,6 +98,7 @@ me_gst_setup_encode_pipeline (const gchar * src_file, const gchar * dest_file, /* ui related functions */ static void ui_refresh (); +static void process_file(); /* * Global Vars @@ -103,6 +115,8 @@ GstElement *gst_video_sink = NULL; GstElement *gst_file_sink = NULL; GstElement *gst_pipeline = NULL; +AppOptions app_options = APP_OPT_ALL; + GstTagList *tag_list = NULL; GladeXML *ui_glade_xml = NULL; @@ -113,7 +127,8 @@ GtkWidget *ui_tree = NULL; GtkEntry *ui_entry_insert_tag = NULL; GtkEntry *ui_entry_insert_value = NULL; -GtkToggleButton *ui_chk_bnt_capture = NULL; +GtkToggleButton *ui_chk_bnt_capture_v4l2 = NULL; +GtkToggleButton *ui_chk_bnt_capture_test = NULL; GString *filename = NULL; @@ -264,6 +279,10 @@ on_buttonInsert_clicked (GtkButton * button, gpointer user_data) const gchar *tag = gtk_entry_get_text (ui_entry_insert_tag); const gchar *value = gtk_entry_get_text (ui_entry_insert_value); + if ( tag_list == NULL ) { + tag_list = gst_tag_list_new (); + } + if (tag && value && tag[0] != '\0') { /* insert just new tags (the ones already in list should be modified) */ @@ -314,16 +333,20 @@ on_buttonSaveFile_clicked (GtkButton * button, gpointer user_data) GString *src_file = NULL; gint enc_status = ENC_UNKNOWN; + const gboolean use_v4l2 = + gtk_toggle_button_get_active (ui_chk_bnt_capture_v4l2); + const gboolean use_test = + gtk_toggle_button_get_active (ui_chk_bnt_capture_test); gst_element_set_state (gst_pipeline, GST_STATE_NULL); gst_element_get_state (gst_pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); src_file = g_string_new (filename->str); - if (gtk_toggle_button_get_active (ui_chk_bnt_capture)) { + if (use_v4l2 || use_test) { setup_new_filename (filename, ".jpg"); if (me_gst_setup_capture_pipeline (src_file->str, filename->str, - &enc_status)) { + &enc_status, use_v4l2)) { goto done; } } else { @@ -381,13 +404,130 @@ done: } void -on_checkbuttonCapture_toggled (GtkToggleButton * togglebutton, +on_checkbuttonCaptureV4l2_toggled (GtkToggleButton * togglebutton, + gpointer user_data) +{ + if (gtk_toggle_button_get_active (togglebutton)) + gtk_toggle_button_set_active(ui_chk_bnt_capture_test, FALSE); +} + +void +on_checkbuttonCaptureTest_toggled (GtkToggleButton * togglebutton, + gpointer user_data) +{ + if (gtk_toggle_button_get_active (togglebutton)) + gtk_toggle_button_set_active(ui_chk_bnt_capture_v4l2, FALSE); +} + +void +on_checkbuttonOptionsDemuxExif_toggled (GtkToggleButton * togglebutton, + gpointer user_data) +{ + if (gtk_toggle_button_get_active (togglebutton)) + app_options |= APP_OPT_DEMUX_EXIF; + else + app_options &= ~APP_OPT_DEMUX_EXIF; +} + +void +on_checkbuttonOptionsDemuxIptc_toggled (GtkToggleButton * togglebutton, + gpointer user_data) +{ + if (gtk_toggle_button_get_active (togglebutton)) + app_options |= APP_OPT_DEMUX_IPTC; + else + app_options &= ~APP_OPT_DEMUX_IPTC; +} + +void +on_checkbuttonOptionsDemuxXmp_toggled (GtkToggleButton * togglebutton, + gpointer user_data) +{ + if (gtk_toggle_button_get_active (togglebutton)) + app_options |= APP_OPT_DEMUX_XMP; + else + app_options &= ~APP_OPT_DEMUX_XMP; +} + +void +on_checkbuttonOptionsMuxExif_toggled (GtkToggleButton * togglebutton, gpointer user_data) { - if (gtk_toggle_button_get_active (togglebutton)) { + if (gtk_toggle_button_get_active (togglebutton)) + app_options |= APP_OPT_MUX_EXIF; + else + app_options &= ~APP_OPT_MUX_EXIF; +} + +void +on_checkbuttonOptionsMuxIptc_toggled (GtkToggleButton * togglebutton, + gpointer user_data) +{ + if (gtk_toggle_button_get_active (togglebutton)) + app_options |= APP_OPT_MUX_IPTC; + else + app_options &= ~APP_OPT_MUX_IPTC; +} + +void +on_checkbuttonOptionsMuxXmp_toggled (GtkToggleButton * togglebutton, + gpointer user_data) +{ + if (gtk_toggle_button_get_active (togglebutton)) + app_options |= APP_OPT_MUX_XMP; + else + app_options &= ~APP_OPT_MUX_XMP; +} + +void +on_buttonOpenFile_clicked (GtkButton * button, gpointer user_data) +{ + GtkWidget *dialog; + gboolean open = FALSE; + + dialog = gtk_file_chooser_dialog_new ("Open File", + GTK_WINDOW(ui_main_window), + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL); + + if (filename) { + const char *p = filename->str; + char *q = filename->str + filename->len - 1; + for (;p != q; --q) { + if ( *q == '/' ) + break; + } + if ( p != q ) + *q = '\0'; + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER (dialog), + filename->str); + if ( p != q ) + *q = '/'; + } + + open = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT; + + if (open) { + char *str; + + str = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); + if (filename) + g_string_free (filename, TRUE); + filename = g_string_new(str); + g_free (str); + } + + gtk_widget_destroy (dialog); + + if (open) { + process_file(); } + } + /* * UI handling functions */ @@ -519,6 +659,62 @@ ui_refresh () gtk_window_set_title (GTK_WINDOW (ui_main_window), filename->str); } +static int +ui_connect_signals() +{ + + glade_xml_signal_connect(ui_glade_xml, "on_checkbuttonCaptureV4l2_toggled", + (GCallback)on_checkbuttonCaptureV4l2_toggled); + + glade_xml_signal_connect(ui_glade_xml, "on_checkbuttonCaptureTest_toggled", + (GCallback)on_checkbuttonCaptureTest_toggled); + + glade_xml_signal_connect(ui_glade_xml, + "on_checkbuttonOptionsDemuxExif_toggled", + (GCallback) on_checkbuttonOptionsDemuxExif_toggled); + + glade_xml_signal_connect(ui_glade_xml, + "on_checkbuttonOptionsDemuxIptc_toggled", + (GCallback) on_checkbuttonOptionsDemuxIptc_toggled); + + glade_xml_signal_connect(ui_glade_xml, + "on_checkbuttonOptionsDemuxXmp_toggled", + (GCallback) on_checkbuttonOptionsDemuxXmp_toggled); + + glade_xml_signal_connect(ui_glade_xml, + "on_checkbuttonOptionsMuxExif_toggled", + (GCallback) on_checkbuttonOptionsMuxExif_toggled); + + glade_xml_signal_connect(ui_glade_xml, + "on_checkbuttonOptionsMuxIptc_toggled", + (GCallback) on_checkbuttonOptionsMuxIptc_toggled); + + glade_xml_signal_connect(ui_glade_xml, + "on_checkbuttonOptionsMuxXmp_toggled", + (GCallback) on_checkbuttonOptionsMuxXmp_toggled); + + glade_xml_signal_connect(ui_glade_xml, "on_buttonSaveFile_clicked", + (GCallback)on_buttonSaveFile_clicked); + + glade_xml_signal_connect(ui_glade_xml, "on_windowMain_delete_event", + (GCallback)on_windowMain_delete_event); + + glade_xml_signal_connect(ui_glade_xml, "on_drawingMain_expose_event", + (GCallback)on_drawingMain_expose_event); + + glade_xml_signal_connect(ui_glade_xml, "on_windowMain_configure_event", + (GCallback)on_windowMain_configure_event); + + glade_xml_signal_connect(ui_glade_xml, "on_buttonInsert_clicked", + (GCallback)on_buttonInsert_clicked); + + glade_xml_signal_connect(ui_glade_xml, "on_buttonOpenFile_clicked", + (GCallback)on_buttonOpenFile_clicked); + + return 0; + +} + static int ui_create () { @@ -544,18 +740,23 @@ ui_create () ui_entry_insert_value = GTK_ENTRY (glade_xml_get_widget (ui_glade_xml, "entryValue")); - ui_chk_bnt_capture = + ui_chk_bnt_capture_v4l2 = + GTK_TOGGLE_BUTTON (glade_xml_get_widget (ui_glade_xml, + "checkbuttonCaptureV4l2")); + + ui_chk_bnt_capture_test = GTK_TOGGLE_BUTTON (glade_xml_get_widget (ui_glade_xml, - "checkbuttonCapture")); + "checkbuttonCaptureTest")); - if (!(ui_main_window && ui_drawing && ui_tree && ui_entry_insert_tag - && ui_entry_insert_value && ui_chk_bnt_capture)) { + if (!(ui_main_window && ui_drawing && ui_tree + && ui_entry_insert_tag && ui_entry_insert_value + && ui_chk_bnt_capture_v4l2 && ui_chk_bnt_capture_test)) { fprintf (stderr, "Some widgets couldn't be created\n"); ret = -105; goto done; } - glade_xml_signal_autoconnect (ui_glade_xml); + ui_connect_signals(); ui_setup_tree_view (GTK_TREE_VIEW (ui_tree)); @@ -752,7 +953,7 @@ done: static int me_gst_setup_capture_pipeline (const gchar * src_file, const gchar * dest_file, - gint * encode_status) + gint * encode_status, gboolean use_v4l2) { int ret = 0; GstBus *bus = NULL; @@ -763,7 +964,10 @@ me_gst_setup_capture_pipeline (const gchar * src_file, const gchar * dest_file, me_gst_cleanup_elements (); /* create elements */ - gst_source = gst_element_factory_make ("v4l2src", NULL); + if ( use_v4l2 ) + gst_source = gst_element_factory_make ("v4l2src", NULL); + else + gst_source = gst_element_factory_make ("videotestsrc", NULL); gst_video_convert = gst_element_factory_make ("ffmpegcolorspace", NULL); gst_image_enc = gst_element_factory_make ("jpegenc", NULL); gst_metadata_mux = gst_element_factory_make ("metadatamux", NULL); @@ -788,6 +992,20 @@ me_gst_setup_capture_pipeline (const gchar * src_file, const gchar * dest_file, /* set elements's properties */ g_object_set (gst_source, "num-buffers", 1, NULL); g_object_set (gst_file_sink, "location", dest_file, NULL); + if ( app_options & APP_OPT_MUX_EXIF ) + g_object_set (gst_metadata_mux, "exif", TRUE, NULL); + else + g_object_set (gst_metadata_mux, "exif", FALSE, NULL); + + if ( app_options & APP_OPT_MUX_IPTC ) + g_object_set (gst_metadata_mux, "iptc", TRUE, NULL); + else + g_object_set (gst_metadata_mux, "iptc", FALSE, NULL); + + if ( app_options & APP_OPT_MUX_XMP ) + g_object_set (gst_metadata_mux, "xmp", TRUE, NULL); + else + g_object_set (gst_metadata_mux, "xmp", FALSE, NULL); /* adding and linking elements */ gst_bin_add_many (GST_BIN (gst_pipeline), gst_source, gst_video_convert, @@ -859,6 +1077,36 @@ me_gst_setup_encode_pipeline (const gchar * src_file, const gchar * dest_file, g_object_set (gst_source, "location", src_file, NULL); g_object_set (gst_file_sink, "location", dest_file, NULL); + if ( app_options & APP_OPT_DEMUX_EXIF ) + g_object_set (gst_metadata_demux, "exif", TRUE, NULL); + else + g_object_set (gst_metadata_demux, "exif", FALSE, NULL); + + if ( app_options & APP_OPT_DEMUX_IPTC ) + g_object_set (gst_metadata_demux, "iptc", TRUE, NULL); + else + g_object_set (gst_metadata_demux, "iptc", FALSE, NULL); + + if ( app_options & APP_OPT_DEMUX_XMP ) + g_object_set (gst_metadata_demux, "xmp", TRUE, NULL); + else + g_object_set (gst_metadata_demux, "xmp", FALSE, NULL); + + if ( app_options & APP_OPT_MUX_EXIF ) + g_object_set (gst_metadata_mux, "exif", TRUE, NULL); + else + g_object_set (gst_metadata_mux, "exif", FALSE, NULL); + + if ( app_options & APP_OPT_MUX_IPTC ) + g_object_set (gst_metadata_mux, "iptc", TRUE, NULL); + else + g_object_set (gst_metadata_mux, "iptc", FALSE, NULL); + + if ( app_options & APP_OPT_MUX_XMP ) + g_object_set (gst_metadata_mux, "xmp", TRUE, NULL); + else + g_object_set (gst_metadata_mux, "xmp", FALSE, NULL); + /* adding and linking elements */ gst_bin_add_many (GST_BIN (gst_pipeline), gst_source, gst_metadata_demux, gst_metadata_mux, gst_file_sink, NULL); @@ -967,34 +1215,47 @@ done: } +static void +process_file() { + /* filename for future usage (title and file name to be created) */ + me_gst_cleanup_elements (); + + if (tag_list) { + gst_tag_list_free (tag_list); + tag_list = NULL; + } + + /* create pipeline */ + me_gst_setup_view_pipeline (filename->str, ui_drawing->window); + + gst_element_set_state (gst_pipeline, GST_STATE_PLAYING); + + ui_refresh (); + +} + int main (int argc, char *argv[]) { int ret = 0; - if (argc != 2) { - fprintf (stderr, "Give the name of a jpeg file as argument\n"); - ret = -5; - goto done; + if (argc >= 2) { + if (filename) + g_string_free (filename, TRUE); + filename = g_string_new (argv[1]); } gst_init (&argc, &argv); gtk_init (&argc, &argv); - /* filename for future usage (title and file name to be created) */ - if (filename) - g_string_free (filename, TRUE); - filename = g_string_new (argv[1]); - /* create UI */ if ((ret = ui_create ())) { goto done; } - /* create pipeline */ - me_gst_setup_view_pipeline (argv[1], ui_drawing->window); - - gst_element_set_state (gst_pipeline, GST_STATE_PLAYING); + if (argc >= 2) { + process_file(); + } gtk_main (); diff --git a/tests/icles/metadata_editor.glade b/tests/icles/metadata_editor.glade index 871d8e6b..521e82f8 100644 --- a/tests/icles/metadata_editor.glade +++ b/tests/icles/metadata_editor.glade @@ -1,6 +1,6 @@ - + 800 @@ -96,6 +96,7 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Insert + 0 @@ -110,6 +111,7 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Save File + 0 @@ -124,13 +126,188 @@ - + True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Capture image from camera - True - + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Capture image from camera + 0 + True + + + + False + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Capture image from videotestsrc + 0 + True + + + + False + 1 + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Open File... + 0 + + + + 2 + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Demux options: + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + exif + 0 + True + True + + + + False + 1 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + iptc + 0 + True + True + + + + False + 2 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + xmp + 0 + True + True + + + + False + 3 + + + + + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Mux options: + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + exif + 0 + True + True + + + + False + 1 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + iptc + 0 + True + True + + + + False + 2 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + xmp + 0 + True + True + + + + False + 3 + + + + + 2 + + 2 @@ -145,6 +322,7 @@ + True False -- cgit v1.2.1