diff -Nru handbrake-7023svnppa1~utopic1/debian/changelog handbrake-7025svnppa1~utopic1/debian/changelog --- handbrake-7023svnppa1~utopic1/debian/changelog 2015-03-27 05:31:08.000000000 +0000 +++ handbrake-7025svnppa1~utopic1/debian/changelog 2015-03-28 05:31:33.000000000 +0000 @@ -1,4 +1,4 @@ -handbrake (7023svnppa1~utopic1) utopic; urgency=low +handbrake (7025svnppa1~utopic1) utopic; urgency=low * Snapshot - See timeline at http://trac.handbrake.fr/timeline diff -Nru handbrake-7023svnppa1~utopic1/gtk/configure.ac handbrake-7025svnppa1~utopic1/gtk/configure.ac --- handbrake-7023svnppa1~utopic1/gtk/configure.ac 2015-03-06 18:12:27.000000000 +0000 +++ handbrake-7025svnppa1~utopic1/gtk/configure.ac 2015-03-28 02:02:37.000000000 +0000 @@ -56,6 +56,10 @@ AS_HELP_STRING([--enable-dl], [enable libdl]), use_libdl=yes, use_libdl=no) +AC_ARG_ENABLE(pthread, + AS_HELP_STRING([--enable-pthread], [enable libpthread]), + use_libpthread=yes, use_libpthread=no) + AC_ARG_ENABLE(fdk-aac, AS_HELP_STRING([--enable-fdk-aac], [enable fdk aac encoder]), use_fdk_aac=yes, use_fdk_aac=no) @@ -64,6 +68,10 @@ AS_HELP_STRING([--enable-x265], [enable x265 encoder]), use_x265=yes, use_x265=no) +AC_ARG_ENABLE(qsv, + AS_HELP_STRING([--enable-qsv], [enable QSV encoder]), + use_qsv=yes, use_qsv=no) + AC_ARG_ENABLE(gst, AS_HELP_STRING([--disable-gst], [disable gstreamer (live preview)]), gst_disable=yes, gst_disable=no) @@ -142,28 +150,30 @@ CFLAGS="$CFLAGS -D_NO_UPDATE_CHECK" fi +PKG_CHECK_MODULES([GHB_GTK_3_14], [gtk+-3.0 >= 3.14], [HAVE_GTK_314=1], [HAVE_GTK_314=0]) +PKG_CHECK_MODULES([GHB_GTK_3_12], [gtk+-3.0 >= 3.12], [HAVE_GTK_312=1], [HAVE_GTK_312=0]) +AM_CONDITIONAL([GHB_GTK_3_14], [test "$HAVE_GTK_314" -eq 1]) +AM_CONDITIONAL([GHB_GTK_3_12], [test "$HAVE_GTK_312" -eq 1]) + AM_CONDITIONAL([MINGW], [test "x$mingw_flag" = "xyes"]) PKG_CHECK_MODULES(GHB, [$GHB_PACKAGES]) GHB_CFLAGS="$HBINC $GHB_CFLAGS" -AC_PATH_PROG(BUILD_PKG_CONFIG, pkg-config, no) -if test x"$BUILD_PKG_CONFIG" = x"no"; then - AC_MSG_ERROR([You need to install pkg-config]) -fi - -GHB_TOOLS_CFLAGS=`$BUILD_PKG_CONFIG --cflags glib-2.0 gdk-pixbuf-2.0 gtk+-3.0 jansson` -GHB_TOOLS_LIBS=`$BUILD_PKG_CONFIG --libs glib-2.0 gdk-pixbuf-2.0 jansson` - HB_LIBS="-lhandbrake -lavresample -lavformat -lavcodec -lavutil -ldvdnav -ldvdread -lmp3lame -lvorbis -lvorbisenc -logg -lsamplerate -lx264 -lswscale -ltheoraenc -ltheoradec -lvpx -lz -lbz2 -lbluray -lass -lfontconfig -lfreetype -lxml2 -ljansson" case $host in *-*-mingw*) if test "x$use_libdl" = "xyes" ; then - HB_LIBS+=" -ldl -lpthreadGC2" + HB_LIBS+=" -ldl" + fi + if test "x$use_libpthread" = "xyes" ; then + HB_LIBS+=" -lpthread" + else + HB_LIBS+=" -lpthreadGC2" fi - HB_LIBS+=" -lpthreadGC2 -lregex" + HB_LIBS+=" -lregex" ;; *) HB_LIBS+=" -ldl -lpthread" @@ -178,9 +188,11 @@ HB_LIBS+=" -lx265" fi +if test "x$use_qsv" = "xyes" ; then + HB_LIBS+=" -lmfx" +fi + AC_SUBST(HB_LIBS) -AC_SUBST(GHB_TOOLS_CFLAGS) -AC_SUBST(GHB_TOOLS_LIBS) AC_SUBST(GHB_CFLAGS) AC_SUBST(GHB_LIBS) diff -Nru handbrake-7023svnppa1~utopic1/gtk/module.defs handbrake-7025svnppa1~utopic1/gtk/module.defs --- handbrake-7023svnppa1~utopic1/gtk/module.defs 2014-08-18 17:22:30.000000000 +0000 +++ handbrake-7025svnppa1~utopic1/gtk/module.defs 2015-03-28 02:02:37.000000000 +0000 @@ -19,6 +19,9 @@ ifeq ($(HAS.dlfcn),1) GTK.CONFIGURE.extra += --enable-dl endif +ifeq ($(HAS.pthread),1) + GTK.CONFIGURE.extra += --enable-pthread +endif endif ifeq (0,$(FEATURE.gtk.update.checks)) @@ -36,3 +39,7 @@ ifeq (1,$(FEATURE.x265)) GTK.CONFIGURE.extra += --enable-x265 endif + +ifeq (1,$(FEATURE.qsv)) + GTK.CONFIGURE.extra += --enable-qsv +endif diff -Nru handbrake-7023svnppa1~utopic1/gtk/src/callbacks.c handbrake-7025svnppa1~utopic1/gtk/src/callbacks.c --- handbrake-7023svnppa1~utopic1/gtk/src/callbacks.c 2015-03-26 16:55:02.000000000 +0000 +++ handbrake-7025svnppa1~utopic1/gtk/src/callbacks.c 2015-03-28 02:02:37.000000000 +0000 @@ -623,7 +623,7 @@ time_t t = time(NULL); lt = localtime(&t); st[0] = 0; - strftime(st, 6, "%R", lt); + strftime(st, 6, "%H:%M", lt); g_string_append_printf(str, "%s", st); p += strlen("{time}"); } @@ -634,7 +634,7 @@ time_t t = time(NULL); lt = localtime(&t); dt[0] = 0; - strftime(dt, 11, "%F", lt); + strftime(dt, 11, "%Y-%m-%d", lt); g_string_append_printf(str, "%s", dt); p += strlen("{date}"); } diff -Nru handbrake-7023svnppa1~utopic1/gtk/src/create_resources.c handbrake-7025svnppa1~utopic1/gtk/src/create_resources.c --- handbrake-7023svnppa1~utopic1/gtk/src/create_resources.c 2015-03-06 22:17:34.000000000 +0000 +++ handbrake-7025svnppa1~utopic1/gtk/src/create_resources.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,614 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "plist.h" -#include "values.h" -#include -#include -#include - -enum -{ - R_NONE = 0, - R_RESOURCES, - R_SECTION, - R_ICON, - R_PLIST, - R_JSON, - R_STRING, -}; - -typedef struct -{ - gchar *tag; - gint id; -} tag_map_t; - -static tag_map_t tag_map[] = -{ - {"resources", R_RESOURCES}, - {"section", R_SECTION}, - {"icon", R_ICON}, - {"plist", R_PLIST}, - {"json", R_JSON}, - {"string", R_STRING}, -}; -#define TAG_MAP_SZ (sizeof(tag_map)/sizeof(tag_map_t)) - -typedef struct -{ - gchar *key; - gchar *value; - GhbValue *dict; - GQueue *stack; - GQueue *tag_stack; - gboolean closed_top; -} parse_data_t; - -GList *inc_list = NULL; - -static gchar* -find_file(GList *list, const gchar *name) -{ - gchar *str; - GList *link = list; - - while (link != NULL) - { - gchar *inc; - - inc = (gchar*)link->data; - str = g_strdup_printf("%s/%s", inc, name); - if (g_file_test(str, G_FILE_TEST_IS_REGULAR)) - { - return str; - } - g_free(str); - link = g_list_next(link); - } - if (g_file_test(name, G_FILE_TEST_IS_REGULAR)) - { - return g_strdup(name); - } - return NULL; -} - -static const gchar* -lookup_attr_value( - const gchar *name, - const gchar **attr_names, - const gchar **attr_values) -{ - gint ii; - - if (attr_names == NULL) return NULL; - for (ii = 0; attr_names[ii] != NULL; ii++) - { - if (strcmp(name, attr_names[ii]) == 0) - return attr_values[ii]; - } - return NULL; -} - -static GhbValue* -read_string_from_file(const gchar *fname) -{ - gchar *buffer; - size_t size; - GhbValue *gval; - FILE *fd; - - fd = g_fopen(fname, "r"); - if (fd == NULL) - return NULL; - fseek(fd, 0, SEEK_END); - size = ftell(fd); - fseek(fd, 0, SEEK_SET); - buffer = g_malloc(size+1); - size = fread(buffer, 1, size, fd); - buffer[size] = 0; - gval = ghb_string_value_new(buffer); - g_free(buffer); - fclose(fd); - return gval; -} - -static void add_icon(GhbValue *dict, const char *fname) -{ - FILE *f; - - GdkPixbufFormat *pbf; - int width, height; - gboolean svg; - - pbf = gdk_pixbuf_get_file_info(fname, &width, &height); - svg = gdk_pixbuf_format_is_scalable(pbf); - - f = fopen(fname, "rb"); - if (f == NULL) - { - fprintf(stderr, "open failed: %s\n", fname); - return; - } - - char* base64; - guint8 *data; - gsize data_size; - - fseek(f, 0, SEEK_END); - data_size = ftell(f); - fseek(f, 0, SEEK_SET); - - data = g_malloc(data_size); - fread(data, 1, data_size, f); - base64 = g_base64_encode(data, data_size); - - GhbValue *icon = ghb_string_value_new(base64); - ghb_dict_insert(dict, "svg", ghb_boolean_value_new(svg)); - ghb_dict_insert(dict, "data", icon); - - g_free(base64); - g_free(data); -} - -static void insert_value(GhbValue *container, const char *key, GhbValue *element) -{ - GhbType gtype; - - gtype = ghb_value_type(container); - if (gtype == GHB_ARRAY) - { - ghb_array_append(container, element); - } - else if (gtype == GHB_DICT) - { - if (key == NULL) - { - g_warning("No key for dictionary item"); - ghb_value_free(element); - } - else - { - ghb_dict_insert(container, key, element); - } - } - else - { - g_error("Invalid container type. This shouldn't happen"); - } -} - -static void -start_element( - GMarkupParseContext *ctx, - const gchar *tag, - const gchar **attr_names, - const gchar **attr_values, - gpointer ud, - GError **error) -{ - parse_data_t *pd = (parse_data_t*)ud; - union - { - gint id; - gpointer pid; - } id; - gint ii; - - // Check to see if the first element found has been closed - // If so, ignore any junk following it. - if (pd->closed_top) - return; - - for (ii = 0; ii < TAG_MAP_SZ; ii++) - { - if (strcmp(tag, tag_map[ii].tag) == 0) - { - id.id = tag_map[ii].id; - break; - } - } - if (ii == TAG_MAP_SZ) - { - g_warning("Unrecognized start tag (%s)", tag); - return; - } - g_queue_push_head(pd->tag_stack, id.pid); - GhbValue *gval = NULL; - GhbValue *current = g_queue_peek_head(pd->stack); - switch (id.id) - { - case R_SECTION: - { - const gchar *key; - - key = lookup_attr_value("name", attr_names, attr_values); - if (key == NULL) - { - g_warning("section: missing a requried *name* attribute"); - exit(EXIT_FAILURE); - } - if (strcmp(key, "icons") == 0) - { - gval = ghb_dict_value_new(); - if (pd->key) g_free(pd->key); - pd->key = g_strdup(key); - g_queue_push_head(pd->stack, gval); - } - } break; - case R_ICON: - { - gchar *fname; - const gchar *name, *key; - - name = lookup_attr_value("file", attr_names, attr_values); - if (name == NULL) - { - g_warning("icon: missing a requried *file* attribute"); - exit(EXIT_FAILURE); - } - fname = find_file(inc_list, name); - if (fname == NULL) - { - g_warning("icon: no such file %s", name); - exit(EXIT_FAILURE); - } - key = lookup_attr_value("name", attr_names, attr_values); - if (key == NULL) - { - g_warning("icon: missing a requried *name* attribute"); - g_free(fname); - exit(EXIT_FAILURE); - } - gval = ghb_dict_value_new(); - add_icon(gval, fname); - - g_free(pd->key); - pd->key = g_strdup(key); - g_free(fname); - } break; - case R_PLIST: - { - gchar *fname; - const gchar *name, *key; - - name = lookup_attr_value("file", attr_names, attr_values); - if (name == NULL) - { - g_warning("plist: missing a requried *file* attribute"); - exit(EXIT_FAILURE); - } - fname = find_file(inc_list, name); - if (fname == NULL) - { - g_warning("plist: no such file %s", name); - exit(EXIT_FAILURE); - } - key = lookup_attr_value("name", attr_names, attr_values); - if (key == NULL) - { - g_warning("plist: missing a requried *name* attribute"); - g_free(fname); - exit(EXIT_FAILURE); - } - gval = ghb_plist_parse_file(fname); - if (pd->key) g_free(pd->key); - pd->key = g_strdup(key); - g_free(fname); - } break; - case R_JSON: - { - gchar *fname; - const gchar *name, *key; - - name = lookup_attr_value("file", attr_names, attr_values); - if (name == NULL) - { - g_warning("json: missing a requried *file* attribute"); - exit(EXIT_FAILURE); - } - fname = find_file(inc_list, name); - if (fname == NULL) - { - g_warning("json: no such file %s", name); - exit(EXIT_FAILURE); - } - key = lookup_attr_value("name", attr_names, attr_values); - if (key == NULL) - { - g_warning("json: missing a requried *name* attribute"); - g_free(fname); - exit(EXIT_FAILURE); - } - gval = ghb_json_parse_file(fname); - if (pd->key) g_free(pd->key); - pd->key = g_strdup(key); - g_free(fname); - } break; - case R_STRING: - { - gchar *fname; - const gchar *name, *key; - const gchar *version; - char *end; - int major = 0, minor = 0, micro = 0; - - name = lookup_attr_value("file", attr_names, attr_values); - if (name == NULL) - { - g_warning("string: missing a requried *file* attribute"); - exit(EXIT_FAILURE); - } - fname = find_file(inc_list, name); - if (fname == NULL) - { - g_warning("string: no such file %s", name); - exit(EXIT_FAILURE); - } - key = lookup_attr_value("name", attr_names, attr_values); - if (key == NULL) - { - g_warning("string: missing a requried *name* attribute"); - g_free(fname); - exit(EXIT_FAILURE); - } - version = lookup_attr_value("version", attr_names, attr_values); - if (version != NULL) - { - major = strtol(version, &end, 10); - if (end != version && *end != 0) - { - version = end + 1; - minor = strtol(version, &end, 10); - if (end != version && *end != 0) - { - version = end + 1; - micro = strtol(version, &end, 10); - if (end != version && *end != 0) - { - version = end + 1; - } - } - } - } - if (GTK_CHECK_VERSION(major, minor, micro)) - { - gval = read_string_from_file(fname); - if (pd->key) g_free(pd->key); - pd->key = g_strdup(key); - } - g_free(fname); - } break; - } - // Add the element to the current container - if (gval) - { // There's an element to add - if (current == NULL) - { - pd->dict = gval; - return; - } - insert_value(current, pd->key, gval); - } -} - -static void -end_element( - GMarkupParseContext *ctx, - const gchar *name, - gpointer ud, - GError **error) -{ - parse_data_t *pd = (parse_data_t*)ud; - gint id; - union - { - gint id; - gpointer pid; - } start_id; - gint ii; - - // Check to see if the first element found has been closed - // If so, ignore any junk following it. - if (pd->closed_top) - return; - - for (ii = 0; ii < TAG_MAP_SZ; ii++) - { - if (strcmp(name, tag_map[ii].tag) == 0) - { - id = tag_map[ii].id; - break; - } - } - if (ii == TAG_MAP_SZ) - { - g_warning("Unrecognized start tag (%s)", name); - return; - } - start_id.pid = g_queue_pop_head(pd->tag_stack); - if (start_id.id != id) - g_warning("start tag != end tag: (%s %d) %d", name, id, id); - - GhbValue *gval = NULL; - GhbValue *current = g_queue_peek_head(pd->stack); - switch (id) - { - case R_SECTION: - { - g_queue_pop_head(pd->stack); - } break; - } - if (gval) - { - // Get the top of the data structure stack and if it's an array - // or dict, add the current element - if (current == NULL) - { - pd->dict = gval; - pd->closed_top = TRUE; - return; - } - insert_value(current, pd->key, gval); - } - if (g_queue_is_empty(pd->tag_stack)) - pd->closed_top = TRUE; -} - -static void -text_data( - GMarkupParseContext *ctx, - const gchar *text, - gsize len, - gpointer ud, - GError **error) -{ - parse_data_t *pd = (parse_data_t*)ud; - if (pd->value) g_free(pd->value); - pd->value = g_strdup(text); -} - -static void -passthrough( - GMarkupParseContext *ctx, - const gchar *text, - gsize len, - gpointer ud, - GError **error) -{ - //parse_data_t *pd = (parse_data_t*)ud; - - //g_debug("passthrough %s", text); -} - -static void -parse_error(GMarkupParseContext *ctx, GError *error, gpointer ud) -{ - g_warning("Resource parse error: %s", error->message); -} - -// This is required or the parser crashes -static void -destroy_notify(gpointer data) -{ // Do nothing - //g_debug("destroy parser"); -} - -GhbValue* -ghb_resource_parse(const gchar *buf, gssize len) -{ - GMarkupParseContext *ctx; - GMarkupParser parser; - parse_data_t pd; - GError *err = NULL; - - pd.stack = g_queue_new(); - pd.tag_stack = g_queue_new(); - pd.key = NULL; - pd.value = NULL; - pd.dict = ghb_dict_value_new(); - g_queue_push_head(pd.stack, pd.dict); - pd.closed_top = FALSE; - - parser.start_element = start_element; - parser.end_element = end_element; - parser.text = text_data; - parser.passthrough = passthrough; - parser.error = parse_error; - ctx = g_markup_parse_context_new(&parser, 0, &pd, destroy_notify); - - g_markup_parse_context_parse(ctx, buf, len, &err); - g_markup_parse_context_end_parse(ctx, &err); - g_markup_parse_context_free(ctx); - g_queue_free(pd.stack); - g_queue_free(pd.tag_stack); - return pd.dict; -} - -GhbValue* -ghb_resource_parse_file(FILE *fd) -{ - gchar *buffer; - size_t size; - GhbValue *gval; - - if (fd == NULL) - return NULL; - fseek(fd, 0, SEEK_END); - size = ftell(fd); - fseek(fd, 0, SEEK_SET); - buffer = g_malloc(size+1); - size = fread(buffer, 1, size, fd); - buffer[size] = 0; - gval = ghb_resource_parse(buffer, (gssize)size); - g_free(buffer); - return gval; -} - -static void -usage(char *cmd) -{ - fprintf(stderr, -"Usage: %s [-I ] \n" -"Summary:\n" -" Creates a resource dict from a resource list\n" -"Options:\n" -" I - Include path to search for files\n" -" Input resources file\n" -" Output resources dict file\n" -, cmd); - - exit(EXIT_FAILURE); -} - -#define OPTS "I:" - -gint -main(gint argc, gchar *argv[]) -{ - FILE *file; - GhbValue *gval; - int opt; - const gchar *src, *dst; - - do - { - opt = getopt(argc, argv, OPTS); - switch (opt) - { - case -1: break; - - case 'I': - inc_list = g_list_prepend(inc_list, g_strdup(optarg)); - break; - } - } while (opt != -1); - - if (optind != argc - 2) - { - usage(argv[0]); - return EXIT_FAILURE; - } - src = argv[optind++]; - dst = argv[optind++]; - -#if !GLIB_CHECK_VERSION(2, 36, 0) - g_type_init(); -#endif - - file = g_fopen(src, "r"); - if (file == NULL) - { - fprintf(stderr, "Error: failed to open %s\n", src); - return EXIT_FAILURE; - } - - gval = ghb_resource_parse_file(file); - ghb_json_write_file(dst, gval); - fclose(file); - return 0; -} - diff -Nru handbrake-7023svnppa1~utopic1/gtk/src/create_resources.py handbrake-7025svnppa1~utopic1/gtk/src/create_resources.py --- handbrake-7023svnppa1~utopic1/gtk/src/create_resources.py 2014-02-23 17:22:05.000000000 +0000 +++ handbrake-7025svnppa1~utopic1/gtk/src/create_resources.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,163 +0,0 @@ -#! /bin/python -# - -import types -import os -import sys -import time -import datetime -import plistlib -import getopt -from xml.parsers import expat -from gtk import gdk - -pl = dict() -stack = list() -stack.append(pl) - -def top(ss): - return ss[len(ss)-1] - -def end_element_handler(tag): - global stack - - if tag == "section": - stack.pop() - -def start_element_handler(tag, attr): - global pl, stack - - current = top(stack) - key = val = None - if tag == "section": - key = attr["name"] - if key == "icons": - val = dict() - stack.append(val) - elif tag == "icon": - fbase = attr["file"] - fname = find_file(fbase) - key = attr["name"] - if fname != None and key != None: - val = dict() - pb = gdk.pixbuf_new_from_file(fname) - val["colorspace"] = pb.get_colorspace() - val["alpha"] = pb.get_has_alpha() - val["bps"] = pb.get_bits_per_sample() - val["width"] = pb.get_width() - val["height"] = pb.get_height() - val["rowstride"] = pb.get_rowstride() - val["data"] = plistlib.Data(pb.get_pixels()) - elif fname == None: - print >> sys.stderr, ( "Error: No such icon file %s" % fbase ) - sys.exit(1) - elif tag == "plist": - fbase = attr["file"] - fname = find_file(fbase) - key = attr["name"] - if fname != None and key != None: - val = plistlib.readPlist(fname) - elif fname == None: - print >> sys.stderr, ( "Error: No such plist file %s" % fbase ) - sys.exit(1) - elif tag == "string": - fbase = attr["file"] - fname = find_file(fbase) - key = attr["name"] - if fname != None and key != None: - try: - ff = open(fname) - val = ff.read() - except Exception, err: - print >> sys.stderr, ( "Error: %s" % str(err) ) - sys.exit(1) - elif fname == None: - print >> sys.stderr, ( "Error: No such string file %s" % fbase ) - sys.exit(1) - - if val != None: - if type(current) == types.DictType: - current[key] = val - elif type(current) == types.TupleType: - current.append(val) - - -def cdata_handler(str): - return - -def resource_parse_file(infile): - parser = expat.ParserCreate() - parser.StartElementHandler = start_element_handler - parser.EndElementHandler = end_element_handler - parser.CharacterDataHandler = cdata_handler - parser.ParseFile(infile) - -def usage(): - print >> sys.stderr, ( - "Usage: %s [-I ] [resource plist]\n" - "Summary:\n" - " Creates a resource plist from a resource list\n\n" - "Options:\n" - " I - Include path to search for files\n" - " Input resources file\n" - " Output resources plist file\n" - % sys.argv[0] - ) - -inc_list = list() - -def find_file(name): - global inc_list - - for inc_dir in inc_list: - inc = "%s/%s" % (inc_dir, name) - if os.path.isfile(inc): - return inc - - if os.path.isfile(name): - return name - - return None - -def main(): - global inc_list - - OPTS = "I:" - try: - opts, args = getopt.gnu_getopt(sys.argv[1:], OPTS) - except getopt.GetoptError, err: - print >> sys.stderr, str(err) - usage() - sys.exit(2) - - for o, a in opts: - if o == "-I": - # add to include list - inc_list.append(a) - else: - assert False, "unhandled option" - - if len(args) > 2 or len(args) < 1: - usage() - sys.exit(2) - - try: - infile = open(args[0]) - except Exception, err: - print >> sys.stderr, ( "Error: %s" % str(err) ) - sys.exit(1) - - if len(args) > 1: - try: - outfile = open(args[1], "w") - except Exception, err: - print >> sys.stderr, ( "Error: %s" % str(err)) - sys.exit(1) - else: - outfile = sys.stdout - - resource_parse_file(infile) - plistlib.writePlist(pl, outfile) - -main() - diff -Nru handbrake-7023svnppa1~utopic1/gtk/src/main.c handbrake-7025svnppa1~utopic1/gtk/src/main.c --- handbrake-7023svnppa1~utopic1/gtk/src/main.c 2015-03-06 18:12:27.000000000 +0000 +++ handbrake-7025svnppa1~utopic1/gtk/src/main.c 2015-03-28 02:02:37.000000000 +0000 @@ -67,6 +67,7 @@ #include "presets.h" #include "preview.h" #include "ghbcompositor.h" +#include "ui_res.h" /* @@ -89,9 +90,15 @@ create_builder_or_die(const gchar * name) { guint res = 0; - GhbValue *gval; GError *error = NULL; const gchar *ghb_ui; + gsize data_size; + + ghb_ui_register_resource(); + GResource *ui_res = ghb_ui_get_resource(); + GBytes *gbytes = g_resource_lookup_data(ui_res, "/org/handbrake/ui/ghb.ui", + 0, NULL); + ghb_ui = g_bytes_get_data(gbytes, &data_size); const gchar *markup = N_("Unable to create %s.\n" @@ -100,8 +107,6 @@ "%s"); g_debug("create_builder_or_die()\n"); GtkBuilder *xml = gtk_builder_new(); - gval = ghb_resource_get("ghb-ui"); - ghb_ui = ghb_value_const_string(gval); if (xml != NULL) res = gtk_builder_add_from_string(xml, ghb_ui, -1, &error); if (!xml || !res) @@ -627,15 +632,20 @@ // Set encoding to raw. g_io_channel_set_encoding(ud->activity_log, NULL, NULL); // redirect stderr to the writer end of the pipe + #if defined(_WIN32) - _dup2(pfd[1], STDERR_FILENO); - // Non-console windows apps do not have a stderr->_file assigned properly - stderr->_file = STDERR_FILENO; + _dup2(pfd[1], _fileno(stderr)); #else dup2(pfd[1], STDERR_FILENO); #endif setvbuf(stderr, NULL, _IONBF, 0); + +#if defined(_WIN32) + channel = g_io_channel_win32_new_fd(pfd[0]); +#else channel = g_io_channel_unix_new(pfd[0]); +#endif + // I was getting an this error: // "Invalid byte sequence in conversion input" // Set disable encoding on the channel. @@ -652,12 +662,16 @@ static gchar *dvd_device = NULL; static gchar *arg_preset = NULL; static gboolean ghb_debug = FALSE; +static gboolean win32_console = FALSE; static GOptionEntry entries[] = { { "device", 'd', 0, G_OPTION_ARG_FILENAME, &dvd_device, N_("The device or file to encode"), NULL }, { "preset", 'p', 0, G_OPTION_ARG_STRING, &arg_preset, N_("The preset values to use for encoding"), NULL }, { "debug", 'x', 0, G_OPTION_ARG_NONE, &ghb_debug, N_("Spam a lot"), NULL }, +#if defined(_WIN32) + { "console",'c', 0, G_OPTION_ARG_NONE, &win32_console, N_("Open a console for debug output"), NULL }, +#endif { NULL } }; @@ -808,6 +822,26 @@ } g_option_context_free(context); +#if defined(_WIN32) + if (win32_console) + { + // Enable console logging + if(AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole()){ + close(STDOUT_FILENO); + freopen("CONOUT$", "w", stdout); + close(STDERR_FILENO); + freopen("CONOUT$", "w", stderr); + } + } + else + { + // Non-console windows apps do not have a stderr->_file + // assigned properly + stderr->_file = STDERR_FILENO; + stdout->_file = STDOUT_FILENO; + } +#endif + if (argc > 1 && dvd_device == NULL && argv[1][0] != '-') { dvd_device = argv[1]; diff -Nru handbrake-7023svnppa1~utopic1/gtk/src/Makefile.am handbrake-7025svnppa1~utopic1/gtk/src/Makefile.am --- handbrake-7023svnppa1~utopic1/gtk/src/Makefile.am 2015-03-26 23:08:36.000000000 +0000 +++ handbrake-7025svnppa1~utopic1/gtk/src/Makefile.am 2015-03-27 19:18:30.000000000 +0000 @@ -55,6 +55,8 @@ preview.c \ data_res.c \ data_res.h \ + ui_res.c \ + ui_res.h \ icon_res.c \ icon_res.h \ icons.c \ @@ -106,30 +108,32 @@ cp $(srcdir)/internal_defaults.json $(srcdir)/standard_presets.json . glib-compile-resources --generate --target=$@ --c-name ghb_data --manual-register $< -resources.o: resource_data.h data_res.h - -resource_data.h: resources.json - python2 $(srcdir)/quotestring.py resources.json resource_data.h +if GHB_GTK_3_14 +UI=ghb-3.14.ui +else +if GHB_GTK_3_12 +UI=ghb-3.12.ui +else +UI=ghb.ui +endif +endif -widget_reverse.deps: makedeps.py -widget.deps: makedeps.py - python2 $(srcdir)/makedeps.py +ui_res.c : ui_res.gresource.xml ui_res.h $(srcdir)/$(UI) + glib-compile-resources --generate --target=$@ --c-name ghb_ui --manual-register $< -resources.json: create_resources resources.list ghb.ui ghb-3.14.ui - ./create_resources -I$(srcdir) $(srcdir)/resources.list resources.json +ui_res.h : ui_res.gresource.xml $(srcdir)/$(UI) + cp $(srcdir)/$(UI) ghb.ui + glib-compile-resources --generate --target=$@ --c-name ghb_ui --manual-register $< -CREATE_RES.c = \ - create_resources.c \ - plist.c \ - values.c +ui_res.o: ui_res.h ui_res.c -CREATE_RES.c.o = $(patsubst %.c,%-native.o,$(CREATE_RES.c)) +main.o : ui_res.o -create_resources: $(CREATE_RES.c.o) - $(CC_FOR_BUILD) -g -o $@ $^ $(GHB_TOOLS_LIBS) +resources.o: data_res.h -$(CREATE_RES.c.o): %-native.o: %.c - $(CC_FOR_BUILD) $(GHB_TOOLS_CFLAGS) -g -c -o $@ $< +widget_reverse.deps: makedeps.py +widget.deps: makedeps.py + python2 $(srcdir)/makedeps.py ghbcellrenderertext.$(OBJEXT): marshalers.h diff -Nru handbrake-7023svnppa1~utopic1/gtk/src/quotestring.c handbrake-7025svnppa1~utopic1/gtk/src/quotestring.c --- handbrake-7023svnppa1~utopic1/gtk/src/quotestring.c 2012-12-27 23:27:10.000000000 +0000 +++ handbrake-7025svnppa1~utopic1/gtk/src/quotestring.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -#include -#include -#include - -#define BUF_SIZE 72 - -void -usage(char *cmd) -{ - printf("%s\n", cmd); - char *base = basename(cmd); - fprintf(stderr, "Usage: %s infile [outfile]\n", base); -} - -int -main(int argc, char *argv[]) -{ - FILE *infile, *outfile; - char in_buffer[BUF_SIZE]; - char out_buffer[2*BUF_SIZE]; - - if (argc < 2 || argc > 3) - { - usage(argv[0]); - return 1; - } - infile = fopen(argv[1], "r"); - if (argc < 3) - { - outfile = stdout; - } - else - { - outfile = fopen(argv[2], "w"); - } - while (fgets(in_buffer, BUF_SIZE, infile) != NULL) - { - int ii, jj; - int len; - int eol = 0; - // Step on any CR LF at end of line - len = strlen(in_buffer); - if (len > 1 && in_buffer[len-1] == '\n' && in_buffer[len-2] == '\r') - { - in_buffer[len-1] = 0; - in_buffer[len-2] = 0; - eol = 1; - } - else if (len > 0 && in_buffer[len-1] == '\n') - { - in_buffer[len-1] = 0; - eol = 1; - } - for (jj = 0, ii = 0; ii < len; ii++) - { - if (in_buffer[ii] == '"') - { - out_buffer[jj++] = '\\'; - out_buffer[jj++] = in_buffer[ii]; - } - else if (in_buffer[ii] == '\r') - { // Skip it - } - else - { - out_buffer[jj++] = in_buffer[ii]; - } - } - out_buffer[jj] = 0; - if (eol) - fprintf(outfile, "\"%s\\n\"\n", out_buffer); - else - fprintf(outfile, "\"%s\"\n", out_buffer); - } - fclose(infile); - fclose(outfile); - return 0; -} diff -Nru handbrake-7023svnppa1~utopic1/gtk/src/quotestring.py handbrake-7025svnppa1~utopic1/gtk/src/quotestring.py --- handbrake-7023svnppa1~utopic1/gtk/src/quotestring.py 2015-03-06 22:17:34.000000000 +0000 +++ handbrake-7025svnppa1~utopic1/gtk/src/quotestring.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -#! /usr/bin/python - -import re -import getopt -import sys - -def usage(): - print >> sys.stderr, ( - "Usage: %s [output]\n" - "Summary:\n" - " Creates a quoted string suitable for inclusion in a C char*\n\n" - "Options:\n" - " Input file to quote\n" - " Output quoted string [stdout]\n" - % sys.argv[0] - ) - -def main(): - global inc_list - - OPTS = "" - try: - opts, args = getopt.gnu_getopt(sys.argv[1:], OPTS) - except getopt.GetoptError, err: - print >> sys.stderr, str(err) - usage() - sys.exit(2) - - for o, a in opts: - usage() - assert False, "unhandled option" - - if len(args) > 2 or len(args) < 1: - usage() - sys.exit(2) - - try: - infile = open(args[0]) - except Exception, err: - print >> sys.stderr, ( "Error: %s" % str(err) ) - sys.exit(1) - - if len(args) > 1: - try: - outfile = open(args[1], "w") - except Exception, err: - print >> sys.stderr, ( "Error: %s" % str(err)) - sys.exit(1) - else: - outfile = sys.stdout - - ss = infile.read() - ss = re.sub(r'\\', r'\\\\', ss) - ss = re.sub(r'"', r'\\"', ss) - pattern = re.compile("$", re.M) - ss = re.sub(pattern, r'\\n"', ss) - pattern = re.compile("^", re.M) - ss = re.sub(pattern, "\"", ss) - outfile.write(ss) - -main() - diff -Nru handbrake-7023svnppa1~utopic1/gtk/src/resources.c handbrake-7025svnppa1~utopic1/gtk/src/resources.c --- handbrake-7023svnppa1~utopic1/gtk/src/resources.c 2015-03-26 22:56:25.000000000 +0000 +++ handbrake-7025svnppa1~utopic1/gtk/src/resources.c 2015-03-27 19:18:30.000000000 +0000 @@ -21,10 +21,6 @@ #include "values.h" #include "data_res.h" -static const gchar resource_str[] = -#include "resource_data.h" -; - static GhbValue *resources; void @@ -35,7 +31,7 @@ GBytes *gbytes; gconstpointer data; - resources = ghb_json_parse(resource_str, sizeof(resource_str)-1); + resources = ghb_dict_value_new(); ghb_data_register_resource(); GResource *data_res = ghb_data_get_resource(); diff -Nru handbrake-7023svnppa1~utopic1/gtk/src/resources.list handbrake-7025svnppa1~utopic1/gtk/src/resources.list --- handbrake-7023svnppa1~utopic1/gtk/src/resources.list 2015-03-26 22:56:25.000000000 +0000 +++ handbrake-7025svnppa1~utopic1/gtk/src/resources.list 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ - - - - - diff -Nru handbrake-7023svnppa1~utopic1/gtk/src/ui_res.gresource.xml handbrake-7025svnppa1~utopic1/gtk/src/ui_res.gresource.xml --- handbrake-7023svnppa1~utopic1/gtk/src/ui_res.gresource.xml 1970-01-01 00:00:00.000000000 +0000 +++ handbrake-7025svnppa1~utopic1/gtk/src/ui_res.gresource.xml 2015-03-27 19:18:30.000000000 +0000 @@ -0,0 +1,6 @@ + + + + ghb.ui + + diff -Nru handbrake-7023svnppa1~utopic1/version.txt handbrake-7025svnppa1~utopic1/version.txt --- handbrake-7023svnppa1~utopic1/version.txt 2015-03-27 05:31:08.000000000 +0000 +++ handbrake-7025svnppa1~utopic1/version.txt 2015-03-28 05:31:33.000000000 +0000 @@ -3,9 +3,9 @@ Relative URL: ^/trunk Repository Root: svn://svn.handbrake.fr/HandBrake Repository UUID: b64f7644-9d1e-0410-96f1-a4d463321fa5 -Revision: 7023 +Revision: 7025 Node Kind: directory Last Changed Author: jstebbins -Last Changed Rev: 7023 -Last Changed Date: 2015-03-26 16:08:36 -0700 (Thu, 26 Mar 2015) +Last Changed Rev: 7025 +Last Changed Date: 2015-03-27 19:02:37 -0700 (Fri, 27 Mar 2015)