Added a vob to mpeg1 transcoder. note that this one is only 68 lines long.

Original commit message from CVS:
Added a vob to mpeg1 transcoder. note that this one is only 68 lines long.
This commit is contained in:
Wim Taymans 2001-07-08 21:02:10 +00:00
parent dbbe6c4e93
commit ecce42b222
3 changed files with 70 additions and 2 deletions

View file

@ -3,7 +3,7 @@
if HAVE_GNOME
GNOME_PROGS = spectrum wave mp1parse videotest aviparse \
videotest2 video2mp1 dvshow dv2mp1 \
mpeg2parse mpeg2parse2 mpeg2parse3
mpeg2parse mpeg2parse2 mpeg2parse3 mp2tomp1v2
else
GNOME_PROGS =
endif

68
test/mp2tomp1v2.c Normal file
View file

@ -0,0 +1,68 @@
#include <string.h>
#include <gst/gst.h>
static gchar *audio_out;
static gchar *video_out;
static void
frame_encoded (GstElement *element, GstElement *pipeline)
{
fprintf (stderr, ".");
}
static void
new_pad (GstElement *element, GstPad *pad, GstElement *pipeline)
{
gst_element_set_state (pipeline, GST_STATE_PAUSED);
if (strncmp(gst_pad_get_name(pad), "video_", 6) == 0) {
gst_parse_launch (g_strdup_printf ("mpeg2dec[vdec] ! "
"ffmpegenc_mpeg1video[venc] width=352 height=288 bit_rate=1220000 ! "
"disksink[dv] location=%s", video_out),
GST_BIN (pipeline));
g_signal_connectc (gst_bin_get_by_name (GST_BIN (pipeline), "venc"), "frame_encoded",
G_CALLBACK (frame_encoded), pipeline, FALSE);
gst_pad_connect (pad, gst_element_get_pad (gst_bin_get_by_name (GST_BIN (pipeline), "vdec"), "sink"));
}
else if (strcmp(gst_pad_get_name(pad), "private_stream_1.0") == 0) {
gst_parse_launch (g_strdup_printf ("ac3dec[adec] ! ffmpegenc_mp2[aenc] ! "
"disksink[da] location=%s", audio_out), GST_BIN (pipeline));
g_signal_connectc (gst_bin_get_by_name (GST_BIN (pipeline), "aenc"), "frame_encoded",
G_CALLBACK (frame_encoded), pipeline, FALSE);
gst_pad_connect (pad, gst_element_get_pad (gst_bin_get_by_name (GST_BIN (pipeline), "adec"), "sink"));
}
gst_element_set_state (pipeline, GST_STATE_PLAYING);
}
int
main (int argc, char *argv[])
{
GstElement *pipeline;
GstElement *parser;
gst_init (&argc, &argv);
if (argc != 4) {
g_print ("usage: %s <file.vob> <out.mp2> <out.mpv>\n", argv[0]);
return -1;
}
audio_out = argv[2];
video_out = argv[3];
pipeline = gst_pipeline_new ("main_pipeline");
gst_parse_launch (g_strdup_printf("disksrc location=%s ! "
"mpeg2parse[parser]", argv[1]), GST_BIN (pipeline));
parser = gst_bin_get_by_name (GST_BIN (pipeline), "parser");
g_assert (parser != NULL);
g_signal_connectc (G_OBJECT (parser), "new_pad", G_CALLBACK (new_pad), pipeline, FALSE);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
while (gst_bin_iterate (GST_BIN (pipeline)));
gst_element_set_state (pipeline, GST_STATE_NULL);
return 0;
}

View file

@ -28,7 +28,7 @@ int main(int argc,char *argv[]) {
src = gst_elementfactory_create(srcfactory,"src");
g_return_val_if_fail(src != NULL, -1);
g_object_set(G_OBJECT(src),"location",argv[1]);
g_object_set(G_OBJECT(src),"location",argv[1], NULL);
g_print("should be using file '%s'\n",argv[1]);
parse = gst_elementfactory_create(parsefactory,"parse");
g_return_val_if_fail(parse != NULL, -1);