[xiph-cvs] cvs commit: vorbis-tools/vorbiscomment vcedit.c

Michael Smith msmith at xiph.org
Thu Jan 18 02:54:33 PST 2001



msmith      01/01/18 02:54:33

  Modified:    include/ogg ogg.h
               src      framing.c
               include/vorbis codec.h
               lib      info.c
               vorbiscomment vcedit.c
  Log:
  Added vorbis_commentheader_out() to vorbis
  Added ogg_packet_clear to ogg
  
  Updated vcedit.c to use them. There's now enough source there to build a working and useful comment editor.

Revision  Changes    Path
1.8       +2 -0      ogg/include/ogg/ogg.h

Index: ogg.h
===================================================================
RCS file: /usr/local/cvsroot/ogg/include/ogg/ogg.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ogg.h	2000/11/05 23:50:21	1.7
+++ ogg.h	2001/01/18 10:54:30	1.8
@@ -147,6 +147,8 @@
 extern long     ogg_page_pageno(ogg_page *og);
 extern int      ogg_page_packets(ogg_page *og);
 
+extern void     ogg_packet_clear(ogg_packet *op);
+
 
 #ifdef __cplusplus
 }

1.9       +6 -1      ogg/src/framing.c

Index: framing.c
===================================================================
RCS file: /usr/local/cvsroot/ogg/src/framing.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- framing.c	2000/11/13 23:54:59	1.8
+++ framing.c	2001/01/18 10:54:30	1.9
@@ -13,7 +13,7 @@
 
  function: code raw [Vorbis] packets into framed OggSquish stream and
            decode Ogg streams back into raw packets
- last mod: $Id: framing.c,v 1.8 2000/11/13 23:54:59 xiphmont Exp $
+ last mod: $Id: framing.c,v 1.9 2001/01/18 10:54:30 msmith Exp $
 
  note: The CRC code is directly derived from public domain code by
  Ross Williams (ross at guest.adelaide.edu.au).  See docs/framing.html
@@ -813,6 +813,11 @@
   }
   os->packetno++;
   return(1);
+}
+
+void ogg_packet_clear(ogg_packet *op) {
+  free(op->packet);
+  memset(op, 0, sizeof(ogg_packet));
 }
 
 #ifdef _V_SELFTEST

1.34      +2 -1      vorbis/include/vorbis/codec.h

Index: codec.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/include/vorbis/codec.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- codec.h	2000/11/06 00:06:55	1.33
+++ codec.h	2001/01/18 10:54:31	1.34
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: libvorbis codec headers
- last mod: $Id: codec.h,v 1.33 2000/11/06 00:06:55 xiphmont Exp $
+ last mod: $Id: codec.h,v 1.34 2001/01/18 10:54:31 msmith Exp $
 
  ********************************************************************/
 
@@ -178,6 +178,7 @@
 /* Vorbis PRIMITIVES: analysis/DSP layer ****************************/
 
 extern int      vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi);
+extern int      vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op);
 extern int      vorbis_analysis_headerout(vorbis_dsp_state *v,
                                           vorbis_comment *vc,
                                           ogg_packet *op,

1.34      +20 -1     vorbis/lib/info.c

Index: info.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/info.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- info.c	2000/11/14 00:05:31	1.33
+++ info.c	2001/01/18 10:54:32	1.34
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: maintain the info structure, info <-> header packets
- last mod: $Id: info.c,v 1.33 2000/11/14 00:05:31 xiphmont Exp $
+ last mod: $Id: info.c,v 1.34 2001/01/18 10:54:32 msmith Exp $
 
  ********************************************************************/
 
@@ -493,6 +493,25 @@
 err_out:
   return(-1);
 } 
+
+int vorbis_commentheader_out(vorbis_comment *vc,
+    				      ogg_packet *op){
+
+  oggpack_buffer opb;
+
+  oggpack_writeinit(&opb);
+  if(_vorbis_pack_comment(&opb,vc)) return OV_EIMPL;
+
+  op->packet = _ogg_malloc(oggpack_bytes(&opb));
+  memcpy(op->packet, opb.buffer, oggpack_bytes(&opb));
+
+  op->bytes=oggpack_bytes(&opb);
+  op->b_o_s=0;
+  op->e_o_s=0;
+  op->granulepos=0;
+
+  return 0;
+}
 
 int vorbis_analysis_headerout(vorbis_dsp_state *v,
                               vorbis_comment *vc,

1.2       +3 -3      vorbis-tools/vorbiscomment/vcedit.c

Index: vcedit.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/vorbiscomment/vcedit.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- vcedit.c	2001/01/17 11:02:45	1.1
+++ vcedit.c	2001/01/18 10:54:32	1.2
@@ -6,7 +6,7 @@
  *
  * Comment editing backend, suitable for use by nice frontend interfaces.
  *
- * last modified: $Id: vcedit.c,v 1.1 2001/01/17 11:02:45 msmith Exp $
+ * last modified: $Id: vcedit.c,v 1.2 2001/01/18 10:54:32 msmith Exp $
  */
 
 
@@ -199,7 +199,7 @@
 
         ogg_stream_init(&streamout, state->serial);
 
-	vorbis_analysis_commentheader_out(state->vc, &header_comments);
+	vorbis_commentheader_out(state->vc, &header_comments);
 
         ogg_stream_packetin(&streamout, &header_main);
         ogg_stream_packetin(&streamout, &header_comments);
@@ -264,7 +264,7 @@
 
         vorbis_comment_clear(state->vc);
 
-	vorbis_analysis_commentheader_clear(&header_comments);
+	ogg_packet_clear(&header_comments);
         free(state->mainbuf);
         free(state->bookbuf);
 

--- >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