Added LAME encoder. Wow.

Original commit message from CVS:
Added LAME encoder.  Wow.
This commit is contained in:
Erik Walthinsen 2000-12-12 09:40:25 +00:00
parent ffbc7201a7
commit 5f7a20ff6f
7 changed files with 61 additions and 5 deletions

View file

@ -429,6 +429,8 @@ plugins/mp3decode/xa/Makefile
plugins/mp3decode/xing/Makefile
plugins/mp3decode/mpg123/Makefile
plugins/mp3decode/parse/Makefile
plugins/mp3encode/Makefile
plugins/mp3encode/lame/Makefile
plugins/mpeg2/Makefile
plugins/mpeg2/parse/Makefile
plugins/mpeg2/ac3parse/Makefile

View file

@ -116,8 +116,10 @@ gst_fdsink_chain (GstPad *pad, GstBuffer *buf)
g_return_if_fail (fdsink->fd >= 0);
if (GST_BUFFER_DATA (buf))
if (GST_BUFFER_DATA (buf)) {
DEBUG("writing %d bytes to file descriptor %d\n",GST_BUFFER_SIZE (buf), fdsink->fd);
write (fdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
}
gst_buffer_unref (buf);
}

View file

@ -794,7 +794,7 @@ gst_bin_create_plan_func (GstBin *bin)
gst_bin_create_plan (GST_BIN (element));
} else if (GST_IS_SRC (element)) {
DEBUG("adding '%s' as entry point\n",gst_element_get_name (element));
DEBUG("adding '%s' as entry point, because it's a source\n",gst_element_get_name (element));
bin->entries = g_list_prepend (bin->entries,element);
bin->numentries++;
cothread_setfunc(element->threadstate,gst_bin_src_wrapper,0,(char **)element);
@ -859,7 +859,7 @@ GST_DEBUG_PAD_NAME(pad->peer),GST_DEBUG_PAD_NAME(pad),&pad->pullfunc);
gst_bin_create_plan (GST_BIN (element));
}
if (GST_IS_SRC (element)) {
g_print("gstbin: adding '%s' as entry point\n",gst_element_get_name (element));
g_print("adding '%s' as entry point, because it's a source\n",gst_element_get_name (element));
bin->entries = g_list_prepend (bin->entries, element);
bin->numentries++;
} else {

View file

@ -270,6 +270,7 @@ gboolean gst_plugin_load_absolute(gchar *name) {
GstPlugin *gst_plugin_new(gchar *name) {
GstPlugin *plugin = (GstPlugin *)g_malloc(sizeof(GstPlugin));
// FIXME need to make sure the plugin hasn't already loaded
plugin->name = g_strdup(name);
plugin->longname = NULL;
plugin->types = NULL;

View file

@ -116,8 +116,10 @@ gst_fdsink_chain (GstPad *pad, GstBuffer *buf)
g_return_if_fail (fdsink->fd >= 0);
if (GST_BUFFER_DATA (buf))
if (GST_BUFFER_DATA (buf)) {
DEBUG("writing %d bytes to file descriptor %d\n",GST_BUFFER_SIZE (buf), fdsink->fd);
write (fdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
}
gst_buffer_unref (buf);
}

View file

@ -1,4 +1,4 @@
noinst_PROGRAMS = init loadall simplefake states caps queue registry paranoia
noinst_PROGRAMS = init loadall simplefake states caps queue registry paranoia rip
LDADD = $(GLIB_LIBS) $(GTK_LIBS) $(top_builddir)/gst/libgst.la
CFLAGS = -Wall

49
tests/rip.c Normal file
View file

@ -0,0 +1,49 @@
#include <gst/gst.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main(int argc,char *argv[]) {
GstPipeline *pipeline;
GstElement *paranoia,*lame,*sink;
int i;
int outfile;
DEBUG_ENTER("(%d)",argc);
gst_init(&argc,&argv);
unlink(argv[1]);
outfile = open(argv[1],O_CREAT | O_RDWR | O_TRUNC);
if (!outfile) {
fprintf(stderr,"couldn't open file\n");
exit(1);
}
fprintf(stderr,"outfile is fd %d\n",outfile);
pipeline = gst_pipeline_new("ripper");
paranoia = gst_elementfactory_make("cdparanoia","paranoia");
g_return_val_if_fail(1,paranoia != NULL);
lame = gst_elementfactory_make("lame","lame");
g_return_val_if_fail(2,lame != NULL);
gtk_object_set(GTK_OBJECT(lame),"bitrate",320,NULL);
sink = gst_elementfactory_make("fdsink","fdsink");
g_return_val_if_fail(3,sink != NULL);
gtk_object_set(GTK_OBJECT(sink),"fd",outfile,NULL);
fprintf(stderr,"paranoia is %p, lame is %p, sink is %p\n",paranoia,lame,sink);
gst_bin_add(GST_BIN(pipeline),paranoia);
gst_bin_add(GST_BIN(pipeline),lame);
gst_bin_add(GST_BIN(pipeline),sink);
gst_element_connect(paranoia,"src",lame,"sink");
gst_element_connect(lame,"src",sink,"sink");
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
if (GST_STATE(paranoia) != GST_STATE_PLAYING) fprintf(stderr,"error: state not set\n");
for (i=0;i<((argc >= 3)?atoi(argv[2]):4500);i++) {
fprintf(stderr,"\n");
gst_bin_iterate(GST_BIN(pipeline));
}
}