[xiph-cvs] cvs commit: vorbis-python/test ogg123.py

Andrew Catham Master of Python andrew at xiph.org
Fri Jun 1 13:54:48 PDT 2001



andrew      01/06/01 13:54:48

  Modified:    .        ChangeLog
               src      general.c general.h pyvorbiscodec.c pyvorbiscodec.h
                        pyvorbisfile.c pyvorbisfile.h pyvorbisinfo.c
                        pyvorbisinfo.h vorbismodule.h
               test     ogg123.py
  Log:
  6-01-2001  Andrew H. Chatham <andrew.chatham at duke.edu>
          * src/pyvorbisinfo.c  (py_comment_as_dict): Fixed call with args=NULL
          ogg123.py works now
  
          * src/*.h src/*.c: Changed to C-style comments
  
          * test/ogg123.py: Removed stupid print statement

Revision  Changes    Path
1.3       +8 -0      vorbis-python/ChangeLog

Index: ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/vorbis-python/ChangeLog,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ChangeLog	2001/05/14 15:37:44	1.2
+++ ChangeLog	2001/06/01 20:54:45	1.3
@@ -1,3 +1,11 @@
+6-01-2001  Andrew H. Chatham <andrew.chatham at duke.edu>
+	* src/pyvorbisinfo.c  (py_comment_as_dict): Fixed call with args=NULL
+	ogg123.py works now
+
+	* src/*.h src/*.c: Changed to C-style comments
+
+	* test/ogg123.py: Removed stupid print statement
+
 5-14-2001  Andrew H. Chatham <andrew.chatham at duke.edu>
         * setup.py: Bumped to version 0.3
 

1.3       +1 -1      vorbis-python/src/general.c

Index: general.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-python/src/general.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- general.c	2001/05/14 15:37:44	1.2
+++ general.c	2001/06/01 20:54:46	1.3
@@ -1,4 +1,4 @@
 #include "general.h"
 #include <pyogg/pyogg.h>
 
-// for now, just take arg_to_int64 from pyogg
+/* for now, just take arg_to_int64 from pyogg */

1.3       +1 -1      vorbis-python/src/general.h

Index: general.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis-python/src/general.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- general.h	2001/05/14 15:37:44	1.2
+++ general.h	2001/06/01 20:54:46	1.3
@@ -14,7 +14,7 @@
 #define FDEF(x) static PyObject *py_##x (PyObject *self, PyObject *args); \
 static char py_##x##_doc[] = 
 
-#endif // __GENERAL_H__
+#endif /* __GENERAL_H__ */
 
 
 

1.3       +11 -11    vorbis-python/src/pyvorbiscodec.c

Index: pyvorbiscodec.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-python/src/pyvorbiscodec.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pyvorbiscodec.c	2001/05/14 15:37:44	1.2
+++ pyvorbiscodec.c	2001/06/01 20:54:46	1.3
@@ -150,13 +150,13 @@
   if (!PyArg_ParseTuple(args, ""))
     return NULL;
 
-  // Takes a comment object as the argument.
-  // I'll just give them an empty one if they don't provied one.
+  /* Takes a comment object as the argument.
+     I'll just give them an empty one if they don't provied one. */
   if (!PyArg_ParseTuple(args, "|O!", &py_vcomment_type, &comm))
     return NULL;
   
   if (comm == NULL) {
-    vorbis_comment_init(&vc); // Initialize an empty comment struct
+    vorbis_comment_init(&vc); /* Initialize an empty comment struct */
   } else {
     vc = comm->vc;
   }
@@ -167,7 +167,7 @@
     goto finish;
   }
   
-  // Returns a tuple of oggpackets (header, header_comm, header_code)
+  /* Returns a tuple of oggpackets (header, header_comm, header_code) */
   
   pyheader = modinfo->ogg_packet_from_packet(&header);
   pyheader_comm = modinfo->ogg_packet_from_packet(&header_comm);
@@ -181,7 +181,7 @@
   PyTuple_SET_ITEM(ret, 2, pyheader_code);
   
  finish:
-  if (comm == NULL) // Get rid of it if we created it
+  if (comm == NULL) /* Get rid of it if we created it */
     vorbis_comment_clear(&vc);
   return ret;
  error:
@@ -208,9 +208,9 @@
   return ret;
 }
 
-// Returns "len" if all arguments are strings of the same length, 
-// -1 if one or more are not strings
-// -2 if they have different lengths
+/* Returns "len" if all arguments are strings of the same length, 
+   -1 if one or more are not strings
+   -2 if they have different lengths */
 
 #define NON_STRING -1
 #define DIFF_LENGTHS -2
@@ -227,7 +227,7 @@
     if (!PyString_Check(cur))
       return NON_STRING;
 
-    // make sure the lengths are uniform
+    /* make sure the lengths are uniform */
     if (len == -1)
       len = PyString_Size(cur);
     else
