1 /*****************************************************************************
2 * input.c: Libvlc new API input management functions
3 *****************************************************************************
4 * Copyright (C) 2005 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #include <libvlc_internal.h>
25 #include <vlc/libvlc.h>
29 void libvlc_input_free( libvlc_input_t *p_input )
35 /**************************************************************************
36 * Getters for stream information
37 **************************************************************************/
38 vlc_int64_t libvlc_input_get_length( libvlc_input_t *p_input,
39 libvlc_exception_t *p_exception )
41 input_thread_t *p_input_thread;
46 libvlc_exception_raise( p_exception, "Input is NULL" );
50 p_input_thread = (input_thread_t*)vlc_object_get(
51 p_input->p_instance->p_vlc,
52 p_input->i_input_id );
55 libvlc_exception_raise( p_exception, "Input does not exist" );
58 var_Get( p_input_thread, "length", &val );
59 vlc_object_release( p_input_thread );
61 return val.i_time / 1000;
64 vlc_int64_t libvlc_input_get_time( libvlc_input_t *p_input,
65 libvlc_exception_t *p_exception )
67 input_thread_t *p_input_thread;
72 libvlc_exception_raise( p_exception, "Input is NULL" );
76 p_input_thread = (input_thread_t*)vlc_object_get(
77 p_input->p_instance->p_vlc,
78 p_input->i_input_id );
81 libvlc_exception_raise( p_exception, "Input does not exist" );
84 var_Get( p_input_thread , "time", &val );
85 vlc_object_release( p_input_thread );
87 return val.i_time / 1000;
90 float libvlc_input_get_position( libvlc_input_t *p_input,
91 libvlc_exception_t *p_exception )
93 input_thread_t *p_input_thread;
98 libvlc_exception_raise( p_exception, "Input is NULL" );
102 p_input_thread = (input_thread_t*)vlc_object_get(
103 p_input->p_instance->p_vlc,
104 p_input->i_input_id );
105 if( !p_input_thread )
107 libvlc_exception_raise( p_exception, "Input does not exist" );
110 var_Get( p_input_thread, "position", &val );
111 vlc_object_release( p_input_thread );