Changeset 923da58842e70c77aacd956274381eb30447b744
- Timestamp:
- 04/12/02 00:36:41
(6 years ago)
- Author:
- Arnaud Schauly <gitan@videolan.org>
- git-committer:
- Arnaud Schauly <gitan@videolan.org> 1038958601 +0000
- git-parent:
[9125323fed7ff85b95393bf206b5f8b32ff01e14]
- git-author:
- Arnaud Schauly <gitan@videolan.org> 1038958601 +0000
- Message:
* src/playlist/playlist.c : Added playlist_AddItem (enqueues
playlist_item_t instead of psz_target ). Now playlist_Add uses
playlist_AddItem to enqueue.
* include/vlc_playlist.h : Added a psz_uri field in the playlist_item_t
structure.
* src/input/input.c : takes item->psz_uri argument to start playing an
item.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r35b6968 |
r923da58 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN |
|---|
| 5 | | * $Id: vlc_playlist.h,v 1.5 2002/11/12 21:20:36 gbazin Exp $ |
|---|
| | 5 | * $Id: vlc_playlist.h,v 1.6 2002/12/03 23:36:41 gitan Exp $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Samuel Hocevar <sam@zoy.org> |
|---|
| … | … | |
| 28 | 28 | { |
|---|
| 29 | 29 | char * psz_name; |
|---|
| | 30 | char * psz_uri; |
|---|
| 30 | 31 | int i_type; /* unused yet */ |
|---|
| 31 | 32 | int i_status; /* unused yet */ |
|---|
| … | … | |
| 70 | 71 | |
|---|
| 71 | 72 | VLC_EXPORT( int, playlist_Add, ( playlist_t *, const char *, int, int ) ); |
|---|
| | 73 | VLC_EXPORT( int, playlist_AddItem, ( playlist_t *, playlist_item_t *, int, int ) ); |
|---|
| 72 | 74 | VLC_EXPORT( int, playlist_Delete, ( playlist_t *, int ) ); |
|---|
| 73 | 75 | |
|---|
| re5daac6 |
r923da58 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: sap.c,v 1.1 2002/12/03 16:29:04 gitan Exp $ |
|---|
| | 5 | * $Id: sap.c,v 1.2 2002/12/03 23:36:41 gitan Exp $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Arnaud Schauly <gitan@via.ecp.fr> |
|---|
| … | … | |
| 63 | 63 | #define MAX_LINE_LENGTH 256 |
|---|
| 64 | 64 | |
|---|
| 65 | | #define HELLO_PORT 9875 // SAP is aloways on that port |
|---|
| 66 | | #define HELLO_GROUP "239.255.255.255" // FIX ME !!!!!!!!!!!!!!! |
|---|
| | 65 | #define HELLO_PORT 9875 /* SAP is always on that port */ |
|---|
| | 66 | #define HELLO_GROUP "239.255.255.255" |
|---|
| 67 | 67 | #define ADD_SESSION 1; |
|---|
| 68 | 68 | |
|---|
| … | … | |
| 80 | 80 | |
|---|
| 81 | 81 | typedef struct sess_descr_s { |
|---|
| 82 | | /* char *psz_version; // v field (protocol version) */ |
|---|
| 83 | 82 | char *psz_origin; /* o field (username sess-id sess-version |
|---|
| 84 | 83 | nettype addrtype addr*/ |
|---|
| … | … | |
| 98 | 97 | static int packet_handle ( char **, intf_thread_t * ); |
|---|
| 99 | 98 | |
|---|
| 100 | | static sess_descr_t * parse_sdp(char * psz_pct) ; |
|---|
| 101 | | |
|---|
| 102 | | |
|---|
| | 99 | static sess_descr_t * parse_sdp( char *,intf_thread_t * ) ; |
|---|
| | 100 | static playlist_item_t * sess_toitem( sess_descr_t * ); |
|---|
| 103 | 101 | |
|---|
| 104 | 102 | |
|---|
| … | … | |
| 138 | 136 | char *psz_network = NULL; |
|---|
| 139 | 137 | struct sockaddr_in addr; |
|---|
| 140 | | struct ip_mreq mreq; |
|---|
| 141 | 138 | int fd,addrlen; |
|---|
| 142 | 139 | char *psz_buf; |
|---|
| … | … | |
| 186 | 183 | if( i_read < 0 ) |
|---|
| 187 | 184 | { |
|---|
| 188 | | msg_Err( p_intf, "argggg" ); |
|---|
| | 185 | msg_Err( p_intf, "Cannot read in the socket" ); |
|---|
| 189 | 186 | } |
|---|
| 190 | 187 | if( i_read == 0 ) |
|---|
| … | … | |
| 194 | 191 | |
|---|
| 195 | 192 | |
|---|
| 196 | | msg_Dbg( p_intf, "New packet arrived" ); |
|---|
| 197 | 193 | packet_handle( &psz_buf, p_intf ); |
|---|
| 198 | 194 | |
|---|
| … | … | |
| 215 | 211 | } |
|---|
| 216 | 212 | |
|---|
| 217 | | |
|---|
| | 213 | /******************************************************************* |
|---|
| | 214 | * sess_toitem : changes a sess_descr_t into a playlist_item_t |
|---|
| | 215 | *******************************************************************/ |
|---|
| | 216 | |
|---|
| | 217 | static playlist_item_t * sess_toitem( sess_descr_t * p_sd ) |
|---|
| | 218 | { |
|---|
| | 219 | playlist_item_t * p_item; |
|---|
| | 220 | |
|---|
| | 221 | p_item = malloc( sizeof( playlist_item_t ) ); |
|---|
| | 222 | p_item->psz_name = p_sd->psz_sessionname; |
|---|
| | 223 | p_item->psz_uri = p_sd->psz_uri; |
|---|
| | 224 | p_item->i_type = 0; |
|---|
| | 225 | p_item->i_status = 0; |
|---|
| | 226 | p_item->b_autodeletion = VLC_FALSE; |
|---|
| | 227 | |
|---|
| | 228 | return p_item; |
|---|
| | 229 | |
|---|
| | 230 | } |
|---|
| | 231 | |
|---|
| 218 | 232 | /******************************************************************** |
|---|
| 219 | 233 | * parse_sap : Takes care of the SAP headers |
|---|
| … | … | |
| 239 | 253 | static int packet_handle( char ** ppsz_packet, intf_thread_t * p_intf ) { |
|---|
| 240 | 254 | int j=0; |
|---|
| 241 | | sess_descr_t * sd; |
|---|
| 242 | | playlist_t *p_playlist; |
|---|
| | 255 | sess_descr_t * p_sd; |
|---|
| | 256 | playlist_t *p_playlist; |
|---|
| | 257 | playlist_item_t *p_item; |
|---|
| 243 | 258 | char * psz_enqueue; |
|---|
| 244 | | char * psz_udp = "udp://@\0"; |
|---|
| 245 | 259 | int i; |
|---|
| 246 | 260 | |
|---|
| … | … | |
| 248 | 262 | |
|---|
| 249 | 263 | if(j != 0) { |
|---|
| 250 | | msg_Dbg( p_intf, "SAP packet parsed"); |
|---|
| 251 | | sd = parse_sdp( * ppsz_packet ); |
|---|
| 252 | | |
|---|
| 253 | | i = strlen( psz_udp ) + strlen( sd->psz_uri )+1 ; |
|---|
| | 264 | p_sd = parse_sdp( *ppsz_packet, p_intf ); |
|---|
| | 265 | |
|---|
| | 266 | i = strlen( "udp://@\0" ) + strlen( p_sd->psz_uri )+1 ; |
|---|
| 254 | 267 | psz_enqueue = malloc ( i * sizeof (char) ); |
|---|
| 255 | 268 | memset( psz_enqueue, '\0',i ); |
|---|
| 256 | | strcat ( psz_enqueue,psz_udp ); |
|---|
| 257 | | strcat ( psz_enqueue,sd->psz_uri ); |
|---|
| 258 | | |
|---|
| | 269 | strcat ( psz_enqueue,"udp://@\0" ); |
|---|
| | 270 | strcat ( psz_enqueue,p_sd->psz_uri ); |
|---|
| | 271 | free( p_sd->psz_uri ); |
|---|
| | 272 | p_sd->psz_uri = psz_enqueue; |
|---|
| | 273 | |
|---|
| | 274 | p_item = sess_toitem ( p_sd ); |
|---|
| 259 | 275 | p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); |
|---|
| 260 | | playlist_Add ( p_playlist, psz_enqueue, PLAYLIST_CHECK_INSERT, PLAYLIST_END); |
|---|
| 261 | | msg_Dbg(p_intf,"SAP packet : End of treatment"); |
|---|
| | 276 | |
|---|
| | 277 | playlist_AddItem ( p_playlist, p_item, PLAYLIST_CHECK_INSERT, PLAYLIST_END); |
|---|
| 262 | 278 | vlc_object_release( p_playlist ); |
|---|
| 263 | 279 | |
|---|
| | 280 | free ( p_sd ); |
|---|
| 264 | 281 | return 1; |
|---|
| 265 | 282 | } |
|---|
| 266 | | free ( sd ); |
|---|
| 267 | 283 | return 0; // Invalid Packet |
|---|
| 268 | 284 | } |
|---|
| … | … | |
| 277 | 293 | ******************************************************/ |
|---|
| 278 | 294 | |
|---|
| 279 | | static sess_descr_t * parse_sdp(char * psz_pct) |
|---|
| | 295 | static sess_descr_t * parse_sdp( char * psz_pct, intf_thread_t * p_intf ) |
|---|
| 280 | 296 | { |
|---|
| 281 | 297 | int j,k; |
|---|
| … | … | |
| 290 | 306 | switch(psz_pct[(j-1)]) { |
|---|
| 291 | 307 | /* case ('v') : { |
|---|
| 292 | | // ppsz_fill = & sd->psz_version; |
|---|
| 293 | | // break; |
|---|
| | 308 | ppsz_fill = & sd->psz_version; |
|---|
| | 309 | break; |
|---|
| 294 | 310 | } */ |
|---|
| 295 | 311 | case ('o') : { |
|---|
| … | … | |
| 335 | 351 | |
|---|
| 336 | 352 | default : { |
|---|
| 337 | | fprintf( stderr,"Warning : Ignored field \"%c\" \n",psz_pct[j-1] ); |
|---|
| | 353 | /* msg_Dbg( p_intf, "Warning : Ignored field \"%c\" \n",psz_pct[j-1] ); */ |
|---|
| 338 | 354 | ppsz_fill = NULL; |
|---|
| 339 | 355 | } |
|---|
| rbc061e8 |
r923da58 |
|
| 5 | 5 | ***************************************************************************** |
|---|
| 6 | 6 | * Copyright (C) 1998-2002 VideoLAN |
|---|
| 7 | | * $Id: input.c,v 1.215 2002/11/11 14:39:12 sam Exp $ |
|---|
| | 7 | * $Id: input.c,v 1.216 2002/12/03 23:36:41 gitan Exp $ |
|---|
| 8 | 8 | * |
|---|
| 9 | 9 | * Authors: Christophe Massiot <massiot@via.ecp.fr> |
|---|
| … | … | |
| 83 | 83 | |
|---|
| 84 | 84 | /* Set target */ |
|---|
| 85 | | p_input->psz_source = strdup( p_item->psz_name ); |
|---|
| | 85 | p_input->psz_source = strdup( p_item->psz_uri ); |
|---|
| 86 | 86 | |
|---|
| 87 | 87 | /* Demux */ |
|---|
| re5daac6 |
r923da58 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 1999-2001 VideoLAN |
|---|
| 5 | | * $Id: playlist.c,v 1.24 2002/12/03 16:29:04 gitan Exp $ |
|---|
| | 5 | * $Id: playlist.c,v 1.25 2002/12/03 23:36:41 gitan Exp $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Samuel Hocevar <sam@zoy.org> |
|---|
| … | … | |
| 104 | 104 | int i_mode, int i_pos ) |
|---|
| 105 | 105 | { |
|---|
| 106 | | playlist_item_t *p_item; |
|---|
| 107 | | |
|---|
| | 106 | playlist_item_t * p_item; |
|---|
| | 107 | |
|---|
| | 108 | p_item = malloc( sizeof( playlist_item_t ) ); |
|---|
| | 109 | if( p_item == NULL ) |
|---|
| | 110 | { |
|---|
| | 111 | msg_Err( p_playlist, "out of memory" ); |
|---|
| | 112 | } |
|---|
| | 113 | |
|---|
| | 114 | p_item->psz_name = strdup( psz_target ); |
|---|
| | 115 | p_item->psz_uri = strdup( psz_target ); |
|---|
| | 116 | p_item->i_type = 0; |
|---|
| | 117 | p_item->i_status = 0; |
|---|
| | 118 | p_item->b_autodeletion = VLC_FALSE; |
|---|
| | 119 | |
|---|
| | 120 | return playlist_AddItem( p_playlist, p_item, i_mode, i_pos ); |
|---|
| | 121 | } |
|---|
| | 122 | |
|---|
| | 123 | |
|---|
| | 124 | int playlist_AddItem( playlist_t *p_playlist, playlist_item_t * p_item, |
|---|
| | 125 | int i_mode, int i_pos) |
|---|
| | 126 | { |
|---|
| 108 | 127 | |
|---|
| 109 | 128 | vlc_mutex_lock( &p_playlist->object_lock ); |
|---|
| … | … | |
| 121 | 140 | for ( j = 0; j < p_playlist->i_size; j++ ) |
|---|
| 122 | 141 | { |
|---|
| 123 | | if ( !strcmp( p_playlist->pp_items[j]->psz_name, psz_target ) ) |
|---|
| | 142 | if ( !strcmp( p_playlist->pp_items[j]->psz_uri, p_item->psz_uri ) ) |
|---|
| 124 | 143 | { |
|---|
| 125 | | msg_Dbg( p_playlist, "item � %s � already enqued", |
|---|
| 126 | | psz_target ); |
|---|
| | 144 | if( p_item->psz_name ) |
|---|
| | 145 | { |
|---|
| | 146 | free( p_item->psz_name ); |
|---|
| | 147 | } |
|---|
| | 148 | if( p_item->psz_uri ) |
|---|
| | 149 | { |
|---|
| | 150 | free( p_item->psz_uri ); |
|---|
| | 151 | } |
|---|
| | 152 | free( p_item ); |
|---|
| 127 | 153 | vlc_mutex_unlock( &p_playlist->object_lock ); |
|---|
| 128 | 154 | return 0; |
|---|
| … | … | |
| 135 | 161 | |
|---|
| 136 | 162 | |
|---|
| 137 | | msg_Dbg( p_playlist, "adding playlist item � %s �", psz_target ); |
|---|
| | 163 | msg_Dbg( p_playlist, "adding playlist item � %s �", p_item->psz_name ); |
|---|
| 138 | 164 | |
|---|
| 139 | 165 | /* Create the new playlist item */ |
|---|
| 140 | | p_item = malloc( sizeof( playlist_item_t ) ); |
|---|
| 141 | | if( p_item == NULL ) |
|---|
| 142 | | { |
|---|
| 143 | | msg_Err( p_playlist, "out of memory" ); |
|---|
| 144 | | } |
|---|
| 145 | | |
|---|
| 146 | | p_item->psz_name = strdup( psz_target ); |
|---|
| 147 | | p_item->i_type = 0; |
|---|
| 148 | | p_item->i_status = 0; |
|---|
| 149 | | p_item->b_autodeletion = VLC_FALSE; |
|---|
| 150 | 166 | |
|---|
| 151 | 167 | |
|---|