diff src/filewriter/mp3.c @ 2774:f1f7ee810de8

add metadata to stream + flush() should do a real flush at least with mp3
author Andrew O. Shadoura <bugzilla@tut.by>
date Fri, 13 Jun 2008 04:58:39 +0300
parents 6d08e3120615
children 5df83337516f
line wrap: on
line diff
--- a/src/filewriter/mp3.c	Tue Jun 10 21:14:28 2008 +0300
+++ b/src/filewriter/mp3.c	Fri Jun 13 04:58:39 2008 +0300
@@ -33,6 +33,7 @@
 static void mp3_configure(void);
 static gint mp3_open(void);
 static void mp3_write(void *ptr, gint length);
+static void mp3_flush(void);
 static void mp3_close(void);
 static gint mp3_free(void);
 static gint mp3_playing(void);
@@ -45,6 +46,7 @@
     mp3_configure,
     mp3_open,
     mp3_write,
+    mp3_flush,
     mp3_close,
     mp3_free,
     mp3_playing,
@@ -310,6 +312,12 @@
     olen += length;
 }
 
+static void mp3_flush(void)
+{
+    encout = lame_encode_flush_nogap(gfp, encbuffer, ENCBUFFER_SIZE);
+    write_output(encbuffer, encout);
+}
+
 static void mp3_close(void)
 {
     if (output_file)
@@ -319,13 +327,13 @@
 
 //        lame_mp3_tags_fid(gfp, output_file); // will erase id3v2 tag??
 
-        lame_close(gfp);
-        AUDDBG("lame_close() done\n");
-
-        free_lameid3(&lameid3);
-
         olen = 0;
     }
+
+    lame_close(gfp);
+    AUDDBG("lame_close() done\n");
+
+    free_lameid3(&lameid3);
 }
 
 static gint mp3_free(void)