Changeset 4c8296b58b24175921b37f99dfa7bda5e08f6cdb

Show
Ignore:
Timestamp:
22/06/08 18:02:50 (4 months ago)
Author:
Rémi Denis-Courmont <rdenis@simphalempin.com>
git-committer:
Rémi Denis-Courmont <rdenis@simphalempin.com> 1214150570 +0300
git-parent:

[a458b6af6b88534edadd8bd218b368fbf173a273]

git-author:
Rémi Denis-Courmont <rdenis@simphalempin.com> 1214150570 +0300
Message:

Fix specifying a sout RTP port number using a sout MRL

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/stream_output/stream_output.c

    r57c3ecd r4c8296b  
    814814    mrl_t       mrl; 
    815815    char        *psz_chain; 
    816     const char  *fmt = "standard{mux=\"%s\",access=\"%s\",dst=\"%s\"}"; 
    817     static const char rtpfmt[] = "rtp{mux=\"%s\",proto=\"%s\",dst=\"%s\"}"; 
    818816 
    819817    mrl_Parse( &mrl, psz_url ); 
    820818 
    821     /* Check if the URLs goes #rtp - otherwise we'll use #standard */ 
     819    /* Check if the URLs goes to #rtp - otherwise we'll use #standard */ 
     820    static const char rtplist[] = "dccp\0sctp\0tcp\0udplite\0"; 
     821    for (const char *a = rtplist; *a; a += strlen (a) + 1) 
     822        if (strcmp (a, mrl.psz_access) == 0) 
     823            goto rtp; 
     824 
    822825    if (strcmp (mrl.psz_access, "rtp") == 0) 
    823826    { 
     827        char *port; 
    824828        /* For historical reasons, rtp:// means RTP over UDP */ 
    825829        strcpy (mrl.psz_access, "udp"); 
    826         fmt = rtpfmt; 
     830rtp: 
     831        if (mrl.psz_name[0] == '[') 
     832        { 
     833            port = strstr (mrl.psz_name, "]:"); 
     834            if (port != NULL) 
     835                port++; 
     836        } 
     837        else 
     838            port = strchr (mrl.psz_name, ':'); 
     839        if (port != NULL) 
     840            *port++ = '\0'; /* erase ':' */ 
     841 
     842        if (asprintf (&psz_chain, 
     843                      "rtp{mux=\"%s\",proto=\"%s\",dst=\"%s%s%s\"}", 
     844                      mrl.psz_way, mrl.psz_access, mrl.psz_name, 
     845                      port ? "\",port=\"" : "", port ? port : "") == -1) 
     846            psz_chain = NULL; 
    827847    } 
    828848    else 
    829849    { 
    830         static const char list[] = "dccp\0sctp\0tcp\0udplite\0"; 
    831         for (const char *a = list; *a; a += strlen (a) + 1) 
    832              if (strcmp (a, mrl.psz_access) == 0) 
    833              { 
    834                  fmt = rtpfmt; 
    835                  break; 
    836              } 
    837     } 
    838  
    839     /* Convert the URL to a basic sout chain */ 
    840     if (asprintf (&psz_chain, fmt, 
    841                   mrl.psz_way, mrl.psz_access, mrl.psz_name) == -1) 
    842         psz_chain = NULL; 
     850        /* Convert the URL to a basic standard sout chain */ 
     851        if (asprintf (&psz_chain, 
     852                      "standard{mux=\"%s\",access=\"%s\",dst=\"%s\"}", 
     853                      mrl.psz_way, mrl.psz_access, mrl.psz_name) == -1) 
     854            psz_chain = NULL; 
     855    } 
    843856 
    844857    /* Duplicate and wrap if sout-display is on */