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
[MAX_MEM
]; // 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 # include <lash/lash.h>
48 void lash_setup(void); //< prototype - fn defined in lash.c
49 lash_client_t
*lash_client
= NULL
;
51 void lash_process(void);
53 // prototypes - defined in callbacks.c
54 gboolean
gpolljack (gpointer data
);
55 void initialize_gjt (void);
56 void update_spinbtns(void);
58 // prototypes - defined in resourceconfig.c
60 void try_load_rc_file (char *filename
);
62 static GdkPixmap
*gjt_icon_pixmap
;
63 static GdkBitmap
*gjt_icon_mask
;
64 #include "gjt_icon.xpm"
67 static void usage (int status
) {
68 printf("%s - JACK transport slider.\n",program_name
);
69 printf("usage: %s [Options] [start-marker [end-marker]]\n",program_name
);
72 " -h, --help display this help and exit\n"
73 " -V, --version print version information and exit\n"
74 " -q, --quiet, --silent inhibit usual output\n"
76 "unit for start/end markers: seconds. (eg 10 60.5)\n"
81 static void printversion (void) {
82 printf ("gjacktransport %s\n (C) GPL 2007, 2010 Robin Gareus <robin@gareus.org>\n", VERSION
);
85 gboolean
glashproc (gpointer data
) {
91 static struct option
const long_options
[] =
93 {"help", no_argument
, 0, 'h'},
94 {"quiet", no_argument
, 0, 'q'},
95 {"silent", no_argument
, 0, 'q'},
96 {"version", no_argument
, 0, 'V'},
102 decode_switches (int argc
, char **argv
)
105 while ((c
= getopt_long (argc
, argv
,
106 "q" /* quiet or silent */
110 long_options
, (int *) 0)) != EOF
)
113 case 'q': /* --quiet, --silent */
116 case 'L': /* --nolash */
125 usage (EXIT_FAILURE
);
132 int main (int argc
, char *argv
[]) {
134 program_name
= argv
[0];
137 bindtextdomain (GETTEXT_PACKAGE
, PACKAGE_LOCALE_DIR
);
138 bind_textdomain_codeset (GETTEXT_PACKAGE
, "UTF-8");
139 textdomain (GETTEXT_PACKAGE
);
142 gtk_init(&argc
, &argv
);
144 lash_args_t
*lash_args
= lash_extract_args(&argc
, &argv
);
149 int i
= decode_switches (argc
, argv
);
150 if (argc
> i
+2 ) usage(1);
152 window1
= create_window1();
154 w
= lookup_widget(window1
,"combobox1");
155 gtk_combo_box_set_active (GTK_COMBO_BOX(w
),6);
156 w
= lookup_widget(window1
,"combobox2");
157 gtk_combo_box_set_active (GTK_COMBO_BOX(w
),2);
158 w
= lookup_widget(window1
,"combobox3");
159 gtk_combo_box_set_active (GTK_COMBO_BOX(w
),0);
160 w
= lookup_widget(window1
,"combobox4");
161 gtk_combo_box_set_active (GTK_COMBO_BOX(w
),0);
162 w
= lookup_widget(window1
,"combobox5");
163 gtk_combo_box_set_active (GTK_COMBO_BOX(w
),0);
168 /* set start end end marker */
170 stg
[0].unit
=UNIT_SEC
;
171 stg
[0].start
=strtod(argv
[i
],NULL
); //* unit_table[stg[0].unit];
172 stg
[0].end
=strtod(argv
[i
+1],NULL
); //* unit_table[stg[0].unit];
173 } else if (argc
-i
== 1) {
174 /* set end marker only */
176 stg
[0].unit
=UNIT_SEC
;
177 stg
[0].end
=strtod(argv
[i
],NULL
);; //* unit_table[stg[0].unit];
184 lash_client
= lash_init (lash_args
, PACKAGE_NAME
, 0 | LASH_Config_Data_Set
,LASH_PROTOCOL (2,0));
186 fprintf(stderr
, "could not initialise LASH!\n");
189 if (!want_quiet
) printf("Connected to LASH.\n");
191 //lash_args_destroy(lash_args);
195 gtk_widget_show (window1
);
196 gjt_icon_pixmap
= gdk_pixmap_create_from_xpm_d (window1
->window
, &gjt_icon_mask
, NULL
, gjt_icon_xpm
);
198 gdk_window_set_icon(window1
->window
, NULL
, gjt_icon_pixmap
, gjt_icon_mask
);
199 //gdk_pixbuf_unref (window1_icon_pixbuf);
200 g_timeout_add(40,gpolljack
,NULL
);
203 g_timeout_add(250,glashproc
,NULL
);
212 /* vi:set ts=8 sts=2 sw=2: */