[pulseaudio-commits] r2230 - in /branches/glitch-free/src/pulse: proplist.c proplist.h

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Wed Apr 9 06:49:05 PDT 2008


Author: lennart
Date: Wed Apr  9 15:49:04 2008
New Revision: 2230

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2230&root=pulseaudio&view=rev
Log:
add new pa_proplist_setf() API function

Modified:
    branches/glitch-free/src/pulse/proplist.c
    branches/glitch-free/src/pulse/proplist.h

Modified: branches/glitch-free/src/pulse/proplist.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/pulse/proplist.c?rev=2230&root=pulseaudio&r1=2229&r2=2230&view=diff
==============================================================================
--- branches/glitch-free/src/pulse/proplist.c (original)
+++ branches/glitch-free/src/pulse/proplist.c Wed Apr  9 15:49:04 2008
@@ -102,6 +102,28 @@
     return 0;
 }
 
+/** Will accept only valid UTF-8 */
+int pa_proplist_setf(pa_proplist *p, const char *key, const char *format, ...) {
+    va_list ap;
+    int r;
+    char *t;
+
+    pa_assert(p);
+    pa_assert(key);
+
+    if (!property_name_valid(key) || !pa_utf8_valid(format))
+        return -1;
+
+    va_start(ap, format);
+    t = pa_vsprintf_malloc(format, ap);
+    va_end(ap);
+
+    r = pa_proplist_sets(p, key, t);
+
+    pa_xfree(t);
+    return r;
+}
+
 int pa_proplist_set(pa_proplist *p, const char *key, const void *data, size_t nbytes) {
     struct property *prop;
     pa_bool_t add = FALSE;

Modified: branches/glitch-free/src/pulse/proplist.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/pulse/proplist.h?rev=2230&root=pulseaudio&r1=2229&r2=2230&view=diff
==============================================================================
--- branches/glitch-free/src/pulse/proplist.h (original)
+++ branches/glitch-free/src/pulse/proplist.h Wed Apr  9 15:49:04 2008
@@ -100,6 +100,8 @@
 #define PA_PROP_DEVICE_CONNECTOR            "device.connector"
 #define PA_PROP_DEVICE_ACCESS_MODE          "device.access_mode"
 #define PA_PROP_DEVICE_MASTER_DEVICE        "device.master_device"
+#define PA_PROP_DEVICE_BUFFER_NFRAGMENTS    "device.buffer.nfragments"
+#define PA_PROP_DEVICE_BUFFER_FRAGMENT_SIZE "device.buffer.fragment_size"
 
 /** A property list object. Basically a dictionary with UTF-8 strings
  * as keys and arbitrary data as values. \since 0.9.11 */
@@ -116,6 +118,13 @@
  * internal copy of the data passed is made. Will accept only valid
  * UTF-8. \since 0.9.11 */
 int pa_proplist_sets(pa_proplist *p, const char *key, const char *value);
+
+/** Append a new string entry to the property list, possibly
+ * overwriting an already existing entry with the same key. An
+ * internal copy of the data passed is made. Will accept only valid
+ * UTF-8. The data can be passed as printf()-style format string with
+ * arguments. \since 0.9.11 */
+int pa_proplist_setf(pa_proplist *p, const char *key, const char *format, ...) PA_GCC_PRINTF_ATTR(3,4);
 
 /** Append a new arbitrary data entry to the property list, possibly
  * overwriting an already existing entry with the same key. An




More information about the pulseaudio-commits mailing list