Changeset f2f15f46eca071e5118bd115fc298cb507872fe4
- Timestamp:
- 06/15/08 15:16:18
(3 months ago)
- Author:
- Rémi Denis-Courmont <rdenis@simphalempin.com>
- git-committer:
- Rémi Denis-Courmont <rdenis@simphalempin.com> 1213535778 +0300
- git-parent:
[8c032439f9efb3cc5bcadb05cd12b770b1459bf6]
- git-author:
- bl4 <bl4@playker.info> 1213534720 +0200
- Message:
M3U playlist detection
Signed-off-by: Rémi Denis-Courmont <rdenis@simphalempin.com>
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r5dd166a |
rf2f15f4 |
|
| 48 | 48 | static int Control( demux_t *p_demux, int i_query, va_list args ); |
|---|
| 49 | 49 | static void parseEXTINF( char *psz_string, char **ppsz_artist, char **ppsz_name, int *pi_duration ); |
|---|
| | 50 | static bool ContainsURL( demux_t *p_demux ); |
|---|
| 50 | 51 | |
|---|
| 51 | 52 | /***************************************************************************** |
|---|
| … | … | |
| 62 | 63 | /* A .ram file can contain a single rtsp link */ |
|---|
| 63 | 64 | demux_IsPathExtension( p_demux, ".ram" ) || demux_IsPathExtension( p_demux, ".rm" ) || |
|---|
| 64 | | demux_IsForced( p_demux, "m3u" ) ) ) |
|---|
| | 65 | demux_IsForced( p_demux, "m3u" ) || ContainsURL( p_demux ) ) ) |
|---|
| 65 | 66 | return VLC_EGENERIC; |
|---|
| 66 | 67 | |
|---|
| … | … | |
| 69 | 70 | |
|---|
| 70 | 71 | return VLC_SUCCESS; |
|---|
| | 72 | } |
|---|
| | 73 | |
|---|
| | 74 | static bool ContainsURL( demux_t *p_demux ) |
|---|
| | 75 | { |
|---|
| | 76 | uint8_t *p_peek; |
|---|
| | 77 | int i_peek; |
|---|
| | 78 | uint8_t *p_peek_end; |
|---|
| | 79 | |
|---|
| | 80 | i_peek = stream_Peek( p_demux->s, &p_peek, 1024 ); |
|---|
| | 81 | if( i_peek <= 0 ) return false; |
|---|
| | 82 | p_peek_end = p_peek + i_peek; |
|---|
| | 83 | |
|---|
| | 84 | while( p_peek + sizeof( "https://" ) < p_peek_end ) |
|---|
| | 85 | { |
|---|
| | 86 | /* One line starting with an URL is enough */ |
|---|
| | 87 | if( !strncasecmp( p_peek, "http://", sizeof( "http://" ) - 1 ) || |
|---|
| | 88 | !strncasecmp( p_peek, "mms://", sizeof( "mms://" ) - 1 ) || |
|---|
| | 89 | !strncasecmp( p_peek, "rtsp://", sizeof( "rtsp://" ) - 1 ) || |
|---|
| | 90 | !strncasecmp( p_peek, "https://", sizeof( "https://" ) - 1 ) || |
|---|
| | 91 | !strncasecmp( p_peek, "ftp://", sizeof( "ftp://" ) - 1 ) ) |
|---|
| | 92 | { |
|---|
| | 93 | return true; |
|---|
| | 94 | } |
|---|
| | 95 | /* Comments and blank lines are ignored */ |
|---|
| | 96 | else if( *p_peek != '#' && *p_peek != '\n' && *p_peek != '\r') |
|---|
| | 97 | { |
|---|
| | 98 | return false; |
|---|
| | 99 | } |
|---|
| | 100 | |
|---|
| | 101 | while( p_peek < p_peek_end && *p_peek != '\n' ) |
|---|
| | 102 | p_peek++; |
|---|
| | 103 | if ( *p_peek == '\n' ) |
|---|
| | 104 | p_peek++; |
|---|
| | 105 | } |
|---|
| | 106 | return false; |
|---|
| 71 | 107 | } |
|---|
| 72 | 108 | |
|---|