]> git.sesse.net Git - vlc/commitdiff
Provide va_list variant to MakeSDPMedia
authorRémi Denis-Courmont <rem@videolan.org>
Tue, 1 May 2007 17:18:46 +0000 (17:18 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Tue, 1 May 2007 17:18:46 +0000 (17:18 +0000)
src/stream_output/sdp.c
src/stream_output/stream_output.h

index 2a0d7417fd37acb4d4443a9e547ef8870e405af6..7cb4420ba500606b41b1cac575e958f3b9f5f4e1 100644 (file)
@@ -4,11 +4,9 @@
  * Copyright © 2007 Rémi Denis-Courmont
  * $Id$
  *
- * Authors: Rémi Denis-Courmont
- *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -153,8 +151,9 @@ char *StartSDP (const char *name, const char *description, const char *url,
 }
 
 
-char *MakeSDPMedia (const char *type, int dport, const char *protocol,
-                    unsigned pt, const char *rtpmap, const char *fmtpfmt, ...)
+char *vMakeSDPMedia (const char *type, int dport, const char *protocol,
+                    unsigned pt, const char *rtpmap,
+                    const char *fmtpfmt, va_list ap)
 {
     char *sdp_media = NULL;
 
@@ -176,18 +175,9 @@ char *MakeSDPMedia (const char *type, int dport, const char *protocol,
 
     /* Format parameters */
     char *fmtp = NULL;
-    if (fmtpfmt != NULL)
-    {
-        va_list ap;
-
-        va_start (ap, fmtpfmt);
-        if (vasprintf (&fmtp, fmtpfmt, ap) == -1)
-            fmtpfmt = NULL;
-        va_end (ap);
-
-        if (fmtp == NULL)
-            return NULL;
-    }
+    if ((fmtpfmt != NULL)
+     && (vasprintf (&fmtp, fmtpfmt, ap) == -1))
+        return NULL;
 
     char sdp_fmtp[fmtp ? (sizeof ("a=fmtp:123 *\r\n") + strlen (fmtp)) : 1];
     if (fmtp != NULL)
index 85150c8c1768f334f4c8f03a4c17e22371101525..837fc900b352dc8f94ffa5d76b5fa5c004e51564 100644 (file)
@@ -112,10 +112,23 @@ int announce_UnRegister( announce_handler_t *p_announce,
 sap_handler_t *announce_SAPHandlerCreate( announce_handler_t *p_announce );
 void announce_SAPHandlerDestroy( sap_handler_t *p_sap );
 
+#include <stdarg.h>
+
 char *StartSDP (const char *name, const char *description, const char *url,
                 const char *email, const char *phone, vlc_bool_t ssm,
                 const struct sockaddr *orig, socklen_t origlen,
                 const struct sockaddr *addr, socklen_t addrlen);
+char *vMakeSDPMedia (const char *type, int dport, const char *protocol,
+                     unsigned pt, const char *rtpmap,
+                     const char *fmtp, va_list ap);
+static inline
 char *MakeSDPMedia (const char *type, int dport, const char *protocol,
-                    unsigned pt, const char *rtpmap, const char *fmtp, ...);
-
+                    unsigned pt, const char *rtpmap, const char *fmtpfmt, ...)
+{
+    va_list ap;
+    char *ret;
+    va_start (ap, fmtpfmt);
+    ret = vMakeSDPMedia (type, dport, protocol, pt, rtpmap, fmtpfmt, ap);
+    va_end (ap);
+    return ret;
+}