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.
This commit is contained in:
Wim Taymans 2000-05-28 19:59:46 +00:00
parent 49899cf0d8
commit cbb196fd31
8 changed files with 34 additions and 11 deletions

View file

@ -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

View file

@ -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

View file

@ -32,6 +32,7 @@
#if HAVE_LIBGHTTP
#include <gsthttpsrc.h>
#endif /* HAVE_LIBGHTTP */
#include <gstpipefilter.h>
#include <gstqueue.h>
#include <gstsinesrc.h>
@ -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 },

View file

@ -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

View file

@ -32,6 +32,7 @@
#if HAVE_LIBGHTTP
#include <gsthttpsrc.h>
#endif /* HAVE_LIBGHTTP */
#include <gstpipefilter.h>
#include <gstqueue.h>
#include <gstsinesrc.h>
@ -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 },

View file

@ -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

View file

@ -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");

View file

@ -6,6 +6,7 @@
#include <gst/gst.h>
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);