[xiph-cvs] cvs commit: ogg-tools/omplay omplay.c

Jack Moffitt jack at xiph.org
Tue Oct 2 14:58:42 PDT 2001



jack        01/10/02 14:58:41

  Modified:    omplay   omplay.c
  Log:
  Added comment status file

Revision  Changes    Path
1.4       +24 -6     ogg-tools/omplay/omplay.c

Index: omplay.c
===================================================================
RCS file: /usr/local/cvsroot/ogg-tools/omplay/omplay.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- omplay.c	2001/10/01 00:15:07	1.3
+++ omplay.c	2001/10/02 21:58:41	1.4
@@ -44,6 +44,7 @@
 #define STATUS_FILE_PLAY "status.PLAY"
 #define STATUS_FILE_PAUSE "status.PAUSE"
 #define STATUS_FILE_FFWD "status.FFWD"
+#define STATUS_FILE_COMMENTS "status.COMMENTS"
 #define FFWD_SPEED 4
 
 typedef struct status_file_tag
@@ -354,8 +355,8 @@
                 ogg_stream_packetout(device.os_v, &op);
         }
 
-	// at this point we've verified vorbis, and os_m should point to the midi stream
-	// but we need to verify it
+	/* at this point we've verified vorbis, and os_m should point to the midi stream
+	   but we need to verify it */
         if (ogg_stream_packetout(device.os_m, &op) < 0) {
                 printf("Error reading intial header packet for MIDI.\n");
                 close_devices();
@@ -494,7 +495,8 @@
         int samples;
         ogg_int16_t convbuffer[4096];
         int convsize = 4096 / device.vi.channels;
-	int i, err;
+	unsigned i;
+	int err;
         unsigned long count, pos;
         snd_seq_queue_status_t *qs;
 
@@ -504,9 +506,9 @@
                 vorbis_synthesis_blockin(&device.vd, &device.vb);
 
         while ((samples = vorbis_synthesis_pcmout(&device.vd, &pcm)) > 0) {
-		int j;
+		unsigned j;
                 int clipflag = 0;
-		int bout = (samples < convsize ? samples : convsize);
+		unsigned bout = (samples < convsize ? samples : convsize);
 
                 for (i = 0; i < device.vi.channels; i++) {
                         ogg_int16_t *ptr = convbuffer+i;
@@ -652,6 +654,21 @@
         close(device.ffwd.fd);
 }
 
+void print_comments(void)
+{
+	FILE *fp;
+	int i;
+
+	fp = fopen(STATUS_FILE_COMMENTS, "w");
+	if (!fp) return;
+
+	for (i = 0; i < device.vc.comments; i++) {
+		fprintf(fp, "%s\n", device.vc.user_comments[i]);
+	}
+
+	fclose(fp);
+}
+
 int main(int argc, char **argv)
 {
         int err;
@@ -734,6 +751,7 @@
                         close_devices();
                         return -1;
                 }
+		print_comments();
         }
 
         err = set_midi_tempo();
@@ -844,7 +862,7 @@
                                 }
                         }
 
-			// NOTE: this is wrong.  we should wait for _both_ eos's
+			/* NOTE: this is wrong.  we should wait for _both_ eos's*/
                         if (ogg_page_eos(&og)) eos = 1;
                 }
 

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list