Changeset ac0f8aa5591e34646577220e8a25c2da230eeb39
- Timestamp:
- 02/03/08 09:48:28
(8 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1204447708 +0200
- git-parent:
[b669af272da01fb5522d78547f5fdb42860f0330]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1204407363 +0200
- Message:
Special case support --sout URL syntax for RTP demux.
This is meant so that this will still work:
$ vlc --sout rtp/ts://239.255.12.42
Also, these new constructs will work:
$ vlc --sout dccp/ts://[::]
$ vlc --sout udplite/ts://239.255.42.12
Signed-off-by: Rémi Denis-Courmont <rem@videolan.org>
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| ra78e273 |
rac0f8aa |
|
| 53 | 53 | #define sout_stream_url_to_chain( p, s ) \ |
|---|
| 54 | 54 | _sout_stream_url_to_chain( VLC_OBJECT(p), s ) |
|---|
| 55 | | static char *_sout_stream_url_to_chain( vlc_object_t *, char * ); |
|---|
| | 55 | static char *_sout_stream_url_to_chain( vlc_object_t *, const char * ); |
|---|
| 56 | 56 | |
|---|
| 57 | 57 | /* |
|---|
| … | … | |
| 860 | 860 | } |
|---|
| 861 | 861 | |
|---|
| 862 | | static char *_sout_stream_url_to_chain( vlc_object_t *p_this, char *psz_url ) |
|---|
| | 862 | static char *_sout_stream_url_to_chain( vlc_object_t *p_this, |
|---|
| | 863 | const char *psz_url ) |
|---|
| 863 | 864 | { |
|---|
| 864 | 865 | mrl_t mrl; |
|---|
| 865 | | char *psz_chain, *p; |
|---|
| | 866 | char *psz_chain; |
|---|
| | 867 | const char *fmt = "standard{mux=\"%s\",access=\"%s\",dst=\"%s\"}"; |
|---|
| | 868 | static const char rtpfmt[] = "rtp{mux=\"%s\",proto=\"%s\",dst=\"%s\"}"; |
|---|
| 866 | 869 | |
|---|
| 867 | 870 | mrl_Parse( &mrl, psz_url ); |
|---|
| 868 | | p = psz_chain = malloc( 500 + strlen( mrl.psz_way ) + |
|---|
| 869 | | strlen( mrl.psz_access ) + |
|---|
| 870 | | strlen( mrl.psz_name ) ); |
|---|
| 871 | | |
|---|
| 872 | | |
|---|
| 873 | | if( config_GetInt( p_this, "sout-display" ) ) |
|---|
| 874 | | { |
|---|
| 875 | | p += sprintf( p, "duplicate{dst=display,dst=std{mux=\"%s\"," |
|---|
| 876 | | "access=\"%s\",dst=\"%s\"}}", |
|---|
| 877 | | mrl.psz_way, mrl.psz_access, mrl.psz_name ); |
|---|
| | 871 | |
|---|
| | 872 | /* Check if the URLs goes #rtp - otherwise we'll use #standard */ |
|---|
| | 873 | if (strcmp (mrl.psz_access, "rtp") == 0) |
|---|
| | 874 | { |
|---|
| | 875 | /* For historical reasons, rtp:// means RTP over UDP */ |
|---|
| | 876 | strcpy (mrl.psz_access, "udp"); |
|---|
| | 877 | fmt = rtpfmt; |
|---|
| 878 | 878 | } |
|---|
| 879 | 879 | else |
|---|
| 880 | 880 | { |
|---|
| 881 | | p += sprintf( p, "std{mux=\"%s\",access=\"%s\",dst=\"%s\"}", |
|---|
| 882 | | mrl.psz_way, mrl.psz_access, mrl.psz_name ); |
|---|
| | 881 | static const char list[] = "dccp\0sctp\0tcp\0udplite\0"; |
|---|
| | 882 | for (const char *a = list; *a; a += strlen (a) + 1) |
|---|
| | 883 | if (strcmp (a, mrl.psz_access) == 0) |
|---|
| | 884 | { |
|---|
| | 885 | fmt = rtpfmt; |
|---|
| | 886 | break; |
|---|
| | 887 | } |
|---|
| | 888 | } |
|---|
| | 889 | |
|---|
| | 890 | /* Convert the URL to a basic sout chain */ |
|---|
| | 891 | if (asprintf (&psz_chain, fmt, |
|---|
| | 892 | mrl.psz_way, mrl.psz_access, mrl.psz_name) == -1) |
|---|
| | 893 | psz_chain = NULL; |
|---|
| | 894 | |
|---|
| | 895 | /* Duplicate and wrap if sout-display is on */ |
|---|
| | 896 | if (psz_chain && (config_GetInt( p_this, "sout-display" ) > 0)) |
|---|
| | 897 | { |
|---|
| | 898 | char *tmp; |
|---|
| | 899 | if (asprintf (&tmp, "duplicate{dst=display,dst=%s}", tmp) == -1) |
|---|
| | 900 | tmp = NULL; |
|---|
| | 901 | free (psz_chain); |
|---|
| | 902 | psz_chain = tmp; |
|---|
| 883 | 903 | } |
|---|
| 884 | 904 | |
|---|
| 885 | 905 | mrl_Clean( &mrl ); |
|---|
| 886 | | return( psz_chain ); |
|---|
| 887 | | } |
|---|
| | 906 | return psz_chain; |
|---|
| | 907 | } |
|---|