[Cvs-annodex] commit (annodex): liboggplay/trunk/configure.ac liboggplay/trunk/include/oggplay/oggplay_callback_info.h liboggplay/trunk/src/liboggplay/Version_script.in liboggplay/trunk/src/liboggplay/oggplay_callback.c liboggplay/trunk/src/liboggplay/oggplay_callback_info.c liboggplay/trunk/src/liboggplay/oggplay_data.c liboggplay/trunk/src/liboggplay/oggplay_data.h liboggplay/trunk/src/liboggplay/oggplay_private.h liboggplay/trunk/src/tests/Makefile.am liboggplay/trunk/src/tests/dump-all-streams.c

shans nobody at lists.annodex.net
Wed Sep 20 06:09:28 UTC 2006


Update of /var/local/lib/svn/annodex (new revision 2505)

Modified files:
   liboggplay/trunk/configure.ac
   liboggplay/trunk/include/oggplay/oggplay_callback_info.h
   liboggplay/trunk/src/liboggplay/Version_script.in
   liboggplay/trunk/src/liboggplay/oggplay_callback.c
   liboggplay/trunk/src/liboggplay/oggplay_callback_info.c
   liboggplay/trunk/src/liboggplay/oggplay_data.c
   liboggplay/trunk/src/liboggplay/oggplay_data.h
   liboggplay/trunk/src/liboggplay/oggplay_private.h
   liboggplay/trunk/src/tests/Makefile.am
   liboggplay/trunk/src/tests/dump-all-streams.c

Log Message:
Audio dumping added, switched default audio to interleaved.  The dumping
is not quite right yet



Modified: liboggplay/trunk/configure.ac
===================================================================
--- liboggplay/trunk/configure.ac	2006-09-20 01:44:05 UTC (rev 2504)
+++ liboggplay/trunk/configure.ac	2006-09-20 06:09:28 UTC (rev 2505)
@@ -73,6 +73,9 @@
 
 PKG_CHECK_MODULES(FISHSOUND, fishsound)
 AC_SUBST(FISHSOUND_LIBS)
+
+PKG_CHECK_MODULES(SNDFILE, sndfile)
+AC_SUBST(SNDFILE_LIBS)
         
 dnl Use -Wall if we have gcc.
 dnl changequote(,)dnl

Modified: liboggplay/trunk/include/oggplay/oggplay_callback_info.h
===================================================================
--- liboggplay/trunk/include/oggplay/oggplay_callback_info.h	2006-09-20 01:44:05 UTC (rev 2504)
+++ liboggplay/trunk/include/oggplay/oggplay_callback_info.h	2006-09-20 06:09:28 UTC (rev 2505)
@@ -45,10 +45,7 @@
   unsigned char   * v;
 } OggPlayVideoData;
 
-typedef struct {
-  short           * left;
-  short           * right;
-} OggPlayAudioData;
+typedef void * OggPlayAudioData;
 
 struct _OggPlayDataHeader;
 typedef struct _OggPlayDataHeader OggPlayDataHeader;

Modified: liboggplay/trunk/src/liboggplay/Version_script.in
===================================================================
--- liboggplay/trunk/src/liboggplay/Version_script.in	2006-09-20 01:44:05 UTC (rev 2504)
+++ liboggplay/trunk/src/liboggplay/Version_script.in	2006-09-20 06:09:28 UTC (rev 2505)
@@ -32,6 +32,7 @@
                 oggplay_callback_info_get_headers;
 		            oggplay_callback_info_get_record_size;
                 oggplay_callback_info_get_video_data;
+                oggplay_callback_info_get_audio_data;
         local:
                 *;
 };

Modified: liboggplay/trunk/src/liboggplay/oggplay_callback.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_callback.c	2006-09-20 01:44:05 UTC (rev 2504)
+++ liboggplay/trunk/src/liboggplay/oggplay_callback.c	2006-09-20 06:09:28 UTC (rev 2505)
@@ -156,7 +156,7 @@
 }
 
 int
-oggplay_fish_sound_callback_shorts(FishSound * fsound, short * pcm[], 
+oggplay_fish_sound_callback_shorts(FishSound * fsound, short ** pcm, 
                                           long frames, void *user_data) {
 
   OggPlayVorbisDecode *decoder = (OggPlayVorbisDecode *)user_data;
@@ -166,7 +166,7 @@
                     sizeof(FishSoundInfo));
   }
   
-  oggplay_data_handle_vorbis_data(&(decoder->decoder), pcm[0], pcm[1], frames, 
+  oggplay_data_handle_vorbis_data(&(decoder->decoder), (short *)pcm, frames, 
               sizeof(short));
   return FISH_SOUND_CONTINUE;
 }
@@ -179,8 +179,9 @@
   decoder->sound_handle = fish_sound_new(FISH_SOUND_DECODE, 
                                                       &(decoder->sound_info));
 
-  fish_sound_set_interleave(decoder->sound_handle, 0);
-  fish_sound_set_decoded_short(decoder->sound_handle, 
+  decoder->sound_info.channels = 0;  
+  fish_sound_set_interleave(decoder->sound_handle, 1);
+  fish_sound_set_decoded_short_ilv(decoder->sound_handle, 
                                       oggplay_fish_sound_callback_shorts, 
                                       (void *)decoder);
  

Modified: liboggplay/trunk/src/liboggplay/oggplay_callback_info.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_callback_info.c	2006-09-20 01:44:05 UTC (rev 2504)
+++ liboggplay/trunk/src/liboggplay/oggplay_callback_info.c	2006-09-20 06:09:28 UTC (rev 2505)
@@ -180,5 +180,5 @@
     return NULL;
   }
 
