1 /*****************************************************************************
2 * playlist.c : Playlist management functions
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
21 *****************************************************************************/
26 #include <stdlib.h> /* free(), strtol() */
27 #include <stdio.h> /* sprintf() */
28 #include <string.h> /* strerror() */
29 #include <errno.h> /* ENOMEM */
38 /* Local prototypes */
39 //int TestPlugin ( plugin_id_t *p_plugin_id, char * psz_name );
40 //int AllocatePlugin ( plugin_id_t plugin_id, plugin_bank_t * p_bank );
42 playlist_t * playlist_Create ( void )
44 playlist_t *p_playlist;
46 /* Allocate structure */
47 p_playlist = malloc( sizeof( playlist_t ) );
50 intf_ErrMsg("playlist error: %s\n", strerror( ENOMEM ) );
54 p_playlist->i_index = 0;
55 p_playlist->p_list = NULL;
57 intf_Msg("Playlist initialized\n");
61 void playlist_Init( playlist_t * p_playlist, int i_optind )
65 int i_argc = p_main->i_argc;
67 if( i_optind < i_argc )
69 i_list_index = i_argc - i_optind;
71 p_playlist->p_list = malloc( i_list_index * sizeof( int ) );
73 while( i_argc - i_index > i_optind )
75 p_playlist->p_list[ i_index ] =
76 p_main->ppsz_argv[ i_argc - i_index - 1];
82 /* if no file was asked, get stream from the network */
83 p_playlist->p_list = NULL;
86 p_main->p_playlist->i_index = i_list_index;
89 void playlist_Destroy( playlist_t * p_playlist )
95 * Following functions are local