@@ -289,7 +289,7 @@
   
   vorbis_analysis_wrote(&dsp_self->vd, samples);
 
-  return PyInt_FromLong(samples); // return the number of samples written
+  return PyInt_FromLong(samples); /* return the number of samples written */
 }
 
 static PyObject *
@@ -369,7 +369,7 @@
   if (!PyArg_ParseTuple(args, ""))
     return NULL;
 
-  vorbis_analysis(&b_self->vb, &op); //TODO error code
+  vorbis_analysis(&b_self->vb, &op); /* TODO error code */
   return modinfo->ogg_packet_from_packet(&op);
 }
 

1.3       +1 -1      vorbis-python/src/pyvorbiscodec.h

Index: pyvorbiscodec.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis-python/src/pyvorbiscodec.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pyvorbiscodec.h	2001/05/14 15:37:44	1.2
+++ pyvorbiscodec.h	2001/06/01 20:54:46	1.3
@@ -25,7 +25,7 @@
 PyObject *py_dsp_from_dsp(vorbis_dsp_state *vd, PyObject *parent);
 PyObject *py_block_from_block(vorbis_block *vb, PyObject *parent);
 
-#endif //__VORBISCODEC_H__
+#endif /* __VORBISCODEC_H__ */
 
 
 

1.3       +2 -2      vorbis-python/src/pyvorbisfile.c

Index: pyvorbisfile.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-python/src/pyvorbisfile.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pyvorbisfile.c	2001/05/14 15:37:44	1.2
+++ pyvorbisfile.c	2001/06/01 20:54:46	1.3
@@ -152,7 +152,7 @@
 };
 
 PyObject *
