[vlc-devel] [PATCH] SAP: show session info as stream description

Tillmann Karras tillmann at selfnet.de
Wed Jan 2 18:40:41 CET 2013


Ah, it seems my mail client removes signatures from drafts. Try this 
one:

 From: Tillmann Karras <tillmann at selfnet.de>
Date: Wed, 2 Jan 2013 18:35:12 +0100
Subject: [PATCH] SAP: show session info as stream description

This adds the SDP i= line (session information) as the description 
field
in the metadata of the SAP stream.
---
  modules/services_discovery/sap.c |   18 ++++++++++++++++++
  1 file changed, 18 insertions(+)

diff --git a/modules/services_discovery/sap.c 
b/modules/services_discovery/sap.c
index 38775e0..a328596 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -172,6 +172,9 @@ struct  sdp_t
      /* s= field */
      char *psz_sessionname;

+    /* i= field */
+    char *psz_sessioninfo;
+
      /* old cruft */
      /* "computed" URI */
      char *psz_uri;
@@ -849,6 +852,9 @@ sap_announce_t *CreateAnnounce( 
services_discovery_t *p_sd, uint32_t *i_source,
      p_input = input_item_NewWithType( p_sap->p_sdp->psz_uri,
                                        p_sdp->psz_sessionname,
                                        0, NULL, 0, -1, ITEM_TYPE_NET );
+    vlc_meta_t *p_meta = vlc_meta_New();
+    vlc_meta_Set( p_meta, vlc_meta_Description, p_sdp->psz_sessioninfo 
);
+    p_input->p_meta = p_meta;
      p_sap->p_item = p_input;
      if( !p_input )
      {
@@ -1269,9 +1275,20 @@ static sdp_t *ParseSDP (vlc_object_t *p_obj, 
const char *psz_sdp)
              }

              case 'I':
+            {
                  expect = 'U';
+                /* optional (and may be empty) */
                  if (cat == 'i')
+                {
+                    assert (p_sdp->psz_sessioninfo == NULL);
+                    p_sdp->psz_sessioninfo = strdup (data);
+                    if (p_sdp->psz_sessioninfo == NULL)
+                        goto error;
+                    EnsureUTF8 (p_sdp->psz_sessioninfo);
                      break;
+                }
+            }
+
              case 'U':
                  expect = 'E';
                  if (cat == 'u')
@@ -1509,6 +1526,7 @@ static int Decompress( const unsigned char 
*psz_src, unsigned char **_dst, int i
  static void FreeSDP( sdp_t *p_sdp )
  {
      free( p_sdp->psz_sessionname );
+    free( p_sdp->psz_sessioninfo );
      free( p_sdp->psz_uri );

      for (unsigned j = 0; j < p_sdp->mediac; j++)
-- 
1.7.10.4



More information about the vlc-devel mailing list