~videolan/vlc/old-trunk

« back to all changes in this revision

Viewing changes to src/input/item.c

  • Committer: zorglub
  • Date: 2006-09-24 12:40:10 UTC
  • Revision ID: vcs-imports@canonical.com-20060924124010-9313cccc4d61dbc9
Rename vlc_input_item_* functions to input_Item* for consistency
Add input_ItemAddOptionNoDup (unused at the moment)
+ free warning fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * item.c: input_item management
3
3
 *****************************************************************************
4
4
 * Copyright (C) 1998-2004 the VideoLAN team
5
 
 * $Id: item.c 16666 2006-09-15 22:10:37Z zorglub $
 
5
 * $Id: item.c 16821 2006-09-24 12:40:10Z zorglub $
6
6
 *
7
7
 * Authors: Clément Stenac <zorglub@videolan.org>
8
8
 *
38
38
 *         empty string otherwise. The caller should free the returned
39
39
 *         pointer.
40
40
 */
41
 
char *vlc_input_item_GetInfo( input_item_t *p_i,
 
41
char *input_ItemGetInfo( input_item_t *p_i,
42
42
                              const char *psz_cat,
43
43
                              const char *psz_name )
44
44
{
67
67
    return strdup( "" );
68
68
}
69
69
 
70
 
static void vlc_input_item_Destroy ( gc_object_t *p_this )
 
70
static void input_ItemDestroy ( gc_object_t *p_this )
71
71
{
72
72
    vlc_object_t *p_obj = (vlc_object_t *)p_this->p_destructor_arg;
73
73
    input_item_t *p_input = (input_item_t *) p_this;
74
74
    int i;
75
75
 
76
76
    playlist_t *p_playlist = pl_Yield( p_obj );
77
 
    vlc_input_item_Clean( p_input );
 
77
    input_ItemClean( p_input );
78
78
 
79
79
    for( i = 0 ; i< p_playlist->i_input_items ; i++ )
80
80
    {
89
89
    free( p_input );
90
90
}
91
91
 
92
 
int vlc_input_item_AddInfo( input_item_t *p_i,
 
92
void input_ItemAddOption( input_item_t *p_input,
 
93
                          const char *psz_option )
 
94
{
 
95
    if( !psz_option ) return;
 
96
    vlc_mutex_lock( &p_input->lock );
 
97
    INSERT_ELEM( p_input->ppsz_options, p_input->i_options,
 
98
                 p_input->i_options, strdup( psz_option ) );
 
99
    vlc_mutex_unlock( &p_input->lock );
 
100
}
 
101
 
 
102
void input_ItemAddOptionNoDup( input_item_t *p_input,
 
103
                               const char *psz_option )
 
104
{
 
105
    int i;
 
106
    if( !psz_option ) return ;
 
107
    vlc_mutex_lock( &p_input->lock );
 
108
    for( i = 0 ; i< p_input->i_options; i++ )
 
109
    {
 
110
        if( !strcmp( p_input->ppsz_options[i], psz_option ) )
 
111
        {
 
112
            vlc_mutex_unlock(& p_input->lock );
 
113
            return;
 
114
        }
 
115
    }
 
116
    TAB_APPEND( p_input->i_options, p_input->ppsz_options, strdup( psz_option));    vlc_mutex_unlock( &p_input->lock );
 
117
}
 
118
 
 
119
 
 
120
int input_ItemAddInfo( input_item_t *p_i,
93
121
                            const char *psz_cat,
94
122
                            const char *psz_name,
95
123
                            const char *psz_format, ... )
156
184
    return VLC_SUCCESS;
157
185
}
158
186
 
159
 
void vlc_input_item_AddOption( input_item_t *p_input,
160
 
                              const char *psz_option )
161
 
{
162
 
    if( !psz_option ) return;
163
 
    vlc_mutex_lock( &p_input->lock );
164
 
    INSERT_ELEM( p_input->ppsz_options, p_input->i_options,
165
 
                 p_input->i_options, strdup( psz_option ) );
166
 
    vlc_mutex_unlock( &p_input->lock );
167
 
};
168
 
 
169
 
 
170
187
input_item_t *input_ItemGetById( playlist_t *p_playlist, int i_id )
171
188
{
172
189
    int i, i_top, i_bottom;
206
223
    playlist_t *p_playlist = pl_Yield( p_obj );
207
224
    DECMALLOC_NULL( p_input, input_item_t );
208
225
 
209
 
    vlc_input_item_Init( p_obj, p_input );
210
 
    vlc_gc_init( p_input, vlc_input_item_Destroy, (void *)p_obj );
 
226
    input_ItemInit( p_obj, p_input );
 
227
    vlc_gc_init( p_input, input_ItemDestroy, (void *)p_obj );
211
228
 
212
229
    PL_LOCK;
213
230
    p_input->i_id = ++p_playlist->i_last_input_id;