-  return &((OggPlayAudioRecord *)header)->data;
+  return ((OggPlayAudioRecord *)header)->data;
 }

Modified: liboggplay/trunk/src/liboggplay/oggplay_data.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_data.c	2006-09-20 01:44:05 UTC (rev 2504)
+++ liboggplay/trunk/src/liboggplay/oggplay_data.c	2006-09-20 06:09:28 UTC (rev 2505)
@@ -130,30 +130,23 @@
 }
 
 void
-oggplay_data_handle_vorbis_data (OggPlayDecode *decode, void *datal, 
-      void *datar, int samples, int samplesize) {
+oggplay_data_handle_vorbis_data (OggPlayDecode *decode, void *data, 
+      int samples, int samplesize) {
 
   int                   num_channels;
   OggPlayAudioRecord  * record;
   
   num_channels = ((OggPlayVorbisDecode *)decode)->sound_info.channels;
-  record = malloc(sizeof (OggPlayAudioRecord) + 
-                    samples * samplesize * num_channels);
+  record = malloc(sizeof(OggPlayAudioRecord) + 
+                  samples * samplesize * num_channels);
 
   oggplay_data_initialise_header(decode, &(record->header));
 
   record->header.samples_in_record = samples;
   
-  record->data.left = (void *)(record + 1);
+  record->data = (void *)(record + 1);
           
-  memcpy(record->data.left, datal, samples * samplesize);
-  if (num_channels > 1) {
-    record->data.right 
-            = (void *)(((char *)record->data.left) + samples * samplesize);
-    memcpy(record->data.right, datar, samples * samplesize);
-  } else {
-    record->data.right = NULL;
-  }
+  memcpy(record->data, data, samples * samplesize * num_channels);
   
   oggplay_data_add_to_list(decode, &(record->header));
 }

Modified: liboggplay/trunk/src/liboggplay/oggplay_data.h
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_data.h	2006-09-20 01:44:05 UTC (rev 2504)
+++ liboggplay/trunk/src/liboggplay/oggplay_data.h	2006-09-20 06:09:28 UTC (rev 2505)
@@ -46,8 +46,8 @@
                                   yuv_buffer *buffer);
 
 void
-oggplay_data_handle_vorbis_data (OggPlayDecode *decode, void *datal, 
-      void *datar, int samples, int samplesize);
+oggplay_data_handle_vorbis_data (OggPlayDecode *decode, void *data, 
+                                 int samples, int samplesize);
 
 void
 oggplay_data_clean_list (OggPlayDecode *decode);

Modified: liboggplay/trunk/src/liboggplay/oggplay_private.h
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_private.h	2006-09-20 01:44:05 UTC (rev 2504)
+++ liboggplay/trunk/src/liboggplay/oggplay_private.h	2006-09-20 06:09:28 UTC (rev 2505)
@@ -58,7 +58,7 @@
 
 typedef struct {
   OggPlayDataHeader   header;
-  OggPlayAudioData    data;
+  void              * data;
 } OggPlayAudioRecord;
 
 struct _OggPlay;

Modified: liboggplay/trunk/src/tests/Makefile.am
===================================================================
--- liboggplay/trunk/src/tests/Makefile.am	2006-09-20 01:44:05 UTC (rev 2504)
+++ liboggplay/trunk/src/tests/Makefile.am	2006-09-20 06:09:28 UTC (rev 2505)
@@ -6,7 +6,7 @@
 
 OGGPLAYDIR = ../liboggplay
 OGGPLAY_LIBS = $(OGGPLAYDIR)/liboggplay.la @OGGZ_LIBS@ @XIPH_LIBS@ \
-	       @FISHSOUND_LIBS@
+	       @FISHSOUND_LIBS@ @SNDFILE_LIBS@
 
 # Test programs
 

Modified: liboggplay/trunk/src/tests/dump-all-streams.c
===================================================================
--- liboggplay/trunk/src/tests/dump-all-streams.c	2006-09-20 01:44:05 UTC (rev 2504)
+++ liboggplay/trunk/src/tests/dump-all-streams.c	2006-09-20 06:09:28 UTC (rev 2505)
@@ -4,6 +4,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <sndfile.h>
+
 static int n_frames = 0;
 
 void
@@ -56,6 +58,25 @@
   
 }
 
+static SNDFILE * sndfile = NULL;
+
+void
+dump_audio_data (OggPlay * player, int track, OggPlayAudioData * data, 
+                int size) {
+
+  if (sndfile == NULL) {
+    SF_INFO sfinfo;
+    sfinfo.samplerate = oggplay_get_audio_samplerate(player, track);
+    sfinfo.channels = oggplay_get_audio_channels(player, track);
+    sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
+
+    sndfile = sf_open ("audio", SFM_WRITE, &sfinfo);
+  }
+
+  sf_writef_short (sndfile, data, size);
+  
+}
+
 int
 dump_streams_callback (OggPlay *player, int num_tracks, 
                        OggPlayCallbackInfo **track_info, void *user) {
@@ -87,6 +108,8 @@
         for (j = 0; j < required; j++) {
           int size;
           size = oggplay_callback_info_get_record_size(headers[j]);
+          audio_data = oggplay_callback_info_get_audio_data(headers[j]);
+          dump_audio_data(player, i, audio_data, size);
         }
       default:
         break;
@@ -135,6 +158,8 @@
   oggplay_set_data_callback(player, dump_streams_callback, NULL);
   oggplay_start_decoding(player);
 
+  sf_close(sndfile);
+  
   printf("there were %d frames\n", n_frames);
   
 }


-- 
shans



More information about the cvs-annodex mailing list