Commit 540ed9aa authored by Loren Merritt's avatar Loren Merritt
Browse files

GTK: support yuv4mpeg input.

patch by Vincent Torri.



git-svn-id: svn://svn.videolan.org/x264/trunk@486 df754926-b1dd-0310-bc7b-ec298dee348c
parent 5fe3e77f
......@@ -2,6 +2,7 @@
include config.mak
OBJECTS = x264_gtk_bitrate.o x264_gtk_rc.o x264_gtk_mb.o x264_gtk_more.o x264_gtk.o
EXTERNAL_DEPS= ../muxers.o ../matroska.o ../libx264.a
TEST_OBJECT = test.o
ENCODE_OBJECT = x264_gtk_encode_encode.o x264_gtk_encode_status_window.o x264_gtk_encode_main_window.o x264_gtk_encode.o
......@@ -40,9 +41,9 @@ test: $(OBJECTS) $(TEST_OBJECT)
@echo " B: $(@F)"
@$(CC) -o test $(OBJECTS) $(TEST_OBJECT) $(LDFLAGS)
x264_gtk_encode: $(OBJECTS) x264_icon.h libx264gtk.a $(ENCODE_OBJECT)
x264_gtk_encode: $(OBJECTS) x264_icon.h libx264gtk.a $(ENCODE_OBJECT) $(EXTERNAL_DEPS)
@echo " B: $(@F)"
@$(CC) -o x264_gtk_encode $(OBJECTS) $(ENCODE_OBJECT) ../muxers.o ../matroska.o $(LDFLAGS)
@$(CC) -o x264_gtk_encode $(OBJECTS) $(ENCODE_OBJECT) $(EXTERNAL_DEPS) $(LDFLAGS)
# Clean rule
clean:
......
......@@ -8,6 +8,7 @@ typedef enum {
X264_DEMUXER_YUV = 0,
X264_DEMUXER_CIF,
X264_DEMUXER_QCIF,
X264_DEMUXER_Y4M,
X264_DEMUXER_AVI,
X264_DEMUXER_AVS,
X264_DEMUXER_UNKOWN
......
......@@ -191,23 +191,29 @@ _set_drivers (X264_Demuxer_Type in_container, gint out_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;
/* 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;
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;
default: /* Unknown */
return -1;
}
switch (out_container) {
......
......@@ -6,6 +6,7 @@
#include <unistd.h>
#ifdef _WIN32 /* Needed to define _O_BINARY */
# include <fcntl.h>
# define strncasecmp _strnicmp
#endif
#include <errno.h>
#include <string.h>
......@@ -154,6 +155,7 @@ x264_gtk_encode_main_window ()
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");
......@@ -171,12 +173,18 @@ x264_gtk_encode_main_window ()
gtk_file_filter_add_pattern (filter, "*.cif");
gtk_file_chooser_add_filter (chooser, filter);
/* CIF 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 ();
......@@ -379,13 +387,15 @@ _chooser_window_cb (GtkDialog *dialog,
{
/* All format needed, search for extension */
const char *ext = strrchr(in, '.');
if (!strncmp(ext, ".avs", 4) || !strncmp(ext, ".AVS", 4))
if (!strncasecmp(ext, ".y4m", 4))
encode->container = X264_DEMUXER_Y4M;
else if (!strncasecmp(ext, ".avs", 4))
encode->container = X264_DEMUXER_AVS;
else if (!strncmp(ext, ".avi", 4) || !strncmp(ext, ".AVI", 4))
encode->container = X264_DEMUXER_AVS;
else if (!strncmp(ext, ".cif", 4) || !strncmp(ext, ".CIF", 4))
else if (!strncasecmp(ext, ".avi", 4))
encode->container = X264_DEMUXER_AVI;
else if (!strncasecmp(ext, ".cif", 4))
encode->container = X264_DEMUXER_CIF;
else if (!strncmp(ext, ".qcif", 4) || !strncmp(ext, ".QCIF", 4))
else if (!strncasecmp(ext, ".qcif", 4))
encode->container = X264_DEMUXER_QCIF;
else
encode->container = X264_DEMUXER_YUV;
......@@ -399,15 +409,22 @@ _chooser_window_cb (GtkDialog *dialog,
switch (encode->container) {
case X264_DEMUXER_YUV: /* YUV */
break;
case X264_DEMUXER_CIF: /* CIF */
case X264_DEMUXER_CIF: /* YUV CIF */
param.i_width = 352;
param.i_height = 288;
break;
case X264_DEMUXER_QCIF: /* QCIF */
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 */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment