From e21bc3443d5717d0960130486f6b8b712d2be8df Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Thu, 2 Oct 2008 20:57:08 -0600 Subject: [PATCH] rm gtk, avc2avi. I don't remember why I allowed a gui into the repository in the first place. There's nothing that makes this one special relative to all the other x264 guis. avc2avi doesn't compile since we removed the bitstream reader. And avc doesn't belong in avi. --- .gitignore | 3 - AUTHORS | 4 - Makefile | 12 +- configure | 28 - gtk/Makefile | 200 ----- gtk/fr.po | 905 --------------------- gtk/test.c | 75 -- gtk/x264.ico | Bin 2238 -> 0 bytes gtk/x264.png | Bin 7178 -> 0 bytes gtk/x264_gtk.c | 1159 --------------------------- gtk/x264_gtk.h | 131 --- gtk/x264_gtk_bitrate.c | 236 ------ gtk/x264_gtk_bitrate.h | 28 - gtk/x264_gtk_cqm.c | 491 ------------ gtk/x264_gtk_cqm.h | 28 - gtk/x264_gtk_demuxers.h | 38 - gtk/x264_gtk_encode.c | 47 -- gtk/x264_gtk_encode_encode.c | 308 ------- gtk/x264_gtk_encode_encode.h | 28 - gtk/x264_gtk_encode_main_window.c | 776 ------------------ gtk/x264_gtk_encode_main_window.h | 28 - gtk/x264_gtk_encode_private.h | 66 -- gtk/x264_gtk_encode_status_window.c | 191 ----- gtk/x264_gtk_encode_status_window.h | 28 - gtk/x264_gtk_enum.h | 77 -- gtk/x264_gtk_i18n.h | 44 - gtk/x264_gtk_mb.c | 270 ------- gtk/x264_gtk_mb.h | 28 - gtk/x264_gtk_more.c | 519 ------------ gtk/x264_gtk_more.h | 28 - gtk/x264_gtk_private.h | 194 ----- gtk/x264_gtk_rc.c | 375 --------- gtk/x264_gtk_rc.h | 28 - gtk/x264gtk.rc | 46 -- tools/Jamfile | 9 - tools/avc2avi.c | 857 -------------------- tools/countquant_x264.pl | 6 +- tools/regression-test.pl | 0 tools/x264-rd.sh | 32 - 39 files changed, 4 insertions(+), 7319 deletions(-) delete mode 100644 gtk/Makefile delete mode 100644 gtk/fr.po delete mode 100644 gtk/test.c delete mode 100644 gtk/x264.ico delete mode 100644 gtk/x264.png delete mode 100644 gtk/x264_gtk.c delete mode 100644 gtk/x264_gtk.h delete mode 100644 gtk/x264_gtk_bitrate.c delete mode 100644 gtk/x264_gtk_bitrate.h delete mode 100644 gtk/x264_gtk_cqm.c delete mode 100644 gtk/x264_gtk_cqm.h delete mode 100644 gtk/x264_gtk_demuxers.h delete mode 100644 gtk/x264_gtk_encode.c delete mode 100644 gtk/x264_gtk_encode_encode.c delete mode 100644 gtk/x264_gtk_encode_encode.h delete mode 100644 gtk/x264_gtk_encode_main_window.c delete mode 100644 gtk/x264_gtk_encode_main_window.h delete mode 100644 gtk/x264_gtk_encode_private.h delete mode 100644 gtk/x264_gtk_encode_status_window.c delete mode 100644 gtk/x264_gtk_encode_status_window.h delete mode 100644 gtk/x264_gtk_enum.h delete mode 100644 gtk/x264_gtk_i18n.h delete mode 100644 gtk/x264_gtk_mb.c delete mode 100644 gtk/x264_gtk_mb.h delete mode 100644 gtk/x264_gtk_more.c delete mode 100644 gtk/x264_gtk_more.h delete mode 100644 gtk/x264_gtk_private.h delete mode 100644 gtk/x264_gtk_rc.c delete mode 100644 gtk/x264_gtk_rc.h delete mode 100644 gtk/x264gtk.rc delete mode 100644 tools/Jamfile delete mode 100644 tools/avc2avi.c mode change 100644 => 100755 tools/regression-test.pl delete mode 100755 tools/x264-rd.sh diff --git a/.gitignore b/.gitignore index 582b9759..308b7930 100644 --- a/.gitignore +++ b/.gitignore @@ -14,9 +14,6 @@ config.h config.mak x264 checkasm -gtk/test -gtk/x264_gtk_encode -gtk/x264_icon.h *.264 *.2pass diff --git a/AUTHORS b/AUTHORS index 4ff9a093..31c7bbbc 100644 --- a/AUTHORS +++ b/AUTHORS @@ -95,7 +95,3 @@ N: Tuukka Toivonen E: tuukkat AT ee DOT oulu DOT fi D: Visualization -N: Vincent Torri -E: Vincent DOT Torri AT iecn DOT u-nancy DOT fr -D: GTK frontend - diff --git a/Makefile b/Makefile index 2d185099..5693fdbc 100644 --- a/Makefile +++ b/Makefile @@ -69,7 +69,7 @@ OBJS = $(SRCS:%.c=%.o) OBJCLI = $(SRCCLI:%.c=%.o) DEP = depend -.PHONY: all default fprofiled clean distclean install install-gtk uninstall dox test testclean +.PHONY: all default fprofiled clean distclean install uninstall dox test testclean default: $(DEP) x264$(EXE) @@ -83,9 +83,6 @@ $(SONAME): .depend $(OBJS) $(OBJASM) x264$(EXE): $(OBJCLI) libx264.a $(CC) -o $@ $+ $(LDFLAGS) -libx264gtk.a: muxers.o libx264.a - $(MAKE) -C gtk - checkasm: tools/checkasm.o libx264.a $(CC) -o $@ $+ $(LDFLAGS) @@ -140,15 +137,12 @@ endif clean: rm -f $(OBJS) $(OBJASM) $(OBJCLI) $(SONAME) *.a x264 x264.exe .depend TAGS rm -f checkasm checkasm.exe tools/checkasm.o - rm -f tools/avc2avi tools/avc2avi.exe tools/avc2avi.o rm -f $(SRC2:%.c=%.gcda) $(SRC2:%.c=%.gcno) - sed -e 's/ *-fprofile-\(generate\|use\)//g' config.mak > config.mak2 && mv config.mak2 config.mak - $(MAKE) -C gtk clean distclean: clean rm -f config.mak config.h x264.pc rm -rf test/ - $(MAKE) -C gtk distclean install: x264$(EXE) $(SONAME) install -d $(DESTDIR)$(bindir) $(DESTDIR)$(includedir) @@ -166,14 +160,10 @@ else endif $(if $(IMPLIBNAME), install -m 644 $(IMPLIBNAME) $(DESTDIR)$(libdir)) -install-gtk: libx264gtk.a - $(MAKE) -C gtk install - uninstall: rm -f $(DESTDIR)$(includedir)/x264.h $(DESTDIR)$(libdir)/libx264.a rm -f $(DESTDIR)$(bindir)/x264 $(DESTDIR)$(libdir)/pkgconfig/x264.pc $(if $(SONAME), rm -f $(DESTDIR)$(libdir)/$(SONAME) $(DESTDIR)$(libdir)/libx264.$(SOSUFFIX)) - $(MAKE) -C gtk uninstall etags: TAGS diff --git a/configure b/configure index c8bbd518..fa53bf2b 100755 --- a/configure +++ b/configure @@ -11,7 +11,6 @@ echo " --disable-avis-input disables avisynth input (win32 only)" echo " --disable-mp4-output disables mp4 output (using gpac)" echo " --disable-pthread disables multithreaded encoding" echo " --disable-asm disables assembly optimizations on x86" -echo " --enable-gtk build GTK+ interface" echo " --enable-debug adds -g, doesn't strip" echo " --enable-gprof adds -pg, doesn't strip" echo " --enable-visualize enables visualization (X11 only)" @@ -58,7 +57,6 @@ asm="yes" debug="no" gprof="no" pic="no" -gtk="no" vis="no" shared="no" @@ -148,12 +146,6 @@ for opt do --enable-pic) pic="yes" ;; - --enable-gtk) - gtk="yes" - ;; - --disable-gtk) - gtk="no" - ;; --enable-shared) shared="yes" ;; @@ -427,7 +419,6 @@ ALTIVECFLAGS=$ALTIVECFLAGS LDFLAGS=$LDFLAGS AS=$AS ASFLAGS=$ASFLAGS -GTK=$gtk EXE=$EXE VIS=$vis HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG @@ -441,8 +432,6 @@ for A in "$@" ; do done echo '' >> config.mak -cp config.mak gtk/config.mak - if [ "$shared" = "yes" ]; then API=$(grep '#define X264_BUILD' < x264.h | cut -f 3 -d ' ') if [ "$SYS" = "MINGW" ]; then @@ -459,22 +448,6 @@ if [ "$shared" = "yes" ]; then echo 'SOFLAGS=-Wl,-soname,$(SONAME)' >> config.mak fi echo 'default: $(SONAME)' >> config.mak - if [ "$gtk" = "yes" ]; then - if [ "$SYS" = "MACOSX" ]; then - echo "SOSUFFIX=dylib" >> gtk/config.mak - echo "SONAMEGTK=libx264gtk.$API.dylib" >> gtk/config.mak - echo 'SOFLAGS=-dynamiclib -Wl,-single_module -Wl,-read_only_relocs,suppress -install_name $(DESTDIR)$(libdir)/$(SONAMEGTK)' >> gtk/config.mak - else - echo "SOSUFFIX=so" >> gtk/config.mak - echo "SONAMEGTK=libx264gtk.so.$API" >> gtk/config.mak - echo 'SOFLAGS=-Wl,-soname,$(SONAMEGTK)' >> gtk/config.mak - fi - fi -fi - -if [ "$gtk" = "yes" ]; then - echo 'default: libx264gtk.a' >> config.mak - echo 'install: install-gtk' >> config.mak fi ./version.sh @@ -501,7 +474,6 @@ echo "asm: $asm" echo "avis input: $avis_input" echo "mp4 output: $mp4_output" echo "pthread: $pthread" -echo "gtk: $gtk" echo "debug: $debug" echo "gprof: $gprof" echo "PIC: $pic" diff --git a/gtk/Makefile b/gtk/Makefile deleted file mode 100644 index ac4b01c5..00000000 --- a/gtk/Makefile +++ /dev/null @@ -1,200 +0,0 @@ - -include config.mak - -# Architecture dependant stuff - -ifeq ($(SYS),MINGW) -datadir="$(HOMEDRIVE)/Documents\ and\ Settings/$(USERNAME)/Application\ Data" -X264GTK_O = x264gtk.o -TEST_OBJECTS+=$(X264GTK_O) -LDFLAGS+=-mwindows -ICONV_LIB = -liconv -else -datadir=${prefix}/share -X264GTK_O = -ICONV_LIB = -endif - -XGETTEXT=xgettext$(EXE) -TEST_BIN = test$(EXE) -ENCODE_BIN = x264_gtk_encode$(EXE) - -# PO / MO files -PO_FILES = $(shell ls *.po) -MO_FILES = $(PO_FILES:%.po=%.mo) -ALL_LINGUAS = $(PO_FILES:%.po=%) - -# Object files -OBJECTS_LIB = \ -x264_gtk_bitrate.o \ -x264_gtk_cqm.o \ -x264_gtk_mb.o \ -x264_gtk_more.o \ -x264_gtk_rc.o \ -x264_gtk.o - -OBJECTS_TEST = test.o - -OBJECTS_ENCODE = \ -x264_gtk_encode_encode.o \ -x264_gtk_encode_main_window.o \ -x264_gtk_encode_status_window.o \ -x264_gtk_encode.o - -OBJECTS_ALL = $(OBJECTS_LIB) $(OBJECTS_TEST) $(OBJECTS_ENCODE) -SOURCES_ALL = $(OBJECTS_ALL:%.o=%.c) - -X264GTK_PC = x264gtk.pc - -EXTERNAL_DEPS= ../muxers.o ../matroska.o ../libx264.a - - -all: $(ENCODE_BIN) $(TEST_BIN) $(MO_FILES) $(X264GTK_PC) - -# Already provides iconv/intl -CPPFLAGS = -g `pkg-config --cflags gtk+-2.0 gthread-2.0` -I.. -DX264_DATA_DIR=\"${datadir}\" -LDFLAGS += `pkg-config --libs gtk+-2.0 gthread-2.0` ../libx264.a - - -# gettext rules -x264_gtk.pot: $(SOURCES_ALL) - @echo " T: x264_gtk.pot" - @$(XGETTEXT) -o x264_gtk.pot -k'_' -s --from-code iso-8859-1 \ - --default-domain=x264_gtk $(SOURCES_ALL) - -%.mo: %.po x264_gtk.pot - @echo " T: $@" - @msgmerge --update $< x264_gtk.pot - @msgfmt -o $@ $< - - -# Compilation rule -%.o : %.c - @echo " C: $(@D)/$( x264_icon.h - - -# Linking rule -libx264gtk.a: $(OBJECTS_LIB) - @echo " L: $(@F)" - @ar rc libx264gtk.a $(OBJECTS_LIB) - @ranlib libx264gtk.a - -$(SONAMEGTK): $(OBJECTS_LIB) - @echo " L: $(@F)" - @$(CC) -shared -o $@ $(OBJECTS_LIB) $(SOFLAGS) $(LDFLAGS) - -# Program : test -$(TEST_BIN): $(OBJECTS_LIB) $(OBJECTS_TEST) - @echo " B: $(@F)" -#Needs iconv/intl - @$(CC) -o $(TEST_BIN) $(OBJECTS_LIB) $(OBJECTS_TEST) $(LDFLAGS) $(ICONV_LIB) - -# Program : x264_gtk_encode -$(ENCODE_BIN): x264_icon.h libx264gtk.a $(SONAMEGTK) $(OBJECTS_ENCODE) $(EXTERNAL_DEPS) $(X264GTK_O) - @echo " B: $(@F)" - @$(CC) -o $(ENCODE_BIN) $(OBJECTS_LIB) $(OBJECTS_ENCODE) $(EXTERNAL_DEPS) $(LDFLAGS) $(X264GTK_O) - -# x264gtk.pc file -$(X264GTK_PC): - @echo " S: $(X264GTK_PC)" - @rm -f $(X264GTK_PC) - @echo "prefix=$(DESTDIR)${prefix}" > $(X264GTK_PC) - @echo "exec_prefix=$(DESTDIR)${exec_prefix}" >> $(X264GTK_PC) - @echo "libdir=$(DESTDIR)${libdir}" >> $(X264GTK_PC) - @echo "includedir=$(DESTDIR)${includedir}" >> $(X264GTK_PC) - @echo "" >> $(X264GTK_PC) - @echo "Name: Gtk+ interface for X264" >> $(X264GTK_PC) - @echo "Description: Gtk+ interface to configure X264" >> $(X264GTK_PC) - @echo "Requires: x264" >> $(X264GTK_PC) - @echo "Version: 0.1" >> $(X264GTK_PC) - @echo "Libs: -L$(DESTDIR)$(libdir) -lx264gtk" >> $(X264GTK_PC) - @echo "Cflags: -I$(DESTDIR)$(includedir)" >> $(X264GTK_PC) - -# Clean rule -clean: - @rm -f *.o *.mo x264_gtk.pot $(TEST_BIN) $(ENCODE_BIN) libx264gtk.a $(SONAMEGTK) x264_icon.h - -# Distclean rule -distclean: - @rm -f config.mak $(X264GTK_PC) - -# Install rule -install: $(ENCODE_BIN) - @echo " D: $(DESTDIR)$(includedir)" - @install -d "$(DESTDIR)$(includedir)" - @echo " I: $(DESTDIR)$(includedir)/x264_gtk.h" - @install -m 644 x264_gtk.h "$(DESTDIR)$(includedir)" - @echo " I: $(DESTDIR)$(includedir)/x264_gtk_enum.h" - @install -m 644 x264_gtk_enum.h "$(DESTDIR)$(includedir)" - @echo " D: $(DESTDIR)$(libdir)" - @install -d "$(DESTDIR)$(libdir)" - @echo " I: $(DESTDIR)$(libdir)/libx264gtk.a" - @install -m 644 libx264gtk.a "$(DESTDIR)$(libdir)" - @echo " I: $(DESTDIR)$(libdir)/libx264gtk.$(SOSUFFIX)" - @$(if $(SONAMEGTK), ln -sf $(SONAMEGTK) $(DESTDIR)$(libdir)/libx264gtk.$(SOSUFFIX)) - @$(if $(SONAMEGTK), install -m 755 $(SONAMEGTK) $(DESTDIR)$(libdir)) - @echo " D: $(DESTDIR)$(bindir)" - @install -d "$(DESTDIR)$(bindir)" - @echo " I: $(DESTDIR)$(bindir)/$(ENCODE_BIN)" - @install $(ENCODE_BIN) "$(DESTDIR)$(bindir)" - @echo " D: $(DESTDIR)${datadir}/x264" - @install -d "$(DESTDIR)${datadir}/x264" - @echo " I: $(DESTDIR)${datadir}/x264/x264.png" - @install -m 644 x264.png "$(DESTDIR)${datadir}/x264" - @for L in $(ALL_LINGUAS); do \ - echo " D: $(DESTDIR)${prefix}/share/locale/$$L/LC_MESSAGES"; \ - install -d "$(DESTDIR)${prefix}/share/locale/$$L/LC_MESSAGES"; \ - echo " I: $(DESTDIR)${prefix}/share/locale/$$L/LC_MESSAGES/x264_gtk.mo"; \ - install -m 644 $$L.mo "$(DESTDIR)${prefix}/share/locale/$$L/LC_MESSAGES/x264_gtk.mo"; \ - done - @echo " D: $(DESTDIR)${libdir}/pkgconfig" - @install -d "$(DESTDIR)${libdir}/pkgconfig" - @echo " I: $(DESTDIR)${libdir}/pkgconfig/$(X264GTK_PC)" - @install -m 644 $(X264GTK_PC) "$(DESTDIR)${libdir}/pkgconfig" - -# Uninstall rule -uninstall: - @echo " U: $(DESTDIR)$(includedir)/x264_gtk.h" - @rm -f "$(DESTDIR)$(includedir)/x264_gtk.h" - @echo " U: $(DESTDIR)$(includedir)/x264_gtk_enum.h" - @rm -f "$(DESTDIR)$(includedir)/x264_gtk_enum.h" - @echo " U: $(DESTDIR)$(libdir)/libx264gtk.a" - @rm -f "$(DESTDIR)$(libdir)/libx264gtk.a" - @echo " U: $(DESTDIR)$(libdir)/$(SONAMEGTK)" - @$(if $(SONAMEGTK), rm -f "$(DESTDIR)$(libdir)/$(SONAMEGTK)") - @rm -f "$(DESTDIR)$(libdir)/libx264gtk.$(SOSUFFIX)" - @echo " U: $(DESTDIR)$(bindir)/$(ENCODE_BIN)" - @rm -f "$(DESTDIR)$(bindir)/$(ENCODE_BIN)" - @echo " U: $(DESTDIR)${datadir}/x264" - @rm -rf "$(DESTDIR)${datadir}/x264" - @for L in $(ALL_LINGUAS); do \ - echo " U: $(DESTDIR)${prefix}/share/locale/$$L/LC_MESSAGES/x264_gtk.mo"; \ - rm -f "$(DESTDIR)${prefix}/share/locale/$$L/LC_MESSAGES/x264_gtk.mo"; \ - done - @echo " U: $(DESTDIR)${libdir}/pkgconfig/$(X264GTK_PC)" - @rm -f "$(DESTDIR)${libdir}/pkgconfig/$(X264GTK_PC)" - - -x264_gtk.o: x264_gtk.h x264gtk.rc x264.ico x264_gtk_bitrate.h x264_gtk_bitrate.o x264_gtk_rc.h x264_gtk_rc.o x264_gtk_mb.h x264_gtk_mb.o x264_gtk_more.h x264_gtk_more.o x264_gtk_cqm.h x264_gtk_cqm.o x264_gtk_i18n.h -x264_gtk_bitrate.o: x264_gtk_private.h x264_gtk_enum.h x264_gtk_bitrate.c x264_gtk_i18n.h -x264_gtk_rc.o: x264_gtk_private.h x264_gtk_rc.c x264_gtk_i18n.h -x264_gtk_mb.o: x264_gtk_private.h x264_gtk_mb.c x264_gtk_i18n.h -x264_gtk_more.o: x264_gtk_private.h x264_gtk_more.c x264_gtk_i18n.h -x264_gtk_cqm.o: x264_gtk_private.h x264_gtk_cqm.c x264_gtk_i18n.h -x264_gtk_encode_encode.o: x264_gtk_encode_private.h x264_gtk_encode_encode.c x264_gtk_i18n.h -x264_gtk_encode_status_window.o: x264_gtk_encode_private.h x264_gtk_encode_status_window.c x264_gtk_demuxers.h x264_gtk_i18n.h -x264_gtk_encode_main_window.o: x264_gtk_encode_private.h x264_gtk_encode_encode.o x264_gtk_encode_status_window.o x264_gtk.o x264_gtk_encode_main_window.c x264_gtk_demuxers.h x264_gtk_i18n.h -x264_gtk_encode.o: x264_gtk_encode_main_window.o x264_gtk_encode.c x264_gtk_i18n.h -test.o: x264_gtk.o test.c x264_gtk_i18n.h diff --git a/gtk/fr.po b/gtk/fr.po deleted file mode 100644 index e19801fd..00000000 --- a/gtk/fr.po +++ /dev/null @@ -1,905 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-09-28 10:28+0200\n" -"PO-Revision-Date: 2006-06-14 13:27+0200\n" -"Last-Translator: Kurosu \n" -"Language-Team: N/A\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=iso-8859-1\n" -"Content-Transfer-Encoding: 8bit\n" - -#: test.c:48 -#, c-format -msgid "" -"\n" -"Different from default values\n" -msgstr "" -"\n" -"Diffère des valeurs par défaut\n" - -#: test.c:46 -#, c-format -msgid "" -"\n" -"Same result !\n" -msgstr "" -"\n" -"Même résultat!\n" - -#: x264_gtk_encode_main_window.c:729 -#, c-format -msgid "%.2fKB/s (%.2f fps)" -msgstr "%.2fKo/s (%.2f fps)" - -#: x264_gtk_encode_main_window.c:723 -#, c-format -msgid "%dKB" -msgstr "%dKo" - -#: x264_gtk_encode_status_window.c:74 -msgid "0KB" -msgstr "0Ko" - -#: x264_gtk_more.c:83 -msgid "1 (Fastest)" -msgstr "1 (la plus rapide)" - -#: x264_gtk_cqm.c:166 -#, fuzzy -msgid "4x4 I chroma quant. matrices" -msgstr "Matrices" - -#: x264_gtk_cqm.c:146 -#, fuzzy -msgid "4x4 I luma quant. matrices" -msgstr "Matrices" - -#: x264_gtk_mb.c:83 -msgid "4x4 Intra search" -msgstr "Recherche 4x4 Intra" - -#: x264_gtk_mb.c:85 -#, fuzzy -msgid "4x4 Intra search - description" -msgstr "Recherche 4x4 Intra" - -#: x264_gtk_cqm.c:206 -#, fuzzy -msgid "4x4 P chroma quant. matrix" -msgstr "Matrices" - -#: x264_gtk_cqm.c:186 -#, fuzzy -msgid "4x4 P luma quant. matrix" -msgstr "Matrices" - -#: x264_gtk_cqm.c:104 -#, fuzzy -msgid "4x4 quant. matrices" -msgstr "Matrices" - -#: x264_gtk_mb.c:66 -msgid "4x8, 8x4 and 4x4 P-frame search" -msgstr "Recherche 4x8, 8x4 and 4x4 dans les images P" - -#: x264_gtk_mb.c:68 -#, fuzzy -msgid "4x8, 8x4 and 4x4 P-frame search - description" -msgstr "Recherche 4x8, 8x4 and 4x4 dans les images P" - -#: x264_gtk_more.c:91 -msgid "5 (High quality)" -msgstr "5 (Haute qualité)" - -#: x264_gtk_more.c:93 -msgid "6 (RDO)" -msgstr "6 (optimisation R/D)" - -#: x264_gtk_more.c:95 -msgid "6b (RDO on B frames)" -msgstr "6b (optimisation R/D sur les images B)" - -#: x264_gtk_mb.c:59 -msgid "8x16, 16x8 and 8x8 B-frame search" -msgstr "Recherche 8x16, 16x8 et 8x8 dans les images B" - -#: x264_gtk_mb.c:61 -#, fuzzy -msgid "8x16, 16x8 and 8x8 B-frame search - description" -msgstr "Recherche 8x16, 16x8 et 8x8 dans les images B" - -#: x264_gtk_mb.c:52 -msgid "8x16, 16x8 and 8x8 P-frame search" -msgstr "Recherche 8x16, 16x8 et 8x8 dans les images P" - -#: x264_gtk_mb.c:54 -#, fuzzy -msgid "8x16, 16x8 and 8x8 P-frame search - description" -msgstr "Recherche 8x16, 16x8 et 8x8 dans les images P" - -#: x264_gtk_cqm.c:111 -#, fuzzy -msgid "8x8 I luma quant. matrices" -msgstr "Matrices" - -#: x264_gtk_mb.c:73 -msgid "8x8 Intra search" -msgstr "Recherche 8x8 Intra" - -#: x264_gtk_mb.c:75 -#, fuzzy -msgid "8x8 Intra search - description" -msgstr "Recherche 8x8 Intra" - -#: x264_gtk_cqm.c:118 -#, fuzzy -msgid "8x8 P luma quant. matrices" -msgstr "Matrices" - -#: x264_gtk_mb.c:42 -msgid "8x8 Transform" -msgstr "Transformée 8x8" - -#: x264_gtk_mb.c:44 -#, fuzzy -msgid "8x8 Transform - description" -msgstr "Transformée 8x8" - -#: x264_gtk_mb.c:160 -msgid "Adaptive" -msgstr "Adaptatif" - -#: x264_gtk_mb.c:162 -msgid "Adaptive - description" -msgstr "" - -#: x264_gtk_encode_main_window.c:155 -msgid "All supported" -msgstr "Tous supportés" - -#: x264_gtk_mb.c:198 -msgid "Auto" -msgstr "Automatique" - -#: x264_gtk_bitrate.c:161 -msgid "Average bitrate" -msgstr "Débit moyen" - -#: x264_gtk_encode_main_window.c:197 -msgid "Avisynth Script" -msgstr "Script Avisynth" - -#: x264_gtk_mb.c:91 -msgid "B-Frames" -msgstr "Images B" - -#: x264_gtk_rc.c:73 -msgid "B-frames reduction (%)" -msgstr "Malus B-frames" - -#: x264_gtk_rc.c:67 -#, fuzzy -msgid "B-frames reduction - description" -msgstr "Malus B-frames" - -#: x264_gtk_mb.c:129 -msgid "Bias" -msgstr "Biais" - -#: x264_gtk_mb.c:123 -msgid "Bias - description" -msgstr "" - -#: x264_gtk_mb.c:152 -msgid "Bidirectional ME" -msgstr "EM bidirectionnel" - -#: x264_gtk_mb.c:154 -#, fuzzy -msgid "Bidirectional ME - description" -msgstr "Estimation de mouvement bidirectionnel" - -#: x264_gtk_rc.c:30 x264_gtk.c:264 -msgid "Bitrate" -msgstr "Débit" - -#: x264_gtk_rc.c:93 -msgid "Bitrate variability (%)" -msgstr "Variabilié du débit (%)" - -#: x264_gtk_rc.c:87 -#, fuzzy -msgid "Bitrate variability - description" -msgstr "Variabilié du débit (%)" - -#: x264_gtk_more.c:269 -msgid "CABAC" -msgstr "CABAC" - -#: x264_gtk_more.c:272 -msgid "CABAC - description" -msgstr "" - -#: x264_gtk_encode_main_window.c:78 -#, c-format -msgid "Can't stat file\n" -msgstr "Ne peut accéder au fichier\n" - -#: x264_gtk_more.c:149 -msgid "Chroma ME" -msgstr "EM sur la chroma" - -#: x264_gtk_more.c:151 -msgid "Chroma ME - description" -msgstr "" - -#: x264_gtk_encode_main_window.c:115 -msgid "Configure" -msgstr "Configurer" - -#: x264_gtk_encode_main_window.c:297 -msgid "Container:" -msgstr "Conteneur:" - -#: x264_gtk_encode_status_window.c:56 -msgid "Current video frame:" -msgstr "Image actuelle:" - -#: x264_gtk_cqm.c:74 -msgid "Custom matrix" -msgstr "Matrice personnalisée" - -#: x264_gtk_cqm.c:76 -#, fuzzy -msgid "Custom matrix - description" -msgstr "Matrice personnalisée" - -#: x264_gtk_more.c:197 -msgid "DCT decimate" -msgstr "Décimation DCT" - -#: x264_gtk_more.c:199 -#, fuzzy -msgid "DCT decimate - description" -msgstr "Décimation DCT" - -#: x264_gtk_more.c:39 x264_gtk_more.c:326 -msgid "Deblocking Filter" -msgstr "Filtre de lissage" - -#: x264_gtk_more.c:328 -#, fuzzy -msgid "Deblocking Filter - description" -msgstr "Filtre de lissage" - -#: x264_gtk_more.c:384 x264_gtk_more.c:418 -msgid "Debug" -msgstr "Déboguage" - -#: x264_gtk.c:243 -msgid "Default" -msgstr "Par défaut" - -#: x264_gtk_more.c:116 -msgid "Diamond Search" -msgstr "Recherche en diamant" - -#: x264_gtk_mb.c:185 -msgid "Direct mode" -msgstr "Mode direct" - -#: x264_gtk_mb.c:179 -#, fuzzy -msgid "Direct mode - description" -msgstr "Mode direct" - -#: x264_gtk_more.c:297 -msgid "Disabled" -msgstr "Désactivé" - -#: x264_gtk_encode_main_window.c:614 -msgid "Do you want to overwrite file\n" -msgstr "" - -#: x264_gtk_more.c:301 -msgid "Enabled (mode decision)" -msgstr "Activé (décision de mode)" - -#: x264_gtk_more.c:299 -msgid "Enabled (once)" -msgstr "Activé" - -#: x264_gtk_encode_status_window.c:32 -msgid "Encoding status" -msgstr "Situation dans le codage" - -#: x264_gtk_bitrate.c:61 -msgid "Encoding type" -msgstr "Type de codage" - -#: x264_gtk_bitrate.c:55 -#, fuzzy -msgid "Encoding type - description" -msgstr "Type de codage" - -#: x264_gtk_more.c:412 -msgid "Error" -msgstr "Erreurs" - -#: x264_gtk_encode_encode.c:150 -#, c-format -msgid "Error ! %d\n" -msgstr "Erreur ! %d\n" - -#: x264_gtk_encode_encode.c:143 x264_gtk_encode_main_window.c:715 -#, c-format -msgid "Error ! %d %d %d\n" -msgstr "Erreur ! %d %d %d\n" - -#: x264_gtk_encode_main_window.c:550 -msgid "Error: input file name is not set" -msgstr "Erreur: pas de nom pour le fichier d'entrée" - -#: x264_gtk_encode_main_window.c:564 -msgid "Error: output file name is not set" -msgstr "Erreur: pas de nom pour le fichier de sortie" - -#: x264_gtk_encode_encode.c:68 -msgid "Error: unknown input file type" -msgstr "Erreur: type inconnu de fichier en entrée" - -#: x264_gtk_encode_encode.c:67 -msgid "Error: unknown output file type" -msgstr "Erreur: type inconnu de fichier en sortie" - -#: x264_gtk_more.c:122 -msgid "Exhaustive search" -msgstr "Recherche exhaustive" - -#: x264_gtk_encode_main_window.c:600 -#, fuzzy -msgid "Existing file" -msgstr "Fichier de statistiques" - -#: x264_gtk_more.c:189 -msgid "Fast P skip" -msgstr "Skip pour P rapide" - -#: x264_gtk_more.c:191 -#, fuzzy -msgid "Fast P skip - description" -msgstr "Skip pour P rapide" - -#: x264_gtk_cqm.c:54 -msgid "Flat matrix" -msgstr "Matrice plate" - -#: x264_gtk_cqm.c:56 -#, fuzzy -msgid "Flat matrix - description" -msgstr "Matrice plate" - -#: x264_gtk_more.c:426 -msgid "FourCC - description" -msgstr "" - -#: x264_gtk_encode_main_window.c:254 -msgid "Frame count:" -msgstr "Nombre d'images:" - -#: x264_gtk_encode_main_window.c:244 -msgid "Frame rate den:" -msgstr "Dénominateur du FPS" - -#: x264_gtk_encode_main_window.c:234 -msgid "Frame rate num:" -msgstr "Numérateur du FPS" - -#: x264_gtk_encode_main_window.c:221 -msgid "Height:" -msgstr "Hauteur:" - -#: x264_gtk_more.c:118 -msgid "Hexagonal Search" -msgstr "Recherche en hexagone" - -#: x264_gtk_more.c:416 -msgid "Info" -msgstr "Information" - -#: x264_gtk_rc.c:306 -msgid "Initial VBV buffer occupancy" -msgstr "" - -#: x264_gtk_rc.c:300 -#, fuzzy -msgid "Initial VBV buffer occupancy - description" -msgstr "Recherche 4x4 Intra" - -#: x264_gtk_encode_main_window.c:129 -msgid "Input file" -msgstr "Fichier d'entrée" - -#: x264_gtk_encode_main_window.c:140 -msgid "Input file:" -msgstr "Fichier d'entrée:" - -#: x264_gtk_cqm.c:64 -msgid "JVT matrix" -msgstr "Matrice JVT" - -#: x264_gtk_cqm.c:66 -msgid "JVT matrix - description" -msgstr "" - -#: x264_gtk_rc.c:49 -msgid "Keyframe boost (%)" -msgstr "Bonus image clé (%)" - -#: x264_gtk_rc.c:43 -#, fuzzy -msgid "Keyframe boost - description" -msgstr "Bonus image clé (%)" - -#: x264_gtk.c:202 -#, c-format -msgid "Loading configuration from %s\n" -msgstr "Chargement de la configuration à partir de %s\n" - -#: x264_gtk.c:194 -msgid "Loading default configuration\n" -msgstr "Chargement de la configuration par défaut\n" - -#: x264_gtk_more.c:403 -msgid "Log level" -msgstr "Niveau de trace" - -#: x264_gtk_more.c:397 -msgid "Log level - description" -msgstr "" - -#: x264_gtk.c:278 -msgid "MB & Frames" -msgstr "MB et image" - -#: x264_gtk_bitrate.c:41 -msgid "Main settings" -msgstr "Réglages principaux" - -#: x264_gtk_rc.c:235 -msgid "Max IDR-frame interval" -msgstr "Distance max entre images IDR" - -#: x264_gtk_rc.c:229 -#, fuzzy -msgid "Max IDR-frame interval - description" -msgstr "Distance max entre images IDR" - -#: x264_gtk_rc.c:144 -msgid "Max QP" -msgstr "QP max" - -#: x264_gtk_rc.c:138 -msgid "Max QP - description" -msgstr "" - -#: x264_gtk_rc.c:164 -msgid "Max QP Step" -msgstr "Pas max pour QP" - -#: x264_gtk_rc.c:158 -#, fuzzy -msgid "Max QP Step - description" -msgstr "Pas max pour QP" - -#: x264_gtk_more.c:166 -msgid "Max Ref. frames" -msgstr "Max images de Ref." - -#: x264_gtk_more.c:160 -#, fuzzy -msgid "Max Ref. frames - description" -msgstr "Max images de Ref." - -#: x264_gtk_mb.c:110 -msgid "Max consecutive" -msgstr "Consécutives maximal" - -#: x264_gtk_mb.c:104 -#, fuzzy -msgid "Max consecutive - description" -msgstr "Consécutives maximal" - -#: x264_gtk_rc.c:266 -msgid "Max local bitrate" -msgstr "" - -#: x264_gtk_rc.c:260 -#, fuzzy -msgid "Max local bitrate - description" -msgstr "Pas max pour QP" - -#: x264_gtk_more.c:109 -msgid "Method" -msgstr "Méthode" - -#: x264_gtk_more.c:103 -msgid "Method - description" -msgstr "" - -#: x264_gtk_rc.c:215 -msgid "Min IDR-frame interval" -msgstr "Distance min entre images IDR" - -#: x264_gtk_rc.c:209 -#, fuzzy -msgid "Min IDR-frame interval - description" -msgstr "Distance min entre images IDR" - -#: x264_gtk_rc.c:124 -msgid "Min QP" -msgstr "QP min" - -#: x264_gtk_rc.c:118 -msgid "Min QP - description" -msgstr "" - -#: x264_gtk_more.c:206 -msgid "Misc. Options" -msgstr "Options diverses" - -#: x264_gtk_more.c:178 -msgid "Mixed Refs" -msgstr "Réf. mélangées" - -#: x264_gtk_more.c:180 -msgid "Mixed Refs - description" -msgstr "" - -#: x264_gtk.c:285 -msgid "More..." -msgstr "Plus..." - -#: x264_gtk_more.c:55 -msgid "Motion Estimation" -msgstr "Estimation de mouvement" - -#: x264_gtk_bitrate.c:72 -msgid "Multipass - First Pass" -msgstr "Plusieurs passes - première" - -#: x264_gtk_bitrate.c:74 -msgid "Multipass - First Pass (fast)" -msgstr "Plusieurs - première (rapide)" - -#: x264_gtk_bitrate.c:76 -msgid "Multipass - Nth Pass" -msgstr "Plusieurs - passe N" - -#: x264_gtk_more.c:315 -msgid "Noise reduction" -msgstr "Débruitage" - -#: x264_gtk_more.c:309 -#, fuzzy -msgid "Noise reduction - description" -msgstr "Débruitage" - -#: x264_gtk_mb.c:192 x264_gtk_more.c:410 -msgid "None" -msgstr "Aucune" - -#: x264_gtk_encode_main_window.c:265 -msgid "Output file" -msgstr "Fichier de sortie" - -#: x264_gtk_encode_main_window.c:288 -msgid "Output file (without ext.):" -msgstr "Fichier de sortie (sans ext.)" - -#: x264_gtk_encode_main_window.c:276 -msgid "Output path:" -msgstr "Répertoire de sortie" - -#: x264_gtk_more.c:43 x264_gtk_more.c:75 -msgid "Partition decision" -msgstr "Decision de la partition" - -#: x264_gtk_more.c:69 -#, fuzzy -msgid "Partition decision - description" -msgstr "Decision de la partition" - -#: x264_gtk_mb.c:33 -msgid "Partitions" -msgstr "Partitions" - -#: x264_gtk_encode_status_window.c:122 -msgid "Progress:" -msgstr "Progression:" - -#: x264_gtk_rc.c:105 -msgid "Quantization limits" -msgstr "Limite de quantification" - -#: x264_gtk.c:292 -msgid "Quantization matrices" -msgstr "Matrices" - -#: x264_gtk_bitrate.c:94 x264_gtk_bitrate.c:171 -msgid "Quantizer" -msgstr "Pas de quantification" - -#: x264_gtk_bitrate.c:88 -msgid "Quantizer - description" -msgstr "" - -#: x264_gtk_more.c:136 -msgid "Range" -msgstr "Portée" - -#: x264_gtk_more.c:130 -msgid "Range - description" -msgstr "" - -#: x264_gtk.c:271 -msgid "Rate Control" -msgstr "Contrôle de débit" - -#: x264_gtk_more.c:226 -msgid "Sample Aspect Ratio" -msgstr "Ratio d'aspect de pixel" - -#: x264_gtk_more.c:220 -#, fuzzy -msgid "Sample Aspect Ratio - description" -msgstr "Ratio d'aspect de pixel" - -#: x264_gtk_rc.c:195 -msgid "Scene Cut Threshold" -msgstr "Seuil de changement" - -#: x264_gtk_rc.c:189 -#, fuzzy -msgid "Scene Cut Threshold - description" -msgstr "Seuil de changement" - -#: x264_gtk_rc.c:176 -msgid "Scene Cuts" -msgstr "Changements de scène" - -#: x264_gtk_cqm.c:84 x264_gtk_encode_main_window.c:146 -msgid "Select a file" -msgstr "Choisir un fichier" - -#: x264_gtk_encode_main_window.c:281 -msgid "Select a path" -msgstr "Choisir un répertoire" - -#: x264_gtk_bitrate.c:68 -msgid "Single Pass - Bitrate" -msgstr "Passe unique - débit" - -#: x264_gtk_bitrate.c:70 -msgid "Single Pass - Quantizer" -msgstr "Passe unique - Quantificateur" - -#: x264_gtk_mb.c:194 -msgid "Spatial" -msgstr "Spatiale" - -#: x264_gtk_bitrate.c:113 -msgid "Statistic file" -msgstr "Fichier de statistiques" - -#: x264_gtk_bitrate.c:135 -#, fuzzy -msgid "Statistic file name" -msgstr "Fichier de statistiques" - -#: x264_gtk_more.c:346 -msgid "Strength" -msgstr "Force" - -#: x264_gtk_more.c:340 -msgid "Strength - description" -msgstr "" - -#: x264_gtk_bitrate.c:182 x264_gtk_bitrate.c:192 -msgid "Target bitrate" -msgstr "Débit visé" - -#: x264_gtk_mb.c:196 -msgid "Temporal" -msgstr "Temporelle" - -#: x264_gtk_more.c:255 -msgid "Threads" -msgstr "Tâches" - -#: x264_gtk_more.c:249 -msgid "Threads - description" -msgstr "" - -#: x264_gtk_more.c:47 x264_gtk_more.c:370 -msgid "Threshold" -msgstr "Seuil" - -#: x264_gtk_more.c:364 -msgid "Threshold - description" -msgstr "" - -#: x264_gtk_encode_status_window.c:92 -msgid "Time elapsed:" -msgstr "Temps écoulé:" - -#: x264_gtk_encode_status_window.c:103 -#, fuzzy -msgid "Time remaining (estimated):" -msgstr "Temps total (estimé):" - -#: x264_gtk_more.c:290 -msgid "Trellis" -msgstr "Treillis" - -#: x264_gtk_more.c:284 -msgid "Trellis - description" -msgstr "" - -#: x264_gtk_more.c:120 -msgid "Uneven Multi-Hexagon" -msgstr "Recherche par hexagones inégaux" - -#: x264_gtk_bitrate.c:124 -#, fuzzy -msgid "Update statistic file" -msgstr "Mettre à jour le fichier" - -#: x264_gtk_bitrate.c:126 -#, fuzzy -msgid "Update statistic file - description" -msgstr "Mettre à jour le fichier" - -#: x264_gtk_mb.c:141 -msgid "Use as references" -msgstr "Utiliser comme références" - -#: x264_gtk_mb.c:143 -#, fuzzy -msgid "Use as references - description" -msgstr "Utiliser comme références" - -#: x264_gtk_rc.c:286 -msgid "VBV buffer size" -msgstr "" - -#: x264_gtk_rc.c:280 -#, fuzzy -msgid "VBV buffer size - description" -msgstr "Skip pour P rapide" - -#: x264_gtk_rc.c:247 -msgid "Video buffer verifier" -msgstr "" - -#: x264_gtk_encode_status_window.c:68 -msgid "Video data:" -msgstr "Données vidéo:" - -#: x264_gtk_encode_status_window.c:80 -msgid "Video rendering rate:" -msgstr "Vitesse de codage vidéo:" - -#: x264_gtk_more.c:414 -msgid "Warning" -msgstr "Avertissements" - -#: x264_gtk_mb.c:168 -msgid "Weighted biprediction" -msgstr "Bi-Prédiction à poids normalisés" - -#: x264_gtk_mb.c:170 -#, fuzzy -msgid "Weighted biprediction - description" -msgstr "Bi-Prédiction à poids normalisés" - -#: x264_gtk_encode_main_window.c:208 -msgid "Width:" -msgstr "Largeur:" - -#: x264_gtk.c:368 -#, c-format -msgid "Writing configuration to %s\n" -msgstr "Ecriture de la configuration dans %s\n" - -#: x264_gtk.c:238 -msgid "X264 Configuration" -msgstr "Configuration de X264" - -#: x264_gtk_encode_main_window.c:99 -msgid "X264 Gtk Encoder" -msgstr "Interface GTK+ pour X264" - -#: x264_gtk_encode_main_window.c:173 -msgid "YUV CIF sequence" -msgstr "Séquence YUV de dimensions CIF" - -#: x264_gtk_encode_main_window.c:179 -msgid "YUV QCIF sequence" -msgstr "Séquence YUV de dimensions QCIF" - -#: x264_gtk_encode_main_window.c:167 -msgid "YUV sequence" -msgstr "Séquence YUV" - -#: x264_gtk_encode_main_window.c:185 -msgid "YUV4MPEG2 sequence" -msgstr "Séquence YUV4MPEG2" - -#: x264_gtk_encode_encode.c:99 -#, c-format -msgid "can't set outfile param\n" -msgstr "ne peut le paramètre du fichier de sortie\n" - -#: x264_gtk_encode_encode.c:75 -#, c-format -msgid "could not open input file '%s'\n" -msgstr "Erreur lors de l'ouverture du fichier d'entrée '%s'\n" - -#: x264_gtk_encode_encode.c:173 -#, c-format -msgid "encoded %d frames, %.2f fps, %.2f kb/s\n" -msgstr "%d images codées, %.2f fps, %.2f kb/s\n" - -#: x264_gtk_encode_encode.c:58 -msgid "encoding...\n" -msgstr "codage...\n" - -#: x264_gtk_encode_main_window.c:587 -#, c-format -msgid "file output : %s\n" -msgstr "fichier de sortie : %s\n" - -#: x264_gtk_encode_encode.c:281 -#, c-format -msgid "need to increase buffer size (size=%d)\n" -msgstr "doit accroître la taille de mémoire tampon (taille=%d)\n" - -#: x264_gtk.c:842 -msgid "problem...\n" -msgstr "Problème...\n" - -#: x264_gtk.c:193 -#, c-format -msgid "x264.cfg: %s\n" -msgstr "" - -#: x264_gtk_encode_encode.c:266 -#, c-format -msgid "x264_encoder_encode failed\n" -msgstr "x264_encoder_encode a échoué\n" - -#: x264_gtk_encode_encode.c:89 -#, c-format -msgid "x264_encoder_open failed\n" -msgstr "x264_encoder_open a échoué\n" - -#~ msgid "Statsfile name" -#~ msgstr "Nom du fichier" - -#~ msgid "bitrate %d\n" -#~ msgstr "Débit %d\n" - -#~ msgid "flat\n" -#~ msgstr "plate\n" - -#~ msgid "log level %d\n" -#~ msgstr "Niveau de trace %d\n" diff --git a/gtk/test.c b/gtk/test.c deleted file mode 100644 index dbb18fd7..00000000 --- a/gtk/test.c +++ /dev/null @@ -1,75 +0,0 @@ -/***************************************************************************** - * test.c: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#include -#include - -#include - -#include "../x264.h" -#include "../common/common.h" - -#include "x264_gtk.h" -#include "x264_gtk_private.h" -#include "x264_gtk_i18n.h" - - -int -main (int argc, char *argv[]) -{ - GtkWidget *window; - X264_Gtk *x264_gtk; - x264_param_t *param; - x264_param_t param_default; - char *res; - char *res_default; - - BIND_X264_TEXTDOMAIN(); - - gtk_init (&argc, &argv); - - window = x264_gtk_window_create (NULL); - x264_gtk_shutdown (window); - - x264_gtk = x264_gtk_load (); - param = x264_gtk_param_get (x264_gtk); - - /* do what you want with these data */ - /* for example, displaying them and compare with default*/ - res = x264_param2string (param, 0); - printf ("%s\n", res); - - x264_param_default (¶m_default); - res_default = x264_param2string (¶m_default, 0); - printf ("\n%s\n", res_default); - - if (strcmp (res, res_default) == 0) - printf (_("\nSame result !\n")); - else - printf (_("\nDifferent from default values\n")); - - x264_free (res); - x264_free (res_default); - - x264_gtk_free (x264_gtk); - g_free (param); - - return 1; -} diff --git a/gtk/x264.ico b/gtk/x264.ico deleted file mode 100644 index 559e65e1f080f172f063b38b6ae503ba399d2a6b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2238 zcmd6ndvFs~6vn?&kfwIvsRG1A#Gt_gH9Kprx(R z*r`@xr|o3E6FQ>RQIkOAoCuAMXkCoEpl4i9U$1w&~+ zYV;t(xCnZK7e=E5v)K!sAqcZTwfadAM!^T8-4DHmHZj?P5Cjh_f&`02qU}ZI=+&@V zy$~!u#{94*)#`&ii)s(TY7f9pvU9h?;qb%Z^utL+lAFI7PB8#6i7NmX(V0Wg>LY+z zhL-d(g`qdqL1)>GuC^*@g$QjT$W&sJp%+5vYu$s4%u4jitcB6We5VYf7{cJGw1pV+ zj-h9E19XlkG$MVmi74om-vm=`6Z*_K29v7^dZz-tOX0l=M%h9T9AQ|9;EcfHioh;L zV5M4JGVEk(euzDUFvnHN9vF8qfOt>8hit2I972_zYNhAff$f6ifh_EQDl`Jg+)@} z@WhZSH9_=7Ve!Xc^K(8B#YnDa=em}F0)gvUf(ck@TZ4=fC-*gn*mIbK60{Q#=nGT} z$*w#HA(DWNIGE!IC*UN7d#Dlm$+(<=C@To*looH1=ik$CqV z<0m_wom5chiX1+CC>&b8|EF5{j9UERn)$EHoSbLZX?s5E$SD{;?@&B`Djsh+-4c(h zs=9jBiZ$!j`<5*!ed@`Vgzh()h90aLvujLETv5)3YE-r1_<zN~F}DsGQZ=tOeqwI@?%KFo-uO-Vre(#`XJn7d&vWFwaPzG# zqXzG+YL2(r!oy!cLgQIRq0nQ;Zeh>F&DT&b58HXmC!3#pdvn8)=#H=aA3fdeO3ih>2R-=E!l0004iP)t-sEd~TW z1P4e24N3+GPy_{01rA#V2UrUeYzYcu5gLFD4ssbIk`NDx6&7kDC4VI?qZ$>m78Zyt zG@B_Q!5tZpG&=80A|my=G+VTqnb6VB}&g=w&6o zaBc8u7v69r#&2u)W+d2jJMwZG{%#)6cX0i5BFcY!(SUdRd>#3M9QlYI-HCkLi-YTu zGx?At`;!>hmW|_-iTs`;{-71`pF#boCg`A){jMhFr<(q^C;hZM{kJmyzcBQ*rRlk^ z{>C-_%sKwaO8d=X{?bAI*hv1@Q18pX{KvEZ+Fkj~zWv};{orE%-f#cleDl}N{^N4~ z*v0?ji~j0q{_c7I=b!!Wh5hf0|KZaA@R*fCP!T;>x{`AcK^4|aS z)&BG4{q*hs`0@Yy`TYL-Yg0c000009a7bBm000XT000XT0n*)m`~Uy|2XskIMF-Uj z4GjV~8F7cd000^tNklRdwsW-_FVN$UW6dOrgA7ONvQD z5C~|95<^i{96-jrwbsWpFaUtb?ECpTMz`r>m=9cBTmS$-5F)54C;$Lv-CdA^mY@Ux z=zs=J+YubreE~K$>$E`(A)yA-XfPrSFtCn0a^FsGZX6yoD~TX61xX>rLx?zv8Yb55 z7WVD}?lUj}XHLC6Zl8Q~n|%y71o6}pJ@o{rp=zWF5FrCFnT*g$0wJIYj)=px1L+8^ zi;^41>+yQLnqIGTgTjiy6|B!N18Pi|9f7;Z+7le{jZP1s0qw?|1G~u=dd%zLP;yMgNC|<08&qV-B#dq;RLYk088o#!aOhO{4mb|OIqvV zIo=Mp)N(^yb{>}fYtewYwg;n$8w07 zn54PWJ;9&-ag1dkV-U{Fdii6`K^6!6{dZ|i$@uT}BQn&%776S~cvu{&dGdzU*5Xy`I zzTdWOKK1_kl!@ElIXI3ng$an7VruqINU{K}t?A_(X0M+Xeg14KvzEPp(=v!75wMmW zkm!Si;F!7?rfLWxjtEi!T7jAXZv}S}He(~^yCj0JR;bj;6Hb$9i5V9wL0E%;yZPLo zpKnjSACGf`fBFXp01O;ZQ4(q#?*ZfHdY50mzURU-MbsXo)Pk2vmYSO;Z{(H}nN})f zA>pMKF?9i9x`G3U@I0mtKGt?V;Eh#@X9O38wn8Yt$tZO@NS zTUauLxqbV4QBhTmBO(xHn1PA2yso(!9*-|xy?7{Z}i4+#pT<}B{TONT5DJ+-W! zr4Ax3lM!(NAWU$(fh!Y;3=MUSf z-XA1J1Qf#r!RBmKzt+bO-_$li{rb0m?ea|DQCHrd391@oDm`I3=H535n){B;-O~MM z8M?LGl{LP7r$X^oY5~MmkPP53Qqvw$XjyxzWN+C-Os05n5fniTDS)D82!IR43R;;! zeDm($c|aVosk;o!+Z?^`=kMO%_HLk}N$o%WS#0d)#QC@v4W0-JBmhze!#?+C-;e#} zx=K>3?Z&mgc=&M%c+FBM;Np@jx!3?(T5ee#5_w3Hws2rQiOhfxZxewD@8^-ArU_6mfDXody&v|w z<1s}R%-YSL_T|OH>sNwMD#b?<7e^2i&F%w89e^bGND(Q3gSZH)6Y&`kF-I`P5fsb? z)X6W_4>lpvbpikirj%#hY)qDSuX^ghPUn^!K76rE;G2|GQA3fCZ-mec=)T;|93Ivj z$?T(Z<;?PK`TQZcJCr_eCrob#b4>QqqvRGFQ2|;^B*a8q05@?wSTIB#P%so1Z~?{K zRGf#t{C*DN(<_Mz3K%f(!zUZ`8ApLcPo&PP4nPJzyzUD;!ulcQjc!G-`frVOXk0@ML=*@5f=eae1;7GfE5q` z6nDX4IWZ;ffGGwT(|y`*-}l;gU?Fjm6T}&q0l1TXP%;7mrnlH!Ird8@eZCL&{q9fS zRU1rBwJP=cG0kxQ)t7H z3x|Ir004kELfRiLAw}~Ef{VMk?QLsy?0?|E5=xO2B%%Ze0EkDy2QUDe)7!Owng(xu zH!Tf4vJFYNp4L+Cu;4{cn#BTvmju0$jjE0G%#^yQraZ z`%R7Df-n&m09*hU-1E*_iPxtG7nnHbHg03!>GZQRX(5HAAs_@``t(+N?fdb{k|Z>GvFU?OS) z?jl%(_wPI6A|7j>Wd;X8a0EwW3un;Sw-*!Gd-nkcvD5|b`pilS2!uJB^>MMs8xFB^ z2MZ)|CImP5JS@A7uqPN1z)TfW@HhiZng84WxI!m+sf+*Lf8WF16$deS2k>gYopo_q z!5kTR0x_MhQ&j2t%Of5$$KNhv{|B=ST09!}@Mr$;X^j+s}yr!@k>>R*H+L%rHc17V%$RN>4}|u+77@*!#W%hx@o_P*oVpbf)dJ+O2_ve+GoPFWdBbJcsq=9V=w@`*)xJ?X$Sx zz_(vj%1F5Ur(YyMIbOc{SH(f71Z(I9D@+SUR<|6>g0I0ND4u~y<=nAzVH3q@(l=+@NN-jYD%oI z>*~~x;c0z(kyC2v-~7*D7-%;jQp@+hq=%aH%HRCly{Rd=$K<(YS|N+eP)CY?^Z&KH zxBT+U{c1l5!tsqDf`_Ss3oiIv{So5JQ=t2F0}>Jy#f(0;xiu{zYKWrdgKB->&;5C0 zf+-1@N?vAwzzl>*n3-MJ=T){BYbIt4s0Dkem4X+3*m~Cuhbbd(aG{ z(#EY{&TTXW1t_MdVRrv!G6BK_0!qK@q|QDcpIF&%5GbkZopCs}Qu!?ao$&Ve-+ee= zSXnn+9$vnE$WEyxyI9MN|MO|tmxVw3Ilc>PURFrK1yfwW1#$LW(5A88Qb1J|7qfBc z&#jFZm$EMC*7`R3zV|aX4&2WLQiuFZzquJ!mZu^3vd5T79UuV; zE(eL|LLl{py)Rz*&~CbD)F1eN8{ClwL zHT}04HL*mLlpqnn)DT0|MTmE|#|beprp>msE_liJ91wB0xo`Da+xdw&=i!-2Ws-o8 znA!v%oa}hnN94v?xx^cs&gZNi0m2kMG$5eZzj|RDl9ak^1OS+-r@P}7+^(`Nq-*%& z!yCkF*1!Au2=LRtOfHBV7Cg~gRsbcKi@PBle^}ni$JygQQF>}o53l=CR25^|wCC-% z8*0^n03%uc^A+V# zqEOgIm`vdG#*vyS|Ki<${8rhP$??PWM6j<}mgn&H)V=`#9K1n;Uva#?yB7q&feyz_ zi4TAF5TZH?IvF-6@Ule!|McmHQD-3KSLrU6q|u`qFmd+2j5cDRYp>=}58HafPZtEx z_ctsWq^ZZBt;dvJ-^Z3)VU06P0(z+hN-f^*e)PC4-mb@X{B)Elz`URRPaz~iBzIgq z-GKH3e@eVCTmZpahwf;6^>T4V0H0>lB?!*JoO!-}{eDu?+q+|l30$x_r*vmn>wY<3 zd*^faAg6@|e-j6dy9)a^&nRjN^YnIE*Ybj5QfjIB^ZzThfRe~HL#~>Axg9x}T(Mmo z?=ytS(vCAk#2W(iNE)3PcAtVfC@v{=5Qs%3C<7A)Qvk=j%^%KBZzjp@BUbw0pfc6+3~ROf(MRx%T9ZU1d?gz_g^$1 z3(nOMaJI!;sn3}{XFd`@9Kppw=tR;U1WW)^QSsFAWD&(CW*Cn9WZRzk_!!c8ep()0 zy+Nk|Q*l&axG8|~LrYYXQ{=>gsGl|5yB@%_-{kozV1AYC~l2)`7PE~5wf%4hg zZv&>O^Pj)SAl{9CtewR1bm4QdmwT6`<(^_sK&H`!9z_y~wH*Zkzz`q;#9BLGfX>_Y z{E>4Cu=E=HUp$l&m>>kz!wJ%iuAXgzk3KHjd-gj1?#KT!lGbfw-PWhy|N4@^Kso%| zg(NqQbz43Gyo6HutM3RH@Xi1JUl+O+{_gKX$C6+4Us{9w-?=!5Be>$ihySpID5;VD zN^k+(K)`&&k)&(8 z{pla|eqEQuw*KjFFDU^iaQk1&ga`o$ldo3Fqu$>A+g~UE{OV6Xc?;kD?o&`;ZpWYe z1<-In+*@(M#9g-Mxvlp-QE(9e3FbiUj|sz_Fz*4yT{m*IH$a0#X;0HoeEG9r^egROGopohQamsn4o^yw3% z4y7x==YQEsExAE%xs~iq6D~N{>v7{4>4FQm;EK7Iefw~{VixVZ(>rI|U76#MmKP8A z$1yU%gd2=Fd@yag;B~5@gW=Ohg}Y^5N1T^;6yL794*-T_Mu|t;I`s5o!V4?aW9nI0A@^y1~}ZlSw@5!ZtkIGM3`~ z!$Wzc;i}Pw;1ie(V=@82&;bT&0fADPIp5U3{gOSK>WzU}cOjv-Vj6ntO=(Iv*Rri} z(DB6=zxn#xigr@(0PyaMx1Ws!xusgNWXUuu37k?fy&x#j2!Ob_fT%2=edso)$&X(- z)f_o2@!@pLE5XJ#0T*NXXm#wJR7k?IoQL>uTxzM%VGpynVMcsqqnclow5{ z{b_!8t!Ip#UsUKb~ z9h@ECJ&M8|001j1k|?YkC`AL*EYx*|83u?$%dH?b67?N3o7mt`=Q&uU)radk(bMBjRM^(we-e3e!u%LGjVfF5tOJY z^u(v1ECRgn$sRa+{pe8-q?H^cp$S$1FtY+R=Pgg)$S~s2p&eW35ialyr5+J+MQWiI zJi8#Kis3#H5E>Im@%6*KCRsdS=CzFv-+ycu@wAkGez%kmn6vJFvDV)(&Nh76E-q*= zH`G8R5CI$do1YLSJ<-EXvN+w_v&U!GB^_C70@j;ydu7>+BQ-ZDP_s#@#eqhBt_ItR zQmzy%7tc<1q!s}T)DUU`@i8}H5<%|}XV(3;pFiGyKP4`Qhx;GpDBkLI|DkQAM(nWP)ZJqZA0aZFLebmH2Ro6N9su|2{aApUWCyxwm7DW~Pln`6XoALbwE zpdow4zGR!uuKV`tr(a)1C84I82ucFQu+;zXjyR;SaFydF-d#=xDa_)?Ez*ybTEO7u zFK-8Ze5khroeQ<_$Oe_o$wfAh2Z)VV$W zFgtyIy1%;%v+vvc&V)tv^q_F=ua&+r9d8BsFi4aGEQv&JmGWN*23)P^W!u?Q+%~PB(-td`-uSnLE}lhGyn?|AVBKij6TL5lEDNz z`?4F;YpLc$!W!TRL3|Jr5l@`O8Bo_-M6P?jk9MR7xn!0PsAVIWg1>D$Fsw z+P-hRT2c=)X+E&Xn4zGG_5>PqN@mj+yMC>zPJ|@;IVC&56{!EhgT1WC_Y*pJ3VnKSyIdeW&{A2 zXPW>Fn8R+nJ#GWA^78KP1tl?093oxZm*$2a2 z;H5_hsnZ7xcXA6e=fuEfKaZPZW4@4ke4g1$4XmcIq(TI&*4k2M7q6erdU)t5)$(*T zZYU8kY_!Myw(ouCncA5^paZwSt9>VhT-I7l-Es3awz`ko_s<N<&h#PEOidN-kr5}n8JFv#cN1v2Tsx!oIv{fQ z<}4@49tE&5CNm?U?c43^&do@ss5%jNv&T~Sh1W6oCPr=RF!xVl;d zHNzZC9N^_wY@KV8`;?X?W%8mCRU&3g>pxuTC%Zxl`|`!Ty6=XhLSElUXj3BUvbGcY4Axu2rdP$gsIP*Y)G~eQ&`;b3CqZVmfFD0*t_%4Ca9p zkW5eA#eKA>n6t|Z3-_-B{>OZ?eN+I%0q*$ma`o2_B_X*SlZq!)hQ;hdHeLK0+|sF6%KH71UP(IN`Pr+p5VddG1lMw|5!}QTMW~@OaK4? M07*qoM6N<$f|Q5ylK=n! diff --git a/gtk/x264_gtk.c b/gtk/x264_gtk.c deleted file mode 100644 index 524d76d6..00000000 --- a/gtk/x264_gtk.c +++ /dev/null @@ -1,1159 +0,0 @@ -/***************************************************************************** - * x264_gtk.c: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#include -#include -#include -#include -#include -#if defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ || defined __DragonFly__ -# include -#else -# include -#endif -#ifdef _WIN32 -# define _WIN32_IE 0x400 -# include /* for mkdir */ -# include /* for SHGetSpecialFolderPath */ -#endif - -#include "../x264.h" - -#include - -#include "x264_gtk.h" -#include "x264_gtk_i18n.h" -#include "x264_gtk_private.h" -#include "x264_gtk_enum.h" -#include "x264_gtk_bitrate.h" -#include "x264_gtk_rc.h" -#include "x264_gtk_mb.h" -#include "x264_gtk_more.h" -#include "x264_gtk_cqm.h" - - -#define CHECK_FLAG(a,flag) ((a) & (flag)) == (flag) -#define round(a) ( ((a)<0.0) ? (gint)(floor((a) - 0.5)) : (gint)(floor((a) + 0.5)) ) -#define X264_MAX(a,b) ( (a)>(b) ? (a) : (b) ) -#define X264_MIN(a,b) ( (a)<(b) ? (a) : (b) ) - -/* Callbacks */ -static void x264_dialog_run (GtkDialog *dialog, - gint response, - X264_Gui_Config *gconfig, - X264_Gtk *x264_gtk); - - -/* x264 config management */ -static void x264_default_load (GtkButton *button, gpointer user_data); -static void x264_current_get (X264_Gui_Config *gconfig, X264_Gtk *x264_gtk); -static void x264_current_set (X264_Gui_Config *gconfig, X264_Gtk *x264_gtk); -static void x264_default_set (X264_Gtk *x264_gtk); - - -/* Result must be freed */ -x264_param_t *x264_gtk_param_get (X264_Gtk *x264_gtk) -{ - x264_param_t *param; - - if (!x264_gtk) - return NULL; - - param = (x264_param_t *)g_malloc (sizeof (x264_param_t)); - if (!param) - return NULL; - - x264_param_default (param); - - /* rate control */ - param->rc.f_ip_factor = 1.0 + (double)x264_gtk->keyframe_boost / 100.0; - param->rc.f_pb_factor = 1.0 + (double)x264_gtk->bframes_reduction / 100.0; - param->rc.f_qcompress = (double)x264_gtk->bitrate_variability / 100.0; - - param->rc.i_qp_min = x264_gtk->min_qp; - param->rc.i_qp_max = x264_gtk->max_qp; - param->rc.i_qp_step = x264_gtk->max_qp_step; - - param->i_scenecut_threshold = x264_gtk->scene_cut_threshold; - param->i_keyint_min = x264_gtk->min_idr_frame_interval; - param->i_keyint_max = x264_gtk->max_idr_frame_interval; - - param->rc.i_vbv_max_bitrate = x264_gtk->vbv_max_bitrate; - param->rc.i_vbv_buffer_size = x264_gtk->vbv_buffer_size; - param->rc.f_vbv_buffer_init = x264_gtk->vbv_buffer_init; - - /* mb */ - param->analyse.b_transform_8x8 = x264_gtk->transform_8x8; - param->analyse.inter = 0; - if (x264_gtk->pframe_search_8) - param->analyse.inter |= X264_ANALYSE_PSUB16x16; - if (x264_gtk->bframe_search_8) - param->analyse.inter |= X264_ANALYSE_BSUB16x16; - if (x264_gtk->pframe_search_4) - param->analyse.inter |= X264_ANALYSE_PSUB8x8; - if (x264_gtk->inter_search_8) - param->analyse.inter |= X264_ANALYSE_I8x8; - if (x264_gtk->inter_search_4) - param->analyse.inter |= X264_ANALYSE_I4x4; - - param->b_bframe_pyramid = x264_gtk->bframe_pyramid && x264_gtk->bframe; - param->analyse.b_bidir_me = x264_gtk->bidir_me; - param->i_bframe_adaptive = x264_gtk->bframe_adaptive; - param->analyse.b_weighted_bipred = x264_gtk->weighted_bipred; - param->i_bframe = x264_gtk->bframe; - param->i_bframe_bias = x264_gtk->bframe_bias; - param->analyse.i_direct_mv_pred = x264_gtk->direct_mode; - -/* param->b_bframe_pyramid = param->b_bframe_pyramid && (param->i_bframe > 1); */ - - /* more */ - param->analyse.i_subpel_refine = x264_gtk->partition_decision + 1; - param->analyse.b_bframe_rdo = x264_gtk->bframe_rdo; - param->analyse.i_me_method = x264_gtk->me_method; - param->analyse.i_me_range = x264_gtk->range; - param->analyse.b_chroma_me = x264_gtk->chroma_me; - param->analyse.i_trellis = x264_gtk->trellis; - param->analyse.i_noise_reduction = x264_gtk->noise_reduction; - param->i_frame_reference = x264_gtk->max_ref_frames; - param->analyse.b_mixed_references = x264_gtk->mixed_refs; - param->analyse.b_fast_pskip = x264_gtk->fast_pskip; - param->analyse.b_dct_decimate = x264_gtk->dct_decimate; - /* rdo : RD based mode decision for B-frames. Requires subme 6 */ - - param->vui.i_sar_width = x264_gtk->sample_ar_x; - param->vui.i_sar_height = x264_gtk->sample_ar_y; - param->i_threads = x264_gtk->threads; - param->b_cabac = x264_gtk->cabac; - param->b_deblocking_filter = x264_gtk->deblocking_filter; - param->i_deblocking_filter_alphac0 = x264_gtk->strength; - param->i_deblocking_filter_beta = x264_gtk->threshold; - - param->i_log_level = x264_gtk->debug_method - 1; - - /* cqm */ - param->i_cqm_preset = x264_gtk->cqm_preset; - if (x264_gtk->cqm_file && (x264_gtk->cqm_file[0] != '\0')) - param->psz_cqm_file = x264_gtk->cqm_file; - memcpy( param->cqm_4iy, x264_gtk->cqm_4iy, 16 ); - memcpy( param->cqm_4ic, x264_gtk->cqm_4ic, 16 ); - memcpy( param->cqm_4py, x264_gtk->cqm_4py, 16 ); - memcpy( param->cqm_4pc, x264_gtk->cqm_4pc, 16 ); - memcpy( param->cqm_8iy, x264_gtk->cqm_8iy, 64 ); - memcpy( param->cqm_8py, x264_gtk->cqm_8py, 64 ); - - /* bitrate */ - switch (x264_gtk->pass) { - case X264_PASS_SINGLE_BITRATE: - param->rc.i_rc_method = X264_RC_ABR; - param->rc.i_bitrate = x264_gtk->average_bitrate; - break; - case X264_PASS_SINGLE_QUANTIZER: - param->rc.i_rc_method = X264_RC_CQP; - param->rc.i_qp_constant = x264_gtk->quantizer; - break; - case X264_PASS_MULTIPASS_1ST_FAST: - param->analyse.i_subpel_refine = X264_MAX( X264_MIN( 3, param->analyse.i_subpel_refine - 1 ), 1 ); - param->i_frame_reference = ( param->i_frame_reference + 1 ) >> 1; - param->analyse.inter &= ( ~X264_ANALYSE_PSUB8x8 ); - param->analyse.inter &= ( ~X264_ANALYSE_BSUB16x16 ); - case X264_PASS_MULTIPASS_1ST: - param->rc.i_rc_method = X264_RC_ABR; - param->rc.i_bitrate = x264_gtk->average_bitrate; - param->rc.f_rate_tolerance = 4.0; - break; - case X264_PASS_MULTIPASS_NTH: - param->rc.i_rc_method = X264_RC_ABR; - param->rc.i_bitrate = x264_gtk->average_bitrate; - param->rc.f_rate_tolerance = 1.0; - break; - } - - param->rc.b_stat_write = x264_gtk->stat_write; - param->rc.b_stat_read = x264_gtk->stat_read; - - /* FIXME: potential mem leak... */ - param->rc.psz_stat_out = x264_gtk_path (x264_gtk->statsfile_name); - - return param; -} - -/* Result must be freed */ -X264_Gtk * -x264_gtk_load (void) -{ - X264_Gtk *x264_gtk; - GIOChannel *file; - GError *error = NULL; - gchar *filename; - - x264_gtk = (X264_Gtk *)g_malloc0 (sizeof (X264_Gtk)); - if (!x264_gtk) - return NULL; - - filename = x264_gtk_path ("x264.cfg"); - file = g_io_channel_new_file (filename, "r", &error); - if (error) { - g_print (_("x264.cfg: %s\n"), error->message); - g_print (_("Loading default configuration\n")); - x264_default_set (x264_gtk); - } - else { - GIOStatus status; - gchar *data = NULL; - gsize length; - - g_print (_("Loading configuration from %s\n"), filename); - g_io_channel_set_encoding (file, NULL, NULL); - status = g_io_channel_read_to_end (file, &data, &length, &error); - if ((status == G_IO_STATUS_NORMAL) && - (length == sizeof (X264_Gtk))) { - memcpy (x264_gtk, data, length); - } - g_io_channel_shutdown (file, TRUE, NULL); - g_io_channel_unref (file); - } - g_free (filename); - - return x264_gtk; -} - -GtkWidget * -x264_gtk_window_create (GtkWidget *parent) -{ - GtkWidget *win_x264_gtk; - GtkWidget *notebook; - GtkWidget *page; - GtkWidget *button; - GtkWidget *label; - X264_Gui_Config *gconfig; - X264_Gtk *x264_gtk; - gint result; - GtkDialogFlags flags = 0; - - gconfig = (X264_Gui_Config *)g_malloc (sizeof (X264_Gui_Config)); - if (!gconfig) - return NULL; - - x264_gtk = x264_gtk_load (); - - if (parent) - flags = GTK_DIALOG_MODAL |GTK_DIALOG_DESTROY_WITH_PARENT; - win_x264_gtk = gtk_dialog_new_with_buttons (_("X264 Configuration"), - GTK_WINDOW (parent), - flags, - NULL); - - button = gtk_button_new_with_label (_("Default")); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (win_x264_gtk)->action_area), button, FALSE, TRUE, 6); - g_signal_connect (G_OBJECT (button), - "clicked", - G_CALLBACK (x264_default_load), - gconfig); - gtk_widget_show (button); - - gtk_dialog_add_buttons (GTK_DIALOG (win_x264_gtk), - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); - - g_object_set_data (G_OBJECT (win_x264_gtk), "x264-gui-config", gconfig); - g_object_set_data (G_OBJECT (win_x264_gtk), "x264-config", x264_gtk); - gtk_window_set_resizable (GTK_WINDOW (win_x264_gtk), FALSE); - - notebook = gtk_notebook_new (); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (win_x264_gtk)->vbox), notebook); - gtk_widget_show (notebook); - - label = gtk_label_new (_("Bitrate")); - gtk_widget_show (label); - - page = x264_bitrate_page (gconfig); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label); - gtk_widget_show (page); - - label = gtk_label_new (_("Rate Control")); - gtk_widget_show (label); - - page = x264_rate_control_page (gconfig); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label); - gtk_widget_show (page); - - label = gtk_label_new (_("MB & Frames")); - gtk_widget_show (label); - - page = x264_mb_page (gconfig); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label); - gtk_widget_show (page); - - label = gtk_label_new (_("More...")); - gtk_widget_show (label); - - page = x264_more_page (gconfig); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label); - gtk_widget_show (page); - - label = gtk_label_new (_("Quantization matrices")); - gtk_widget_show (label); - - page = x264_cqm_page (gconfig); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label); - gtk_widget_show (page); - - x264_current_set (gconfig, x264_gtk); - - result = gtk_dialog_run (GTK_DIALOG (win_x264_gtk)); - x264_dialog_run (GTK_DIALOG (win_x264_gtk), result, gconfig, x264_gtk); - - return win_x264_gtk; -} - -void -x264_gtk_shutdown (GtkWidget *dialog) -{ - X264_Gui_Config *gconfig; - - gconfig = g_object_get_data (G_OBJECT (dialog), "x264-gui-config"); - gtk_widget_destroy (dialog); - if (gconfig) - g_free (gconfig); -} - -void -x264_gtk_free (X264_Gtk *x264_gtk) -{ - if (!x264_gtk) - return; - - g_free (x264_gtk); -} - - -/* Notebook pages */ - -/* Callbacks */ - -static void -x264_dialog_run (GtkDialog *dialog UNUSED, - gint response, - X264_Gui_Config *gconfig, - X264_Gtk *x264_gtk) -{ - if (response == GTK_RESPONSE_OK) - { - GIOChannel *file; - gchar *filename; - gchar *dir; - gsize length; - gint res; -#ifndef _WIN32 - mode_t mode; -#endif - - dir = x264_gtk_path (NULL); - -#ifdef _WIN32 - res = mkdir (dir); -#else - mode = - S_IRUSR | S_IXUSR | S_IWUSR | - S_IRGRP | S_IXGRP | S_IWGRP | - S_IROTH | S_IXOTH | S_IWOTH; - res = mkdir (dir, mode); -#endif /* _WIN32 */ - if (res != 0 && errno != EEXIST) - { - g_free (dir); - - return; - } - - filename = x264_gtk_path ("x264.cfg"); - g_print (_("Writing configuration to %s\n"), filename); - file = g_io_channel_new_file (filename, "w+", NULL); - if (file) - { - x264_current_get (gconfig, x264_gtk); - g_io_channel_set_encoding (file, NULL, NULL); - g_io_channel_write_chars (file, (const gchar *)x264_gtk, - sizeof (X264_Gtk), &length, NULL); - g_io_channel_unref (file); - } - g_free (filename); - g_free (dir); - } -} - -/* x264 config management */ -static void -x264_default_load (GtkButton *button UNUSED, gpointer user_data) -{ - gchar buf[64]; - X264_Gui_Config *config; - x264_param_t param; - gint i; - - if (!user_data) - return; - - config = (X264_Gui_Config *)user_data; - - x264_param_default (¶m); - - /* bitrate */ - gtk_combo_box_set_active (GTK_COMBO_BOX (config->bitrate.pass), 1); - g_snprintf (buf, 64, "%d", param.rc.i_bitrate); - gtk_entry_set_text (GTK_ENTRY (config->bitrate.w_average_bitrate), buf); - gtk_entry_set_text (GTK_ENTRY (config->bitrate.w_target_bitrate), buf); - gtk_range_set_range (GTK_RANGE (config->bitrate.w_quantizer), - 0.0, - 51.0); - gtk_range_set_value (GTK_RANGE (config->bitrate.w_quantizer), - (gdouble)param.rc.i_qp_constant); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->bitrate.update_statfile), FALSE); - gtk_entry_set_text (GTK_ENTRY (config->bitrate.statsfile_name), "x264.stats"); - gtk_widget_set_sensitive (config->bitrate.statsfile_name, FALSE); - gtk_widget_set_sensitive (config->bitrate.update_statfile, FALSE); - - /* rate control */ - g_snprintf (buf, 64, "%d", round((param.rc.f_ip_factor - 1.0) * 100)); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.bitrate.keyframe_boost), buf); - g_snprintf (buf, 64, "%d", round((param.rc.f_pb_factor - 1.0) * 100)); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.bitrate.bframes_reduction), buf); - g_snprintf (buf, 64, "%d", (gint)(param.rc.f_qcompress * 100)); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.bitrate.bitrate_variability), buf); - - g_snprintf (buf, 64, "%d", param.rc.i_qp_min); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.quantization_limits.min_qp), buf); - g_snprintf (buf, 64, "%d", param.rc.i_qp_max); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.quantization_limits.max_qp), buf); - g_snprintf (buf, 64, "%d", param.rc.i_qp_step); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.quantization_limits.max_qp_step), buf); - - g_snprintf (buf, 64, "%d", param.i_scenecut_threshold); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.scene_cuts.scene_cut_threshold), buf); - g_snprintf (buf, 64, "%d", param.i_keyint_min); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.scene_cuts.min_idr_frame_interval), buf); - g_snprintf (buf, 64, "%d", param.i_keyint_max); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.scene_cuts.max_idr_frame_interval), buf); - - g_snprintf (buf, 64, "%d", param.rc.i_vbv_max_bitrate); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.vbv.vbv_max_bitrate), buf); - g_snprintf (buf, 64, "%d", param.rc.i_vbv_buffer_size); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.vbv.vbv_buffer_size), buf); - g_snprintf (buf, 64, "%.1f", param.rc.f_vbv_buffer_init); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.vbv.vbv_buffer_init), buf); - - /* mb */ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.transform_8x8), param.analyse.b_transform_8x8); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.pframe_search_8), CHECK_FLAG(param.analyse.inter, X264_ANALYSE_PSUB16x16)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.bframe_search_8), CHECK_FLAG(param.analyse.inter, X264_ANALYSE_BSUB16x16)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.pframe_search_4), CHECK_FLAG(param.analyse.inter, X264_ANALYSE_PSUB8x8)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.inter_search_8), CHECK_FLAG(param.analyse.inter, X264_ANALYSE_I8x8)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.inter_search_4), CHECK_FLAG(param.analyse.inter, X264_ANALYSE_I4x4)); - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.bframe_pyramid), param.b_bframe_pyramid); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.bidir_me), param.analyse.b_bidir_me); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.bframe_adaptive), param.i_bframe_adaptive); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.weighted_bipred), param.analyse.b_weighted_bipred); - g_snprintf (buf, 64, "%d", param.i_bframe); - gtk_entry_set_text (GTK_ENTRY (config->mb.bframes.bframe), buf); - gtk_range_set_value (GTK_RANGE (config->mb.bframes.bframe_bias), (gdouble)param.i_bframe_bias); - gtk_combo_box_set_active (GTK_COMBO_BOX (config->mb.bframes.direct_mode), param.analyse.i_direct_mv_pred); - - /* more */ - if (param.analyse.b_bframe_rdo) - gtk_combo_box_set_active (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision), X264_PD_6b); - else - gtk_combo_box_set_active (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision), param.analyse.i_subpel_refine - 1); - gtk_combo_box_set_active (GTK_COMBO_BOX (config->more.motion_estimation.method), param.analyse.i_me_method); - g_snprintf (buf, 64, "%d", param.analyse.i_me_range); - gtk_entry_set_text (GTK_ENTRY (config->more.motion_estimation.range), buf); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.chroma_me), param.analyse.b_chroma_me); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.mixed_refs), param.analyse.b_mixed_references); - g_snprintf (buf, 64, "%d", param.i_frame_reference); - gtk_entry_set_text (GTK_ENTRY (config->more.motion_estimation.max_ref_frames), buf); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.fast_pskip), param.analyse.b_fast_pskip); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.dct_decimate), param.analyse.b_dct_decimate); - - g_snprintf (buf, 64, "%d", param.vui.i_sar_width); - gtk_entry_set_text (GTK_ENTRY (config->more.misc.sample_ar_x), buf); - g_snprintf (buf, 64, "%d", param.vui.i_sar_height); - gtk_entry_set_text (GTK_ENTRY (config->more.misc.sample_ar_y), buf); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (config->more.misc.threads), param.i_threads); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.misc.cabac), param.b_cabac); - gtk_combo_box_set_active (GTK_COMBO_BOX (config->more.misc.trellis), param.analyse.i_trellis); - g_snprintf (buf, 64, "%d", param.analyse.i_noise_reduction); - gtk_entry_set_text (GTK_ENTRY (config->more.misc.noise_reduction), buf); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.misc.df.deblocking_filter), param.b_deblocking_filter); - gtk_range_set_value (GTK_RANGE (config->more.misc.df.strength), (gdouble)param.i_deblocking_filter_alphac0); - gtk_range_set_value (GTK_RANGE (config->more.misc.df.threshold), (gdouble)param.i_deblocking_filter_beta); - - gtk_combo_box_set_active (GTK_COMBO_BOX (config->more.debug.log_level), param.i_log_level + 1); - gtk_entry_set_text (GTK_ENTRY (config->more.debug.fourcc), "H264"); - - /* cqm */ - switch (param.i_cqm_preset) { - case X264_CQM_FLAT: - // workaround: gtk fails to update the matrix entries if we activate the button - // that was already active. - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->cqm.radio_jvt), TRUE); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->cqm.radio_flat), TRUE); - break; - case X264_CQM_JVT: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->cqm.radio_jvt), TRUE); - break; - case X264_CQM_CUSTOM: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->cqm.radio_custom), TRUE); - break; - } - if (param.psz_cqm_file && (param.psz_cqm_file[0] != '\0')) - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (config->cqm.cqm_file), param.psz_cqm_file); - for (i = 0; i < 16; i++) { - gchar buf[4]; - - g_snprintf (buf, 4, "%d", param.cqm_4iy[i]); - gtk_entry_set_text (GTK_ENTRY (config->cqm.cqm_4iy[i]), buf); - g_snprintf (buf, 4, "%d", param.cqm_4ic[i]); - gtk_entry_set_text (GTK_ENTRY (config->cqm.cqm_4ic[i]), buf); - g_snprintf (buf, 4, "%d", param.cqm_4py[i]); - gtk_entry_set_text (GTK_ENTRY (config->cqm.cqm_4py[i]), buf); - g_snprintf (buf, 4, "%d", param.cqm_4pc[i]); - gtk_entry_set_text (GTK_ENTRY (config->cqm.cqm_4pc[i]), buf); - } - for (i = 0; i < 64; i++) { - gchar buf[4]; - - g_snprintf (buf, 4, "%d", param.cqm_8iy[i]); - gtk_entry_set_text (GTK_ENTRY (config->cqm.cqm_8iy[i]), buf); - g_snprintf (buf, 4, "%d", param.cqm_8py[i]); - gtk_entry_set_text (GTK_ENTRY (config->cqm.cqm_8py[i]), buf); - } -} - -static void -x264_default_set (X264_Gtk *x264_gtk) -{ - x264_param_t param; - - x264_param_default (¶m); - - /* bitrate */ - x264_gtk->pass = X264_PASS_SINGLE_QUANTIZER; - x264_gtk->average_bitrate = param.rc.i_bitrate; - x264_gtk->target_bitrate = param.rc.i_bitrate; - x264_gtk->quantizer = param.rc.i_qp_constant; - x264_gtk->stat_write = param.rc.b_stat_write; - x264_gtk->stat_read = param.rc.b_stat_read; - x264_gtk->update_statfile = 0; - x264_gtk->statsfile_length = strlen (param.rc.psz_stat_out); - memcpy (x264_gtk->statsfile_name, param.rc.psz_stat_out, x264_gtk->statsfile_length + 1); - - /* rate control */ - x264_gtk->keyframe_boost = round((param.rc.f_ip_factor - 1.0) * 100); - x264_gtk->bframes_reduction = round((param.rc.f_pb_factor - 1.0) * 100); - x264_gtk->bitrate_variability = round(param.rc.f_qcompress * 100); - - x264_gtk->min_qp = param.rc.i_qp_min; - x264_gtk->max_qp = param.rc.i_qp_max; - x264_gtk->max_qp_step = param.rc.i_qp_step; - - x264_gtk->scene_cut_threshold = param.i_scenecut_threshold; - x264_gtk->min_idr_frame_interval = param.i_keyint_min; - x264_gtk->max_idr_frame_interval = param.i_keyint_max; - - x264_gtk->vbv_max_bitrate = param.rc.i_vbv_max_bitrate; - x264_gtk->vbv_buffer_size = param.rc.i_vbv_buffer_size; - x264_gtk->vbv_buffer_init = param.rc.f_vbv_buffer_init; - - /* mb */ - x264_gtk->transform_8x8 = param.analyse.b_transform_8x8; - - if (CHECK_FLAG(param.analyse.inter, X264_ANALYSE_PSUB16x16)) - x264_gtk->pframe_search_8 = 1; - else - x264_gtk->pframe_search_8 = 0; - if (CHECK_FLAG(param.analyse.inter, X264_ANALYSE_BSUB16x16)) - x264_gtk->bframe_search_8 = 1; - else - x264_gtk->bframe_search_8 = 0; - if (CHECK_FLAG(param.analyse.inter, X264_ANALYSE_PSUB8x8)) - x264_gtk->pframe_search_4 = 1; - else - x264_gtk->pframe_search_4 = 0; - x264_gtk->inter_search_8 = CHECK_FLAG(param.analyse.inter, X264_ANALYSE_I8x8); - x264_gtk->inter_search_4 = CHECK_FLAG(param.analyse.inter, X264_ANALYSE_I4x4); - - x264_gtk->bframe_pyramid = param.b_bframe_pyramid; - x264_gtk->bidir_me = param.analyse.b_bidir_me; - x264_gtk->bframe_adaptive = param.i_bframe_adaptive; - x264_gtk->weighted_bipred = param.analyse.b_weighted_bipred; - x264_gtk->bframe = param.i_bframe; - x264_gtk->bframe_bias = param.i_bframe_bias; - x264_gtk->direct_mode = param.analyse.i_direct_mv_pred; - - /* more */ - x264_gtk->bframe_rdo = param.analyse.b_bframe_rdo; - x264_gtk->partition_decision = param.analyse.i_subpel_refine - 1; - x264_gtk->me_method = param.analyse.i_me_method; - x264_gtk->range = param.analyse.i_me_range; - x264_gtk->chroma_me = param.analyse.b_chroma_me; - x264_gtk->max_ref_frames = param.i_frame_reference; - x264_gtk->mixed_refs = param.analyse.b_mixed_references; - x264_gtk->fast_pskip = param.analyse.b_fast_pskip; - x264_gtk->dct_decimate = param.analyse.b_dct_decimate; - - x264_gtk->sample_ar_x = param.vui.i_sar_width; - x264_gtk->sample_ar_y = param.vui.i_sar_height; - x264_gtk->threads = param.i_threads; - x264_gtk->cabac = param.b_cabac; - x264_gtk->trellis = param.analyse.i_trellis; - x264_gtk->noise_reduction = param.analyse.i_noise_reduction; - x264_gtk->deblocking_filter = param.b_deblocking_filter; - x264_gtk->strength = param.i_deblocking_filter_alphac0; - x264_gtk->threshold = param.i_deblocking_filter_beta; - - x264_gtk->debug_method = param.i_log_level + 1; - memcpy (x264_gtk->fourcc, "H264", 5); - - /* cqm */ - x264_gtk->cqm_preset = param.i_cqm_preset; - if (param.psz_cqm_file && (param.psz_cqm_file[0] != '\0')) - memcpy (x264_gtk->cqm_file, param.psz_cqm_file, strlen (param.psz_cqm_file) + 1); - memcpy (x264_gtk->cqm_4iy, param.cqm_4iy, 16); - memcpy (x264_gtk->cqm_4ic, param.cqm_4ic, 16); - memcpy (x264_gtk->cqm_4py, param.cqm_4py, 16); - memcpy (x264_gtk->cqm_4pc, param.cqm_4pc, 16); - memcpy (x264_gtk->cqm_8iy, param.cqm_8iy, 64); - memcpy (x264_gtk->cqm_8py, param.cqm_8py, 64); -} - -static void -x264_current_set (X264_Gui_Config *config, X264_Gtk *x264_gtk) -{ - gchar buf[4096]; - gint i; - - if (!config) - return; - - /* bitrate */ - gtk_combo_box_set_active (GTK_COMBO_BOX (config->bitrate.pass), x264_gtk->pass); - g_snprintf (buf, 5, "%d", x264_gtk->average_bitrate); - gtk_entry_set_text (GTK_ENTRY (config->bitrate.w_average_bitrate), buf); - gtk_range_set_range (GTK_RANGE (config->bitrate.w_quantizer), - 0.0, - 51.0); - gtk_range_set_value (GTK_RANGE (config->bitrate.w_quantizer), x264_gtk->quantizer); - g_snprintf (buf, 5, "%d", x264_gtk->target_bitrate); - gtk_entry_set_text (GTK_ENTRY (config->bitrate.w_target_bitrate), buf); - switch (gtk_combo_box_get_active (GTK_COMBO_BOX (config->bitrate.pass))) - { - case 0: - case 1: - gtk_widget_set_sensitive (config->bitrate.update_statfile, FALSE); - gtk_widget_set_sensitive (config->bitrate.statsfile_name, FALSE); - break; - case 2: - case 3: - case 4: - default: - gtk_widget_set_sensitive (config->bitrate.update_statfile, TRUE); - break; - } - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->bitrate.update_statfile), x264_gtk->update_statfile); - gtk_entry_set_text (GTK_ENTRY (config->bitrate.statsfile_name), x264_gtk->statsfile_name); - if (x264_gtk->update_statfile) - gtk_widget_set_sensitive (config->bitrate.statsfile_name, TRUE); - else - gtk_widget_set_sensitive (config->bitrate.statsfile_name, FALSE); - - /* rate control */ - g_snprintf (buf, 5, "%d", x264_gtk->keyframe_boost); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.bitrate.keyframe_boost), buf); - g_snprintf (buf, 5, "%d", x264_gtk->bframes_reduction); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.bitrate.bframes_reduction), buf); - g_snprintf (buf, 5, "%d", x264_gtk->bitrate_variability); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.bitrate.bitrate_variability), buf); - - g_snprintf (buf, 5, "%d", x264_gtk->min_qp); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.quantization_limits.min_qp), buf); - g_snprintf (buf, 5, "%d", x264_gtk->max_qp); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.quantization_limits.max_qp), buf); - g_snprintf (buf, 5, "%d", x264_gtk->max_qp_step); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.quantization_limits.max_qp_step), buf); - - g_snprintf (buf, 5, "%d", x264_gtk->scene_cut_threshold); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.scene_cuts.scene_cut_threshold), buf); - g_snprintf (buf, 5, "%d", x264_gtk->min_idr_frame_interval); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.scene_cuts.min_idr_frame_interval), buf); - g_snprintf (buf, 5, "%d", x264_gtk->max_idr_frame_interval); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.scene_cuts.max_idr_frame_interval), buf); - - g_snprintf (buf, 5, "%d", x264_gtk->vbv_max_bitrate); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.vbv.vbv_max_bitrate), buf); - g_snprintf (buf, 5, "%d", x264_gtk->vbv_buffer_size); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.vbv.vbv_buffer_size), buf); - g_snprintf (buf, 5, "%.1f", x264_gtk->vbv_buffer_init); - gtk_entry_set_text (GTK_ENTRY (config->rate_control.vbv.vbv_buffer_init), buf); - - /* mb */ - if (x264_gtk->transform_8x8) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.transform_8x8), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.transform_8x8), FALSE); - if (x264_gtk->pframe_search_8) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.pframe_search_8), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.pframe_search_8), FALSE); - if (x264_gtk->bframe_search_8) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.bframe_search_8), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.bframe_search_8), FALSE); - if (x264_gtk->pframe_search_4) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.pframe_search_4), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.pframe_search_4), FALSE); - if (x264_gtk->inter_search_8) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.inter_search_8), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.inter_search_8), FALSE); - if (x264_gtk->inter_search_4) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.inter_search_4), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.inter_search_4), FALSE); - - /* mb - bframes */ - if (x264_gtk->bframe_pyramid) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.bframe_pyramid), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.bframe_pyramid), FALSE); - if (x264_gtk->bidir_me) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.bidir_me), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.bidir_me), FALSE); - if (x264_gtk->bframe_adaptive) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.bframe_adaptive), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.bframe_adaptive), FALSE); - if (x264_gtk->weighted_bipred) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.weighted_bipred), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.bframes.weighted_bipred), FALSE); - g_snprintf (buf, 5, "%d", x264_gtk->bframe); - gtk_entry_set_text (GTK_ENTRY (config->mb.bframes.bframe), buf); - gtk_range_set_value (GTK_RANGE (config->mb.bframes.bframe_bias), (gdouble)x264_gtk->bframe_bias); - gtk_combo_box_set_active (GTK_COMBO_BOX (config->mb.bframes.direct_mode), x264_gtk->direct_mode); - - /* more */ - if (x264_gtk->bframe_rdo) - gtk_combo_box_set_active (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision), X264_PD_6b); - else - gtk_combo_box_set_active (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision), x264_gtk->partition_decision); - gtk_combo_box_set_active (GTK_COMBO_BOX (config->more.motion_estimation.method), x264_gtk->me_method); - g_snprintf (buf, 5, "%d", x264_gtk->range); - gtk_entry_set_text (GTK_ENTRY (config->more.motion_estimation.range), buf); - if (x264_gtk->chroma_me) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.chroma_me), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.chroma_me), FALSE); - g_snprintf (buf, 5, "%d", x264_gtk->max_ref_frames); - gtk_entry_set_text (GTK_ENTRY (config->more.motion_estimation.max_ref_frames), buf); - if (x264_gtk->mixed_refs && (x264_gtk->max_ref_frames >= 2)) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.mixed_refs), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.mixed_refs), FALSE); - if (x264_gtk->fast_pskip) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.fast_pskip), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.fast_pskip), FALSE); - if (x264_gtk->dct_decimate) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.dct_decimate), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.motion_estimation.dct_decimate), FALSE); - - g_snprintf (buf, 5, "%d", x264_gtk->sample_ar_x); - gtk_entry_set_text (GTK_ENTRY (config->more.misc.sample_ar_x), buf); - g_snprintf (buf, 5, "%d", x264_gtk->sample_ar_y); - gtk_entry_set_text (GTK_ENTRY (config->more.misc.sample_ar_y), buf); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (config->more.misc.threads), x264_gtk->threads); - if (x264_gtk->cabac) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.misc.cabac), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.misc.cabac), FALSE); - gtk_combo_box_set_active (GTK_COMBO_BOX (config->more.misc.trellis), x264_gtk->trellis); - g_snprintf (buf, 64, "%d", x264_gtk->noise_reduction); - gtk_entry_set_text (GTK_ENTRY (config->more.misc.noise_reduction), buf); - if (x264_gtk->deblocking_filter) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.misc.df.deblocking_filter), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->more.misc.df.deblocking_filter), FALSE); - gtk_range_set_value (GTK_RANGE (config->more.misc.df.strength), (gdouble)x264_gtk->strength); - gtk_range_set_value (GTK_RANGE (config->more.misc.df.threshold), (gdouble)x264_gtk->threshold); - - gtk_combo_box_set_active (GTK_COMBO_BOX (config->more.debug.log_level), x264_gtk->debug_method); - gtk_entry_set_text (GTK_ENTRY (config->more.debug.fourcc), x264_gtk->fourcc); - - /* cqm */ - switch (x264_gtk->cqm_preset) { - case X264_CQM_PRESET_FLAT: - // workaround: gtk fails to update the matrix entries if we activate the button - // that was already active. - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->cqm.radio_jvt), TRUE); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->cqm.radio_flat), TRUE); - break; - case X264_CQM_PRESET_JVT: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->cqm.radio_jvt), TRUE); - break; - case X264_CQM_PRESET_CUSTOM: - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->cqm.radio_custom), TRUE); - break; - } - if (x264_gtk->cqm_file && (x264_gtk->cqm_file[0] != '\0')) - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (config->cqm.cqm_file), x264_gtk->cqm_file); - for (i = 0; i < 16; i++) { - gchar buf[4]; - - g_snprintf (buf, 4, "%d", x264_gtk->cqm_4iy[i]); - gtk_entry_set_text (GTK_ENTRY (config->cqm.cqm_4iy[i]), buf); - g_snprintf (buf, 4, "%d", x264_gtk->cqm_4ic[i]); - gtk_entry_set_text (GTK_ENTRY (config->cqm.cqm_4ic[i]), buf); - g_snprintf (buf, 4, "%d", x264_gtk->cqm_4py[i]); - gtk_entry_set_text (GTK_ENTRY (config->cqm.cqm_4py[i]), buf); - g_snprintf (buf, 4, "%d", x264_gtk->cqm_4pc[i]); - gtk_entry_set_text (GTK_ENTRY (config->cqm.cqm_4pc[i]), buf); - } - for (i = 0; i < 64; i++) { - gchar buf[4]; - - g_snprintf (buf, 4, "%d", x264_gtk->cqm_8iy[i]); - gtk_entry_set_text (GTK_ENTRY (config->cqm.cqm_8iy[i]), buf); - g_snprintf (buf, 4, "%d", x264_gtk->cqm_8py[i]); - gtk_entry_set_text (GTK_ENTRY (config->cqm.cqm_8py[i]), buf); - } -} - -static void -x264_current_get (X264_Gui_Config *gconfig, X264_Gtk *x264_gtk) -{ - const gchar *text; - gint i; - - if (!gconfig) - return; - - if (!x264_gtk) - g_print (_("problem...\n")); - - /* bitrate */ - switch (gtk_combo_box_get_active (GTK_COMBO_BOX (gconfig->bitrate.pass))) - { - case 0: - x264_gtk->pass = X264_PASS_SINGLE_BITRATE; - text = gtk_entry_get_text (GTK_ENTRY (gconfig->bitrate.w_average_bitrate)); - x264_gtk->average_bitrate = (gint)g_ascii_strtoull (text, NULL, 10); - x264_gtk->stat_write = 0; - x264_gtk->stat_read = 0; - break; - case 1: - x264_gtk->pass = X264_PASS_SINGLE_QUANTIZER; - x264_gtk->quantizer = (gint)gtk_range_get_value (GTK_RANGE (gconfig->bitrate.w_quantizer)); - x264_gtk->stat_write = 0; - x264_gtk->stat_read = 0; - break; - case 2: - x264_gtk->pass = X264_PASS_MULTIPASS_1ST; - text = gtk_entry_get_text (GTK_ENTRY (gconfig->bitrate.w_target_bitrate)); - x264_gtk->target_bitrate = (gint)g_ascii_strtoull (text, NULL, 10); - x264_gtk->stat_write = 1; - break; - case 3: - x264_gtk->pass = X264_PASS_MULTIPASS_1ST_FAST; - text = gtk_entry_get_text (GTK_ENTRY (gconfig->bitrate.w_target_bitrate)); - x264_gtk->target_bitrate = (gint)g_ascii_strtoull (text, NULL, 10); - x264_gtk->stat_write = 1; - break; - case 4: - default: - x264_gtk->pass = X264_PASS_MULTIPASS_NTH; - text = gtk_entry_get_text (GTK_ENTRY (gconfig->bitrate.w_target_bitrate)); - x264_gtk->target_bitrate = (gint)g_ascii_strtoull (text, NULL, 10); - x264_gtk->stat_read = 1; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->bitrate.update_statfile))) - x264_gtk->stat_write = 1; - break; - } - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->bitrate.update_statfile))) - x264_gtk->update_statfile = 1; - else - x264_gtk->update_statfile = 0; - - text = gtk_entry_get_text (GTK_ENTRY (gconfig->bitrate.statsfile_name)); - x264_gtk->statsfile_length = strlen (text); - memcpy (x264_gtk->statsfile_name, - text, - x264_gtk->statsfile_length + 1); - - /* rate control */ - text = gtk_entry_get_text (GTK_ENTRY (gconfig->rate_control.bitrate.keyframe_boost)); - x264_gtk->keyframe_boost = (gint)g_ascii_strtoull (text, NULL, 10); - - text = gtk_entry_get_text (GTK_ENTRY (gconfig->rate_control.bitrate.bframes_reduction)); - x264_gtk->bframes_reduction = (gint)g_ascii_strtoull (text, NULL, 10); - text = gtk_entry_get_text (GTK_ENTRY (gconfig->rate_control.bitrate.bitrate_variability)); - x264_gtk->bitrate_variability = (gint)g_ascii_strtoull (text, NULL, 10); - - text = gtk_entry_get_text (GTK_ENTRY (gconfig->rate_control.quantization_limits.min_qp)); - x264_gtk->min_qp = (gint)g_ascii_strtoull (text, NULL, 10); - text = gtk_entry_get_text (GTK_ENTRY (gconfig->rate_control.quantization_limits.max_qp)); - x264_gtk->max_qp = (gint)g_ascii_strtoull (text, NULL, 10); - text = gtk_entry_get_text (GTK_ENTRY (gconfig->rate_control.quantization_limits.max_qp_step)); - x264_gtk->max_qp_step = (gint)g_ascii_strtoull (text, NULL, 10); - - text = gtk_entry_get_text (GTK_ENTRY (gconfig->rate_control.scene_cuts.scene_cut_threshold)); - x264_gtk->scene_cut_threshold = (gint)g_ascii_strtoull (text, NULL, 10); - text = gtk_entry_get_text (GTK_ENTRY (gconfig->rate_control.scene_cuts.min_idr_frame_interval)); - x264_gtk->min_idr_frame_interval = (gint)g_ascii_strtoull (text, NULL, 10); - text = gtk_entry_get_text (GTK_ENTRY (gconfig->rate_control.scene_cuts.max_idr_frame_interval)); - x264_gtk->max_idr_frame_interval = (gint)g_ascii_strtoull (text, NULL, 10); - - text = gtk_entry_get_text (GTK_ENTRY (gconfig->rate_control.vbv.vbv_max_bitrate)); - x264_gtk->vbv_max_bitrate = (gint)g_ascii_strtoull (text, NULL, 10); - text = gtk_entry_get_text (GTK_ENTRY (gconfig->rate_control.vbv.vbv_buffer_size)); - x264_gtk->vbv_buffer_size = (gint)g_ascii_strtoull (text, NULL, 10); - text = gtk_entry_get_text (GTK_ENTRY (gconfig->rate_control.vbv.vbv_buffer_init)); - x264_gtk->vbv_buffer_init = (gint)g_ascii_strtoull (text, NULL, 10); - - /* mb */ - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->mb.partitions.transform_8x8))) - x264_gtk->transform_8x8 = 1; - else - x264_gtk->transform_8x8 = 0; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->mb.partitions.pframe_search_8))) - x264_gtk->pframe_search_8 = 1; - else - x264_gtk->pframe_search_8 = 0; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->mb.partitions.bframe_search_8))) - x264_gtk->bframe_search_8 = 1; - else - x264_gtk->bframe_search_8 = 0; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->mb.partitions.pframe_search_4))) - x264_gtk->pframe_search_4 = 1; - else - x264_gtk->pframe_search_4 = 0; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->mb.partitions.inter_search_8))) - x264_gtk->inter_search_8 = 1; - else - x264_gtk->inter_search_8 = 0; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->mb.partitions.inter_search_4))) - x264_gtk->inter_search_4 = 1; - else - x264_gtk->inter_search_4 = 0; - - /* mb - bframes */ - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->mb.bframes.bframe_pyramid))) - x264_gtk->bframe_pyramid = 1; - else - x264_gtk->bframe_pyramid = 0; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->mb.bframes.bidir_me))) - x264_gtk->bidir_me = 1; - else - x264_gtk->bidir_me = 0; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->mb.bframes.bframe_adaptive))) - x264_gtk->bframe_adaptive = 1; - else - x264_gtk->bframe_adaptive = 0; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->mb.bframes.weighted_bipred))) - x264_gtk->weighted_bipred = 1; - else - x264_gtk->weighted_bipred = 0; - text = gtk_entry_get_text (GTK_ENTRY (gconfig->mb.bframes.bframe)); - x264_gtk->bframe = (gint)g_ascii_strtoull (text, NULL, 10); - x264_gtk->bframe_bias = (gint)gtk_range_get_value (GTK_RANGE (gconfig->mb.bframes.bframe_bias)); - - switch (gtk_combo_box_get_active (GTK_COMBO_BOX (gconfig->mb.bframes.direct_mode))) - { - case 0: - x264_gtk->direct_mode = X264_NONE; - case 1: - x264_gtk->direct_mode = X264_SPATIAL; - break; - case 2: - x264_gtk->direct_mode = X264_TEMPORAL; - break; - default: - x264_gtk->direct_mode = X264_AUTO; - break; - } - - /* more */ - switch (gtk_combo_box_get_active (GTK_COMBO_BOX (gconfig->more.motion_estimation.partition_decision))) - { - case 0: - x264_gtk->partition_decision = X264_PD_1; - break; - case 1: - x264_gtk->partition_decision = X264_PD_2; - break; - case 2: - x264_gtk->partition_decision = X264_PD_3; - break; - case 3: - x264_gtk->partition_decision = X264_PD_4; - break; - case 4: - x264_gtk->partition_decision = X264_PD_5; - break; - case 5: - x264_gtk->partition_decision = X264_PD_6; - break; - default: - x264_gtk->partition_decision = X264_PD_6; - x264_gtk->bframe_rdo = 1; - break; - } - switch (gtk_combo_box_get_active (GTK_COMBO_BOX (gconfig->more.motion_estimation.method))) - { - case 0: - x264_gtk->me_method = X264_ME_METHOD_DIAMOND; - break; - case 1: - x264_gtk->me_method = X264_ME_METHOD_HEXAGONAL; - break; - case 2: - x264_gtk->me_method = X264_ME_METHOD_UNEVEN_MULTIHEXA; - break; - default: - x264_gtk->me_method = X264_ME_METHOD_EXHAUSTIVE; - break; - } - text = gtk_entry_get_text (GTK_ENTRY (gconfig->more.motion_estimation.range)); - x264_gtk->range = (gint)g_ascii_strtoull (text, NULL, 10); - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->more.motion_estimation.chroma_me))) - x264_gtk->chroma_me = 1; - else - x264_gtk->chroma_me = 0; - text = gtk_entry_get_text (GTK_ENTRY (gconfig->more.motion_estimation.max_ref_frames)); - x264_gtk->max_ref_frames = (gint)g_ascii_strtoull (text, NULL, 10); - if (x264_gtk->max_ref_frames <= 0) - x264_gtk->max_ref_frames = 1; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->more.motion_estimation.mixed_refs)) && - (x264_gtk->max_ref_frames >= 2)) - x264_gtk->mixed_refs = 1; - else - x264_gtk->mixed_refs = 0; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->more.motion_estimation.fast_pskip))) - x264_gtk->fast_pskip = 1; - else - x264_gtk->fast_pskip = 0; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->more.motion_estimation.dct_decimate))) - x264_gtk->dct_decimate = 1; - else - x264_gtk->dct_decimate = 0; - - - text = gtk_entry_get_text (GTK_ENTRY (gconfig->more.misc.sample_ar_x)); - x264_gtk->sample_ar_x = (gint)g_ascii_strtoull (text, NULL, 10); - text = gtk_entry_get_text (GTK_ENTRY (gconfig->more.misc.sample_ar_y)); - x264_gtk->sample_ar_y = (gint)g_ascii_strtoull (text, NULL, 10); - x264_gtk->threads = (gint)gtk_spin_button_get_value (GTK_SPIN_BUTTON (gconfig->more.misc.threads)); - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->more.misc.cabac))) - x264_gtk->cabac = 1; - else - x264_gtk->cabac = 0; - x264_gtk->trellis = gtk_combo_box_get_active (GTK_COMBO_BOX (gconfig->more.misc.trellis)); - text = gtk_entry_get_text (GTK_ENTRY (gconfig->more.misc.noise_reduction)); - x264_gtk->noise_reduction = (gint)g_ascii_strtoull (text, NULL, 10); - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->more.misc.df.deblocking_filter))) - x264_gtk->deblocking_filter = 1; - else - x264_gtk->deblocking_filter = 0; - x264_gtk->strength = (gint)gtk_range_get_value (GTK_RANGE (gconfig->more.misc.df.strength)); - x264_gtk->threshold = (gint)gtk_range_get_value (GTK_RANGE (gconfig->more.misc.df.threshold)); - - switch (gtk_combo_box_get_active (GTK_COMBO_BOX (gconfig->more.debug.log_level))) - { - case 0: - x264_gtk->debug_method = X264_DEBUG_METHOD_NONE; - break; - case 1: - x264_gtk->debug_method = X264_DEBUG_METHOD_ERROR; - break; - case 2: - x264_gtk->debug_method = X264_DEBUG_METHOD_WARNING; - break; - case 3: - x264_gtk->debug_method = X264_DEBUG_METHOD_INFO; - break; - default: - x264_gtk->debug_method = X264_DEBUG_METHOD_DEBUG; - break; - } - text = gtk_entry_get_text (GTK_ENTRY (gconfig->more.debug.fourcc)); - memcpy (x264_gtk->fourcc, text, strlen (text) + 1); - - /* cqm */ - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->cqm.radio_flat))) - x264_gtk->cqm_preset = X264_CQM_PRESET_FLAT; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->cqm.radio_jvt))) - x264_gtk->cqm_preset = X264_CQM_PRESET_JVT; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->cqm.radio_custom))) - x264_gtk->cqm_preset = X264_CQM_PRESET_CUSTOM; - text = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (gconfig->cqm.cqm_file)); - if (text && (text[0] != '\0')) - memcpy (x264_gtk->cqm_file, text, strlen (text) + 1); - for (i = 0; i < 16; i++) { - text = gtk_entry_get_text (GTK_ENTRY (gconfig->cqm.cqm_4iy[i])); - x264_gtk->cqm_4iy[i] = (gint)g_ascii_strtoull (text, NULL, 10); - text = gtk_entry_get_text (GTK_ENTRY (gconfig->cqm.cqm_4ic[i])); - x264_gtk->cqm_4ic[i] = (gint)g_ascii_strtoull (text, NULL, 10); - text = gtk_entry_get_text (GTK_ENTRY (gconfig->cqm.cqm_4py[i])); - x264_gtk->cqm_4py[i] = (gint)g_ascii_strtoull (text, NULL, 10); - text = gtk_entry_get_text (GTK_ENTRY (gconfig->cqm.cqm_4pc[i])); - x264_gtk->cqm_4pc[i] = (gint)g_ascii_strtoull (text, NULL, 10); - } - for (i = 0; i < 64; i++) { - text = gtk_entry_get_text (GTK_ENTRY (gconfig->cqm.cqm_8iy[i])); - x264_gtk->cqm_8iy[i] = (gint)g_ascii_strtoull (text, NULL, 10); - text = gtk_entry_get_text (GTK_ENTRY (gconfig->cqm.cqm_8py[i])); - x264_gtk->cqm_8py[i] = (gint)g_ascii_strtoull (text, NULL, 10); - } -} - -gchar* -x264_gtk_path(const char* more) -{ -#ifdef _WIN32 - gchar szPath[MAX_PATH]; - - // "Documents and Settings\user" is CSIDL_PROFILE - szPath[0] = 0; - - SHGetSpecialFolderPath(NULL, szPath, CSIDL_APPDATA, FALSE); - if (more) - return g_build_filename(szPath, "x264", more, NULL); - else - return g_build_filename(szPath, "x264", NULL); -#else - if (more) - return g_build_filename (g_get_home_dir (), ".x264", more, NULL); - else - return g_build_filename (g_get_home_dir (), ".x264", NULL); -#endif -} diff --git a/gtk/x264_gtk.h b/gtk/x264_gtk.h deleted file mode 100644 index 6589e0a3..00000000 --- a/gtk/x264_gtk.h +++ /dev/null @@ -1,131 +0,0 @@ -/***************************************************************************** - * x264_gtk.h: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#ifndef X264_GTK_H -#define X264_GTK_H - - -#include "x264_gtk_enum.h" - -typedef struct X264_Gtk_ X264_Gtk; - -struct X264_Gtk_ -{ - /* video properties */ - gint width; - gint height; - gint csp; - - /* bitrate */ - X264_Pass pass; - gint average_bitrate; - gint target_bitrate; - gint quantizer; - gint desired_size; - gint statsfile_length; /* length of the filename (as returned by strlen) */ - gchar statsfile_name[4095+1]; - - /* rc */ - gint keyframe_boost; - gint bframes_reduction; - gint bitrate_variability; - - gint min_qp; - gint max_qp; - gint max_qp_step; - - gint scene_cut_threshold; - gint min_idr_frame_interval; - gint max_idr_frame_interval; - - gint vbv_max_bitrate; - gint vbv_buffer_size; - gdouble vbv_buffer_init; - - /* mb */ - - gint bframe; /* max consecutive B frames */ - gint bframe_bias; - X264_Direct_Mode direct_mode; - - /* more */ - X264_Partition_Decision partition_decision; - X264_Me_Method me_method; - gint range; - gint max_ref_frames; - - gint sample_ar_x; - gint sample_ar_y; - gint threads; - guint trellis; - gint noise_reduction; - - gint strength; - gint threshold; - - X264_Debug_Method debug_method; - gchar fourcc[4+1]; - - /* cqm */ - X264_Cqm_Preset cqm_preset; - gchar cqm_file[4095+1]; - guint8 cqm_4iy[16]; - guint8 cqm_4ic[16]; - guint8 cqm_4py[16]; - guint8 cqm_4pc[16]; - guint8 cqm_8iy[64]; - guint8 cqm_8py[64]; - - /* bitrate */ - guint stat_write : 1; - guint stat_read : 1; - guint update_statfile : 1; - /* mb - partitions */ - guint transform_8x8 : 1; - guint pframe_search_8 : 1; - guint bframe_search_8 : 1; - guint pframe_search_4 : 1; - guint inter_search_8 : 1; - guint inter_search_4 : 1; - /* mb - bframes */ - guint bframe_pyramid : 1; /* use as reference */ - guint bidir_me : 1; - guint bframe_adaptive : 1; - guint weighted_bipred : 1; - /* more - me */ - guint bframe_rdo : 1; - guint chroma_me : 1; - guint mixed_refs : 1; - guint fast_pskip : 1; - guint dct_decimate : 1; - /* more - misc */ - guint cabac : 1; - /* more - misc - df */ - guint deblocking_filter : 1; -}; - -x264_param_t *x264_gtk_param_get (X264_Gtk *x264_gtk); -X264_Gtk *x264_gtk_load (void); -GtkWidget *x264_gtk_window_create (GtkWidget *parent); -void x264_gtk_shutdown (GtkWidget *dialog); -void x264_gtk_free (X264_Gtk *x264_gtk); - - -#endif /* X264_GTK_H */ diff --git a/gtk/x264_gtk_bitrate.c b/gtk/x264_gtk_bitrate.c deleted file mode 100644 index fdd88596..00000000 --- a/gtk/x264_gtk_bitrate.c +++ /dev/null @@ -1,236 +0,0 @@ -/***************************************************************************** - * x264_gtk_bitrate.c: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#if defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ || defined __DragonFly__ -# include -#else -# include -#endif - -#include - -#include "../x264.h" -#include "x264_gtk_i18n.h" -#include "x264_gtk_private.h" -#include "x264_gtk_enum.h" - - -/* Callbacks */ -static void x264_bitrate_pass (GtkComboBox *combo, - gpointer user_data); -static void x264_bitrate_statfile (GtkToggleButton *button, - gpointer user_data); - -GtkWidget * -x264_bitrate_page (X264_Gui_Config *gconfig) -{ - GtkWidget *vbox; - GtkWidget *frame; - GtkWidget *table; - GtkWidget *image; - GtkWidget *eb; - GtkWidget *label; - GtkTooltips *tooltips; - - tooltips = gtk_tooltips_new (); - - vbox = gtk_vbox_new (FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); - - image = gtk_image_new_from_file (X264_DATA_DIR "/x264/x264.png"); - gtk_box_pack_start (GTK_BOX (vbox), image, FALSE, TRUE, 6); - gtk_widget_show (image); - - frame = gtk_frame_new (_("Main settings")); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 6); - gtk_widget_show (frame); - - table = gtk_table_new (2, 2, TRUE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - gtk_container_add (GTK_CONTAINER (frame), table); - gtk_widget_show (table); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Encoding type - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 0, 1); - gtk_widget_show (eb); - - label = gtk_label_new (_("Encoding type")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - gconfig->bitrate.pass = gtk_combo_box_new_text (); - gtk_combo_box_append_text (GTK_COMBO_BOX (gconfig->bitrate.pass), - _("Single Pass - Bitrate")); - gtk_combo_box_append_text (GTK_COMBO_BOX (gconfig->bitrate.pass), - _("Single Pass - Quantizer")); - gtk_combo_box_append_text (GTK_COMBO_BOX (gconfig->bitrate.pass), - _("Multipass - First Pass")); - gtk_combo_box_append_text (GTK_COMBO_BOX (gconfig->bitrate.pass), - _("Multipass - First Pass (fast)")); - gtk_combo_box_append_text (GTK_COMBO_BOX (gconfig->bitrate.pass), - _("Multipass - Nth Pass")); - gtk_table_attach_defaults (GTK_TABLE (table), gconfig->bitrate.pass, - 1, 2, 0, 1); - g_signal_connect (G_OBJECT (gconfig->bitrate.pass), - "changed", - G_CALLBACK (x264_bitrate_pass), - gconfig); - gtk_widget_show (gconfig->bitrate.pass); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Quantizer - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 1, 2); - gtk_widget_show (eb); - - gconfig->bitrate.label = gtk_label_new (_("Quantizer")); - gtk_misc_set_alignment (GTK_MISC (gconfig->bitrate.label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), gconfig->bitrate.label); - gtk_widget_show (gconfig->bitrate.label); - - gconfig->bitrate.w_quantizer = gtk_hscale_new_with_range (0.0, 51.0, 1.0); - gtk_scale_set_digits (GTK_SCALE (gconfig->bitrate.w_quantizer), 0); - gtk_scale_set_value_pos (GTK_SCALE (gconfig->bitrate.w_quantizer), GTK_POS_RIGHT); - gtk_table_attach_defaults (GTK_TABLE (table), gconfig->bitrate.w_quantizer, - 1, 2, 1, 2); - - gconfig->bitrate.w_average_bitrate = gtk_entry_new_with_max_length (4095); - gtk_table_attach_defaults (GTK_TABLE (table), gconfig->bitrate.w_average_bitrate, - 1, 2, 1, 2); - - gconfig->bitrate.w_target_bitrate = gtk_entry_new_with_max_length (4095); - gtk_table_attach_defaults (GTK_TABLE (table), gconfig->bitrate.w_target_bitrate, - 1, 2, 1, 2); - - frame = gtk_frame_new (_("Statistic file")); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 6); - gtk_widget_show (frame); - - table = gtk_table_new (2, 2, TRUE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - gtk_container_add (GTK_CONTAINER (frame), table); - gtk_widget_show (table); - - gconfig->bitrate.update_statfile = gtk_check_button_new_with_label (_("Update statistic file")); - gtk_tooltips_set_tip (tooltips, gconfig->bitrate.update_statfile, - _("Update statistic file - description"), - ""); - g_signal_connect (G_OBJECT (gconfig->bitrate.update_statfile), - "toggled", - G_CALLBACK (x264_bitrate_statfile), gconfig); - gtk_table_attach_defaults (GTK_TABLE (table), gconfig->bitrate.update_statfile, - 0, 1, 0, 1); - gtk_widget_show (gconfig->bitrate.update_statfile); - - label = gtk_label_new (_("Statistic file name")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, - 0, 1, 1, 2); - gtk_widget_show (label); - - gconfig->bitrate.statsfile_name = gtk_entry_new_with_max_length (4095); - gtk_table_attach_defaults (GTK_TABLE (table), gconfig->bitrate.statsfile_name, - 1, 2, 1, 2); - gtk_widget_show (gconfig->bitrate.statsfile_name); - - return vbox; -} - -/* Callbacks */ -static void -x264_bitrate_pass (GtkComboBox *combo, - gpointer user_data) -{ - X264_Gui_Config *gconfig; - - gconfig = (X264_Gui_Config *)user_data; - - switch (gtk_combo_box_get_active (combo)) - { - case X264_PASS_SINGLE_BITRATE: - gtk_label_set_text (GTK_LABEL (gconfig->bitrate.label), _("Average bitrate")); - if (!GTK_WIDGET_VISIBLE (gconfig->bitrate.w_average_bitrate)) { - gtk_widget_hide (gconfig->bitrate.w_quantizer); - gtk_widget_hide (gconfig->bitrate.w_target_bitrate); - gtk_widget_show (gconfig->bitrate.w_average_bitrate); - } - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gconfig->bitrate.update_statfile), FALSE); - gtk_widget_set_sensitive (gconfig->bitrate.update_statfile, FALSE); - break; - case X264_PASS_SINGLE_QUANTIZER: - gtk_label_set_text (GTK_LABEL (gconfig->bitrate.label), _("Quantizer")); - if (!GTK_WIDGET_VISIBLE (gconfig->bitrate.w_quantizer)) { - gtk_widget_hide (gconfig->bitrate.w_average_bitrate); - gtk_widget_hide (gconfig->bitrate.w_target_bitrate); - gtk_widget_show (gconfig->bitrate.w_quantizer); - } - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gconfig->bitrate.update_statfile), FALSE); - gtk_widget_set_sensitive (gconfig->bitrate.update_statfile, FALSE); - break; - case X264_PASS_MULTIPASS_1ST: - case X264_PASS_MULTIPASS_1ST_FAST: - gtk_label_set_text (GTK_LABEL (gconfig->bitrate.label), _("Target bitrate")); - if (!GTK_WIDGET_VISIBLE (gconfig->bitrate.w_target_bitrate)) { - gtk_widget_hide (gconfig->bitrate.w_quantizer); - gtk_widget_hide (gconfig->bitrate.w_average_bitrate); - gtk_widget_show (gconfig->bitrate.w_target_bitrate); - } - gtk_widget_set_sensitive (gconfig->bitrate.update_statfile, TRUE); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gconfig->bitrate.update_statfile), TRUE); - break; - case X264_PASS_MULTIPASS_NTH: - gtk_label_set_text (GTK_LABEL (gconfig->bitrate.label), _("Target bitrate")); - if (!GTK_WIDGET_VISIBLE (gconfig->bitrate.w_target_bitrate)) { - gtk_widget_hide (gconfig->bitrate.w_quantizer); - gtk_widget_hide (gconfig->bitrate.w_average_bitrate); - gtk_widget_show (gconfig->bitrate.w_target_bitrate); - } - gtk_widget_set_sensitive (gconfig->bitrate.update_statfile, TRUE); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gconfig->bitrate.update_statfile), TRUE); - break; - } -} - -static void -x264_bitrate_statfile (GtkToggleButton *button, - gpointer user_data) -{ - X264_Gui_Config *gconfig; - - gconfig = (X264_Gui_Config *)user_data; - - if (gtk_toggle_button_get_active (button)) - gtk_widget_set_sensitive (gconfig->bitrate.statsfile_name, TRUE); - else - gtk_widget_set_sensitive (gconfig->bitrate.statsfile_name, FALSE); -} diff --git a/gtk/x264_gtk_bitrate.h b/gtk/x264_gtk_bitrate.h deleted file mode 100644 index 35315f6d..00000000 --- a/gtk/x264_gtk_bitrate.h +++ /dev/null @@ -1,28 +0,0 @@ -/***************************************************************************** - * x264_gtk_bitrate.h: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#ifndef X264_GTK_BITRATE_H -#define X264_GTK_BITRATE_H - - -GtkWidget *x264_bitrate_page (X264_Gui_Config *config); - - -#endif /* X264_GTK_BITRATE_H */ diff --git a/gtk/x264_gtk_cqm.c b/gtk/x264_gtk_cqm.c deleted file mode 100644 index 4312f8e5..00000000 --- a/gtk/x264_gtk_cqm.c +++ /dev/null @@ -1,491 +0,0 @@ -/***************************************************************************** - * x264_gtk_cqm.c: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#if defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ || defined __DragonFly__ -# include -#else -# include -#endif - -#include - -#include "../x264.h" -#include "x264_gtk_private.h" -#include "x264_gtk_i18n.h" -#include "x264_gtk_enum.h" - - -/* Callbacks */ -static void x264_cqm_flat_matrix_cb (GtkToggleButton *togglebutton, - gpointer user_data); -static void x264_cqm_jvt_matrix_cb (GtkToggleButton *togglebutton, - gpointer user_data); -static void x264_cqm_custom_matrix_cb (GtkToggleButton *togglebutton, - gpointer user_data); -static void x264_cqm_matrix_file_cb (GtkFileChooser *filechooser, - gint response, - gpointer user_data); - - -static GtkWidget *x264_cqm_4x4_page (X264_Gui_Config *gconfig); -static GtkWidget *x264_cqm_8x8_iy_page (X264_Gui_Config *gconfig); -static GtkWidget *x264_cqm_8x8_py_page (X264_Gui_Config *gconfig); - -GtkWidget * -x264_cqm_page (X264_Gui_Config *gconfig) -{ - GtkWidget *vbox; - GtkWidget *table; - GtkWidget *notebook; - GtkWidget *chooser; - GtkWidget *label; - GtkWidget *page; - GtkTooltips *tooltips; - - tooltips = gtk_tooltips_new (); - - vbox = gtk_vbox_new (FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); - - table = gtk_table_new (4, 2, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 6); - gtk_widget_show (table); - - gconfig->cqm.radio_flat = gtk_radio_button_new_with_label (NULL, _("Flat matrix")); - gtk_tooltips_set_tip (tooltips, gconfig->cqm.radio_flat, - _("Flat matrix - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), gconfig->cqm.radio_flat, - 0, 1, 0, 1); - g_signal_connect (G_OBJECT (gconfig->cqm.radio_flat), "toggled", - G_CALLBACK (x264_cqm_flat_matrix_cb), gconfig); - gtk_widget_show (gconfig->cqm.radio_flat); - - gconfig->cqm.radio_jvt = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (gconfig->cqm.radio_flat), _("JVT matrix")); - gtk_tooltips_set_tip (tooltips, gconfig->cqm.radio_jvt, - _("JVT matrix - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), gconfig->cqm.radio_jvt, - 0, 1, 1, 2); - g_signal_connect (G_OBJECT (gconfig->cqm.radio_jvt), "toggled", - G_CALLBACK (x264_cqm_jvt_matrix_cb), gconfig); - gtk_widget_show (gconfig->cqm.radio_jvt); - - gconfig->cqm.radio_custom = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (gconfig->cqm.radio_flat), _("Custom matrix")); - gtk_tooltips_set_tip (tooltips, gconfig->cqm.radio_custom, - _("Custom matrix - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), gconfig->cqm.radio_custom, - 0, 1, 2, 3); - g_signal_connect (G_OBJECT (gconfig->cqm.radio_custom), "toggled", - G_CALLBACK (x264_cqm_custom_matrix_cb), gconfig); - gtk_widget_show (gconfig->cqm.radio_custom); - - chooser = gtk_file_chooser_dialog_new(_("Select a file"), - NULL, - GTK_FILE_CHOOSER_ACTION_OPEN, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, - NULL); - g_signal_connect (G_OBJECT (chooser), "response", - G_CALLBACK (x264_cqm_matrix_file_cb), gconfig); - gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (chooser), - g_get_home_dir ()); - gconfig->cqm.cqm_file = gtk_file_chooser_button_new_with_dialog (chooser); - gtk_table_attach_defaults (GTK_TABLE (table), gconfig->cqm.cqm_file, - 1, 2, 2, 3); - gtk_widget_show (gconfig->cqm.cqm_file); - - notebook = gtk_notebook_new (); - gtk_table_attach_defaults (GTK_TABLE (table), notebook, - 0, 2, 3, 4); - gtk_widget_show (notebook); - - label = gtk_label_new (_("4x4 quant. matrices")); - gtk_widget_show (label); - - page = x264_cqm_4x4_page (gconfig); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label); - gtk_widget_show (page); - - label = gtk_label_new (_("8x8 I luma quant. matrices")); - gtk_widget_show (label); - - page = x264_cqm_8x8_iy_page (gconfig); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label); - gtk_widget_show (page); - - label = gtk_label_new (_("8x8 P luma quant. matrices")); - gtk_widget_show (label); - - page = x264_cqm_8x8_py_page (gconfig); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label); - gtk_widget_show (page); - - return vbox; -} - -static GtkWidget * -x264_cqm_4x4_page (X264_Gui_Config *gconfig) -{ - GtkWidget *table; - GtkWidget *misc; - GtkWidget *frame; - GtkWidget *t; - GtkRequisition size; - gint i; - - misc = gtk_entry_new_with_max_length (3); - gtk_widget_size_request (misc, &size); - - table = gtk_table_new (2, 2, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - - frame = gtk_frame_new (_("4x4 I luma quant. matrices")); - gtk_table_attach_defaults (GTK_TABLE (table), frame, - 0, 1, 0, 1); - gtk_widget_show (frame); - - t = gtk_table_new (4, 4, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (t), 6); - gtk_table_set_col_spacings (GTK_TABLE (t), 6); - gtk_container_set_border_width (GTK_CONTAINER (t), 6); - gtk_container_add (GTK_CONTAINER (frame), t); - gtk_widget_show (t); - - for (i = 0; i < 16; i++) { - gconfig->cqm.cqm_4iy[i] = gtk_entry_new_with_max_length (3); - gtk_widget_set_size_request (gconfig->cqm.cqm_4iy[i], 25, size.height); - gtk_table_attach_defaults (GTK_TABLE (t), gconfig->cqm.cqm_4iy[i], - i >> 2, (i >> 2) + 1, i & 3, (i & 3) + 1); - gtk_widget_show (gconfig->cqm.cqm_4iy[i]); - } - - frame = gtk_frame_new (_("4x4 I chroma quant. matrices")); - gtk_table_attach_defaults (GTK_TABLE (table), frame, - 0, 1, 1, 2); - gtk_widget_show (frame); - - t = gtk_table_new (4, 4, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (t), 6); - gtk_table_set_col_spacings (GTK_TABLE (t), 6); - gtk_container_set_border_width (GTK_CONTAINER (t), 6); - gtk_container_add (GTK_CONTAINER (frame), t); - gtk_widget_show (t); - - for (i = 0; i < 16; i++) { - gconfig->cqm.cqm_4ic[i] = gtk_entry_new_with_max_length (3); - gtk_widget_set_size_request (gconfig->cqm.cqm_4ic[i], 25, size.height); - gtk_table_attach_defaults (GTK_TABLE (t), gconfig->cqm.cqm_4ic[i], - i >> 2, (i >> 2) + 1, i & 3, (i & 3) + 1); - gtk_widget_show (gconfig->cqm.cqm_4ic[i]); - } - - frame = gtk_frame_new (_("4x4 P luma quant. matrix")); - gtk_table_attach_defaults (GTK_TABLE (table), frame, - 1, 2, 0, 1); - gtk_widget_show (frame); - - t = gtk_table_new (4, 4, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (t), 6); - gtk_table_set_col_spacings (GTK_TABLE (t), 6); - gtk_container_set_border_width (GTK_CONTAINER (t), 6); - gtk_container_add (GTK_CONTAINER (frame), t); - gtk_widget_show (t); - - for (i = 0; i < 16; i++) { - gconfig->cqm.cqm_4py[i] = gtk_entry_new_with_max_length (3); - gtk_widget_set_size_request (gconfig->cqm.cqm_4py[i], 25, size.height); - gtk_table_attach_defaults (GTK_TABLE (t), gconfig->cqm.cqm_4py[i], - i >> 2, (i >> 2) + 1, i & 3, (i & 3) + 1); - gtk_widget_show (gconfig->cqm.cqm_4py[i]); - } - - frame = gtk_frame_new (_("4x4 P chroma quant. matrix")); - gtk_table_attach_defaults (GTK_TABLE (table), frame, - 1, 2, 1, 2); - gtk_widget_show (frame); - - t = gtk_table_new (4, 4, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (t), 6); - gtk_table_set_col_spacings (GTK_TABLE (t), 6); - gtk_container_set_border_width (GTK_CONTAINER (t), 6); - gtk_container_add (GTK_CONTAINER (frame), t); - gtk_widget_show (t); - - for (i = 0; i < 16; i++) { - gconfig->cqm.cqm_4pc[i] = gtk_entry_new_with_max_length (3); - gtk_widget_set_size_request (gconfig->cqm.cqm_4pc[i], 25, size.height); - gtk_table_attach_defaults (GTK_TABLE (t), gconfig->cqm.cqm_4pc[i], - i >> 2, (i >> 2) + 1, i & 3, (i & 3) + 1); - gtk_widget_show (gconfig->cqm.cqm_4pc[i]); - } - - return table; -} - -static GtkWidget * -x264_cqm_8x8_iy_page (X264_Gui_Config *gconfig) -{ - GtkWidget *table; - GtkWidget *misc; - GtkRequisition size; - gint i; - - misc = gtk_entry_new_with_max_length (3); - gtk_widget_size_request (misc, &size); - - table = gtk_table_new (8, 8, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - - for (i = 0; i < 64; i++) { - gconfig->cqm.cqm_8iy[i] = gtk_entry_new_with_max_length (3); - gtk_widget_set_size_request (gconfig->cqm.cqm_8iy[i], 25, size.height); - gtk_table_attach_defaults (GTK_TABLE (table), gconfig->cqm.cqm_8iy[i], - i >> 3, (i >> 3) + 1, i & 7, (i & 7) + 1); - gtk_widget_show (gconfig->cqm.cqm_8iy[i]); - } - - return table; -} - -static GtkWidget * -x264_cqm_8x8_py_page (X264_Gui_Config *gconfig) -{ - GtkWidget *table; - GtkWidget *misc; - GtkRequisition size; - gint i; - - misc = gtk_entry_new_with_max_length (3); - gtk_widget_size_request (misc, &size); - - table = gtk_table_new (8, 8, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - - for (i = 0; i < 64; i++) { - gconfig->cqm.cqm_8py[i] = gtk_entry_new_with_max_length (3); - gtk_widget_set_size_request (gconfig->cqm.cqm_8py[i], 25, size.height); - gtk_table_attach_defaults (GTK_TABLE (table), gconfig->cqm.cqm_8py[i], - i >> 3, (i >> 3) + 1, i & 7, (i & 7) + 1); - gtk_widget_show (gconfig->cqm.cqm_8py[i]); - } - - return table; -} - -/* Callbacks */ -static void -x264_cqm_flat_matrix_cb (GtkToggleButton *togglebutton, - gpointer user_data) -{ - X264_Gui_Config *gconfig; - - gconfig = (X264_Gui_Config *)user_data; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->cqm.radio_flat))) { - gint i; - - gtk_widget_set_sensitive (gconfig->cqm.cqm_file, FALSE); - for (i = 0; i < 16; i++) { - gtk_widget_set_sensitive (gconfig->cqm.cqm_4iy[i], FALSE); - gtk_widget_set_sensitive (gconfig->cqm.cqm_4ic[i], FALSE); - gtk_widget_set_sensitive (gconfig->cqm.cqm_4py[i], FALSE); - gtk_widget_set_sensitive (gconfig->cqm.cqm_4pc[i], FALSE); - } - for (i = 0; i < 64; i++) { - gtk_widget_set_sensitive (gconfig->cqm.cqm_8iy[i], FALSE); - gtk_widget_set_sensitive (gconfig->cqm.cqm_8py[i], FALSE); - } - } -} - -static void -x264_cqm_jvt_matrix_cb (GtkToggleButton *togglebutton, - gpointer user_data) -{ - X264_Gui_Config *gconfig; - - gconfig = (X264_Gui_Config *)user_data; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->cqm.radio_jvt))) { - gint i; - - gtk_widget_set_sensitive (gconfig->cqm.cqm_file, FALSE); - for (i = 0; i < 16; i++) { - gtk_widget_set_sensitive (gconfig->cqm.cqm_4iy[i], FALSE); - gtk_widget_set_sensitive (gconfig->cqm.cqm_4ic[i], FALSE); - gtk_widget_set_sensitive (gconfig->cqm.cqm_4py[i], FALSE); - gtk_widget_set_sensitive (gconfig->cqm.cqm_4pc[i], FALSE); - } - for (i = 0; i < 64; i++) { - gtk_widget_set_sensitive (gconfig->cqm.cqm_8iy[i], FALSE); - gtk_widget_set_sensitive (gconfig->cqm.cqm_8py[i], FALSE); - } - } -} - -static void -x264_cqm_custom_matrix_cb (GtkToggleButton *togglebutton, - gpointer user_data) -{ - X264_Gui_Config *gconfig; - - gconfig = (X264_Gui_Config *)user_data; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gconfig->cqm.radio_custom))) { - gint i; - - gtk_widget_set_sensitive (gconfig->cqm.cqm_file, TRUE); - for (i = 0; i < 16; i++) { - gtk_widget_set_sensitive (gconfig->cqm.cqm_4iy[i], TRUE); - gtk_widget_set_sensitive (gconfig->cqm.cqm_4ic[i], TRUE); - gtk_widget_set_sensitive (gconfig->cqm.cqm_4py[i], TRUE); - gtk_widget_set_sensitive (gconfig->cqm.cqm_4pc[i], TRUE); - } - for (i = 0; i < 64; i++) { - gtk_widget_set_sensitive (gconfig->cqm.cqm_8iy[i], TRUE); - gtk_widget_set_sensitive (gconfig->cqm.cqm_8py[i], TRUE); - } - } -} - -static gboolean -x264_set_coefs (int size, GtkWidget **entries, GIOChannel *file) -{ - gchar *line; - gsize length; - int i = 0; - int offset = 0; - - while (i < size) { - gchar **coefs; - int j; - - if (g_io_channel_read_line (file, &line, &length, NULL, NULL) != G_IO_STATUS_NORMAL) { - g_print ("Not a JM custom AVC matrix compliant file\n"); - return FALSE; - } - if ((line[0] == '\0') || (line[0] == '\n') || (line[0] == '\r') || (line[0] == '#')) { - g_free (line); - continue; - } - coefs = g_strsplit (line, ",", size + 1); - for (j = 0; j < size; j++) { - gtk_entry_set_text (GTK_ENTRY (entries[offset]), coefs[j]); - offset++; - } - g_strfreev (coefs); - g_free (line); - i++; - } - return TRUE; -} - -static void -x264_cqm_matrix_file_cb (GtkFileChooser *filechooser, - gint response, - gpointer user_data) -{ - X264_Gui_Config *gconfig; - GIOChannel *file; - GError *error = NULL; - gchar *filename; - gchar *line; - gsize length; - - if (!user_data) - return; - - gconfig = (X264_Gui_Config *)user_data; - - filename = gtk_file_chooser_get_filename (filechooser); - file = g_io_channel_new_file (filename, "r", &error); - if (error) { - g_print ("Can not open file %s\n", filename); - g_free (filename); - - return; - } - - while ((g_io_channel_read_line (file, &line, &length, NULL, NULL) == G_IO_STATUS_NORMAL)) { - if (!line) continue; - if ((line[0] == '\0') || (line[0] == '\n') || (line[0] == '\r') || (line[0] == '#')) { - g_free (line); - continue; - } - if (g_str_has_prefix (line, "INTRA4X4_LUMA")) { - g_free (line); - if (!x264_set_coefs (4, gconfig->cqm.cqm_4iy, file)) { - g_free (filename); - return; - } - continue; - } - if (g_str_has_prefix (line, "INTRA4X4_CHROMAU")) { - g_free (line); - if (!x264_set_coefs (4, gconfig->cqm.cqm_4ic, file)) { - g_free (filename); - return; - } - continue; - } - if (g_str_has_prefix (line, "INTER4X4_LUMA")) { - g_free (line); - if (!x264_set_coefs (4, gconfig->cqm.cqm_4py, file)) { - g_free (filename); - return; - } - continue; - } - - if (g_str_has_prefix (line, "INTER4X4_CHROMAU")) { - g_free (line); - if (!x264_set_coefs (4, gconfig->cqm.cqm_4pc, file)) { - g_free (filename); - return; - } - continue; - } - if (g_str_has_prefix (line, "INTRA8X8_LUMA")) { - g_free (line); - if (!x264_set_coefs (8, gconfig->cqm.cqm_8iy, file)) { - g_free (filename); - return; - } - continue; - } - if (g_str_has_prefix (line, "INTER8X8_LUMA")) { - g_free (line); - if (!x264_set_coefs (8, gconfig->cqm.cqm_8py, file)) { - g_free (filename); - return; - } - continue; - } - } - g_free (filename); -} diff --git a/gtk/x264_gtk_cqm.h b/gtk/x264_gtk_cqm.h deleted file mode 100644 index 0ba3dc39..00000000 --- a/gtk/x264_gtk_cqm.h +++ /dev/null @@ -1,28 +0,0 @@ -/***************************************************************************** - * x264_gtk_cqm.h: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#ifndef X264_GTK_CQM_H -#define X264_GTK_CQM_H - - -GtkWidget *x264_cqm_page (X264_Gui_Config *config); - - -#endif /* X264_GTK_CQM_H */ diff --git a/gtk/x264_gtk_demuxers.h b/gtk/x264_gtk_demuxers.h deleted file mode 100644 index 638a7af6..00000000 --- a/gtk/x264_gtk_demuxers.h +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************** - * x264_gtk_demuxers.h: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#ifndef X264_GTK_MUXERS_H -#define X264_GTK_MUXERS_H - -#include "../config.h" -#include "../muxers.h" - -typedef enum { - X264_DEMUXER_YUV = 0, - X264_DEMUXER_CIF, - X264_DEMUXER_QCIF, - X264_DEMUXER_Y4M, - X264_DEMUXER_AVI, - X264_DEMUXER_AVS, - X264_DEMUXER_UNKOWN -} X264_Demuxer_Type; -/* static int X264_Num_Demuxers = (int)X264_DEMUXER_UNKOWN; */ - -#endif /* X264_GTK_MUXERS_H */ diff --git a/gtk/x264_gtk_encode.c b/gtk/x264_gtk_encode.c deleted file mode 100644 index 28c8ee3c..00000000 --- a/gtk/x264_gtk_encode.c +++ /dev/null @@ -1,47 +0,0 @@ -/***************************************************************************** - * x264_gtk_encode.c: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#if defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ || defined __DragonFly__ -# include -#else -# include -#endif - -#include - -#include "x264_gtk_private.h" -#include "x264_gtk_i18n.h" -#include "x264_gtk_encode_main_window.h" - -int -main (int argc, char *argv[]) -{ - BIND_X264_TEXTDOMAIN(); - - g_thread_init (NULL); - - gtk_init (&argc, &argv); - - x264_gtk_encode_main_window (); - - gtk_main (); - - return 0; -} diff --git a/gtk/x264_gtk_encode_encode.c b/gtk/x264_gtk_encode_encode.c deleted file mode 100644 index f05c0aa1..00000000 --- a/gtk/x264_gtk_encode_encode.c +++ /dev/null @@ -1,308 +0,0 @@ -/***************************************************************************** - * x264_gtk_encode_encode.c: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#include -#if defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ || defined __DragonFly__ -# include -#else -# include -#endif - -#include - -#include "../x264.h" -#include "x264_gtk_i18n.h" -#include "x264_gtk_demuxers.h" -#include "x264_gtk_encode_private.h" - - -#define DATA_MAX 3000000 -uint8_t data[DATA_MAX]; - -int64_t x264_mdate (void); - -/* input interface */ -int (*p_open_infile)( char *psz_filename, hnd_t *p_handle, x264_param_t *p_param ); -int (*p_get_frame_total)( hnd_t handle ); -int (*p_read_frame)( x264_picture_t *p_pic, hnd_t handle, int i_frame ); -int (*p_close_infile)( hnd_t handle ); - -/* output interface */ -static int (*p_open_outfile) (char *filename, void **handle); -static int (*p_set_outfile_param) (void *handle, x264_param_t *p_param); -static int (*p_write_nalu) (void *handle, uint8_t *p_nal, int i_size); -static int (*p_set_eop) (void *handle, x264_picture_t *p_picture); -static int (*p_close_outfile) (void *handle); - -static int x264_set_drivers (X264_Demuxer_Type in_container, gint out_container); -static int x264_encode_frame (x264_t *h, void *handle, x264_picture_t *pic); - - -gpointer -x264_gtk_encode_encode (X264_Thread_Data *thread_data) -{ - GIOStatus status; - gsize size; - X264_Pipe_Data pipe_data; - x264_param_t *param; - x264_picture_t pic; - x264_t *h; - hnd_t hin; - hnd_t hout; - int i_frame; - int i_frame_total; - int64_t i_start; - int64_t i_end; - int64_t i_file; - int i_frame_size; - int i_progress; - int err; - - g_print (_("encoding...\n")); - param = thread_data->param; - err = x264_set_drivers (thread_data->in_container, thread_data->out_container); - if (err < 0) { - GtkWidget *no_driver; - no_driver = gtk_message_dialog_new (GTK_WINDOW(thread_data->dialog), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - (err == -2) ? _("Error: unknown output file type") - : _("Error: unknown input file type")); - gtk_dialog_run (GTK_DIALOG (no_driver)); - gtk_widget_destroy (no_driver); - return NULL; - } - - if (p_open_infile (thread_data->file_input, &hin, param)) { - fprintf( stderr, _("could not open input file '%s'\n"), thread_data->file_input ); - return NULL; - } - - p_open_outfile ((char *)thread_data->file_output, &hout); - - i_frame_total = p_get_frame_total (hin ); - if (((i_frame_total == 0) || (param->i_frame_total < i_frame_total)) && - (param->i_frame_total > 0)) - i_frame_total = param->i_frame_total; - param->i_frame_total = i_frame_total; - - if ((h = x264_encoder_open (param)) == NULL) - { - fprintf (stderr, _("x264_encoder_open failed\n")); - p_close_infile (hin); - p_close_outfile (hout); - g_free (param); - - return NULL; - } - - if (p_set_outfile_param (hout, param)) - { - fprintf (stderr, _("can't set outfile param\n")); - p_close_infile (hin); - p_close_outfile (hout); - g_free (param); - - return NULL; - } - - /* Create a new pic */ - x264_picture_alloc (&pic, X264_CSP_I420, param->i_width, param->i_height ); - - i_start = x264_mdate(); - - /* Encode frames */ - for (i_frame = 0, i_file = 0, i_progress = 0; - ((i_frame < i_frame_total) || (i_frame_total == 0)); ) - { - if (p_read_frame (&pic, hin, i_frame)) - break; - - pic.i_pts = (int64_t)i_frame * param->i_fps_den; - - i_file += x264_encode_frame (h, hout, &pic); - - i_frame++; - - /* update status line (up to 1000 times per input file) */ - if (param->i_log_level < X264_LOG_DEBUG && - (i_frame_total ? i_frame * 1000 / i_frame_total > i_progress - : i_frame % 10 == 0)) - { - int64_t i_elapsed = x264_mdate () - i_start; - - if (i_frame_total) - { - pipe_data.frame = i_frame; - pipe_data.frame_total = i_frame_total; - pipe_data.file = i_file; - pipe_data.elapsed = i_elapsed; - status = g_io_channel_write_chars (thread_data->io_write, - (const gchar *)&pipe_data, - sizeof (X264_Pipe_Data), - &size, NULL); - if (status != G_IO_STATUS_NORMAL) { - g_print (_("Error ! %d %d %d\n"), status, (int)sizeof (X264_Pipe_Data), (int)size); - } - else { - /* we force the GIOChannel to write to the pipeline */ - status = g_io_channel_flush (thread_data->io_write, - NULL); - if (status != G_IO_STATUS_NORMAL) { - g_print (_("Error ! %d\n"), status); - } - } - } - } - } - /* Flush delayed B-frames */ - do { - i_file += i_frame_size = x264_encode_frame (h, hout, NULL); - } while (i_frame_size); - - i_end = x264_mdate (); - x264_picture_clean (&pic); - x264_encoder_close (h); - fprintf (stderr, "\n"); - - p_close_infile (hin); - p_close_outfile (hout); - - if (i_frame > 0) { - double fps = (double)i_frame * (double)1000000 / - (double)(i_end - i_start); - - fprintf (stderr, _("encoded %d frames, %.2f fps, %.2f kb/s\n"), - i_frame, fps, - (double) i_file * 8 * param->i_fps_num / - ((double) param->i_fps_den * i_frame * 1000)); - } - - gtk_widget_set_sensitive (thread_data->end_button, TRUE); - gtk_widget_hide (thread_data->button); - return NULL; -} - -static int -x264_set_drivers (X264_Demuxer_Type in_container, gint out_container) -{ - switch (in_container) { - case X264_DEMUXER_YUV: - case X264_DEMUXER_CIF: - case X264_DEMUXER_QCIF: - /* Default input file driver */ - p_open_infile = open_file_yuv; - p_get_frame_total = get_frame_total_yuv; - p_read_frame = read_frame_yuv; - p_close_infile = close_file_yuv; - break; - case X264_DEMUXER_Y4M: - p_open_infile = open_file_y4m; - p_get_frame_total = get_frame_total_y4m; - p_read_frame = read_frame_y4m; - p_close_infile = close_file_y4m; - break; -#ifdef AVIS_INPUT - case X264_DEMUXER_AVI: - case X264_DEMUXER_AVS: - p_open_infile = open_file_avis; - p_get_frame_total = get_frame_total_avis; - p_read_frame = read_frame_avis; - p_close_infile = close_file_avis; - break; -#endif - default: /* Unknown */ - return -1; - } - - switch (out_container) { - case 0: -/* Raw ES output file driver */ - p_open_outfile = open_file_bsf; - p_set_outfile_param = set_param_bsf; - p_write_nalu = write_nalu_bsf; - p_set_eop = set_eop_bsf; - p_close_outfile = close_file_bsf; - break; - case 1: -/* Matroska output file driver */ - p_open_outfile = open_file_mkv; - p_set_outfile_param = set_param_mkv; - p_write_nalu = write_nalu_mkv; - p_set_eop = set_eop_mkv; - p_close_outfile = close_file_mkv; - break; -#ifdef MP4_OUTPUT - case 2: - p_open_outfile = open_file_mp4; - p_set_outfile_param = set_param_mp4; - p_write_nalu = write_nalu_mp4; - p_set_eop = set_eop_mp4; - p_close_outfile = close_file_mp4; - break; -#endif - default: - return -2; - } - - return 1; -} - -static int -x264_encode_frame (x264_t *h, void *handle, x264_picture_t *pic) -{ - x264_picture_t pic_out; - x264_nal_t *nal; - int i_nal; - int i; - int i_file = 0; - - /* Do not force any parameters */ - if (pic) - { - pic->i_type = X264_TYPE_AUTO; - pic->i_qpplus1 = 0; - } - if (x264_encoder_encode (h, &nal, &i_nal, pic, &pic_out) < 0) - { - fprintf (stderr, _("x264_encoder_encode failed\n")); - } - - for (i = 0; i < i_nal; i++) - { - int i_size; - int i_data; - - i_data = DATA_MAX; - if ((i_size = x264_nal_encode (data, &i_data, 1, &nal[i])) > 0 ) - { - i_file += p_write_nalu (handle, data, i_size); - } - else if (i_size < 0) - { - fprintf (stderr, _("need to increase buffer size (size=%d)\n"), -i_size); - } - } - if (i_nal) - p_set_eop (handle, &pic_out); - - return i_file; -} diff --git a/gtk/x264_gtk_encode_encode.h b/gtk/x264_gtk_encode_encode.h deleted file mode 100644 index 5cc61e0b..00000000 --- a/gtk/x264_gtk_encode_encode.h +++ /dev/null @@ -1,28 +0,0 @@ -/***************************************************************************** - * x264_gtk_encode_encode.h: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#ifndef X264_GTK_ENCODE_ENCODE_H -#define X264_GTK_ENCODE_ENCODE_H - - -gpointer x264_gtk_encode_encode (X264_Thread_Data *thread_data); - - -#endif /* X264_GTK_ENCODE_ENCODE_H */ diff --git a/gtk/x264_gtk_encode_main_window.c b/gtk/x264_gtk_encode_main_window.c deleted file mode 100644 index 6deea6d3..00000000 --- a/gtk/x264_gtk_encode_main_window.c +++ /dev/null @@ -1,776 +0,0 @@ -/***************************************************************************** - * x264_gtk_encode_main_window.c: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#if defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ || defined __DragonFly__ -# include -#else -# include -#endif -#include -#ifdef _WIN32 /* Needed to define _O_BINARY */ -# include -# define strncasecmp _strnicmp -#endif -#include -#include -#include /* For stat */ - -#include - -#include "../x264.h" -#include "../config.h" -#include "x264_icon.h" -#include "x264_gtk.h" -#include "x264_gtk_i18n.h" -#include "x264_gtk_demuxers.h" -#include "x264_gtk_encode_private.h" -#include "x264_gtk_encode_encode.h" -#include "x264_gtk_encode_status_window.h" - - -typedef struct X264_Gtk_Encode_ X264_Gtk_Encode; - -struct X264_Gtk_Encode_ -{ - GtkWidget *main_dialog; - - /* input */ - X264_Demuxer_Type container; - guint64 size; /* For YUV formats */ - GtkWidget *file_input; - GtkWidget *width; - GtkWidget *height; - GtkWidget *fps_num; - GtkWidget *fps_den; - GtkWidget *frame_count; - - /* output */ - GtkWidget *path_output; - GtkWidget *file_output; - GtkWidget *combo; -}; - - -/* Callbacks */ -static gboolean x264_delete_window_cb (GtkWidget *widget, - GdkEvent *event, - gpointer user_data); -static void x264_configure_window_cb (GtkButton *button, - gpointer user_data); -static void x264_chooser_window_cb (GtkDialog *dialog, - gint res, - gpointer user_data); -static void x264_response_window_cb (GtkDialog *dialog, - gint res, - gpointer user_data); -static void x264_dimension_entry_cb (GtkEditable *editable, - gpointer user_data); - -static gboolean x264_fill_status_window (GIOChannel *io, - GIOCondition condition, - gpointer user_data); -/* Code */ -guint64 -x264_file_size(const char* name) -{ - struct stat buf; - memset(&buf, 0, sizeof(struct stat)); - - if (stat(name, &buf) < 0) - { - fprintf(stderr, _("Can't stat file\n")); - return 0; - } - return buf.st_size; -} - -void -x264_gtk_encode_main_window () -{ - GtkWidget *dialog; - GtkWidget *frame; - GtkWidget *button; - GtkWidget *table; - GtkWidget *label; - GtkFileChooser *chooser; - GtkFileFilter *filter; - GdkPixbuf *icon; - X264_Gtk_Encode *encode; - - encode = (X264_Gtk_Encode *)g_malloc0 (sizeof (X264_Gtk_Encode)); - - dialog = gtk_dialog_new_with_buttons (_("X264 Gtk Encoder"), - NULL, 0, - NULL); - icon = gdk_pixbuf_new_from_inline (-1, x264_icon, - FALSE, NULL); - gtk_window_set_icon (GTK_WINDOW (dialog), icon); - g_signal_connect (G_OBJECT (dialog), - "delete-event", - G_CALLBACK (x264_delete_window_cb), - encode); - g_signal_connect (G_OBJECT (dialog), - "response", - G_CALLBACK (x264_response_window_cb), - encode); - encode->main_dialog = dialog; - - button = gtk_button_new_with_label (_("Configure")); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), button, FALSE, TRUE, 6); - g_signal_connect (G_OBJECT (button), - "clicked", - G_CALLBACK (x264_configure_window_cb), - dialog); - gtk_widget_show (button); - - gtk_dialog_add_buttons (GTK_DIALOG (dialog), - GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, - GTK_STOCK_EXECUTE, GTK_RESPONSE_APPLY, - NULL); - - /* input */ - frame = gtk_frame_new (_("Input file")); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), frame, FALSE, TRUE, 6); - gtk_widget_show (frame); - - table = gtk_table_new (6, 2, TRUE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - gtk_container_add (GTK_CONTAINER (frame), table); - gtk_widget_show (table); - - label = gtk_label_new (_("Input file:")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1); - gtk_widget_show (label); - - chooser = (GtkFileChooser*) - gtk_file_chooser_dialog_new(_("Select a file"), - GTK_WINDOW(dialog), - GTK_FILE_CHOOSER_ACTION_OPEN, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, - NULL); - gtk_file_chooser_set_current_folder (chooser, g_get_home_dir ()); - /* All supported */ - filter = gtk_file_filter_new (); - gtk_file_filter_set_name (filter, _("All supported")); - gtk_file_filter_add_pattern (filter, "*.yuv"); - gtk_file_filter_add_pattern (filter, "*.cif"); - gtk_file_filter_add_pattern (filter, "*.qcif"); - gtk_file_filter_add_pattern (filter, "*.y4m"); -#ifdef AVIS_INPUT - gtk_file_filter_add_pattern (filter, "*.avs"); - gtk_file_filter_add_pattern (filter, "*.avi"); -#endif - gtk_file_chooser_add_filter (chooser, filter); - /* YUV filter */ - filter = gtk_file_filter_new (); - gtk_file_filter_set_name (filter, _("YUV sequence")); - gtk_file_filter_add_pattern (filter, "*.yuv"); - gtk_file_chooser_add_filter (chooser, filter); - - /* CIF filter */ - filter = gtk_file_filter_new (); - gtk_file_filter_set_name (filter, _("YUV CIF sequence")); - gtk_file_filter_add_pattern (filter, "*.cif"); - gtk_file_chooser_add_filter (chooser, filter); - - /* QCIF filter */ - filter = gtk_file_filter_new (); - gtk_file_filter_set_name (filter, _("YUV QCIF sequence")); - gtk_file_filter_add_pattern (filter, "*.qcif"); - gtk_file_chooser_add_filter (chooser, filter); - - /* YUV4MPEG2 filter */ - filter = gtk_file_filter_new (); - gtk_file_filter_set_name (filter, _("YUV4MPEG2 sequence")); - gtk_file_filter_add_pattern (filter, "*.y4m"); - gtk_file_chooser_add_filter (chooser, filter); - -#ifdef AVIS_INPUT - /* AVI filter */ - filter = gtk_file_filter_new (); - gtk_file_filter_set_name (filter, "AVI"); - gtk_file_filter_add_pattern (filter, "*.avi"); - gtk_file_chooser_add_filter (chooser, filter); - /* AVS filter */ - filter = gtk_file_filter_new (); - gtk_file_filter_set_name (filter, _("Avisynth Script")); - gtk_file_filter_add_pattern (filter, "*.avs"); - gtk_file_chooser_add_filter (chooser, filter); -#endif - g_signal_connect_after(G_OBJECT (chooser), "response", - G_CALLBACK (x264_chooser_window_cb), - encode); - encode->file_input = gtk_file_chooser_button_new_with_dialog (GTK_WIDGET(chooser)); - gtk_table_attach_defaults (GTK_TABLE (table), encode->file_input, 1, 2, 0, 1); - gtk_widget_show (encode->file_input); - - label = gtk_label_new (_("Width:")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2); - gtk_widget_show (label); - - encode->width = gtk_entry_new_with_max_length (255); - gtk_entry_set_text (GTK_ENTRY (encode->width), "352"); - g_signal_connect_after(G_OBJECT (encode->width), "changed", - G_CALLBACK (x264_dimension_entry_cb), - encode); - gtk_table_attach_defaults (GTK_TABLE (table), encode->width, 1, 2, 1, 2); - gtk_widget_show (encode->width); - - label = gtk_label_new (_("Height:")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3); - gtk_widget_show (label); - - encode->height = gtk_entry_new_with_max_length (255); - gtk_entry_set_text (GTK_ENTRY (encode->height), "288"); - gtk_table_attach_defaults (GTK_TABLE (table), encode->height, 1, 2, 2, 3); - g_signal_connect_after(G_OBJECT (encode->height), "changed", - G_CALLBACK (x264_dimension_entry_cb), - encode); - gtk_widget_show (encode->height); - - label = gtk_label_new (_("Frame rate num:")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4); - gtk_widget_show (label); - - encode->fps_num = gtk_entry_new_with_max_length (255); - gtk_entry_set_text (GTK_ENTRY (encode->fps_num), "25"); - gtk_table_attach_defaults (GTK_TABLE (table), encode->fps_num, 1, 2, 3, 4); - gtk_widget_show (encode->fps_num); - - label = gtk_label_new (_("Frame rate den:")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 4, 5); - gtk_widget_show (label); - - encode->fps_den = gtk_entry_new_with_max_length (255); - gtk_entry_set_text (GTK_ENTRY (encode->fps_den), "1"); - gtk_table_attach_defaults (GTK_TABLE (table), encode->fps_den, 1, 2, 4, 5); - gtk_widget_show (encode->fps_den); - - label = gtk_label_new (_("Frame count:")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 5, 6); - gtk_widget_show (label); - - encode->frame_count = gtk_entry_new_with_max_length (255); - gtk_entry_set_text (GTK_ENTRY (encode->frame_count), "0"); - gtk_table_attach_defaults (GTK_TABLE (table), encode->frame_count, 1, 2, 5, 6); - gtk_widget_show (encode->frame_count); - - /* output */ - frame = gtk_frame_new (_("Output file")); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), frame, FALSE, TRUE, 6); - gtk_widget_show (frame); - - table = gtk_table_new (3, 2, TRUE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - gtk_container_add (GTK_CONTAINER (frame), table); - gtk_widget_show (table); - - label = gtk_label_new (_("Output path:")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1); - gtk_widget_show (label); - - encode->path_output = gtk_file_chooser_button_new (_("Select a path"), - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); - gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (encode->path_output), - g_get_home_dir ()); - gtk_table_attach_defaults (GTK_TABLE (table), encode->path_output, 1, 2, 0, 1); - gtk_widget_show (encode->path_output); - - label = gtk_label_new (_("Output file (without ext.):")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2); - gtk_widget_show (label); - - encode->file_output = gtk_entry_new_with_max_length (4095); - gtk_table_attach_defaults (GTK_TABLE (table), encode->file_output, 1, 2, 1, 2); - gtk_widget_show (encode->file_output); - - label = gtk_label_new (_("Container:")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3); - gtk_widget_show (label); - - encode->combo = gtk_combo_box_new_text (); - gtk_combo_box_append_text (GTK_COMBO_BOX (encode->combo), - "Raw ES"); - gtk_combo_box_append_text (GTK_COMBO_BOX (encode->combo), - "Matroska"); -#ifdef MP4_OUTPUT - gtk_combo_box_append_text (GTK_COMBO_BOX (encode->combo), - "Mp4"); -#endif - gtk_table_attach_defaults (GTK_TABLE (table), encode->combo, 1, 2, 2, 3); - gtk_widget_show (encode->combo); - - gtk_combo_box_set_active (GTK_COMBO_BOX (encode->combo), 0); - - gtk_widget_show (dialog); -} - -/* Callbacks */ - -static void -x264_encode_shutdown (X264_Gtk_Encode *encode) -{ - if (!encode) return; - - g_free (encode); - encode = NULL; -} - -static gboolean -x264_delete_window_cb (GtkWidget *widget UNUSED, - GdkEvent *event UNUSED, - gpointer user_data) -{ - gtk_main_quit (); - x264_encode_shutdown ((X264_Gtk_Encode *)user_data); - - return TRUE; -} - -static void -x264_chooser_window_cb (GtkDialog *dialog, - gint res, - gpointer user_data) -{ - X264_Gtk_Encode *encode; - gboolean sensitivity = TRUE; - x264_param_t param; - hnd_t hin; - char *in; -#define BUFFER_LENGTH 64 - gchar buffer[BUFFER_LENGTH]; - - /* input interface */ - int (*p_open_infile)( char *psz_filename, hnd_t *p_handle, x264_param_t *p_param ); - int (*p_get_frame_total)( hnd_t handle ); - int (*p_close_infile)( hnd_t handle ); - - encode = (X264_Gtk_Encode *)user_data; - in = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (encode->file_input)); - if (!in) return; - - /* Set defaults */ - p_open_infile = open_file_yuv; - p_get_frame_total = get_frame_total_yuv; - p_close_infile = close_file_yuv; - param.i_width = (gint)(g_ascii_strtod (gtk_entry_get_text (GTK_ENTRY (encode->width)), NULL)); - param.i_height = (gint)(g_ascii_strtod (gtk_entry_get_text (GTK_ENTRY (encode->height)), NULL)); - param.i_fps_num = 25; - param.i_fps_den = 1; - param.i_frame_total = 0; - - switch (res) { - case GTK_RESPONSE_OK: - case GTK_RESPONSE_ACCEPT: - case GTK_RESPONSE_APPLY: { - X264_Gtk_Encode *encode = (X264_Gtk_Encode *)user_data; - GSList *filters; - GtkFileFilter *selected; - int container; - - filters = gtk_file_chooser_list_filters(GTK_FILE_CHOOSER (encode->file_input)); - selected = gtk_file_chooser_get_filter(GTK_FILE_CHOOSER (encode->file_input)); - container = g_slist_index(filters, selected); - g_slist_free (filters); - - if (container == 0) - { - /* All format needed, search for extension */ - const char *ext = strrchr(in, '.'); - if (!strncasecmp(ext, ".y4m", 4)) - encode->container = X264_DEMUXER_Y4M; - else if (!strncasecmp(ext, ".avs", 4)) - encode->container = X264_DEMUXER_AVS; - else if (!strncasecmp(ext, ".avi", 4)) - encode->container = X264_DEMUXER_AVI; - else if (!strncasecmp(ext, ".cif", 4)) - encode->container = X264_DEMUXER_CIF; - else if (!strncasecmp(ext, ".qcif", 4)) - encode->container = X264_DEMUXER_QCIF; - else - encode->container = X264_DEMUXER_YUV; - } - else - { - /* The all supproted type is 0 => shift of 1 */ - encode->container = (X264_Demuxer_Type)container-1; - } - - switch (encode->container) { - case X264_DEMUXER_YUV: /* YUV */ - break; - case X264_DEMUXER_CIF: /* YUV CIF */ - param.i_width = 352; - param.i_height = 288; - break; - case X264_DEMUXER_QCIF: /* YUV QCIF */ - /* Default input file driver */ - param.i_width = 176; - param.i_height = 144; - break; - case X264_DEMUXER_Y4M: /* YUV4MPEG */ - /* Default input file driver */ - sensitivity = FALSE; - p_open_infile = open_file_y4m; - p_get_frame_total = get_frame_total_y4m; - p_close_infile = close_file_y4m; - break; -#ifdef AVIS_INPUT - case X264_DEMUXER_AVI: /* AVI */ - case X264_DEMUXER_AVS: /* AVS */ - sensitivity = FALSE; - p_open_infile = open_file_avis; - p_get_frame_total = get_frame_total_avis; - p_close_infile = close_file_avis; - break; -#endif - default: /* Unknown */ - break; - } - break; - } - default: - break; - } - - /* Modify dialog */ - gtk_widget_set_sensitive(encode->width, sensitivity); - gtk_widget_set_sensitive(encode->height, sensitivity); - gtk_widget_set_sensitive(encode->fps_num, sensitivity); - gtk_widget_set_sensitive(encode->fps_den, sensitivity); - gtk_widget_set_sensitive(encode->frame_count, sensitivity); - - /* Inquire input format */ - if (param.i_width < 2) param.i_width = 352; - if (param.i_height < 2) param.i_height = 288; - if (p_open_infile (in, &hin, ¶m) >= 0) { - param.i_frame_total = p_get_frame_total(hin); - p_close_infile (hin); - } else { - GtkWidget *dialog_message; - - dialog_message = gtk_message_dialog_new (GTK_WINDOW (dialog), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - strerror(errno)); - gtk_dialog_run (GTK_DIALOG (dialog_message)); - gtk_widget_destroy (dialog_message); - } - encode->size = x264_file_size(in); - - if (g_snprintf(buffer, BUFFER_LENGTH, "%i", param.i_width) > 0) - gtk_entry_set_text (GTK_ENTRY (encode->width), buffer); - if (g_snprintf(buffer, BUFFER_LENGTH, "%i", param.i_height) > 0) - gtk_entry_set_text (GTK_ENTRY (encode->height), buffer); - if (g_snprintf(buffer, BUFFER_LENGTH, "%i", param.i_fps_num) > 0) - gtk_entry_set_text (GTK_ENTRY (encode->fps_num), buffer); - if (g_snprintf(buffer, BUFFER_LENGTH, "%i", param.i_fps_den) > 0) - gtk_entry_set_text (GTK_ENTRY (encode->fps_den), buffer); - - if (g_snprintf(buffer, BUFFER_LENGTH, "%i", param.i_frame_total) > 0) - gtk_entry_set_text (GTK_ENTRY (encode->frame_count), buffer); -} -static void -x264_dimension_entry_cb (GtkEditable *editable, - gpointer user_data) -{ - X264_Gtk_Encode *encode = (X264_Gtk_Encode *)user_data; - char buffer[32]; - gint width; - gint height; - gint frame_size; - - width = (gint)(g_ascii_strtod (gtk_entry_get_text (GTK_ENTRY (encode->width)), NULL)); - height = (gint)(g_ascii_strtod (gtk_entry_get_text (GTK_ENTRY (encode->height)), NULL)); - frame_size = (3*width*height)/2; - - if (frame_size > 0 && encode->container <= X264_DEMUXER_QCIF) - { - snprintf(buffer, 32, "%lu", (long unsigned int)((encode->size+frame_size/2)/frame_size)); - gtk_entry_set_text (GTK_ENTRY (encode->frame_count), buffer); - } -} - -static void -x264_configure_window_cb (GtkButton *button UNUSED, - gpointer user_data) -{ - GtkWidget *window; - - window = x264_gtk_window_create (GTK_WIDGET (user_data)); - x264_gtk_shutdown (window); -} - -static void -x264_response_window_cb (GtkDialog *dialog, - gint res, - gpointer user_data) -{ - switch (res) { - case GTK_RESPONSE_APPLY: { - x264_param_t *param; - X264_Gtk *x264_gtk; - X264_Gtk_Encode *encode; - X264_Thread_Data *thread_data; - GtkWidget *win_status; - GThread *thread; - const gchar *file_input = NULL; - const gchar *path_output = NULL; - const gchar *filename_output = NULL; - gchar *file_output = NULL; - gchar *ext; - gint fds[2]; - gint out_container; - - encode = (X264_Gtk_Encode *)user_data; - file_input = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (encode->file_input)); - path_output = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (encode->path_output)); - filename_output = gtk_entry_get_text (GTK_ENTRY (encode->file_output)); - - if (!file_input || - (file_input[0] == '\0')) { - GtkWidget *dialog_message; - - dialog_message = gtk_message_dialog_new (GTK_WINDOW (dialog), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - _("Error: input file name is not set")); - gtk_dialog_run (GTK_DIALOG (dialog_message)); - gtk_widget_destroy (dialog_message); - break; - } - - if (!filename_output || - (filename_output[0] == '\0')) { - GtkWidget *dialog_message; - - dialog_message = gtk_message_dialog_new (GTK_WINDOW (dialog), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - _("Error: output file name is not set")); - gtk_dialog_run (GTK_DIALOG (dialog_message)); - gtk_widget_destroy (dialog_message); - break; - } - - out_container = gtk_combo_box_get_active (GTK_COMBO_BOX (encode->combo)); - - switch (out_container) { - case 1: - ext = ".mkv"; - break; -#ifdef MP4_OUTPUT - case 2: - ext = ".mp4"; - break; -#endif - case 0: - default: - ext = ".264"; - } - - file_output = g_strconcat (path_output, "/", filename_output, ext, NULL); - g_print (_("file output : %s\n"), file_output); - - { - GIOChannel *file; - - file = g_io_channel_new_file (file_output, "r", NULL); - if (file) { - GtkWidget *dialog_overwrite; - GtkWidget *eb; - GtkWidget *label; - const gchar *label_text = NULL; - gint res; - - dialog_overwrite = gtk_dialog_new_with_buttons (_("Existing file"), - GTK_WINDOW (dialog), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_YES, - GTK_RESPONSE_ACCEPT, - GTK_STOCK_NO, - GTK_RESPONSE_REJECT, - NULL); - - eb = gtk_event_box_new (); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog_overwrite)->vbox), eb); - gtk_container_set_border_width (GTK_CONTAINER (eb), 6); - gtk_widget_show (eb); - - label_text = g_strconcat (_("Do you want to overwrite file\n"), - file_output, " ?", NULL); - label = gtk_label_new (label_text); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - res = gtk_dialog_run (GTK_DIALOG (dialog_overwrite)); - gtk_widget_destroy (dialog_overwrite); - g_io_channel_unref (file); - if ((res == GTK_RESPONSE_REJECT) || (res == GTK_RESPONSE_DELETE_EVENT)) - break; - } - } - - x264_gtk = x264_gtk_load (); - param = x264_gtk_param_get (x264_gtk); - x264_gtk_free (x264_gtk); - - { - gint width; - gint height; - gint fps_num; - gint fps_den; - gint frame_count; - - width = (gint)(g_ascii_strtod (gtk_entry_get_text (GTK_ENTRY (encode->width)), NULL)); - height = (gint)(g_ascii_strtod (gtk_entry_get_text (GTK_ENTRY (encode->height)), NULL)); - fps_num = (gint)(g_ascii_strtod (gtk_entry_get_text (GTK_ENTRY (encode->fps_num)), NULL)); - fps_den = (gint)(g_ascii_strtod (gtk_entry_get_text (GTK_ENTRY (encode->fps_den)), NULL)); - frame_count = (gint)(g_ascii_strtod (gtk_entry_get_text (GTK_ENTRY (encode->frame_count)), NULL)); - - if ((width <= 0) || - (height <= 0) || - (fps_num <= 0) || - (fps_den <= 0) || - (frame_count < 0)) - break; - - param->i_width = width; - param->i_height = height; - param->i_fps_num = fps_num; - param->i_fps_den = fps_den; - param->i_frame_total = frame_count; - } - - if (pipe (fds) == -1) - break; - - thread_data = (X264_Thread_Data *)g_malloc0 (sizeof (X264_Thread_Data)); - thread_data->param = param; - thread_data->file_input = g_strdup (file_input); - thread_data->file_output = g_strdup (file_output); - thread_data->in_container = encode->container; - thread_data->out_container = out_container; - g_free (file_output); - - thread_data->io_read = g_io_channel_unix_new (fds[0]); - g_io_channel_set_encoding (thread_data->io_read, NULL, NULL); - thread_data->io_write = g_io_channel_unix_new (fds[1]); - g_io_channel_set_encoding (thread_data->io_write, NULL, NULL); - - g_io_add_watch (thread_data->io_read, G_IO_IN, - (GIOFunc)x264_fill_status_window, thread_data); - - win_status = x264_gtk_encode_status_window (thread_data); - gtk_window_set_transient_for (GTK_WINDOW (win_status), GTK_WINDOW (dialog)); - gtk_window_set_modal (GTK_WINDOW (win_status), TRUE); - gtk_widget_show (win_status); - //gtk_widget_hide(thread_data->end_button); - - thread = g_thread_create ((GThreadFunc)x264_gtk_encode_encode, thread_data, FALSE, NULL); - - break; - } - case GTK_RESPONSE_CLOSE: - default: - gtk_main_quit (); - x264_encode_shutdown ((X264_Gtk_Encode *)user_data); - } -} - -static gboolean -x264_fill_status_window (GIOChannel *io UNUSED, - GIOCondition condition UNUSED, - gpointer user_data) -{ - gchar str[128]; - X264_Thread_Data *thread_data; - X264_Pipe_Data pipe_data; - GIOStatus status; - gsize size; - gint eta; - gdouble progress; - gdouble fps; - - thread_data = (X264_Thread_Data *)user_data; - status = g_io_channel_read_chars (thread_data->io_read, - (gchar *)&pipe_data, - sizeof (X264_Pipe_Data), - &size, NULL); - if (status != G_IO_STATUS_NORMAL) { - g_print (_("Error ! %d %d %d\n"), status, (int)sizeof (X264_Pipe_Data), (int)size); - return FALSE; - } - - snprintf (str, 128, "%d/%d", pipe_data.frame, pipe_data.frame_total); - gtk_entry_set_text (GTK_ENTRY (thread_data->current_video_frame), - str); - - snprintf (str, 128, _("%dKB"), - pipe_data.file >> 10); - gtk_entry_set_text (GTK_ENTRY (thread_data->video_data), - str); - - fps = pipe_data.elapsed > 0 ? 1000000.0 * (gdouble)pipe_data.frame / (gdouble)pipe_data.elapsed : 0.0; - snprintf (str, 128, _("%.2fKB/s (%.2f fps)"), - (double) pipe_data.file * 8 * thread_data->param->i_fps_num / - ((double) thread_data->param->i_fps_den * pipe_data.frame * 1000), - fps); - gtk_entry_set_text (GTK_ENTRY (thread_data->video_rendering_rate), - str); - - snprintf (str, 128, "%" PRId64 ":%02" PRId64 ":%02" PRId64, - (pipe_data.elapsed / 1000000) / 3600, - ((pipe_data.elapsed / 1000000) / 60) % 60, - (pipe_data.elapsed / 1000000) % 60); - gtk_entry_set_text (GTK_ENTRY (thread_data->time_elapsed), - str); - - eta = pipe_data.elapsed * (pipe_data.frame_total - pipe_data.frame) / ((int64_t)pipe_data.frame * 1000000); - snprintf (str, 128, "%d:%02d:%02d", eta / 3600, (eta / 60) % 60, eta % 60); - gtk_entry_set_text (GTK_ENTRY (thread_data->time_remaining), - str); - - progress = (gdouble)pipe_data.frame / (gdouble)pipe_data.frame_total; - gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (thread_data->progress), - progress); - - snprintf (str, 128, "%0.1f%%", 100.0 * progress); - gtk_progress_bar_set_text (GTK_PROGRESS_BAR (thread_data->progress), str); - - return TRUE; -} diff --git a/gtk/x264_gtk_encode_main_window.h b/gtk/x264_gtk_encode_main_window.h deleted file mode 100644 index e0a6143e..00000000 --- a/gtk/x264_gtk_encode_main_window.h +++ /dev/null @@ -1,28 +0,0 @@ -/***************************************************************************** - * x264_gtk_encode_main_window.h: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#ifndef X264_GTK_ENCODE_MAIN_WINDOW_H -#define X264_GTK_ENCODE_MAIN_WINDOW_H - - -void x264_gtk_encode_main_window (); - - -#endif /* X264_GTK_ENCODE_MAIN_WINDOW_H */ diff --git a/gtk/x264_gtk_encode_private.h b/gtk/x264_gtk_encode_private.h deleted file mode 100644 index 44dc4906..00000000 --- a/gtk/x264_gtk_encode_private.h +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * x264_gtk_encode_private.h: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#ifndef X264_GTK_ENCODE_PRIVATE_H -#define X264_GTK_ENCODE_PRIVATE_H - - -#include - -#include "x264_gtk_demuxers.h" - -typedef struct X264_Thread_Data_ X264_Thread_Data; -typedef struct X264_Pipe_Data_ X264_Pipe_Data; - -struct X264_Thread_Data_ -{ - GtkWidget *current_video_frame; - GtkWidget *video_data; - GtkWidget *video_rendering_rate; - GtkWidget *time_elapsed; - GtkWidget *time_remaining; - GtkWidget *progress; - - GtkWidget *dialog; - GtkWidget *button; - GtkWidget *end_button; - - x264_param_t *param; - gchar *file_input; - X264_Demuxer_Type in_container; - - gchar *file_output; - gint out_container; - - /* file descriptors */ - GIOChannel *io_read; /* use it with read */ - GIOChannel *io_write; /* use it with write */ -}; - -struct X264_Pipe_Data_ -{ - int frame; - int frame_total; - int file; - int64_t elapsed; -}; - - -#endif /* X264_GTK_ENCODE_PRIVATE_H */ diff --git a/gtk/x264_gtk_encode_status_window.c b/gtk/x264_gtk_encode_status_window.c deleted file mode 100644 index 24e015d8..00000000 --- a/gtk/x264_gtk_encode_status_window.c +++ /dev/null @@ -1,191 +0,0 @@ -/***************************************************************************** - * x264_encode_status_window.c: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#if defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ || defined __DragonFly__ -# include -#else -# include -#endif - -#include - -#include "../x264.h" -#include "x264_gtk_i18n.h" -#include "x264_gtk_encode_private.h" - - -/* Callbacks */ -static gboolean x264_delete_window_cb (GtkWidget *widget, - GdkEvent *event, - gpointer user_data); -static void x264_response_window_cb (GtkDialog *dialog, - gint res, - gpointer user_data); - -GtkWidget * -x264_gtk_encode_status_window (X264_Thread_Data *thread_data) -{ - GtkWidget *win_status; - GtkWidget *table; - GtkWidget *label; - - if (!thread_data) return NULL; - - win_status = thread_data->dialog = gtk_dialog_new (); - gtk_window_set_title (GTK_WINDOW (win_status), _("Encoding status")); - thread_data->button = gtk_dialog_add_button (GTK_DIALOG (win_status), - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); - thread_data->end_button = gtk_dialog_add_button (GTK_DIALOG (thread_data->dialog), - GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL); - gtk_widget_set_sensitive (thread_data->end_button, FALSE); - - g_signal_connect (G_OBJECT (win_status), - "delete-event", - G_CALLBACK (x264_delete_window_cb), - thread_data); - g_signal_connect (G_OBJECT (win_status), - "response", - G_CALLBACK (x264_response_window_cb), - thread_data); - - table = gtk_table_new (5, 2, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (win_status)->vbox), table, - FALSE, FALSE, 0); - gtk_widget_show (table); - - label = gtk_label_new (_("Current video frame:")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1); - gtk_widget_show (label); - - thread_data->current_video_frame = gtk_entry_new (); - gtk_editable_set_editable (GTK_EDITABLE (thread_data->current_video_frame), FALSE); - gtk_table_attach_defaults (GTK_TABLE (table), - thread_data->current_video_frame, - 1, 2, 0, 1); - gtk_widget_show (thread_data->current_video_frame); - - label = gtk_label_new (_("Video data:")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2); - gtk_widget_show (label); - - thread_data->video_data = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (thread_data->video_data), _("0KB")); - gtk_editable_set_editable (GTK_EDITABLE (thread_data->video_data), FALSE); - gtk_table_attach_defaults (GTK_TABLE (table), thread_data->video_data, - 1, 2, 1, 2); - gtk_widget_show (thread_data->video_data); - - label = gtk_label_new (_("Video rendering rate:")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3); - gtk_widget_show (label); - - thread_data->video_rendering_rate = gtk_entry_new (); - gtk_editable_set_editable (GTK_EDITABLE (thread_data->video_rendering_rate), FALSE); - gtk_table_attach_defaults (GTK_TABLE (table), - thread_data->video_rendering_rate, - 1, 2, 2, 3); - gtk_widget_show (thread_data->video_rendering_rate); - - label = gtk_label_new (_("Time elapsed:")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4); - gtk_widget_show (label); - - thread_data->time_elapsed = gtk_entry_new (); - gtk_editable_set_editable (GTK_EDITABLE (thread_data->time_elapsed), FALSE); - gtk_table_attach_defaults (GTK_TABLE (table), thread_data->time_elapsed, - 1, 2, 3, 4); - gtk_widget_show (thread_data->time_elapsed); - - label = gtk_label_new (_("Time remaining (estimated):")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 4, 5); - gtk_widget_show (label); - - thread_data->time_remaining = gtk_entry_new (); - gtk_editable_set_editable (GTK_EDITABLE (thread_data->time_remaining), FALSE); - gtk_table_attach_defaults (GTK_TABLE (table), thread_data->time_remaining, - 1, 2, 4, 5); - gtk_widget_show (thread_data->time_remaining); - - table = gtk_table_new (1, 2, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (win_status)->vbox), table, - FALSE, FALSE, 0); - gtk_widget_show (table); - - label = gtk_label_new (_("Progress:")); - gtk_misc_set_alignment (GTK_MISC (label), - 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), - label, - 0, 1, - 0, 1); - gtk_widget_show (label); - - thread_data->progress = gtk_progress_bar_new (); - gtk_table_attach_defaults (GTK_TABLE (table), thread_data->progress, - 1, 2, 0, 1); - gtk_widget_show (thread_data->progress); - - return win_status; -} - -static void -x264_thread_data_free (X264_Thread_Data *thread_data) -{ - g_free (thread_data->param); - g_free (thread_data->file_input); - g_free (thread_data->file_output); - g_io_channel_unref (thread_data->io_read); - g_io_channel_unref (thread_data->io_write); - g_free (thread_data); -} - -static gboolean -x264_delete_window_cb (GtkWidget *widget, - GdkEvent *event UNUSED, - gpointer user_data) -{ - gtk_widget_destroy (widget); - x264_thread_data_free ((X264_Thread_Data *)user_data); - return TRUE; -} - -static void -x264_response_window_cb (GtkDialog *dialog, - gint res, - gpointer user_data) -{ - switch (res) { - case GTK_RESPONSE_CANCEL: - default: - gtk_widget_destroy (GTK_WIDGET (dialog)); - x264_thread_data_free ((X264_Thread_Data *)user_data); - } -} diff --git a/gtk/x264_gtk_encode_status_window.h b/gtk/x264_gtk_encode_status_window.h deleted file mode 100644 index 51b03057..00000000 --- a/gtk/x264_gtk_encode_status_window.h +++ /dev/null @@ -1,28 +0,0 @@ -/***************************************************************************** - * x264_encode_status_window.h: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#ifndef X264_GTK_ENCODE_STATUS_WINDOW_H -#define X264_GTK_ENCODE_STATUS_WINDOW_H - - -GtkWidget *x264_gtk_encode_status_window (X264_Thread_Data *thread_data); - - -#endif /* X264_GTK_ENCODE_STATUS_WINDOW_H */ diff --git a/gtk/x264_gtk_enum.h b/gtk/x264_gtk_enum.h deleted file mode 100644 index 06e57473..00000000 --- a/gtk/x264_gtk_enum.h +++ /dev/null @@ -1,77 +0,0 @@ -/***************************************************************************** - * x264_gtk_enum.h: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#ifndef X264_GTK_ENUM_H -#define X264_GTK_ENUM_H - -typedef enum -{ - X264_PASS_SINGLE_BITRATE, - X264_PASS_SINGLE_QUANTIZER, - X264_PASS_MULTIPASS_1ST, - X264_PASS_MULTIPASS_1ST_FAST, - X264_PASS_MULTIPASS_NTH -}X264_Pass; - -typedef enum -{ - X264_NONE = X264_DIRECT_PRED_NONE, - X264_SPATIAL = X264_DIRECT_PRED_SPATIAL, - X264_TEMPORAL = X264_DIRECT_PRED_TEMPORAL, - X264_AUTO = X264_DIRECT_PRED_AUTO -}X264_Direct_Mode; - -typedef enum -{ - X264_PD_1, - X264_PD_2, - X264_PD_3, - X264_PD_4, - X264_PD_5, - X264_PD_6, - X264_PD_6b -}X264_Partition_Decision; - -typedef enum -{ - X264_ME_METHOD_DIAMOND = X264_ME_DIA, - X264_ME_METHOD_HEXAGONAL = X264_ME_HEX, - X264_ME_METHOD_UNEVEN_MULTIHEXA = X264_ME_UMH, - X264_ME_METHOD_EXHAUSTIVE = X264_ME_ESA -}X264_Me_Method; - -typedef enum -{ - X264_DEBUG_METHOD_NONE = X264_LOG_NONE + 1, - X264_DEBUG_METHOD_ERROR = X264_LOG_ERROR + 1, - X264_DEBUG_METHOD_WARNING = X264_LOG_WARNING + 1, - X264_DEBUG_METHOD_INFO = X264_LOG_INFO + 1, - X264_DEBUG_METHOD_DEBUG = X264_LOG_DEBUG + 1 -}X264_Debug_Method; - -typedef enum -{ - X264_CQM_PRESET_FLAT = X264_CQM_FLAT, - X264_CQM_PRESET_JVT = X264_CQM_JVT, - X264_CQM_PRESET_CUSTOM = X264_CQM_CUSTOM -}X264_Cqm_Preset; - - -#endif /* X264_GTK_ENUM_H */ diff --git a/gtk/x264_gtk_i18n.h b/gtk/x264_gtk_i18n.h deleted file mode 100644 index 60a572e1..00000000 --- a/gtk/x264_gtk_i18n.h +++ /dev/null @@ -1,44 +0,0 @@ -/***************************************************************************** - * x264_gtk_i18n.h: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#ifndef X264_GTK_I18N_H -#define X264_GTK_I18N_H - - -#include - - -#define _(X) gettext(X) -#define GETTEXT_DOMAIN "x264_gtk" - -#ifdef X264_GTK_PRIVATE_H -/* x264_path must be known for this to work */ -# define BIND_X264_TEXTDOMAIN() \ - gchar* x264_tmp = x264_gtk_path("locale"); \ - bindtextdomain(GETTEXT_DOMAIN, x264_tmp); \ - g_free(x264_tmp); \ - bind_textdomain_codeset (GETTEXT_DOMAIN, "UTF-8"); \ - textdomain(GETTEXT_DOMAIN) -#else -# define BIND_X264_TEXTDOMAIN() you_must_include_x64_gtk_private_h_first -#endif - - -#endif /* X264_GTK_I18N_H */ diff --git a/gtk/x264_gtk_mb.c b/gtk/x264_gtk_mb.c deleted file mode 100644 index 61fda344..00000000 --- a/gtk/x264_gtk_mb.c +++ /dev/null @@ -1,270 +0,0 @@ -/***************************************************************************** - * x264_gtk_mb.c: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#include - -#include "x264_gtk_i18n.h" -#include "x264_gtk_private.h" - - -/* Callbacks */ -static void x264_mb_bframe_pyramid (GtkToggleButton *button, - gpointer user_data); -static void x264_mb_inter_search_8 (GtkToggleButton *button, - gpointer user_data); -static void x264_mb_transform_8x8 (GtkToggleButton *button, - gpointer user_data); - - -GtkWidget * -x264_mb_page (X264_Gui_Config *config) -{ - GtkWidget *vbox; - GtkWidget *frame; - GtkWidget *vbox2; - GtkWidget *table; - GtkWidget *eb; - GtkWidget *label; - GtkTooltips *tooltips; - - tooltips = gtk_tooltips_new (); - - vbox = gtk_vbox_new (FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); - - /* Partitions */ - frame = gtk_frame_new (_("Partitions")); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 6); - gtk_widget_show (frame); - - vbox2 = gtk_vbox_new (FALSE, 6); - gtk_container_set_border_width (GTK_CONTAINER (vbox2), 6); - gtk_container_add (GTK_CONTAINER (frame), vbox2); - gtk_widget_show (vbox2); - - config->mb.partitions.transform_8x8 = gtk_check_button_new_with_label (_("8x8 Transform")); - gtk_tooltips_set_tip (tooltips, config->mb.partitions.transform_8x8, - _("8x8 Transform - description"), - ""); - g_signal_connect (G_OBJECT (config->mb.partitions.transform_8x8), - "toggled", - G_CALLBACK (x264_mb_transform_8x8), config); - gtk_box_pack_start (GTK_BOX (vbox2), config->mb.partitions.transform_8x8, FALSE, TRUE, 0); - gtk_widget_show (config->mb.partitions.transform_8x8); - - config->mb.partitions.pframe_search_8 = gtk_check_button_new_with_label (_("8x16, 16x8 and 8x8 P-frame search")); - gtk_tooltips_set_tip (tooltips, config->mb.partitions.pframe_search_8, - _("8x16, 16x8 and 8x8 P-frame search - description"), - ""); - gtk_box_pack_start (GTK_BOX (vbox2), config->mb.partitions.pframe_search_8, FALSE, TRUE, 0); - gtk_widget_show (config->mb.partitions.pframe_search_8); - - config->mb.partitions.bframe_search_8 = gtk_check_button_new_with_label (_("8x16, 16x8 and 8x8 B-frame search")); - gtk_tooltips_set_tip (tooltips, config->mb.partitions.bframe_search_8, - _("8x16, 16x8 and 8x8 B-frame search - description"), - ""); - gtk_box_pack_start (GTK_BOX (vbox2), config->mb.partitions.bframe_search_8, FALSE, TRUE, 0); - gtk_widget_show (config->mb.partitions.bframe_search_8); - - config->mb.partitions.pframe_search_4 = gtk_check_button_new_with_label (_("4x8, 8x4 and 4x4 P-frame search")); - gtk_tooltips_set_tip (tooltips, config->mb.partitions.pframe_search_4, - _("4x8, 8x4 and 4x4 P-frame search - description"), - ""); - gtk_box_pack_start (GTK_BOX (vbox2), config->mb.partitions.pframe_search_4, FALSE, TRUE, 0); - gtk_widget_show (config->mb.partitions.pframe_search_4); - - config->mb.partitions.inter_search_8 = gtk_check_button_new_with_label (_("8x8 Intra search")); - gtk_tooltips_set_tip (tooltips, config->mb.partitions.inter_search_8, - _("8x8 Intra search - description"), - ""); - g_signal_connect (G_OBJECT (config->mb.partitions.inter_search_8), - "toggled", - G_CALLBACK (x264_mb_inter_search_8), config); - gtk_box_pack_start (GTK_BOX (vbox2), config->mb.partitions.inter_search_8, FALSE, TRUE, 0); - gtk_widget_show (config->mb.partitions.inter_search_8); - - config->mb.partitions.inter_search_4 = gtk_check_button_new_with_label (_("4x4 Intra search")); - gtk_tooltips_set_tip (tooltips, config->mb.partitions.inter_search_4, - _("4x4 Intra search - description"), - ""); - gtk_box_pack_start (GTK_BOX (vbox2), config->mb.partitions.inter_search_4, FALSE, TRUE, 0); - gtk_widget_show (config->mb.partitions.inter_search_4); - - /* B-Frames */ - frame = gtk_frame_new (_("B-Frames")); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 6); - gtk_widget_show (frame); - - table = gtk_table_new (5, 2, TRUE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - gtk_container_add (GTK_CONTAINER (frame), table); - gtk_widget_show (table); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Max consecutive - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 0, 1); - gtk_widget_show (eb); - - label = gtk_label_new (_("Max consecutive")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->mb.bframes.bframe = gtk_entry_new_with_max_length (3); - gtk_table_attach_defaults (GTK_TABLE (table), config->mb.bframes.bframe, - 1, 2, 0, 1); - gtk_widget_show (config->mb.bframes.bframe); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Bias - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 1, 2); - gtk_widget_show (eb); - - label = gtk_label_new (_("Bias")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->mb.bframes.bframe_bias = gtk_hscale_new_with_range (-100.0, 100.0, 1.0); - gtk_scale_set_digits (GTK_SCALE (config->mb.bframes.bframe_bias), 0); - gtk_scale_set_value_pos (GTK_SCALE (config->mb.bframes.bframe_bias), GTK_POS_RIGHT); - gtk_table_attach_defaults (GTK_TABLE (table), config->mb.bframes.bframe_bias, - 1, 2, 1, 2); - gtk_widget_show (config->mb.bframes.bframe_bias); - - config->mb.bframes.bframe_pyramid = gtk_check_button_new_with_label (_("Use as references")); - gtk_tooltips_set_tip (tooltips, config->mb.bframes.bframe_pyramid, - _("Use as references - description"), - ""); - g_signal_connect (G_OBJECT (config->mb.bframes.bframe_pyramid), - "toggled", - G_CALLBACK (x264_mb_bframe_pyramid), config); - gtk_table_attach_defaults (GTK_TABLE (table), config->mb.bframes.bframe_pyramid, - 0, 1, 2, 3); - gtk_widget_show (config->mb.bframes.bframe_pyramid); - - config->mb.bframes.bidir_me = gtk_check_button_new_with_label (_("Bidirectional ME")); - gtk_tooltips_set_tip (tooltips, config->mb.bframes.bidir_me, - _("Bidirectional ME - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), config->mb.bframes.bidir_me, - 1, 2, 2, 3); - gtk_widget_show (config->mb.bframes.bidir_me); - - config->mb.bframes.bframe_adaptive = gtk_check_button_new_with_label (_("Adaptive")); - gtk_tooltips_set_tip (tooltips, config->mb.bframes.bframe_adaptive, - _("Adaptive - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), config->mb.bframes.bframe_adaptive, - 0, 1, 3, 4); - gtk_widget_show (config->mb.bframes.bframe_adaptive); - - config->mb.bframes.weighted_bipred = gtk_check_button_new_with_label (_("Weighted biprediction")); - gtk_tooltips_set_tip (tooltips, config->mb.bframes.weighted_bipred, - _("Weighted biprediction - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), config->mb.bframes.weighted_bipred, - 1, 2, 3, 4); - gtk_widget_show (config->mb.bframes.weighted_bipred); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Direct mode - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 4, 5); - gtk_widget_show (eb); - - label = gtk_label_new (_("Direct mode")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->mb.bframes.direct_mode = gtk_combo_box_new_text (); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->mb.bframes.direct_mode), - _("None")); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->mb.bframes.direct_mode), - _("Spatial")); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->mb.bframes.direct_mode), - _("Temporal")); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->mb.bframes.direct_mode), - _("Auto")); - gtk_table_attach_defaults (GTK_TABLE (table), - config->mb.bframes.direct_mode, - 1, 2, 4, 5); - gtk_widget_show (config->mb.bframes.direct_mode); - - return vbox; -} - -static void -x264_mb_bframe_pyramid (GtkToggleButton *button, - gpointer user_data) -{ - X264_Gui_Config *config; - - config = (X264_Gui_Config *)user_data; - - if (gtk_toggle_button_get_active (button)) { - const gchar *text; - gint val; - - text = gtk_entry_get_text (GTK_ENTRY (config->mb.bframes.bframe)); - val = (gint)g_ascii_strtoull (text, NULL, 10); - if (val < 2) - gtk_entry_set_text (GTK_ENTRY (config->mb.bframes.bframe), "2"); - } -} - -static void -x264_mb_inter_search_8 (GtkToggleButton *button, - gpointer user_data) -{ - X264_Gui_Config *config; - - config = (X264_Gui_Config *)user_data; - - if (gtk_toggle_button_get_active (button)) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.transform_8x8), TRUE); - } -} - -static void -x264_mb_transform_8x8 (GtkToggleButton *button, - gpointer user_data) -{ - X264_Gui_Config *config; - - config = (X264_Gui_Config *)user_data; - - if (!gtk_toggle_button_get_active (button)) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (config->mb.partitions.inter_search_8), FALSE); - } -} diff --git a/gtk/x264_gtk_mb.h b/gtk/x264_gtk_mb.h deleted file mode 100644 index 865735e2..00000000 --- a/gtk/x264_gtk_mb.h +++ /dev/null @@ -1,28 +0,0 @@ -/***************************************************************************** - * x264_gtk_mb.h: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#ifndef X264_GTK_MB_H -#define X264_GTK_MB_H - - -GtkWidget *x264_mb_page (X264_Gui_Config *config); - - -#endif /* X264_GTK_MB_H */ diff --git a/gtk/x264_gtk_more.c b/gtk/x264_gtk_more.c deleted file mode 100644 index e01adf04..00000000 --- a/gtk/x264_gtk_more.c +++ /dev/null @@ -1,519 +0,0 @@ -/***************************************************************************** - * x264_gtk_more.c: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#include - -#include "x264_gtk_i18n.h" -#include "x264_gtk_private.h" - - -/* Callbacks */ -static void x264_more_deblocking_filter (GtkToggleButton *button, - gpointer user_data); -static void x264_more_cabac (GtkToggleButton *button, - gpointer user_data); -static void x264_more_mixed_ref (GtkToggleButton *button, - gpointer user_data); - - -GtkWidget * -x264_more_page (X264_Gui_Config *config) -{ - GtkWidget *vbox; - GtkWidget *frame; - GtkWidget *hbox; - GtkWidget *table; - GtkWidget *eb; - GtkWidget *label; - GtkObject *adj; - GtkRequisition size; - GtkRequisition size2; - GtkRequisition size3; - GtkRequisition size4; - GtkRequisition size5; - GtkTooltips *tooltips; - - tooltips = gtk_tooltips_new (); - - label = gtk_entry_new_with_max_length (3); - gtk_widget_size_request (label, &size); - gtk_widget_destroy (GTK_WIDGET (label)); - - label = gtk_check_button_new_with_label (_("Deblocking Filter")); - gtk_widget_size_request (label, &size2); - gtk_widget_destroy (GTK_WIDGET (label)); - - label = gtk_label_new (_("Partition decision")); - gtk_widget_size_request (label, &size3); - gtk_widget_destroy (GTK_WIDGET (label)); - - label = gtk_label_new (_("Threshold")); - gtk_widget_size_request (label, &size5); - gtk_widget_destroy (GTK_WIDGET (label)); - - vbox = gtk_vbox_new (FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); - - /* Motion Estimation */ - frame = gtk_frame_new (_("Motion Estimation")); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 6); - gtk_widget_show (frame); - - table = gtk_table_new (5, 3, TRUE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - gtk_container_add (GTK_CONTAINER (frame), table); - gtk_widget_show (table); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Partition decision - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 0, 1); - gtk_widget_show (eb); - - label = gtk_label_new (_("Partition decision")); - gtk_widget_set_size_request (label, size2.width, size3.height); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->more.motion_estimation.partition_decision = gtk_combo_box_new_text (); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision), - _("1 (Fastest)")); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision), - "2"); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision), - "3"); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision), - "4"); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision), - _("5 (High quality)")); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision), - _("6 (RDO)")); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.partition_decision), - _("6b (RDO on B frames)")); - gtk_table_attach_defaults (GTK_TABLE (table), config->more.motion_estimation.partition_decision, - 1, 3, 0, 1); - gtk_widget_show (config->more.motion_estimation.partition_decision); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Method - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 1, 2); - gtk_widget_show (eb); - - label = gtk_label_new (_("Method")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->more.motion_estimation.method = gtk_combo_box_new_text (); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.method), - _("Diamond Search")); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.method), - _("Hexagonal Search")); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.method), - _("Uneven Multi-Hexagon")); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.motion_estimation.method), - _("Exhaustive search")); - gtk_table_attach_defaults (GTK_TABLE (table), config->more.motion_estimation.method, - 1, 3, 1, 2); - gtk_widget_show (config->more.motion_estimation.method); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Range - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 2, 3); - gtk_widget_show (eb); - - label = gtk_label_new (_("Range")); - gtk_widget_size_request (label, &size4); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->more.motion_estimation.range = gtk_entry_new_with_max_length (3); - gtk_widget_set_size_request (config->more.motion_estimation.range, - 20, size.height); - gtk_table_attach_defaults (GTK_TABLE (table), config->more.motion_estimation.range, - 1, 2, 2, 3); - gtk_widget_show (config->more.motion_estimation.range); - - config->more.motion_estimation.chroma_me = gtk_check_button_new_with_label (_("Chroma ME")); - gtk_tooltips_set_tip (tooltips, config->more.motion_estimation.chroma_me, - _("Chroma ME - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), config->more.motion_estimation.chroma_me, - 2, 3, 2, 3); - gtk_widget_show (config->more.motion_estimation.chroma_me); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Max Ref. frames - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 3, 4); - gtk_widget_show (eb); - - label = gtk_label_new (_("Max Ref. frames")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->more.motion_estimation.max_ref_frames = gtk_entry_new_with_max_length (3); - gtk_widget_set_size_request (config->more.motion_estimation.max_ref_frames, - 20, size.height); - gtk_table_attach_defaults (GTK_TABLE (table), config->more.motion_estimation.max_ref_frames, - 1, 2, 3, 4); - gtk_widget_show (config->more.motion_estimation.max_ref_frames); - - config->more.motion_estimation.mixed_refs = gtk_check_button_new_with_label (_("Mixed Refs")); - gtk_tooltips_set_tip (tooltips, config->more.motion_estimation.mixed_refs, - _("Mixed Refs - description"), - ""); - g_signal_connect (G_OBJECT (config->more.motion_estimation.mixed_refs), - "toggled", - G_CALLBACK (x264_more_mixed_ref), config); - gtk_table_attach_defaults (GTK_TABLE (table), config->more.motion_estimation.mixed_refs, - 2, 3, 3, 4); - gtk_widget_show (config->more.motion_estimation.mixed_refs); - - config->more.motion_estimation.fast_pskip = gtk_check_button_new_with_label (_("Fast P skip")); - gtk_tooltips_set_tip (tooltips, config->more.motion_estimation.fast_pskip, - _("Fast P skip - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), config->more.motion_estimation.fast_pskip, - 0, 1, 4, 5); - gtk_widget_show (config->more.motion_estimation.fast_pskip); - - config->more.motion_estimation.dct_decimate = gtk_check_button_new_with_label (_("DCT decimate")); - gtk_tooltips_set_tip (tooltips, config->more.motion_estimation.dct_decimate, - _("DCT decimate - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), config->more.motion_estimation.dct_decimate, - 1, 2, 4, 5); - gtk_widget_show (config->more.motion_estimation.dct_decimate); - - /* Misc. Options */ - frame = gtk_frame_new (_("Misc. Options")); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 6); - gtk_widget_show (frame); - - table = gtk_table_new (5, 4, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - gtk_container_add (GTK_CONTAINER (frame), table); - gtk_widget_show (table); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Sample Aspect Ratio - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 0, 1); - gtk_widget_show (eb); - - label = gtk_label_new (_("Sample Aspect Ratio")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - hbox = gtk_hbox_new (TRUE, 6); - gtk_table_attach_defaults (GTK_TABLE (table), hbox, - 1, 2, 0, 1); - gtk_widget_show (hbox); - - config->more.misc.sample_ar_x = gtk_entry_new_with_max_length (3); - gtk_widget_set_size_request (config->more.misc.sample_ar_x, 25, size.height); - gtk_box_pack_start (GTK_BOX (hbox), config->more.misc.sample_ar_x, FALSE, TRUE, 0); - gtk_widget_show (config->more.misc.sample_ar_x); - - config->more.misc.sample_ar_y = gtk_entry_new_with_max_length (3); - gtk_widget_set_size_request (config->more.misc.sample_ar_y, 25, size.height); - gtk_box_pack_start (GTK_BOX (hbox), config->more.misc.sample_ar_y, FALSE, TRUE, 0); - gtk_widget_show (config->more.misc.sample_ar_y); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Threads - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 2, 3, 0, 1); - gtk_widget_show (eb); - - label = gtk_label_new (_("Threads")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - adj = gtk_adjustment_new (1.0, 1.0, 4.0, 1.0, 1.0, 1.0); - config->more.misc.threads = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1.0, 0); - - gtk_widget_set_size_request (config->more.misc.threads, size5.width, size.height); - gtk_table_attach_defaults (GTK_TABLE (table), - config->more.misc.threads, - 3, 4, 0, 1); - gtk_widget_show (config->more.misc.threads); - - config->more.misc.cabac = gtk_check_button_new_with_label (_("CABAC")); - gtk_widget_set_size_request (config->more.misc.cabac, size5.width, size.height); - gtk_tooltips_set_tip (tooltips, config->more.misc.cabac, - _("CABAC - description"), - ""); - g_signal_connect (G_OBJECT (config->more.misc.cabac), - "toggled", - G_CALLBACK (x264_more_cabac), config); - gtk_table_attach_defaults (GTK_TABLE (table), config->more.misc.cabac, - 0, 1, 1, 2); - gtk_widget_show (config->more.misc.cabac); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Trellis - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 1, 2, 1, 2); - gtk_widget_show (eb); - - label = gtk_label_new (_("Trellis")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->more.misc.trellis = gtk_combo_box_new_text (); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.misc.trellis), - _("Disabled")); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.misc.trellis), - _("Enabled (once)")); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.misc.trellis), - _("Enabled (mode decision)")); - gtk_table_attach_defaults (GTK_TABLE (table), config->more.misc.trellis, - 2, 4, 1, 2); - gtk_widget_show (config->more.misc.trellis); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Noise reduction - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 2, 3); - gtk_widget_show (eb); - - label = gtk_label_new (_("Noise reduction")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->more.misc.noise_reduction = gtk_entry_new_with_max_length (3); - gtk_widget_set_size_request (config->more.misc.noise_reduction, size5.width, size.height); - gtk_table_attach_defaults (GTK_TABLE (table), config->more.misc.noise_reduction, - 1, 2, 2, 3); - gtk_widget_show (config->more.misc.noise_reduction); - - config->more.misc.df.deblocking_filter = gtk_check_button_new_with_label (_("Deblocking Filter")); - gtk_tooltips_set_tip (tooltips, config->more.misc.df.deblocking_filter, - _("Deblocking Filter - description"), - ""); - g_signal_connect (G_OBJECT (config->more.misc.df.deblocking_filter), - "toggled", - G_CALLBACK (x264_more_deblocking_filter), config); - gtk_table_attach_defaults (GTK_TABLE (table), config->more.misc.df.deblocking_filter, - 0, 1, 3, 4); - gtk_widget_show (config->more.misc.df.deblocking_filter); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Strength - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 1, 2, 3, 4); - gtk_widget_show (eb); - - label = gtk_label_new (_("Strength")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_widget_set_size_request (label, size5.width, size4.height); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->more.misc.df.strength = gtk_hscale_new_with_range (-6.0, 6.0, 1.0); - gtk_widget_size_request (config->more.misc.df.strength, &size4); - gtk_scale_set_digits (GTK_SCALE (config->more.misc.df.strength), 0); - gtk_scale_set_value_pos (GTK_SCALE (config->more.misc.df.strength), GTK_POS_RIGHT); - // gtk_widget_set_size_request (config->more.misc.df.strength, size5.width, size4.height); - gtk_table_attach_defaults (GTK_TABLE (table), config->more.misc.df.strength, - 2, 4, 3, 4); - gtk_widget_show (config->more.misc.df.strength); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Threshold - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 1, 2, 4, 5); - gtk_widget_show (eb); - - label = gtk_label_new (_("Threshold")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_widget_set_size_request (label, size5.width, size4.height); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->more.misc.df.threshold = gtk_hscale_new_with_range (-6.0, 6.0, 1.0); - gtk_scale_set_digits (GTK_SCALE (config->more.misc.df.threshold), 0); - gtk_scale_set_value_pos (GTK_SCALE (config->more.misc.df.threshold), GTK_POS_RIGHT); - gtk_table_attach_defaults (GTK_TABLE (table), config->more.misc.df.threshold, - 2, 4, 4, 5); - gtk_widget_show (config->more.misc.df.threshold); - - /* Debug */ - frame = gtk_frame_new (_("Debug")); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 6); - gtk_widget_show (frame); - - table = gtk_table_new (2, 2, TRUE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - gtk_container_add (GTK_CONTAINER (frame), table); - gtk_widget_show (table); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Log level - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 0, 1); - gtk_widget_show (eb); - - label = gtk_label_new (_("Log level")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->more.debug.log_level = gtk_combo_box_new_text (); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.debug.log_level), - _("None")); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.debug.log_level), - _("Error")); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.debug.log_level), - _("Warning")); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.debug.log_level), - _("Info")); - gtk_combo_box_append_text (GTK_COMBO_BOX (config->more.debug.log_level), - _("Debug")); - gtk_table_attach_defaults (GTK_TABLE (table), config->more.debug.log_level, - 1, 2, 0, 1); - gtk_widget_show (config->more.debug.log_level); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("FourCC - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 1, 2); - gtk_widget_show (eb); - - label = gtk_label_new ("FourCC"); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->more.debug.fourcc = gtk_entry_new_with_max_length (4); - gtk_table_attach_defaults (GTK_TABLE (table), - config->more.debug.fourcc, - 1, 2, 1, 2); - gtk_widget_set_sensitive (config->more.debug.fourcc, FALSE); - gtk_widget_show (config->more.debug.fourcc); - - - - return vbox; -} - -/* Callbacks */ -static void -x264_more_deblocking_filter (GtkToggleButton *button, - gpointer user_data) -{ - X264_Gui_Config *config; - - config = (X264_Gui_Config *)user_data; - - if (gtk_toggle_button_get_active (button)) { - gtk_widget_set_sensitive (config->more.misc.df.strength, TRUE); - gtk_widget_set_sensitive (config->more.misc.df.threshold, TRUE); - } - else { - gtk_widget_set_sensitive (config->more.misc.df.strength, FALSE); - gtk_widget_set_sensitive (config->more.misc.df.threshold, FALSE); - } -} - -static void -x264_more_cabac (GtkToggleButton *button, - gpointer user_data) -{ - X264_Gui_Config *config; - - config = (X264_Gui_Config *)user_data; - - if (gtk_toggle_button_get_active (button)) - gtk_widget_set_sensitive (config->more.misc.trellis, TRUE); - else - gtk_widget_set_sensitive (config->more.misc.trellis, FALSE); -} - -static void -x264_more_mixed_ref (GtkToggleButton *button, - gpointer user_data) -{ - X264_Gui_Config *config; - - config = (X264_Gui_Config *)user_data; - - if (gtk_toggle_button_get_active (button)) { - const gchar *text; - gint val; - - text = gtk_entry_get_text (GTK_ENTRY (config->more.motion_estimation.max_ref_frames)); - val = (gint)g_ascii_strtoull (text, NULL, 10); - if (val < 2) - gtk_entry_set_text (GTK_ENTRY (config->more.motion_estimation.max_ref_frames), "2"); - } -} diff --git a/gtk/x264_gtk_more.h b/gtk/x264_gtk_more.h deleted file mode 100644 index a4ea3b95..00000000 --- a/gtk/x264_gtk_more.h +++ /dev/null @@ -1,28 +0,0 @@ -/***************************************************************************** - * x264_gtk_more.h: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#ifndef X264_GTK_MORE_H -#define X264_GTK_MORE_H - - -GtkWidget *x264_more_page (X264_Gui_Config *config); - - -#endif /* X264_GTK_MORE_H */ diff --git a/gtk/x264_gtk_private.h b/gtk/x264_gtk_private.h deleted file mode 100644 index 859da041..00000000 --- a/gtk/x264_gtk_private.h +++ /dev/null @@ -1,194 +0,0 @@ -/***************************************************************************** - * x264_gtk_private.h: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#ifndef X264_GTK_PRIVATE_H -#define X264_GTK_PRIVATE_H - - -#include - - -typedef struct Bitrate_ Bitrate; -typedef struct Rate_Control_ Rate_Control; -typedef struct MB_ MB; -typedef struct More_ More; -typedef struct Cqm_ Cqm; -typedef struct Zones_ Zones; -typedef struct X264_Gui_Config_ X264_Gui_Config; -typedef struct X264_Gui_Zone_ X264_Gui_Zone; - -struct Bitrate_ -{ - GtkWidget *pass; - GtkWidget *label; - GtkWidget *w_quantizer; - GtkWidget *w_average_bitrate; - GtkWidget *w_target_bitrate; - - GtkWidget *update_statfile; - GtkWidget *statsfile_name; -}; - -struct Rate_Control_ -{ - /* bitrate */ - struct - { - GtkWidget *keyframe_boost; - GtkWidget *bframes_reduction; - GtkWidget *bitrate_variability; - }bitrate; - - /* Quantization Limits */ - struct - { - GtkWidget *min_qp; - GtkWidget *max_qp; - GtkWidget *max_qp_step; - }quantization_limits; - - /* Scene Cuts */ - struct - { - GtkWidget *scene_cut_threshold; - GtkWidget *min_idr_frame_interval; - GtkWidget *max_idr_frame_interval; - }scene_cuts; - - /* VBV */ - struct - { - GtkWidget *vbv_max_bitrate; - GtkWidget *vbv_buffer_size; - GtkWidget *vbv_buffer_init; - }vbv; - -}; - -struct MB_ -{ - /* Partitions */ - struct - { - GtkWidget *transform_8x8; - GtkWidget *pframe_search_8; - GtkWidget *bframe_search_8; - GtkWidget *pframe_search_4; - GtkWidget *inter_search_8; - GtkWidget *inter_search_4; - }partitions; - - /* B-frames */ - struct - { - GtkWidget *bframe_pyramid; - GtkWidget *bidir_me; - GtkWidget *bframe_adaptive; - GtkWidget *weighted_bipred; - GtkWidget *bframe; - GtkWidget *bframe_bias; - GtkWidget *direct_mode; - }bframes; - -}; - -struct More_ -{ - /* Motion estimation */ - struct - { - GtkWidget *partition_decision; - GtkWidget *method; - GtkWidget *range; - GtkWidget *chroma_me; - GtkWidget *max_ref_frames; - GtkWidget *mixed_refs; - GtkWidget *fast_pskip; - GtkWidget *dct_decimate; - }motion_estimation; - - /* Misc. Options */ - struct - { - GtkWidget *sample_ar_x; - GtkWidget *sample_ar_y; - GtkWidget *threads; - GtkWidget *cabac; - GtkWidget *trellis; - GtkWidget *noise_reduction; - - struct - { - GtkWidget *deblocking_filter; - GtkWidget *strength; - GtkWidget *threshold; - }df; - - }misc; - - struct - { - GtkWidget *log_level; - GtkWidget *fourcc; - }debug; - -}; - -struct Cqm_ -{ - GtkWidget *radio_flat; - GtkWidget *radio_jvt; - GtkWidget *radio_custom; - GtkWidget *cqm_file; - GtkWidget *cqm_4iy[16]; - GtkWidget *cqm_4ic[16]; - GtkWidget *cqm_4py[16]; - GtkWidget *cqm_4pc[16]; - GtkWidget *cqm_8iy[64]; - GtkWidget *cqm_8py[64]; -}; - -struct Zones_ -{ - GtkWidget *list_zones; -}; - -struct X264_Gui_Config_ -{ - Bitrate bitrate; - Rate_Control rate_control; - MB mb; - More more; - Cqm cqm; - Zones zones; -}; - -struct X264_Gui_Zone_ -{ - GtkWidget *entry_start_frame; - GtkWidget *radio_qp; - GtkWidget *entry_qp; - GtkWidget *entry_weight; -}; - -gchar *x264_gtk_path (const char* more_path); - - -#endif /* X264_GTK_PRIVATE_H */ diff --git a/gtk/x264_gtk_rc.c b/gtk/x264_gtk_rc.c deleted file mode 100644 index 5f9711be..00000000 --- a/gtk/x264_gtk_rc.c +++ /dev/null @@ -1,375 +0,0 @@ -/***************************************************************************** - * x264_gtk_rc.c: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#include - -#include "x264_gtk_i18n.h" -#include "x264_gtk_private.h" - - -/* Callbacks */ -static void x264_insert_numeric (GtkEditable *editable, - const gchar *text, - gint length, - gint *position, - gpointer data); - -GtkWidget * -x264_rate_control_page (X264_Gui_Config *config) -{ - GtkWidget *vbox; - GtkWidget *frame; - GtkWidget *table; - GtkWidget *eb; - GtkWidget *label; - GtkTooltips *tooltips; - - tooltips = gtk_tooltips_new (); - - vbox = gtk_vbox_new (FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); - - /* bitrate */ - frame = gtk_frame_new (_("Bitrate")); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 6); - gtk_widget_show (frame); - - table = gtk_table_new (3, 2, TRUE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - gtk_container_add (GTK_CONTAINER (frame), table); - gtk_widget_show (table); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Keyframe boost - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 0, 1); - gtk_widget_show (eb); - - label = gtk_label_new (_("Keyframe boost (%)")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->rate_control.bitrate.keyframe_boost = gtk_entry_new_with_max_length (3); - g_signal_connect (G_OBJECT (config->rate_control.bitrate.keyframe_boost), - "insert-text", - G_CALLBACK (x264_insert_numeric), - NULL); - gtk_table_attach_defaults (GTK_TABLE (table), - config->rate_control.bitrate.keyframe_boost, - 1, 2, 0, 1); - gtk_widget_show (config->rate_control.bitrate.keyframe_boost); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("B-frames reduction - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 1, 2); - gtk_widget_show (eb); - - label = gtk_label_new (_("B-frames reduction (%)")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->rate_control.bitrate.bframes_reduction = gtk_entry_new_with_max_length (5); - gtk_table_attach_defaults (GTK_TABLE (table), - config->rate_control.bitrate.bframes_reduction, - 1, 2, 1, 2); - gtk_widget_show (config->rate_control.bitrate.bframes_reduction); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Bitrate variability - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 2, 3); - gtk_widget_show (eb); - - label = gtk_label_new (_("Bitrate variability (%)")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->rate_control.bitrate.bitrate_variability = gtk_entry_new_with_max_length (3); - gtk_table_attach_defaults (GTK_TABLE (table), - config->rate_control.bitrate.bitrate_variability, - 1, 2, 2, 3); - gtk_widget_show (config->rate_control.bitrate.bitrate_variability); - - /* Quantization limits */ - frame = gtk_frame_new (_("Quantization limits")); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 6); - gtk_widget_show (frame); - - table = gtk_table_new (3, 2, TRUE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - gtk_container_add (GTK_CONTAINER (frame), table); - gtk_widget_show (table); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Min QP - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 0, 1); - gtk_widget_show (eb); - - label = gtk_label_new (_("Min QP")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->rate_control.quantization_limits.min_qp = gtk_entry_new_with_max_length (3); - gtk_table_attach_defaults (GTK_TABLE (table), - config->rate_control.quantization_limits.min_qp, - 1, 2, 0, 1); - gtk_widget_show (config->rate_control.quantization_limits.min_qp); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Max QP - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 1, 2); - gtk_widget_show (eb); - - label = gtk_label_new (_("Max QP")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->rate_control.quantization_limits.max_qp = gtk_entry_new_with_max_length (3); - gtk_table_attach_defaults (GTK_TABLE (table), - config->rate_control.quantization_limits.max_qp, - 1, 2, 1, 2); - gtk_widget_show (config->rate_control.quantization_limits.max_qp); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Max QP Step - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 2, 3); - gtk_widget_show (eb); - - label = gtk_label_new (_("Max QP Step")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->rate_control.quantization_limits.max_qp_step = gtk_entry_new_with_max_length (3); - gtk_table_attach_defaults (GTK_TABLE (table), - config->rate_control.quantization_limits.max_qp_step, - 1, 2, 2, 3); - gtk_widget_show (config->rate_control.quantization_limits.max_qp_step); - - /* Scene Cuts */ - frame = gtk_frame_new (_("Scene Cuts")); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 6); - gtk_widget_show (frame); - - table = gtk_table_new (3, 2, TRUE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - gtk_container_add (GTK_CONTAINER (frame), table); - gtk_widget_show (table); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Scene Cut Threshold - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 0, 1); - gtk_widget_show (eb); - - label = gtk_label_new (_("Scene Cut Threshold")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->rate_control.scene_cuts.scene_cut_threshold = gtk_entry_new_with_max_length (3); - gtk_table_attach_defaults (GTK_TABLE (table), - config->rate_control.scene_cuts.scene_cut_threshold, - 1, 2, 0, 1); - gtk_widget_show (config->rate_control.scene_cuts.scene_cut_threshold); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Min IDR-frame interval - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 1, 2); - gtk_widget_show (eb); - - label = gtk_label_new (_("Min IDR-frame interval")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->rate_control.scene_cuts.min_idr_frame_interval = gtk_entry_new_with_max_length (3); - gtk_table_attach_defaults (GTK_TABLE (table), - config->rate_control.scene_cuts.min_idr_frame_interval, - 1, 2, 1, 2); - gtk_widget_show (config->rate_control.scene_cuts.min_idr_frame_interval); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Max IDR-frame interval - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 2, 3); - gtk_widget_show (eb); - - label = gtk_label_new (_("Max IDR-frame interval")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->rate_control.scene_cuts.max_idr_frame_interval = gtk_entry_new_with_max_length (3); - gtk_table_attach_defaults (GTK_TABLE (table), - config->rate_control.scene_cuts.max_idr_frame_interval, - 1, 2, 2, 3); - gtk_widget_show (config->rate_control.scene_cuts.max_idr_frame_interval); - - /* vbv */ - frame = gtk_frame_new (_("Video buffer verifier")); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 6); - gtk_widget_show (frame); - - table = gtk_table_new (3, 2, TRUE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 6); - gtk_container_add (GTK_CONTAINER (frame), table); - gtk_widget_show (table); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Max local bitrate - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 0, 1); - gtk_widget_show (eb); - - label = gtk_label_new (_("Max local bitrate")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->rate_control.vbv.vbv_max_bitrate = gtk_entry_new_with_max_length (3); - gtk_table_attach_defaults (GTK_TABLE (table), - config->rate_control.vbv.vbv_max_bitrate, - 1, 2, 0, 1); - gtk_widget_show (config->rate_control.vbv.vbv_max_bitrate); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("VBV buffer size - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 1, 2); - gtk_widget_show (eb); - - label = gtk_label_new (_("VBV buffer size")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->rate_control.vbv.vbv_buffer_size = gtk_entry_new_with_max_length (3); - gtk_table_attach_defaults (GTK_TABLE (table), - config->rate_control.vbv.vbv_buffer_size, - 1, 2, 1, 2); - gtk_widget_show (config->rate_control.vbv.vbv_buffer_size); - - eb = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (eb), FALSE); - gtk_tooltips_set_tip (tooltips, eb, - _("Initial VBV buffer occupancy - description"), - ""); - gtk_table_attach_defaults (GTK_TABLE (table), eb, - 0, 1, 2, 3); - gtk_widget_show (eb); - - label = gtk_label_new (_("Initial VBV buffer occupancy")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_container_add (GTK_CONTAINER (eb), label); - gtk_widget_show (label); - - config->rate_control.vbv.vbv_buffer_init = gtk_entry_new_with_max_length (3); - gtk_table_attach_defaults (GTK_TABLE (table), - config->rate_control.vbv.vbv_buffer_init, - 1, 2, 2, 3); - gtk_widget_show (config->rate_control.vbv.vbv_buffer_init); - - return vbox; -} - -static void -x264_insert_numeric (GtkEditable *editable, - const gchar *text, - gint length, - gint *position, - gpointer data) -{ - gint i; - gint j; - gchar *result; - - result = (gchar *)g_malloc (sizeof (gchar) * (length + 1)); - if (!result) - return; - - for (i = 0, j = 0; i < length; i++) - { - if (g_ascii_isdigit (text[i])) - { - result[j] = text[i]; - j++; - } - } - result[j] = '\0'; - - g_signal_handlers_block_by_func (editable, - (gpointer) x264_insert_numeric, data); - gtk_editable_insert_text (editable, result, j, position); - g_signal_handlers_unblock_by_func (editable, - (gpointer) x264_insert_numeric, data); - - g_signal_stop_emission_by_name (editable, "insert-text"); - - g_free (result); -} - diff --git a/gtk/x264_gtk_rc.h b/gtk/x264_gtk_rc.h deleted file mode 100644 index 1813fade..00000000 --- a/gtk/x264_gtk_rc.h +++ /dev/null @@ -1,28 +0,0 @@ -/***************************************************************************** - * x264_gtk_rc.h: h264 gtk encoder frontend - ***************************************************************************** - * Copyright (C) 2006 Vincent Torri - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#ifndef X264_GTK_RC_H -#define X264_GTK_RC_H - - -GtkWidget *x264_rate_control_page (X264_Gui_Config *config); - - -#endif /* X264_GTK_RC_H */ diff --git a/gtk/x264gtk.rc b/gtk/x264gtk.rc deleted file mode 100644 index 1ef6053d..00000000 --- a/gtk/x264gtk.rc +++ /dev/null @@ -1,46 +0,0 @@ -// Wormux resource for win32 target - -#include -#include "../config.h" -#if ENABLE_NLS -# define IS_NLS_ENABLED "yes" -#else -# define IS_NLS_ENABLED "no" -#endif - -1 VERSIONINFO -FILEVERSION 0,45,0,0 -PRODUCTVERSION 0,45,0,0 -FILEFLAGSMASK 0x3fL -#ifdef _DEBUG -FILEFLAGS 0x1L -#else -FILEFLAGS 0x0L -#endif -FILEOS VOS__WINDOWS32 -FILETYPE VFT_APP -{ - BLOCK "StringFileInfo" - { - BLOCK "000004b0" - { - VALUE "Comments","Localization support: " IS_NLS_ENABLED "." - VALUE "CompanyName", "\000" - VALUE "FileDescription", "x264gtk: a minimalistic encoding GUI for x264" - VALUE "FileVersion", X264_VERSION - VALUE "InternalName", "x264" - VALUE "LegalCopyright", "Copyright (C) 2003-2006 Laurent Aimar, the x264 Project et al." - VALUE "LegalTrademarks", "Distributed under the GPL license" - VALUE "OriginalFilename", "x264.exe" - VALUE "ProductName", "x264" - VALUE "ProductVersion", X264_POINTVER - VALUE "SpecialBuild", "Build date: " __DATE__ ", " __TIME__ " with compiler version " __VERSION__ - } - } - BLOCK "VarFileInfo" - { - VALUE "Translation", 0x0, 1200 - } -} - -IDI_ICON1 ICON DISCARDABLE "x264.ico" diff --git a/tools/Jamfile b/tools/Jamfile deleted file mode 100644 index 8507f195..00000000 --- a/tools/Jamfile +++ /dev/null @@ -1,9 +0,0 @@ -# Jamfile - -# Little tool to embed h264 into avi -Main avc2avi : avc2avi.c ; - -# Little YUV I420 player -LINKLIBS = `sdl-config --libs` ; -Main xyuv : xyuv.c ; - diff --git a/tools/avc2avi.c b/tools/avc2avi.c deleted file mode 100644 index 075866ae..00000000 --- a/tools/avc2avi.c +++ /dev/null @@ -1,857 +0,0 @@ -/***************************************************************************** - * avc2avi.c: raw h264 -> AVI - ***************************************************************************** - * Copyright (C) 2004-2006 x264 project - * - * Authors: Laurent Aimar - * Loren Merritt - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. - *****************************************************************************/ - -#include -#include -#include -#include - -#include -#define _GNU_SOURCE -#include - -#ifdef _MSC_VER -#include /* _setmode() */ -#include /* _O_BINARY */ -#endif - -#include "../common/bs.h" - -#define DATA_MAX 3000000 -uint8_t data[DATA_MAX]; - -/* Ctrl-C handler */ -static int i_ctrl_c = 0; -static void SigIntHandler( int a ) -{ - i_ctrl_c = 1; -} - -typedef struct -{ - char *psz_fin; - char *psz_fout; - - float f_fps; - char fcc[4]; -} cfg_t; - -typedef struct -{ - int i_data; - int i_data_max; - uint8_t *p_data; -} vbuf_t; - -void vbuf_init( vbuf_t * ); -void vbuf_add( vbuf_t *, int i_data, void *p_data ); -void vbuf_reset( vbuf_t * ); - -typedef struct -{ - FILE *f; - - float f_fps; - char fcc[4]; - - int i_width; - int i_height; - - int64_t i_movi; - int64_t i_movi_end; - int64_t i_riff; - - int i_frame; - int i_idx_max; - uint32_t *idx; -} avi_t; - -void avi_init( avi_t *, FILE *, float, char fcc[4] ); -void avi_write( avi_t *, vbuf_t *, int ); -void avi_end( avi_t * ); - -enum nal_unit_type_e -{ - NAL_UNKNOWN = 0, - NAL_SLICE = 1, - NAL_SLICE_DPA = 2, - NAL_SLICE_DPB = 3, - NAL_SLICE_DPC = 4, - NAL_SLICE_IDR = 5, /* ref_idc != 0 */ - NAL_SEI = 6, /* ref_idc == 0 */ - NAL_SPS = 7, - NAL_PPS = 8 - /* ref_idc == 0 for 6,9,10,11,12 */ -}; -enum nal_priority_e -{ - NAL_PRIORITY_DISPOSABLE = 0, - NAL_PRIORITY_LOW = 1, - NAL_PRIORITY_HIGH = 2, - NAL_PRIORITY_HIGHEST = 3, -}; - -typedef struct -{ - int i_ref_idc; /* nal_priority_e */ - int i_type; /* nal_unit_type_e */ - - /* This data are raw payload */ - int i_payload; - uint8_t *p_payload; -} nal_t; - -typedef struct -{ - int i_width; - int i_height; - - int i_nal_type; - int i_ref_idc; - int i_idr_pic_id; - int i_frame_num; - int i_poc; - - int b_key; - int i_log2_max_frame_num; - int i_poc_type; - int i_log2_max_poc_lsb; -} h264_t; - -void h264_parser_init( h264_t * ); -void h264_parser_parse( h264_t *h, nal_t *n, int *pb_nal_start ); - - -static int nal_decode( nal_t *nal, void *p_data, int i_data ); - -static void Help( void ); -static int Parse( int argc, char **argv, cfg_t * ); -static int ParseNAL( nal_t *nal, avi_t *a, h264_t *h, int *pb_slice ); - -/**************************************************************************** - * main: - ****************************************************************************/ -int main( int argc, char **argv ) -{ - cfg_t cfg; - - FILE *fout; - FILE *fin; - - vbuf_t vb; - avi_t avi; - h264_t h264; - - nal_t nal; - int i_frame; - int i_data; - int b_eof; - int b_key; - int b_slice; - -#ifdef _MSC_VER - _setmode(_fileno(stdin), _O_BINARY); /* thanks to Marcos Morais */ - _setmode(_fileno(stdout), _O_BINARY); -#endif - - /* Parse command line */ - if( Parse( argc, argv, &cfg ) < 0 ) - { - return -1; - } - - /* Open input */ - if( cfg.psz_fin == NULL || *cfg.psz_fin == '\0' || !strcmp( cfg.psz_fin, "-" ) ) - fin = stdin; - else - fin = fopen( cfg.psz_fin, "rb" ); - if( fin == NULL ) - { - fprintf( stderr, "cannot open input file\n" ); - return -1; - } - - /* Open output */ - if( cfg.psz_fout == NULL || *cfg.psz_fout == '\0' || !strcmp( cfg.psz_fout, "-" ) ) - fout = stdin; - else - fout = fopen( cfg.psz_fout, "wb" ); - if( fout == NULL ) - { - fprintf( stderr, "cannot open output file\n" ); - return -1; - } - - /* Init avi */ - avi_init( &avi, fout, cfg.f_fps, cfg.fcc ); - - /* Init parser */ - h264_parser_init( &h264 ); - - /* Control-C handler */ - signal( SIGINT, SigIntHandler ); - - /* Init data */ - b_eof = 0; - b_key = 0; - b_slice = 0; - i_frame = 0; - i_data = 0; - - /* Alloc space for a nal, used for decoding pps/sps/slice header */ - nal.p_payload = malloc( DATA_MAX ); - - vbuf_init( &vb ); - - /* split frame */ - while( !i_ctrl_c ) - { - uint8_t *p, *p_next, *end; - int i_size; - - /* fill buffer */ - if( i_data < DATA_MAX && !b_eof ) - { - int i_read = fread( &data[i_data], 1, DATA_MAX - i_data, fin ); - if( i_read <= 0 ) - b_eof = 1; - else - i_data += i_read; - } - if( i_data < 3 ) - break; - - end = &data[i_data]; - - /* Search begin of a NAL */ - p = &data[0]; - while( p < end - 3 ) - { - if( p[0] == 0x00 && p[1] == 0x00 && p[2] == 0x01 ) - { - break; - } - p++; - } - - if( p >= end - 3 ) - { - fprintf( stderr, "garbage (i_data = %d)\n", i_data ); - i_data = 0; - continue; - } - - /* Search end of NAL */ - p_next = p + 3; - while( p_next < end - 3 ) - { - if( p_next[0] == 0x00 && p_next[1] == 0x00 && p_next[2] == 0x01 ) - { - break; - } - p_next++; - } - - if( p_next == end - 3 && i_data < DATA_MAX ) - p_next = end; - - /* Compute NAL size */ - i_size = p_next - p - 3; - if( i_size <= 0 ) - { - if( b_eof ) - break; - - fprintf( stderr, "nal too large (FIXME) ?\n" ); - i_data = 0; - continue; - } - - /* Nal start at p+3 with i_size length */ - nal_decode( &nal, p +3, i_size < 2048 ? i_size : 2048 ); - - b_key = h264.b_key; - - if( b_slice && vb.i_data && ( nal.i_type == NAL_SPS || nal.i_type == NAL_PPS ) ) - { - avi_write( &avi, &vb, b_key ); - vbuf_reset( &vb ); - b_slice = 0; - } - - /* Parse SPS/PPS/Slice */ - if( ParseNAL( &nal, &avi, &h264, &b_slice ) && vb.i_data > 0 ) - { - avi_write( &avi, &vb, b_key ); - vbuf_reset( &vb ); - } - - /* fprintf( stderr, "nal:%d ref:%d\n", nal.i_type, nal.i_ref_idc ); */ - - /* Append NAL to buffer */ - vbuf_add( &vb, i_size + 3, p ); - - /* Remove this nal */ - memmove( &data[0], p_next, end - p_next ); - i_data -= p_next - &data[0]; - } - - if( vb.i_data > 0 ) - { - avi_write( &avi, &vb, h264.b_key ); - } - - avi.i_width = h264.i_width; - avi.i_height = h264.i_height; - - avi_end( &avi ); - - /* free mem */ - free( nal.p_payload ); - - fclose( fin ); - fclose( fout ); - - return 0; -} - -/***************************************************************************** - * Help: - *****************************************************************************/ -static void Help( void ) -{ - fprintf( stderr, - "avc2avi\n" - "Syntax: avc2avi [options] [ -i input.h264 ] [ -o output.avi ]\n" - "\n" - " -h, --help Print this help\n" - "\n" - " -i, --input Specify input file (default: stdin)\n" - " -o, --output Specify output file (default: stdout)\n" - "\n" - " -f, --fps Set FPS (default: 25.0)\n" - " -c, --codec Set the codec fourcc (default: 'h264')\n" - "\n" ); -} - -/***************************************************************************** - * Parse: - *****************************************************************************/ -static int Parse( int argc, char **argv, cfg_t *cfg ) -{ - /* Set default values */ - cfg->psz_fin = NULL; - cfg->psz_fout = NULL; - cfg->f_fps = 25.0; - memcpy( cfg->fcc, "h264", 4 ); - - /* Parse command line options */ - opterr = 0; // no error message - for( ;; ) - { - int long_options_index; - static struct option long_options[] = - { - { "help", no_argument, NULL, 'h' }, - { "input", required_argument, NULL, 'i' }, - { "output", required_argument, NULL, 'o' }, - { "fps", required_argument, NULL, 'f' }, - { "codec", required_argument, NULL, 'c' }, - {0, 0, 0, 0} - }; - - int c; - - c = getopt_long( argc, argv, "hi:o:f:c:", - long_options, &long_options_index); - - if( c == -1 ) - { - break; - } - - switch( c ) - { - case 'h': - Help(); - return -1; - - case 0: - break; - case 'i': - cfg->psz_fin = strdup( optarg ); - break; - case 'o': - cfg->psz_fout = strdup( optarg ); - break; - case 'f': - cfg->f_fps = atof( optarg ); - break; - case 'c': - memset( cfg->fcc, ' ', 4 ); - memcpy( cfg->fcc, optarg, strlen( optarg ) < 4 ? strlen( optarg ) : 4 ); - break; - - default: - fprintf( stderr, "unknown option (%c)\n", optopt ); - return -1; - } - } - - - return 0; -} - -/***************************************************************************** - * h264_parser_*: - *****************************************************************************/ -void h264_parser_init( h264_t *h ) -{ - h->i_width = 0; - h->i_height = 0; - h->b_key = 0; - h->i_nal_type = -1; - h->i_ref_idc = -1; - h->i_idr_pic_id = -1; - h->i_frame_num = -1; - h->i_log2_max_frame_num = 0; - h->i_poc = -1; - h->i_poc_type = -1; -} -void h264_parser_parse( h264_t *h, nal_t *nal, int *pb_nal_start ) -{ - bs_t s; - *pb_nal_start = 0; - - if( nal->i_type == NAL_SPS || nal->i_type == NAL_PPS ) - *pb_nal_start = 1; - - bs_init( &s, nal->p_payload, nal->i_payload ); - if( nal->i_type == NAL_SPS ) - { - int i_tmp; - - i_tmp = bs_read( &s, 8 ); - bs_skip( &s, 1+1+1 + 5 + 8 ); - /* sps id */ - bs_read_ue( &s ); - - if( i_tmp >= 100 ) - { - bs_read_ue( &s ); // chroma_format_idc - bs_read_ue( &s ); // bit_depth_luma_minus8 - bs_read_ue( &s ); // bit_depth_chroma_minus8 - bs_skip( &s, 1 ); // qpprime_y_zero_transform_bypass_flag - if( bs_read( &s, 1 ) ) // seq_scaling_matrix_present_flag - { - int i, j; - for( i = 0; i < 8; i++ ) - { - if( bs_read( &s, 1 ) ) // seq_scaling_list_present_flag[i] - { - uint8_t i_tmp = 8; - for( j = 0; j < (i<6?16:64); j++ ) - { - i_tmp += bs_read_se( &s ); - if( i_tmp == 0 ) - break; - } - } - } - } - } - - /* Skip i_log2_max_frame_num */ - h->i_log2_max_frame_num = bs_read_ue( &s ) + 4; - /* Read poc_type */ - h->i_poc_type = bs_read_ue( &s ); - if( h->i_poc_type == 0 ) - { - h->i_log2_max_poc_lsb = bs_read_ue( &s ) + 4; - } - else if( h->i_poc_type == 1 ) - { - int i_cycle; - /* skip b_delta_pic_order_always_zero */ - bs_skip( &s, 1 ); - /* skip i_offset_for_non_ref_pic */ - bs_read_se( &s ); - /* skip i_offset_for_top_to_bottom_field */ - bs_read_se( &s ); - /* read i_num_ref_frames_in_poc_cycle */ - i_cycle = bs_read_ue( &s ); - if( i_cycle > 256 ) i_cycle = 256; - while( i_cycle > 0 ) - { - /* skip i_offset_for_ref_frame */ - bs_read_se(&s ); - } - } - /* i_num_ref_frames */ - bs_read_ue( &s ); - /* b_gaps_in_frame_num_value_allowed */ - bs_skip( &s, 1 ); - - /* Read size */ - h->i_width = 16 * ( bs_read_ue( &s ) + 1 ); - h->i_height = 16 * ( bs_read_ue( &s ) + 1 ); - - /* b_frame_mbs_only */ - i_tmp = bs_read( &s, 1 ); - if( i_tmp == 0 ) - { - bs_skip( &s, 1 ); - } - /* b_direct8x8_inference */ - bs_skip( &s, 1 ); - - /* crop ? */ - i_tmp = bs_read( &s, 1 ); - if( i_tmp ) - { - /* left */ - h->i_width -= 2 * bs_read_ue( &s ); - /* right */ - h->i_width -= 2 * bs_read_ue( &s ); - /* top */ - h->i_height -= 2 * bs_read_ue( &s ); - /* bottom */ - h->i_height -= 2 * bs_read_ue( &s ); - } - - /* vui: ignored */ - } - else if( nal->i_type >= NAL_SLICE && nal->i_type <= NAL_SLICE_IDR ) - { - int i_tmp; - - /* i_first_mb */ - bs_read_ue( &s ); - /* picture type */ - switch( bs_read_ue( &s ) ) - { - case 0: case 5: /* P */ - case 1: case 6: /* B */ - case 3: case 8: /* SP */ - h->b_key = 0; - break; - case 2: case 7: /* I */ - case 4: case 9: /* SI */ - h->b_key = (nal->i_type == NAL_SLICE_IDR); - break; - } - /* pps id */ - bs_read_ue( &s ); - - /* frame num */ - i_tmp = bs_read( &s, h->i_log2_max_frame_num ); - - if( i_tmp != h->i_frame_num ) - *pb_nal_start = 1; - - h->i_frame_num = i_tmp; - - if( nal->i_type == NAL_SLICE_IDR ) - { - i_tmp = bs_read_ue( &s ); - if( h->i_nal_type == NAL_SLICE_IDR && h->i_idr_pic_id != i_tmp ) - *pb_nal_start = 1; - - h->i_idr_pic_id = i_tmp; - } - - if( h->i_poc_type == 0 ) - { - i_tmp = bs_read( &s, h->i_log2_max_poc_lsb ); - if( i_tmp != h->i_poc ) - *pb_nal_start = 1; - h->i_poc = i_tmp; - } - } - h->i_nal_type = nal->i_type; - h->i_ref_idc = nal->i_ref_idc; -} - - -static int ParseNAL( nal_t *nal, avi_t *a, h264_t *h, int *pb_slice ) -{ - int b_flush = 0; - int b_start; - - h264_parser_parse( h, nal, &b_start ); - - if( b_start && *pb_slice ) - { - b_flush = 1; - *pb_slice = 0; - } - - if( nal->i_type >= NAL_SLICE && nal->i_type <= NAL_SLICE_IDR ) - *pb_slice = 1; - - return b_flush; -} - -/***************************************************************************** - * vbuf: variable buffer - *****************************************************************************/ -void vbuf_init( vbuf_t *v ) -{ - v->i_data = 0; - v->i_data_max = 10000; - v->p_data = malloc( v->i_data_max ); -} -void vbuf_add( vbuf_t *v, int i_data, void *p_data ) -{ - if( i_data + v->i_data >= v->i_data_max ) - { - v->i_data_max += i_data; - v->p_data = realloc( v->p_data, v->i_data_max ); - } - memcpy( &v->p_data[v->i_data], p_data, i_data ); - - v->i_data += i_data; -} -void vbuf_reset( vbuf_t *v ) -{ - v->i_data = 0; -} - -/***************************************************************************** - * avi: - *****************************************************************************/ -void avi_write_uint16( avi_t *a, uint16_t w ) -{ - fputc( ( w ) & 0xff, a->f ); - fputc( ( w >> 8 ) & 0xff, a->f ); -} - -void avi_write_uint32( avi_t *a, uint32_t dw ) -{ - fputc( ( dw ) & 0xff, a->f ); - fputc( ( dw >> 8 ) & 0xff, a->f ); - fputc( ( dw >> 16) & 0xff, a->f ); - fputc( ( dw >> 24) & 0xff, a->f ); -} - -void avi_write_fourcc( avi_t *a, char fcc[4] ) -{ - fputc( fcc[0], a->f ); - fputc( fcc[1], a->f ); - fputc( fcc[2], a->f ); - fputc( fcc[3], a->f ); -} - -/* Flags in avih */ -#define AVIF_HASINDEX 0x00000010 // Index at end of file? -#define AVIF_ISINTERLEAVED 0x00000100 -#define AVIF_TRUSTCKTYPE 0x00000800 // Use CKType to find key frames? - -#define AVIIF_KEYFRAME 0x00000010L /* this frame is a key frame.*/ - -void avi_write_header( avi_t *a ) -{ - avi_write_fourcc( a, "RIFF" ); - avi_write_uint32( a, a->i_riff > 0 ? a->i_riff - 8 : 0xFFFFFFFF ); - avi_write_fourcc( a, "AVI " ); - - avi_write_fourcc( a, "LIST" ); - avi_write_uint32( a, 4 + 4*16 + 12 + 4*16 + 4*12 ); - avi_write_fourcc( a, "hdrl" ); - - avi_write_fourcc( a, "avih" ); - avi_write_uint32( a, 4*16 - 8 ); - avi_write_uint32( a, 1000000 / a->f_fps ); - avi_write_uint32( a, 0xffffffff ); - avi_write_uint32( a, 0 ); - avi_write_uint32( a, AVIF_HASINDEX|AVIF_ISINTERLEAVED|AVIF_TRUSTCKTYPE); - avi_write_uint32( a, a->i_frame ); - avi_write_uint32( a, 0 ); - avi_write_uint32( a, 1 ); - avi_write_uint32( a, 1000000 ); - avi_write_uint32( a, a->i_width ); - avi_write_uint32( a, a->i_height ); - avi_write_uint32( a, 0 ); - avi_write_uint32( a, 0 ); - avi_write_uint32( a, 0 ); - avi_write_uint32( a, 0 ); - - avi_write_fourcc( a, "LIST" ); - avi_write_uint32( a, 4 + 4*16 + 4*12 ); - avi_write_fourcc( a, "strl" ); - - avi_write_fourcc( a, "strh" ); - avi_write_uint32( a, 4*16 - 8 ); - avi_write_fourcc( a, "vids" ); - avi_write_fourcc( a, a->fcc ); - avi_write_uint32( a, 0 ); - avi_write_uint32( a, 0 ); - avi_write_uint32( a, 0 ); - avi_write_uint32( a, 1000 ); - avi_write_uint32( a, a->f_fps * 1000 ); - avi_write_uint32( a, 0 ); - avi_write_uint32( a, a->i_frame ); - avi_write_uint32( a, 1024*1024 ); - avi_write_uint32( a, -1 ); - avi_write_uint32( a, a->i_width * a->i_height ); - avi_write_uint32( a, 0 ); - avi_write_uint16( a, a->i_width ); - avi_write_uint16( a, a->i_height ); - - avi_write_fourcc( a, "strf" ); - avi_write_uint32( a, 4*12 - 8 ); - avi_write_uint32( a, 4*12 - 8 ); - avi_write_uint32( a, a->i_width ); - avi_write_uint32( a, a->i_height ); - avi_write_uint16( a, 1 ); - avi_write_uint16( a, 24 ); - avi_write_fourcc( a, a->fcc ); - avi_write_uint32( a, a->i_width * a->i_height ); - avi_write_uint32( a, 0 ); - avi_write_uint32( a, 0 ); - avi_write_uint32( a, 0 ); - avi_write_uint32( a, 0 ); - - avi_write_fourcc( a, "LIST" ); - avi_write_uint32( a, a->i_movi_end > 0 ? a->i_movi_end - a->i_movi + 4: 0xFFFFFFFF ); - avi_write_fourcc( a, "movi" ); -} - -void avi_write_idx( avi_t *a ) -{ - avi_write_fourcc( a, "idx1" ); - avi_write_uint32( a, a->i_frame * 16 ); - fwrite( a->idx, a->i_frame * 16, 1, a->f ); -} - -void avi_init( avi_t *a, FILE *f, float f_fps, char fcc[4] ) -{ - a->f = f; - a->f_fps = f_fps; - memcpy( a->fcc, fcc, 4 ); - a->i_width = 0; - a->i_height = 0; - a->i_frame = 0; - a->i_movi = 0; - a->i_riff = 0; - a->i_movi_end = 0; - a->i_idx_max = 0; - a->idx = NULL; - - avi_write_header( a ); - - a->i_movi = ftell( a->f ); -} - -static void avi_set_dw( void *_p, uint32_t dw ) -{ - uint8_t *p = _p; - - p[0] = ( dw )&0xff; - p[1] = ( dw >> 8 )&0xff; - p[2] = ( dw >> 16)&0xff; - p[3] = ( dw >> 24)&0xff; -} - -void avi_write( avi_t *a, vbuf_t *v, int b_key ) -{ - int64_t i_pos = ftell( a->f ); - - /* chunk header */ - avi_write_fourcc( a, "00dc" ); - avi_write_uint32( a, v->i_data ); - - fwrite( v->p_data, v->i_data, 1, a->f ); - - if( v->i_data&0x01 ) - { - /* pad */ - fputc( 0, a->f ); - } - - /* Append idx chunk */ - if( a->i_idx_max <= a->i_frame ) - { - a->i_idx_max += 1000; - a->idx = realloc( a->idx, a->i_idx_max * 16 ); - } - - memcpy( &a->idx[4*a->i_frame+0], "00dc", 4 ); - avi_set_dw( &a->idx[4*a->i_frame+1], b_key ? AVIIF_KEYFRAME : 0 ); - avi_set_dw( &a->idx[4*a->i_frame+2], i_pos ); - avi_set_dw( &a->idx[4*a->i_frame+3], v->i_data ); - - a->i_frame++; -} - -void avi_end( avi_t *a ) -{ - a->i_movi_end = ftell( a->f ); - - /* write index */ - avi_write_idx( a ); - - a->i_riff = ftell( a->f ); - - /* Fix header */ - fseek( a->f, 0, SEEK_SET ); - avi_write_header( a ); - - fprintf( stderr, "avi file written\n" ); - fprintf( stderr, " - codec: %4.4s\n", a->fcc ); - fprintf( stderr, " - size: %dx%d\n", a->i_width, a->i_height ); - fprintf( stderr, " - fps: %.3f\n", a->f_fps ); - fprintf( stderr, " - frames: %d\n", a->i_frame ); -} - -/***************************************************************************** - * nal: - *****************************************************************************/ -int nal_decode( nal_t *nal, void *p_data, int i_data ) -{ - uint8_t *src = p_data; - uint8_t *end = &src[i_data]; - uint8_t *dst = nal->p_payload; - - nal->i_type = src[0]&0x1f; - nal->i_ref_idc = (src[0] >> 5)&0x03; - - src++; - - while( src < end ) - { - if( src < end - 3 && src[0] == 0x00 && src[1] == 0x00 && src[2] == 0x03 ) - { - *dst++ = 0x00; - *dst++ = 0x00; - - src += 3; - continue; - } - *dst++ = *src++; - } - - nal->i_payload = dst - (uint8_t*)nal->p_payload; - return 0; -} - diff --git a/tools/countquant_x264.pl b/tools/countquant_x264.pl index c24a4521..e08f2efc 100755 --- a/tools/countquant_x264.pl +++ b/tools/countquant_x264.pl @@ -1,4 +1,4 @@ -#!/usr/bin/env perl +#!/bin/env perl # countquant_x264.pl: displays statistics from x264 multipass logfiles # by Loren Merritt, 2005-4-5 @@ -8,13 +8,13 @@ sub proc_file { my $fh = shift; while(<$fh>) { - /type:(.) q:(\d+\.\d+) itex:(\d+) ptex:(\d+) mv:(\d+) misc:(\d+)/ or next; + /type:(.) q:(\d+\.\d+) tex:(\d+) mv:(\d+) misc:(\d+)/ or next; $type = uc $1; $n{$type} ++; $q[int($2+.5)] ++; $avgq += $2; $avgq{$type} += $2; - my $bytes = ($3+$4+$5+$6)/8; + my $bytes = ($3+$4+$5)/8; $size{$type} += $bytes; } $size = $size{I} + $size{P} + $size{B}; diff --git a/tools/regression-test.pl b/tools/regression-test.pl old mode 100644 new mode 100755 diff --git a/tools/x264-rd.sh b/tools/x264-rd.sh deleted file mode 100755 index 8a287b56..00000000 --- a/tools/x264-rd.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -X264="../x264" -YUV="/usr/src/yuv/af-720x576.yuv" -OUT="/tmp/x264-$$.h264" - -DAT="x264-rd.dat" - -OPTS="-c" - -# Init -rm -f "$DAT" -echo "#QP kb/s PSNR Y U V fps" > $DAT - -for qp in `seq 1 51` -do - LOG="/tmp/x264-$qp-$$.log" - # clean - rm -f "$LOG" - # encode - $X264 "$YUV" -o "$OUT" --qp $qp $OPTS 2> "$LOG" - # gather stats - cat "$LOG" | - grep '^x264: overall' | - sed 's/^x264: overall PSNR Y:\([[:digit:]]*\.[[:digit:]]*\) U:\([[:digit:]]*\.[[:digit:]]*\) V:\([[:digit:]]*\.[[:digit:]]*\) kb\/s:\([[:digit:]]*\.[[:digit:]]*\) fps:\([[:digit:]]*\.[[:digit:]]*\)$/\1 \2 \3 \4 \5/g' | - awk -v QP=$qp '{ printf( "%2d %7.1f %5.2f %5.2f %5.2f %5.3f\n", QP, $4, $1, $2, $3, $5 ); }' >> $DAT -done - -# Clean -rm -f "$OUT" -rm -f "$LOG" - -- 2.40.0