-py_file_new(PyObject *self, PyObject *args) //change to accept kwarg
+py_file_new(PyObject *self, PyObject *args) /* change to accept kwarg */
 { 
   PyObject *ret;
   
@@ -203,7 +203,7 @@
 
   } else if (PyArg_ParseTuple(args, "O!|sl", &PyFile_Type, &fobject,
                               &initial, &ibytes)) {
-    PyErr_Clear(); //clear first failure
+    PyErr_Clear(); /* clear first failure */
 
     file = PyFile_AsFile(fobject);
 

1.3       +1 -1      vorbis-python/src/pyvorbisfile.h

Index: pyvorbisfile.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis-python/src/pyvorbisfile.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pyvorbisfile.h	2001/05/14 15:37:44	1.2
+++ pyvorbisfile.h	2001/06/01 20:54:46	1.3
@@ -12,7 +12,7 @@
 #define PY_VORBISFILE(x) (((py_vorbisfile *)x)->ovf)
 extern PyTypeObject py_vorbisfile_type;
 
-#endif // __PYVORBIS_FILE_H__
+#endif /* __PYVORBIS_FILE_H__ */
 
 
 

1.3       +19 -17    vorbis-python/src/pyvorbisinfo.c

Index: pyvorbisinfo.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-python/src/pyvorbisinfo.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pyvorbisinfo.c	2001/05/14 15:37:44	1.2
+++ pyvorbisinfo.c	2001/06/01 20:54:46	1.3
@@ -283,8 +283,9 @@
 
 
 
-// I store the parent since I don't think the vorbis_comment data will actually
-// stick around if we let the vorbis_file object get freed.
+/* I store the parent since I don't think the vorbis_comment data will
+   actually stick around if we let the vorbis_file object get
+   freed. */
 
 PyObject *
 py_comment_new_from_vc(vorbis_comment *vc, PyObject *parent)
@@ -335,7 +336,7 @@
   py_vcomment *ovc_self = (py_vcomment *) self;
 
   if (ovc_self->parent)
-    Py_DECREF(ovc_self->parent); //parent will clear for us
+    Py_DECREF(ovc_self->parent); /* parent will clear for us */
   else
     vorbis_comment_clear(&ovc_self->vc); 
 
@@ -465,7 +466,7 @@
 
   while (PyDict_Next(dict, &curitem, &key, &val) > 0) {
     assert(PyList_Check(val));
-    //flatten out the list
+    /* flatten out the list */
     for (j = 0; j < PyList_Size(val); j++) {
       tuple = PyTuple_New(2);
 
@@ -500,7 +501,7 @@
 
   while (PyDict_Next (dict, &curitem, &key, &val)) {
     assert(PyList_Check(val));
-    //flatten out the list
+    /* flatten out the list */ 
     for (j = 0; j < PyList_Size(val); j++) {
       curval = PyList_GET_ITEM(val, j);
       PyList_Append(retlist, curval);
@@ -531,8 +532,8 @@
   py_vcomment *ovc_self = (py_vcomment *) self;
   char *comment, *tag;
 
-  // TODO: What will this store if it's unicode? I think UTF-16, want UTF-8.
-  // TODO: Learn Unicode!!
+  /* TODO: What will this store if it's unicode? I think UTF-16, want UTF-8.
+     TODO: Learn Unicode!! */
   if (!PyArg_ParseTuple(args, "ss", &comment, &tag))
     return NULL;
 
@@ -593,15 +594,16 @@
 
   PyObject *retdict, *curlist, *item, *vendor_obj;
   
-  if (!PyArg_ParseTuple(args, ""))
+  /* This can be called with args=NULL as a helper function */
+  if (args != NULL && !PyArg_ParseTuple(args, ""))
     return NULL;
 
   comment = &ovc_self->vc;
   retdict = PyDict_New();
 
 
-  // If the vendor is set, set the key "VENDOR" to map to a 
-  // singleton list with the vendor value in it.
+  /* If the vendor is set, set the key "VENDOR" to map to a 
+     singleton list with the vendor value in it. */
 
   if (comment->vendor != NULL) {
     curlist = PyList_New(1);
@@ -612,9 +614,9 @@
   } else 
     vendor_obj = NULL;
 
-  //These first few lines taken from the Perl bindings
+  /* These first few lines taken from the Perl bindings */
   for (i = 0; i < comment->comments; i++) {
-    //don't want to limit this, I guess
+    /* don't want to limit this, I guess */
     key = strdup(comment->user_comments[i]); 
     
     if ((val = strchr(key, '='))) {
@@ -631,15 +633,15 @@
       if (!item)
         goto error;
       
-      if (make_caps_key(key, keylen)) { // overwrites key
+      if (make_caps_key(key, keylen)) { /* overwrites key */
         Py_DECREF(item);
         goto error;
       }
 
-      // GetItem borrows a reference
+      /* GetItem borrows a reference */
       if ((curlist = PyDict_GetItemString(retdict, key))) {
 
-	// A list already exists for that key
+	/* A list already exists for that key */
         if (PyList_Append(curlist, item) < 0) {
           Py_DECREF(item);
           goto error;
@@ -647,12 +649,12 @@
 
       } else {
 
-	// Add a new list in that position
+	/* Add a new list in that position */
         curlist = PyList_New(1);
         PyList_SET_ITEM(curlist, 0, item);
         Py_INCREF(item);
 
-	//this does not steal a reference
+	/* this does not steal a reference */
         PyDict_SetItemString(retdict, key, curlist); 
         Py_DECREF(curlist);
       }

1.3       +1 -1      vorbis-python/src/pyvorbisinfo.h

Index: pyvorbisinfo.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis-python/src/pyvorbisinfo.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pyvorbisinfo.h	2001/05/14 15:37:44	1.2
+++ pyvorbisinfo.h	2001/06/01 20:54:46	1.3
@@ -26,5 +26,5 @@
 PyObject *py_comment_new_from_vc(vorbis_comment *vc, PyObject *parent);
 PyObject *py_comment_new(PyObject *, PyObject *);
 
-#endif // __PYVORBIS_INFO_H__
+#endif /* __PYVORBIS_INFO_H__ */
 

1.2       +4 -4      vorbis-python/src/vorbismodule.h

Index: vorbismodule.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis-python/src/vorbismodule.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- vorbismodule.h	2001/02/06 03:20:48	1.1
+++ vorbismodule.h	2001/06/01 20:54:46	1.2
@@ -10,20 +10,20 @@
 
 PyObject *Py_VorbisError;
 
-// Object docstrings
+/* Object docstrings */
 
 extern char py_vorbisfile_doc[];
 extern char py_vinfo_doc[];
 extern char py_vcomment_doc[];
 extern char py_dsp_doc[];
 
-// Module-accessible functions
+/* Module-accessible functions */
 
 PyObject *py_file_new(PyObject *, PyObject *);
 PyObject *py_info_new(PyObject *, PyObject *, PyObject *);
 PyObject *py_comment_new(PyObject *, PyObject *);
 
-// Utility functions/macros
+/* Utility functions/macros */
 
 PyObject *v_error_from_code(int, char*);
 
@@ -34,5 +34,5 @@
                                    return Py_None;
 
 
-#endif // __VORBISMODULE_H__
+#endif /* __VORBISMODULE_H__ */
 

1.3       +0 -1      vorbis-python/test/ogg123.py

Index: ogg123.py
===================================================================
RCS file: /usr/local/cvsroot/vorbis-python/test/ogg123.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ogg123.py	2001/05/14 15:37:46	1.2
+++ ogg123.py	2001/06/01 20:54:47	1.3
@@ -100,7 +100,6 @@
         if id is None:
             id = ao.get_driver_id('esd')
         self.dev = ao.AudioDevice(id)
-        print "Hey"
 
     def write(self, buff, bytes):
         self.dev.play(buff, bytes)

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