From cbb196fd3144dfc2e1374dee525f92748de7a903 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 28 May 2000 19:59:46 +0000 Subject: [PATCH] Rewrote the mpeg1 system stream parser. Original commit message from CVS: Rewrote the mpeg1 system stream parser. Fixed a motion compensation bug (was a bug on Intels site) Faster/Better/more accurate motion detection in the mpeg encoder Added an audio resampler (convert 48000 kHz to 44100 for example) does not work Fixed rate control in the mpeg2 encoder. --- configure.in | 1 + gst/elements/Makefile.am | 2 ++ gst/elements/gstelements.c | 2 ++ plugins/elements/Makefile.am | 2 ++ plugins/elements/gstelements.c | 2 ++ test/Makefile.am | 2 +- test/avi2mpg.c | 4 +++- test/mp2tomp1.c | 30 +++++++++++++++++++++--------- 8 files changed, 34 insertions(+), 11 deletions(-) diff --git a/configure.in b/configure.in index 542948beda..b3349b3365 100644 --- a/configure.in +++ b/configure.in @@ -361,6 +361,7 @@ plugins/visualization/synaesthesia/Makefile plugins/visualization/smoothwave/Makefile plugins/videosink/Makefile plugins/videoscale/Makefile +plugins/audioscale/Makefile plugins/dvdsrc/Makefile plugins/vcdsrc/Makefile plugins/cobin/Makefile diff --git a/gst/elements/Makefile.am b/gst/elements/Makefile.am index 49cc8dcf81..f07e48cd60 100644 --- a/gst/elements/Makefile.am +++ b/gst/elements/Makefile.am @@ -21,6 +21,7 @@ libgstelements_la_SOURCES = \ gstaudiosink.c \ gstaudiosrc.c \ gstfdsink.c \ + gstpipefilter.c \ gstqueue.c \ gstsinesrc.c @@ -35,6 +36,7 @@ noinst_HEADERS = \ gstaudiosink.h \ gstaudiosrc.h \ gstfdsink.h \ + gstpipefilter.h \ gstqueue.h \ gstsinesrc.h diff --git a/gst/elements/gstelements.c b/gst/elements/gstelements.c index 030ea57c72..bf4ba0ee81 100644 --- a/gst/elements/gstelements.c +++ b/gst/elements/gstelements.c @@ -32,6 +32,7 @@ #if HAVE_LIBGHTTP #include #endif /* HAVE_LIBGHTTP */ +#include #include #include @@ -55,6 +56,7 @@ struct _elements_entry _elements[] = { #if HAVE_LIBGHTTP { "httpsrc", gst_httpsrc_get_type, &gst_httpsrc_details }, #endif /* HAVE_LIBGHTTP */ + { "pipefilter", gst_pipefilter_get_type, &gst_pipefilter_details }, { "queue", gst_queue_get_type, &gst_queue_details }, { "sinesrc", gst_sinesrc_get_type, &gst_sinesrc_details }, { NULL, 0 }, diff --git a/plugins/elements/Makefile.am b/plugins/elements/Makefile.am index 49cc8dcf81..f07e48cd60 100644 --- a/plugins/elements/Makefile.am +++ b/plugins/elements/Makefile.am @@ -21,6 +21,7 @@ libgstelements_la_SOURCES = \ gstaudiosink.c \ gstaudiosrc.c \ gstfdsink.c \ + gstpipefilter.c \ gstqueue.c \ gstsinesrc.c @@ -35,6 +36,7 @@ noinst_HEADERS = \ gstaudiosink.h \ gstaudiosrc.h \ gstfdsink.h \ + gstpipefilter.h \ gstqueue.h \ gstsinesrc.h diff --git a/plugins/elements/gstelements.c b/plugins/elements/gstelements.c index 030ea57c72..bf4ba0ee81 100644 --- a/plugins/elements/gstelements.c +++ b/plugins/elements/gstelements.c @@ -32,6 +32,7 @@ #if HAVE_LIBGHTTP #include #endif /* HAVE_LIBGHTTP */ +#include #include #include @@ -55,6 +56,7 @@ struct _elements_entry _elements[] = { #if HAVE_LIBGHTTP { "httpsrc", gst_httpsrc_get_type, &gst_httpsrc_details }, #endif /* HAVE_LIBGHTTP */ + { "pipefilter", gst_pipefilter_get_type, &gst_pipefilter_details }, { "queue", gst_queue_get_type, &gst_queue_details }, { "sinesrc", gst_sinesrc_get_type, &gst_sinesrc_details }, { NULL, 0 }, diff --git a/test/Makefile.am b/test/Makefile.am index 25dce549b0..223e7bb7e5 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,7 +1,7 @@ #noinst_PROGRAMS = basic m types a r plugin w s args mpg123 mcut push qtest noinst_PROGRAMS = qtest spectrum record wave mp3 teardown buffer mp3parse \ mpeg2parse mp1parse mp3play ac3parse ac3play dvdcat fake cobin videotest \ - aviparse vidcapture avi2mpg mp2tomp1 mp1tomp1 + aviparse vidcapture avi2mpg mp2tomp1 mp1tomp1 pipetest SUBDIRS = xml cothreads bindings diff --git a/test/avi2mpg.c b/test/avi2mpg.c index 23203e63c7..784f5c3767 100644 --- a/test/avi2mpg.c +++ b/test/avi2mpg.c @@ -67,7 +67,8 @@ void new_pad_created(GstElement *parse,GstPad *pad,GstElement *pipeline) { smooth = gst_elementfactory_make("smooth","smooth"); //smooth = gst_elementfactory_make("median","median"); g_return_if_fail(smooth != NULL); - //gtk_object_set(GTK_OBJECT(smooth),"filtersize",9,NULL); + gtk_object_set(GTK_OBJECT(smooth),"filtersize",2,NULL); + gtk_object_set(GTK_OBJECT(smooth),"tolerance",4,NULL); encode = gst_elementfactory_make("mpeg2enc","encode"); g_return_if_fail(encode != NULL); fd = open(outfile,O_CREAT|O_RDWR|O_TRUNC); @@ -92,6 +93,7 @@ void new_pad_created(GstElement *parse,GstPad *pad,GstElement *pipeline) { // set up pad connections gst_element_add_ghost_pad(GST_ELEMENT(video_thread), gst_element_get_pad(smooth,"sink")); + //gst_element_get_pad(encode,"sink")); // construct queue and connect everything in the main pipeline video_queue = gst_elementfactory_make("queue","video_queue"); diff --git a/test/mp2tomp1.c b/test/mp2tomp1.c index 7d7b3ef7ec..7ee5249d63 100644 --- a/test/mp2tomp1.c +++ b/test/mp2tomp1.c @@ -6,6 +6,7 @@ #include int fd; +int audiofd; char *outfile; void eof(GstSrc *src) { @@ -17,15 +18,15 @@ void mp2tomp1(GstElement *parser,GstPad *pad, GstElement *pipeline) { GstElement *parse_audio, *parse_video, *decode, *decode_video, *play, *encode; GstElement *audio_queue, *video_queue; GstElement *audio_thread, *video_thread; - GstElement *videoscale; - GstElement *fdsink; - GstElementFactory *fdsinkfactory; + GstElement *videoscale, *audio_encode; + GstElement *fdsink, *audiofdsink; + GstElementFactory *fdsinkfactory, *audiofdsinkfactory; g_print("***** a new pad %s was created\n", gst_pad_get_name(pad)); // connect to audio pad - if (0) { - //if (strncmp(gst_pad_get_name(pad), "private_stream_1.0", 18) == 0) { + //if (0) { + if (strncmp(gst_pad_get_name(pad), "private_stream_1.0", 18) == 0) { gst_plugin_load("ac3parse"); gst_plugin_load("ac3dec"); // construct internal pipeline elements @@ -33,15 +34,23 @@ void mp2tomp1(GstElement *parser,GstPad *pad, GstElement *pipeline) { g_return_if_fail(parse_audio != NULL); decode = gst_elementfactory_make("ac3dec","decode_audio"); g_return_if_fail(decode != NULL); - play = gst_elementfactory_make("audiosink","play_audio"); - g_return_if_fail(play != NULL); + audio_encode = gst_elementfactory_make("pipefilter","audio_encode"); + g_return_if_fail(audio_encode != NULL); // create the thread and pack stuff into it audio_thread = gst_thread_new("audio_thread"); g_return_if_fail(audio_thread != NULL); gst_bin_add(GST_BIN(audio_thread),GST_ELEMENT(parse_audio)); gst_bin_add(GST_BIN(audio_thread),GST_ELEMENT(decode)); - gst_bin_add(GST_BIN(audio_thread),GST_ELEMENT(play)); + gst_bin_add(GST_BIN(audio_thread),GST_ELEMENT(audio_encode)); + + audiofd = open("/opt2/audio.mp3",O_CREAT|O_RDWR|O_TRUNC); + audiofdsinkfactory = gst_elementfactory_find("fdsink"); + g_return_if_fail(audiofdsinkfactory != NULL); + audiofdsink = gst_elementfactory_create(audiofdsinkfactory,"fdsink"); + g_return_if_fail(audiofdsink != NULL); + gtk_object_set(GTK_OBJECT(audiofdsink),"fd",audiofd,NULL); + gst_bin_add(GST_BIN(audio_thread),GST_ELEMENT(audiofdsink)); // set up pad connections gst_element_add_ghost_pad(GST_ELEMENT(audio_thread), @@ -49,7 +58,9 @@ void mp2tomp1(GstElement *parser,GstPad *pad, GstElement *pipeline) { gst_pad_connect(gst_element_get_pad(parse_audio,"src"), gst_element_get_pad(decode,"sink")); gst_pad_connect(gst_element_get_pad(decode,"src"), - gst_element_get_pad(play,"sink")); + gst_element_get_pad(audio_encode,"sink")); + gst_pad_connect(gst_element_get_pad(audio_encode,"src"), + gst_element_get_pad(audiofdsink,"sink")); // construct queue and connect everything in the main pipelie audio_queue = gst_elementfactory_make("queue","audio_queue"); @@ -124,6 +135,7 @@ void mp2tomp1(GstElement *parser,GstPad *pad, GstElement *pipeline) { g_return_if_fail(decode_video != NULL); videoscale = gst_elementfactory_make("videoscale","videoscale"); g_return_if_fail(videoscale != NULL); + gtk_object_set(GTK_OBJECT(videoscale),"width",352, "height", 224,NULL); encode = gst_elementfactory_make("mpeg2enc","encode"); //encode = gst_elementfactory_make("mpeg1encoder","encode"); g_return_if_fail(encode != NULL);