1 /* gjacktransport - jack transport slider
2 * Copyright (C) 2006 Robin Gareus <robin AT gareus.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 #include "interface.h"
31 #include "gjacktransport.h"
32 #include "framerate.h"
36 FrameRate
*jffr
; //< jack video FPS
37 FrameRate
*uffr
; //< user set FPS
38 FrameRate
*fffr
; //< pointer to currently used.
40 gjtdata
*stg
; // settings
41 int mem
= 0; // current mem
42 double stride
= 10; // seek stride (in seconds)
44 int no_lash
= 0; // don't try to use LASH
47 char *smpte_font
= NULL
;
50 # include <lash/lash.h>
51 void lash_setup(void); //< prototype - fn defined in lash.c
52 lash_client_t
*lash_client
= NULL
;
54 void lash_process(void);
56 // prototypes - defined in callbacks.c
57 gboolean
gpolljack (gpointer data
);
58 void initialize_gjt (void);
59 void update_spinbtns(void);
60 void update_combotxt (int pos
);
61 gboolean
limit_height (gpointer data
);
63 // prototypes - defined in resourceconfig.c
65 void try_load_rc_file (char *filename
);
67 static GdkPixmap
*gjt_icon_pixmap
;
68 static GdkBitmap
*gjt_icon_mask
;
69 #include "gjt_icon.xpm"
72 static void usage (int status
) {
73 printf("%s - JACK transport slider.\n",program_name
);
74 printf("usage: %s [Options] [start-marker [end-marker]]\n",program_name
);
77 " -h, --help display this help and exit\n"
78 " -V, --version print version information and exit\n"
79 " -q, --quiet, --silent inhibit usual output\n"
81 "unit for start/end markers: seconds. (eg 10 60.5)\n"
86 static void printversion (void) {
87 printf ("gjacktransport %s\n (C) GPL 2007, 2010 Robin Gareus <robin@gareus.org>\n", VERSION
);
90 gboolean
glashproc (gpointer data
) {
96 static struct option
const long_options
[] =
98 {"help", no_argument
, 0, 'h'},
99 {"quiet", no_argument
, 0, 'q'},
100 {"silent", no_argument
, 0, 'q'},
101 {"version", no_argument
, 0, 'V'},
107 decode_switches (int argc
, char **argv
)
110 while ((c
= getopt_long (argc
, argv
,
111 "q" /* quiet or silent */
115 long_options
, (int *) 0)) != EOF
)
118 case 'q': /* --quiet, --silent */
121 case 'L': /* --nolash */
130 usage (EXIT_FAILURE
);
137 int main (int argc
, char *argv
[]) {
139 program_name
= argv
[0];
142 bindtextdomain (GETTEXT_PACKAGE
, PACKAGE_LOCALE_DIR
);
143 bind_textdomain_codeset (GETTEXT_PACKAGE
, "UTF-8");
144 textdomain (GETTEXT_PACKAGE
);
147 gtk_init(&argc
, &argv
);
149 lash_args_t
*lash_args
= lash_extract_args(&argc
, &argv
);
154 int i
= decode_switches (argc
, argv
);
155 if (argc
> i
+2 ) usage(1);
157 window1
= create_window1();
159 w
= lookup_widget(window1
,"combobox1");
160 gtk_combo_box_set_active (GTK_COMBO_BOX(w
),6);
161 w
= lookup_widget(window1
,"combobox2");
162 gtk_combo_box_set_active (GTK_COMBO_BOX(w
),2);
163 w
= lookup_widget(window1
,"combobox3");
164 gtk_combo_box_set_active (GTK_COMBO_BOX(w
),0);
165 w
= lookup_widget(window1
,"combobox4");
166 gtk_combo_box_set_active (GTK_COMBO_BOX(w
),0);
167 w
= lookup_widget(window1
,"combobox5");
168 gtk_combo_box_set_active (GTK_COMBO_BOX(w
),0);
173 /* set start end end marker */
175 stg
[0].unit
=UNIT_SEC
;
176 stg
[0].start
=strtod(argv
[i
],NULL
); //* unit_table[stg[0].unit];
177 stg
[0].end
=strtod(argv
[i
+1],NULL
); //* unit_table[stg[0].unit];
178 } else if (argc
-i
== 1) {
179 /* set end marker only */
181 stg
[0].unit
=UNIT_SEC
;
182 stg
[0].end
=strtod(argv
[i
],NULL
);; //* unit_table[stg[0].unit];
185 for (i
=0;i
<max_mem
; i
++) {
189 if (mem
>= max_mem
) mem
=max_mem
-1;
191 gtk_combo_box_set_active (GTK_COMBO_BOX(w
),mem
);
194 gtk_widget_modify_font (
195 lookup_widget(window1
,"label_smpte"),
196 pango_font_description_from_string (smpte_font
));
201 lash_client
= lash_init (lash_args
, PACKAGE_NAME
, 0 | LASH_Config_Data_Set
,LASH_PROTOCOL (2,0));
203 fprintf(stderr
, "could not initialise LASH!\n");
206 if (!want_quiet
) printf("Connected to LASH.\n");
208 //lash_args_destroy(lash_args);
213 gtk_widget_show (window1
);
214 gjt_icon_pixmap
= gdk_pixmap_create_from_xpm_d (window1
->window
, &gjt_icon_mask
, NULL
, gjt_icon_xpm
);
216 gdk_window_set_icon(window1
->window
, NULL
, gjt_icon_pixmap
, gjt_icon_mask
);
217 //gdk_pixbuf_unref (window1_icon_pixbuf);
218 gtk_idle_add(limit_height
, NULL
);
219 g_timeout_add(40,gpolljack
,NULL
);
222 g_timeout_add(250,glashproc
,NULL
);
229 for (i
=0;i
<max_mem
;i
++){
230 if (stg
[i
].name
) free(stg
[i
].name
);
233 if (smpte_font
) free(smpte_font
);
236 /* vi:set ts=8 sw=2: */