Added LAME encoder. Wow.
authorErik Walthinsen <omega@temple-baptist.org>
Tue, 12 Dec 2000 09:40:25 +0000 (09:40 +0000)
committerErik Walthinsen <omega@temple-baptist.org>
Tue, 12 Dec 2000 09:40:25 +0000 (09:40 +0000)
Original commit message from CVS:
Added LAME encoder.  Wow.

configure.in
gst/elements/gstfdsink.c
gst/gstbin.c
gst/gstplugin.c
plugins/elements/gstfdsink.c
tests/Makefile.am
tests/rip.c [new file with mode: 0644]

index d9f045f..a9028fb 100644 (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
index 6e0a36d..389b344 100644 (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);
 }
index e2b9696..ef9725d 100644 (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 {
index 85917b3..3eff53c 100644 (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;
index 6e0a36d..389b344 100644 (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);
 }
index 22b404d..34b5b9b 100644 (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
diff --git a/tests/rip.c b/tests/rip.c
new file mode 100644 (file)
index 0000000..d69544b
--- /dev/null
@@ -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));
+  }
+}