Changeset 34f81612d956bfc7ad53fb7937b7d38d9cdec730

Show
Ignore:
Timestamp:
17/06/07 22:54:32 (1 year ago)
Author:
Pierre d'Herbemont <pdherbemont@videolan.org>
git-committer:
Pierre d'Herbemont <pdherbemont@videolan.org> 1182113672 +0000
git-parent:

[0dabfb1de3089a7e568767baeb275465488eaac6]

git-author:
Pierre d'Herbemont <pdherbemont@videolan.org> 1182113672 +0000
Message:

libvlc: Rename input to media_instance. And add the possibility to create a medi_instance from a media_descriptor.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc/libvlc.h

    r39793dd r34f8161  
    287287                                                libvlc_exception_t * ); 
    288288 
    289 typedef struct libvlc_input_t libvlc_input_t; 
    290  
    291289/* Get the input that is currently being played by the playlist 
    292290 * \param p_instance the instance to use 
     
    294292 * \return an input object 
    295293 */ 
    296 VLC_PUBLIC_API libvlc_input_t *libvlc_playlist_get_input( libvlc_instance_t *, 
    297                                                           libvlc_exception_t * ); 
     294VLC_PUBLIC_API libvlc_media_instance_t * libvlc_playlist_get_media_instance( 
     295                                libvlc_instance_t *, libvlc_exception_t * ); 
    298296 
    299297/** @}*/ 
    300298 
    301299/***************************************************************************** 
    302  * Input 
     300 * Media Instance 
    303301 *****************************************************************************/ 
    304 /** defgroup libvlc_input Input 
    305  * \ingroup libvlc 
    306  * LibVLC Input handling 
    307  * @{ 
    308  */ 
    309  
    310 /** Free an input object 
    311  * \param p_input the input to free 
    312  */ 
    313 VLC_PUBLIC_API void libvlc_input_free( libvlc_input_t * ); 
     302/** defgroup libvlc_media_instance Media Instance 
     303 * \ingroup libvlc 
     304 * LibVLC Media Instance 
     305 * @{ 
     306 */ 
     307 
     308/** Create a Media Instance object from a Media Descriptor 
     309 * \param p_md the Media Descriptor from which the Media Instance should be 
     310 * created. The p_md can then be destroyed if needed. 
     311 */ 
     312VLC_PUBLIC_API libvlc_media_instance_t * libvlc_media_instance_new( libvlc_media_descriptor_t * ); 
     313 
     314/** Destroy a Media Instance object 
     315 * \param p_mi the Media Instance to free 
     316 */ 
     317VLC_PUBLIC_API void libvlc_media_instance_destroy( libvlc_media_instance_t * ); 
     318 
     319VLC_PUBLIC_API void libvlc_media_instance_play ( libvlc_media_instance_t *, libvlc_exception_t * ); 
     320VLC_PUBLIC_API void libvlc_media_instance_pause ( libvlc_media_instance_t *, libvlc_exception_t * ); 
    314321 
    315322/// \bug This might go away ... to be replaced by a broader system 
    316 VLC_PUBLIC_API vlc_int64_t libvlc_input_get_length     ( libvlc_input_t *, libvlc_exception_t *); 
    317 VLC_PUBLIC_API vlc_int64_t libvlc_input_get_time       ( libvlc_input_t *, libvlc_exception_t *); 
    318 VLC_PUBLIC_API void        libvlc_input_set_time       ( libvlc_input_t *, vlc_int64_t, libvlc_exception_t *); 
    319 VLC_PUBLIC_API float       libvlc_input_get_position   ( libvlc_input_t *, libvlc_exception_t *); 
    320 VLC_PUBLIC_API void        libvlc_input_set_position   ( libvlc_input_t *, float, libvlc_exception_t *); 
    321 VLC_PUBLIC_API vlc_bool_t  libvlc_input_will_play      ( libvlc_input_t *, libvlc_exception_t *); 
    322 VLC_PUBLIC_API float       libvlc_input_get_rate       ( libvlc_input_t *, libvlc_exception_t *); 
    323 VLC_PUBLIC_API void        libvlc_input_set_rate       ( libvlc_input_t *, float, libvlc_exception_t *); 
    324 VLC_PUBLIC_API int         libvlc_input_get_state      ( libvlc_input_t *, libvlc_exception_t *); 
     323VLC_PUBLIC_API vlc_int64_t libvlc_media_instance_get_length     ( libvlc_media_instance_t *, libvlc_exception_t *); 
     324VLC_PUBLIC_API vlc_int64_t libvlc_media_instance_get_time       ( libvlc_media_instance_t *, libvlc_exception_t *); 
     325VLC_PUBLIC_API void        libvlc_media_instance_set_time       ( libvlc_media_instance_t *, vlc_int64_t, libvlc_exception_t *); 
     326VLC_PUBLIC_API float       libvlc_media_instance_get_position   ( libvlc_media_instance_t *, libvlc_exception_t *); 
     327VLC_PUBLIC_API void        libvlc_media_instance_set_position   ( libvlc_media_instance_t *, float, libvlc_exception_t *); 
     328VLC_PUBLIC_API vlc_bool_t  libvlc_media_instance_will_play      ( libvlc_media_instance_t *, libvlc_exception_t *); 
     329VLC_PUBLIC_API float       libvlc_media_instance_get_rate       ( libvlc_media_instance_t *, libvlc_exception_t *); 
     330VLC_PUBLIC_API void        libvlc_media_instance_set_rate       ( libvlc_media_instance_t *, float, libvlc_exception_t *); 
     331VLC_PUBLIC_API int         libvlc_media_instance_get_state      ( libvlc_media_instance_t *, libvlc_exception_t *); 
     332 
     333/** 
     334 * Does this input have a video output ? 
     335 * \param p_input the input 
     336 * \param p_exception an initialized exception 
     337 */ 
     338VLC_PUBLIC_API vlc_bool_t  libvlc_media_instance_has_vout( libvlc_media_instance_t *, libvlc_exception_t *); 
     339VLC_PUBLIC_API float       libvlc_media_instance_get_fps( libvlc_media_instance_t *, libvlc_exception_t *); 
     340 
    325341 
    326342/** @} */ 
     
    337353 * \param p_exception an initialized exception 
    338354 */ 
    339 VLC_PUBLIC_API vlc_bool_t  libvlc_input_has_vout( libvlc_input_t *, libvlc_exception_t *); 
    340 VLC_PUBLIC_API float       libvlc_input_get_fps( libvlc_input_t *, libvlc_exception_t *); 
     355VLC_PUBLIC_API vlc_bool_t  libvlc_input_has_vout( libvlc_media_instance_t *, libvlc_exception_t *); 
     356VLC_PUBLIC_API float       libvlc_input_get_fps( libvlc_media_instance_t *, libvlc_exception_t *); 
    341357 
    342358/** 
     
    345361 * \param p_exception an initialized exception 
    346362 */ 
    347 VLC_PUBLIC_API void libvlc_toggle_fullscreen( libvlc_input_t *, libvlc_exception_t * ); 
     363VLC_PUBLIC_API void libvlc_toggle_fullscreen( libvlc_media_instance_t *, libvlc_exception_t * ); 
    348364 
    349365/** 
     
    353369 * \param p_exception an initialized exception 
    354370 */ 
    355 VLC_PUBLIC_API void libvlc_set_fullscreen( libvlc_input_t *, int, libvlc_exception_t * ); 
     371VLC_PUBLIC_API void libvlc_set_fullscreen( libvlc_media_instance_t *, int, libvlc_exception_t * ); 
    356372 
    357373/** 
     
    361377 * \return the fullscreen status (boolean) 
    362378 */ 
    363 VLC_PUBLIC_API int libvlc_get_fullscreen( libvlc_input_t *, libvlc_exception_t * ); 
     379VLC_PUBLIC_API int libvlc_get_fullscreen( libvlc_media_instance_t *, libvlc_exception_t * ); 
    364380 
    365381/** 
     
    369385 * \return the video height 
    370386 */ 
    371 VLC_PUBLIC_API int libvlc_video_get_height( libvlc_input_t *, libvlc_exception_t * ); 
     387VLC_PUBLIC_API int libvlc_video_get_height( libvlc_media_instance_t *, libvlc_exception_t * ); 
    372388 
    373389/** 
     
    377393 * \return the video width 
    378394 */ 
    379 VLC_PUBLIC_API int libvlc_video_get_width( libvlc_input_t *, libvlc_exception_t * ); 
     395VLC_PUBLIC_API int libvlc_video_get_width( libvlc_media_instance_t *, libvlc_exception_t * ); 
    380396 
    381397/** 
     
    385401 * \return the video aspect ratio 
    386402 */ 
    387 VLC_PUBLIC_API char *libvlc_video_get_aspect_ratio( libvlc_input_t *, libvlc_exception_t * ); 
     403VLC_PUBLIC_API char *libvlc_video_get_aspect_ratio( libvlc_media_instance_t *, libvlc_exception_t * ); 
    388404 
    389405/** 
     
    393409 * \param p_exception an initialized exception 
    394410 */ 
    395 VLC_PUBLIC_API void libvlc_video_set_aspect_ratio( libvlc_input_t *, char *, libvlc_exception_t * ); 
     411VLC_PUBLIC_API void libvlc_video_set_aspect_ratio( libvlc_media_instance_t *, char *, libvlc_exception_t * ); 
    396412 
    397413/** 
     
    401417 * \return the video subtitle selected 
    402418 */ 
    403 VLC_PUBLIC_API int libvlc_video_get_spu( libvlc_input_t *, libvlc_exception_t * ); 
     419VLC_PUBLIC_API int libvlc_video_get_spu( libvlc_media_instance_t *, libvlc_exception_t * ); 
    404420 
    405421/** 
     
    409425 * \param p_exception an initialized exception 
    410426 */ 
    411 VLC_PUBLIC_API void libvlc_video_set_spu( libvlc_input_t *, int , libvlc_exception_t * ); 
     427VLC_PUBLIC_API void libvlc_video_set_spu( libvlc_media_instance_t *, int , libvlc_exception_t * ); 
    412428 
    413429/** 
     
    417433 * \return the crop filter geometry 
    418434 */ 
    419 VLC_PUBLIC_API char *libvlc_video_get_crop_geometry( libvlc_input_t *, libvlc_exception_t * ); 
     435VLC_PUBLIC_API char *libvlc_video_get_crop_geometry( libvlc_media_instance_t *, libvlc_exception_t * ); 
    420436 
    421437/** 
     
    425441 * \param p_exception an initialized exception 
    426442 */ 
    427 VLC_PUBLIC_API void libvlc_video_set_crop_geometry( libvlc_input_t *, char *, libvlc_exception_t * ); 
     443VLC_PUBLIC_API void libvlc_video_set_crop_geometry( libvlc_media_instance_t *, char *, libvlc_exception_t * ); 
    428444 
    429445/** 
     
    433449 * \param p_exception an initialized exception 
    434450 */ 
    435 VLC_PUBLIC_API void libvlc_video_take_snapshot( libvlc_input_t *, char *, libvlc_exception_t * ); 
    436  
    437 VLC_PUBLIC_API int libvlc_video_destroy( libvlc_input_t *, libvlc_exception_t *); 
     451VLC_PUBLIC_API void libvlc_video_take_snapshot( libvlc_media_instance_t *, char *, libvlc_exception_t * ); 
     452 
     453VLC_PUBLIC_API int libvlc_video_destroy( libvlc_media_instance_t *, libvlc_exception_t *); 
    438454 
    439455/** 
     
    445461 * \return the success status (boolean) 
    446462 */ 
    447 VLC_PUBLIC_API void libvlc_video_resize( libvlc_input_t *, int, int, libvlc_exception_t *); 
     463VLC_PUBLIC_API void libvlc_video_resize( libvlc_media_instance_t *, int, int, libvlc_exception_t *); 
    448464 
    449465/** 
     
    454470 * \return the success status (boolean) 
    455471 */ 
    456 VLC_PUBLIC_API int libvlc_video_reparent( libvlc_input_t *, libvlc_drawable_t, libvlc_exception_t * ); 
     472VLC_PUBLIC_API int libvlc_video_reparent( libvlc_media_instance_t *, libvlc_drawable_t, libvlc_exception_t * ); 
    457473 
    458474/** 
     
    462478 * \param p_exception an initialized exception 
    463479 */ 
    464 VLC_PUBLIC_API void libvlc_video_redraw_rectangle( libvlc_input_t *, const libvlc_rectangle_t *, libvlc_exception_t * ); 
     480VLC_PUBLIC_API void libvlc_video_redraw_rectangle( libvlc_media_instance_t *, const libvlc_rectangle_t *, libvlc_exception_t * ); 
    465481 
    466482/** 
     
    564580+  * \return the audio track (int) 
    565581+  */ 
    566 VLC_PUBLIC_API int libvlc_audio_get_track( libvlc_input_t *, libvlc_exception_t * ); 
     582VLC_PUBLIC_API int libvlc_audio_get_track( libvlc_media_instance_t *, libvlc_exception_t * ); 
    567583 
    568584/** 
     
    572588 * \param p_exception an initialized exception 
    573589 */ 
    574 VLC_PUBLIC_API void libvlc_audio_set_track( libvlc_input_t *, int, libvlc_exception_t * ); 
     590VLC_PUBLIC_API void libvlc_audio_set_track( libvlc_media_instance_t *, int, libvlc_exception_t * ); 
    575591 
    576592/** 
  • include/vlc/libvlc_structures.h

    rd1a3355 r34f8161  
    7777 
    7878typedef struct libvlc_media_descriptor_t libvlc_media_descriptor_t; 
     79 
     80/**@} */ 
     81 
     82/***************************************************************************** 
     83 * Media Instance 
     84 *****************************************************************************/ 
     85/** defgroup libvlc_media_instance MediaInstance 
     86 * \ingroup libvlc 
     87 * LibVLC Media Instance handling 
     88 * @{ 
     89 */ 
     90 
     91typedef struct libvlc_media_instance_t libvlc_media_instance_t; 
    7992 
    8093/**@} */ 
  • src/control/audio.c

    rf3968d6 r34f8161  
    2828#include <vlc_input.h> 
    2929#include <vlc_aout.h> 
    30  
    31 /* 
    32  * Remember to release the returned input_thread_t since it is locked at 
    33  * the end of this function. 
    34  */ 
    35 static input_thread_t *GetInput( libvlc_input_t *p_input, 
    36                                  libvlc_exception_t *p_exception ) 
    37 { 
    38     input_thread_t *p_input_thread = NULL; 
    39  
    40     if( !p_input ) 
    41     { 
    42         libvlc_exception_raise( p_exception, "Input is NULL" ); 
    43         return NULL; 
    44     } 
    45  
    46     p_input_thread = (input_thread_t*)vlc_object_get( 
    47                                  p_input->p_instance->p_libvlc_int, 
    48                                  p_input->i_input_id ); 
    49     if( !p_input_thread ) 
    50     { 
    51         libvlc_exception_raise( p_exception, "Input does not exist" ); 
    52         return NULL; 
    53     } 
    54  
    55     return p_input_thread; 
    56 } 
    5730 
    5831/* 
     
    143116 * libvlc_audio_get_track : Get the current audio track 
    144117 *****************************************************************************/ 
    145 int libvlc_audio_get_track( libvlc_input_t *p_input
     118int libvlc_audio_get_track( libvlc_media_instance_t *p_mi
    146119                            libvlc_exception_t *p_e ) 
    147120{ 
    148     input_thread_t *p_input_thread = GetInput( p_input, p_e ); 
     121    input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e ); 
    149122    vlc_value_t val_list; 
    150123    vlc_value_t val; 
     
    181154 * libvlc_audio_set_track : Set the current audio track 
    182155 *****************************************************************************/ 
    183 void libvlc_audio_set_track( libvlc_input_t *p_input, int i_track, 
     156void libvlc_audio_set_track( libvlc_media_instance_t *p_mi, int i_track, 
    184157                             libvlc_exception_t *p_e ) 
    185158{ 
    186     input_thread_t *p_input_thread = GetInput( p_input, p_e ); 
     159    input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e ); 
    187160    vlc_value_t val_list; 
    188161    int i_ret = -1; 
  • src/control/event.c

    r4c401bd r34f8161  
    9191{ 
    9292    libvlc_exception_t p_e_unused; /* FIXME: error checking here */ 
    93     libvlc_input_t * p_libvlc_input = libvlc_playlist_get_input( p_instance, &p_e_unused )
     93    libvlc_media_instance_t * p_mi
    9494    input_thread_t * p_input; 
    9595 
    96     if( !p_libvlc_input ) 
     96    p_mi = libvlc_playlist_get_media_instance( p_instance, &p_e_unused ); 
     97 
     98    if( !p_mi ) 
    9799        return NULL; 
    98      
    99     p_input = libvlc_get_input_thread( p_libvlc_input, &p_e_unused ); 
    100  
    101     libvlc_input_free(p_libvlc_input); 
     100 
     101    p_input = libvlc_get_input_thread( p_mi, &p_e_unused ); 
     102 
     103    libvlc_media_instance_destroy( p_mi ); 
    102104 
    103105    return p_input; 
  • src/control/input.c

    rff8e2f8 r34f8161  
    11/***************************************************************************** 
    2  * input.c: Libvlc new API input management functions 
     2 * media_instance.c: Libvlc API Media Instance management functions 
    33 ***************************************************************************** 
    44 * Copyright (C) 2005 the VideoLAN team 
     
    2828#include "input/input_internal.h" 
    2929 
    30 void libvlc_input_free( libvlc_input_t *p_input ) 
    31 { 
    32     if( p_input ) free( p_input ); 
    33 } 
    34  
    3530/* 
    3631 * Retrieve the input thread. Be sure to release the object 
    3732 * once you are done with it. (libvlc Internal) 
    3833 */ 
    39 input_thread_t *libvlc_get_input_thread( libvlc_input_t *p_input
     34input_thread_t *libvlc_get_input_thread( libvlc_media_instance_t *p_mi
    4035                                         libvlc_exception_t *p_e )  
    4136{ 
    4237    input_thread_t *p_input_thread; 
    4338 
    44     if( !p_input
     39    if( !p_mi || p_mi->i_input_id == -1
    4540        RAISENULL( "Input is NULL" ); 
    4641 
    4742    p_input_thread = (input_thread_t*)vlc_object_get( 
    48                                              p_input->p_instance->p_libvlc_int, 
    49                                              p_input->i_input_id ); 
     43                                             p_mi->p_libvlc_instance->p_libvlc_int, 
     44                                             p_mi->i_input_id ); 
    5045    if( !p_input_thread ) 
    5146        RAISENULL( "Input does not exist" ); 
     
    5449} 
    5550 
     51/************************************************************************** 
     52 * Create a Media Instance object 
     53 **************************************************************************/ 
     54libvlc_media_instance_t * 
     55libvlc_media_instance_new( libvlc_media_descriptor_t *p_md ) 
     56{ 
     57    libvlc_media_instance_t * p_mi; 
     58 
     59    if( !p_md ) 
     60        return NULL; 
     61 
     62    p_mi = malloc( sizeof(libvlc_media_instance_t) ); 
     63    p_mi->p_md = libvlc_media_descriptor_duplicate( p_md ); 
     64    p_mi->p_libvlc_instance = p_mi->p_md->p_libvlc_instance; 
     65    p_mi->i_input_id = -1; 
     66 
     67    return p_mi; 
     68} 
     69 
     70/************************************************************************** 
     71 * Create a new media instance object from an input_thread (Libvlc Internal) 
     72 **************************************************************************/ 
     73libvlc_media_instance_t * libvlc_media_instance_new_from_input_thread( 
     74                                   struct libvlc_instance_t *p_libvlc_instance, 
     75                                   input_thread_t *p_input ) 
     76{ 
     77    libvlc_media_instance_t * p_mi; 
     78 
     79    p_mi = malloc( sizeof(libvlc_media_instance_t) ); 
     80    p_mi->p_md = libvlc_media_descriptor_new_from_input_item( 
     81                    p_libvlc_instance, 
     82                    p_input->p->input.p_item ); 
     83    p_mi->p_libvlc_instance = p_libvlc_instance; 
     84    p_mi->i_input_id = p_input->i_object_id; 
     85 
     86    return p_mi; 
     87} 
     88 
     89/************************************************************************** 
     90 * Destroy a Media Instance object 
     91 **************************************************************************/ 
     92void libvlc_media_instance_destroy( libvlc_media_instance_t *p_mi ) 
     93{ 
     94    input_thread_t *p_input_thread; 
     95    libvlc_exception_t p_e; 
     96 
     97    /* XXX: locking */ 
     98    libvlc_exception_init( &p_e ); 
     99 
     100    if( !p_mi ) 
     101        return; 
     102 
     103    p_input_thread = libvlc_get_input_thread( p_mi, &p_e ); 
     104 
     105    if( libvlc_exception_raised( &p_e ) ) 
     106        return; /* no need to worry about no input thread */ 
     107     
     108    input_DestroyThread( p_input_thread ); 
     109 
     110    libvlc_media_descriptor_destroy( p_mi->p_md ); 
     111 
     112    free( p_mi ); 
     113} 
     114 
     115/************************************************************************** 
     116 * Free a Media Instance object (libvlc internal) 
     117 **************************************************************************/ 
     118void libvlc_media_instance_destroy_and_detach( libvlc_media_instance_t *p_mi ) 
     119{ 
     120    if( !p_mi ) 
     121        return; 
     122 
     123    libvlc_media_descriptor_destroy( p_mi->p_md ); 
     124 
     125    free( p_mi ); 
     126} 
     127 
     128/************************************************************************** 
     129 * Play 
     130 **************************************************************************/ 
     131void libvlc_media_instance_play( libvlc_media_instance_t *p_mi, 
     132                                 libvlc_exception_t *p_e ) 
     133{ 
     134    input_thread_t * p_input_thread; 
     135 
     136    if( p_mi->i_input_id != -1)  
     137    { 
     138        vlc_value_t val; 
     139        val.i_int = PLAYING_S; 
     140 
     141        /* A thread alread exists, send it a play message */ 
     142        p_input_thread = libvlc_get_input_thread( p_mi, p_e ); 
     143 
     144        if( libvlc_exception_raised( p_e ) ) 
     145            return; 
     146 
     147        input_Control( p_input_thread, INPUT_CONTROL_SET_STATE, PLAYING_S ); 
     148        return; 
     149    } 
     150 
     151    p_input_thread = input_CreateThread( p_mi->p_libvlc_instance->p_libvlc_int, 
     152                                         p_mi->p_md->p_input_item ); 
     153    p_mi->i_input_id = p_input_thread->i_object_id; 
     154} 
     155 
     156/************************************************************************** 
     157 * Pause 
     158 **************************************************************************/ 
     159void libvlc_media_instance_pause( libvlc_media_instance_t *p_mi, 
     160                                  libvlc_exception_t *p_e ) 
     161{ 
     162    input_thread_t * p_input_thread; 
     163    vlc_value_t val; 
     164    val.i_int = PAUSE_S; 
     165 
     166    p_input_thread = libvlc_get_input_thread( p_mi, p_e ); 
     167 
     168    if( libvlc_exception_raised( p_e ) ) 
     169        return; 
     170 
     171    input_Control( p_input_thread, INPUT_CONTROL_SET_STATE, val ); 
     172} 
    56173 
    57174/************************************************************************** 
    58175 * Getters for stream information 
    59176 **************************************************************************/ 
    60 vlc_int64_t libvlc_input_get_length( libvlc_input_t *p_input, 
     177vlc_int64_t libvlc_media_instance_get_length( 
     178                             libvlc_media_instance_t *p_mi, 
    61179                             libvlc_exception_t *p_e ) 
    62180{ 
     
    64182    vlc_value_t val; 
    65183 
    66     p_input_thread = libvlc_get_input_thread ( p_input, p_e); 
     184    p_input_thread = libvlc_get_input_thread ( p_mi, p_e); 
    67185    if( !p_input_thread ) 
    68186        return -1; 
     
    74192} 
    75193 
    76 vlc_int64_t libvlc_input_get_time( libvlc_input_t *p_input, 
     194vlc_int64_t libvlc_media_instance_get_time( 
     195                                   libvlc_media_instance_t *p_mi, 
    77196                                   libvlc_exception_t *p_e ) 
    78197{ 
     
    80199    vlc_value_t val; 
    81200 
    82     p_input_thread = libvlc_get_input_thread ( p_input, p_e ); 
     201    p_input_thread = libvlc_get_input_thread ( p_mi, p_e ); 
    83202    if( !p_input_thread ) 
    84203        return -1; 
     
    89208} 
    90209 
    91 void libvlc_input_set_time( libvlc_input_t *p_input, vlc_int64_t time, 
    92                             libvlc_exception_t *p_e ) 
     210void libvlc_media_instance_set_time( 
     211                                 libvlc_media_instance_t *p_mi, 
     212                                 vlc_int64_t time, 
     213                                 libvlc_exception_t *p_e ) 
    93214{ 
    94215    input_thread_t *p_input_thread; 
    95216    vlc_value_t value; 
    96217 
    97     p_input_thread = libvlc_get_input_thread ( p_input, p_e ); 
     218    p_input_thread = libvlc_get_input_thread ( p_mi, p_e ); 
    98219    if( !p_input_thread ) 
    99220        return; 
     
    104225} 
    105226 
    106 void libvlc_input_set_position( libvlc_input_t *p_input, float position, 
     227void libvlc_media_instance_set_position( 
     228                                libvlc_media_instance_t *p_mi, 
     229                                float position, 
    107230                                libvlc_exception_t *p_e )  
    108231{ 
     
    111234    val.f_float = position; 
    112235 
    113     p_input_thread = libvlc_get_input_thread ( p_input, p_e); 
     236    p_input_thread = libvlc_get_input_thread ( p_mi, p_e); 
    114237    if( !p_input_thread ) 
    115238        return; 
     
    119242} 
    120243 
    121 float libvlc_input_get_position( libvlc_input_t *p_input, 
    122                                  libvlc_exception_t *p_e ) 
    123 
    124     input_thread_t *p_input_thread; 
    125     vlc_value_t val; 
    126  
    127     p_input_thread = libvlc_get_input_thread ( p_input, p_e); 
     244float libvlc_media_instance_get_position( 
     245                                 libvlc_media_instance_t *p_mi, 
     246                                 libvlc_exception_t *p_e ) 
     247
     248    input_thread_t *p_input_thread; 
     249    vlc_value_t val; 
     250 
     251    p_input_thread = libvlc_get_input_thread ( p_mi, p_e ); 
    128252    if( !p_input_thread ) 
    129253        return -1.0; 
     
    135259} 
    136260 
    137 float libvlc_input_get_fps( libvlc_input_t *p_input, 
    138                             libvlc_exception_t *p_e)  
     261float libvlc_media_instance_get_fps( 
     262                                 libvlc_media_instance_t *p_mi, 
     263                                 libvlc_exception_t *p_e)  
    139264{ 
    140265    double f_fps = 0.0; 
    141266    input_thread_t *p_input_thread; 
    142267 
    143     p_input_thread = libvlc_get_input_thread ( p_input, p_e ); 
     268    p_input_thread = libvlc_get_input_thread ( p_mi, p_e ); 
    144269    if( !p_input_thread ) 
    145270        return 0.0; 
     
    159284} 
    160285 
    161 vlc_bool_t libvlc_input_will_play( libvlc_input_t *p_input, 
    162                                    libvlc_exception_t *p_e)  
     286vlc_bool_t libvlc_media_instance_will_play( 
     287                                 libvlc_media_instance_t *p_mi, 
     288                                 libvlc_exception_t *p_e)  
    163289{ 
    164290    input_thread_t *p_input_thread = 
    165                             libvlc_get_input_thread ( p_input, p_e); 
     291                            libvlc_get_input_thread ( p_mi, p_e); 
    166292    if ( !p_input_thread ) 
    167293        return VLC_FALSE; 
     
    176302} 
    177303 
    178 void libvlc_input_set_rate( libvlc_input_t *p_input, float rate, 
    179                                 libvlc_exception_t *p_e )  
     304void libvlc_media_instance_set_rate( 
     305                                 libvlc_media_instance_t *p_mi, 
     306                                 float rate, 
     307                                 libvlc_exception_t *p_e )  
    180308{ 
    181309    input_thread_t *p_input_thread; 
     
    187315    val.i_int = 1000.0f/rate; 
    188316 
    189     p_input_thread = libvlc_get_input_thread ( p_input, p_e); 
     317    p_input_thread = libvlc_get_input_thread ( p_mi, p_e); 
    190318    if ( !p_input_thread ) 
    191319        return; 
     
    195323} 
    196324 
    197 float libvlc_input_get_rate( libvlc_input_t *p_input, 
    198                                  libvlc_exception_t *p_e ) 
    199 
    200     input_thread_t *p_input_thread; 
    201     vlc_value_t val; 
    202  
    203     p_input_thread = libvlc_get_input_thread ( p_input, p_e); 
     325float libvlc_media_instance_get_rate( 
     326                                 libvlc_media_instance_t *p_mi, 
     327                                 libvlc_exception_t *p_e ) 
     328
     329    input_thread_t *p_input_thread; 
     330    vlc_value_t val; 
     331 
     332    p_input_thread = libvlc_get_input_thread ( p_mi, p_e); 
    204333    if ( !p_input_thread ) 
    205334        return -1.0; 
     
    211340} 
    212341 
    213 int libvlc_input_get_state( libvlc_input_t *p_input, 
    214                                  libvlc_exception_t *p_e ) 
    215 
    216     input_thread_t *p_input_thread; 
    217     vlc_value_t val; 
    218  
    219     p_input_thread = libvlc_get_input_thread ( p_input, p_e ); 
     342int libvlc_media_instance_get_state( 
     343                                 libvlc_media_instance_t *p_mi, 
     344                                 libvlc_exception_t *p_e ) 
     345
     346    input_thread_t *p_input_thread; 
     347    vlc_value_t val; 
     348 
     349    p_input_thread = libvlc_get_input_thread ( p_mi, p_e ); 
    220350    if ( !p_input_thread ) 
    221351        return 0; 
  • src/control/libvlc_internal.h

    rd6346a3 r34f8161  
    3232#include <vlc/vlc.h> 
    3333#include <vlc/libvlc_structures.h> 
     34 
     35#include <vlc_input.h> 
    3436     
    3537/*************************************************************************** 
     
    8385}; 
    8486 
    85 struct libvlc_input_t 
     87struct libvlc_media_instance_t 
    8688{ 
    87     int i_input_id;  ///< Input object id. We don't use a pointer to 
    88                      /// avoid any crash 
    89     struct libvlc_instance_t *p_instance; ///< Parent instance 
     89    int i_input_id;  /* Input object id. We don't use a pointer to 
     90                        avoid any crash */ 
     91    struct libvlc_instance_t  *p_libvlc_instance; /* Parent instance */ 
     92    libvlc_media_descriptor_t *p_md; /* current media descriptor */ 
    9093}; 
    9194 
     
    9497 ***************************************************************************/ 
    9598VLC_EXPORT (input_thread_t *, libvlc_get_input_thread, 
    96                         ( struct libvlc_input_t *, libvlc_exception_t * ) ); 
     99                        ( struct libvlc_media_instance_t *, libvlc_exception_t * ) ); 
     100 
     101VLC_EXPORT (libvlc_media_instance_t *, libvlc_media_instance_new_from_input_thread, 
     102                        ( struct libvlc_instance_t *, input_thread_t * ) ); 
     103 
     104VLC_EXPORT (void, libvlc_media_instance_destroy_and_detach, 
     105                        ( libvlc_media_instance_t * ) ); 
     106 
     107VLC_EXPORT (libvlc_media_descriptor_t *, libvlc_media_descriptor_new_from_input_item, 
     108                        ( struct libvlc_instance_t *, input_item_t * ) ); 
     109 
     110VLC_EXPORT (libvlc_media_descriptor_t *, libvlc_media_descriptor_duplicate, 
     111                        ( libvlc_media_descriptor_t * ) ); 
    97112 
    98113#define RAISENULL( psz,a... ) { libvlc_exception_raise( p_e, psz,##a ); \ 
  • src/control/media_descriptor.c

    r0dabfb1 r34f8161  
    5959        return NULL; /* XXX: throw an exception */ 
    6060 
    61     p_media_desc = malloc( sizeof(libvlc_input_t) ); 
     61    p_media_desc = malloc( sizeof(libvlc_media_descriptor_t) ); 
    6262    p_media_desc->p_libvlc_instance = p_instance; 
    6363    p_media_desc->p_input_item      = p_input_item; 
     
    6868 
    6969/************************************************************************** 
     70 * Create a new media descriptor object from an input_item 
     71 * (libvlc internal) 
     72 **************************************************************************/ 
     73libvlc_media_descriptor_t * libvlc_media_descriptor_new_from_input_item( 
     74                                   libvlc_instance_t *p_instance, 
     75                                   input_item_t *p_input_item ) 
     76{ 
     77    libvlc_media_descriptor_t * p_media_desc; 
     78 
     79    if (!p_input_item) 
     80        return NULL; /* XXX: throw an exception */ 
     81 
     82    p_media_desc = malloc( sizeof(libvlc_media_descriptor_t) ); 
     83    p_media_desc->p_libvlc_instance = p_instance; 
     84    p_media_desc->p_input_item      = p_input_item; 
     85    p_media_desc->b_preparsed       = VLC_TRUE; 
     86 
     87    return p_media_desc; 
     88} 
     89 
     90/************************************************************************** 
    7091 * Delete a media descriptor object 
    7192 **************************************************************************/ 
    72 void libvlc_media_descriptor_destroy( libvlc_media_descriptor_t *p_meta_desc
     93void libvlc_media_descriptor_destroy( libvlc_media_descriptor_t *p_md
    7394{ 
    74     if (!p_meta_desc
     95    if (!p_md
    7596        return; 
    7697 
    7798    /* XXX: locking */ 
    78     input_ItemClean( p_meta_desc->p_input_item ); 
     99    input_ItemClean( p_md->p_input_item ); 
    79100 
    80     free( p_meta_desc ); 
     101    free( p_md ); 
    81102} 
    82103 
    83104/************************************************************************** 
    84  * Getters for meta information 
     105 * Delete a media descriptor object 
     106 **************************************************************************/ 
     107libvlc_media_descriptor_t * 
     108libvlc_media_descriptor_duplicate( libvlc_media_descriptor_t *p_md_orig ) 
     109
     110    libvlc_media_descriptor_t * p_md; 
     111 
     112    p_md = malloc( sizeof(libvlc_media_descriptor_t) ); 
     113    bcopy( p_md_orig, p_md, sizeof(libvlc_media_descriptor_t) ); 
     114 
     115    return p_md; 
     116
     117 
     118/************************************************************************** 
     119 * Getter for meta information 
    85120 **************************************************************************/ 
    86121static const int meta_conversion[] = 
  • src/control/mediacontrol_audio_video.c

    ra79c62a r34f8161  
    284284{ 
    285285    libvlc_exception_t ex; 
    286     libvlc_input_t* p_input
     286    libvlc_media_instance_t* p_mi
    287287    int i_ret; 
    288288 
     
    290290    libvlc_exception_init( &ex ); 
    291291 
    292     p_input = libvlc_playlist_get_input( self->p_instance, &ex ); 
    293     HANDLE_LIBVLC_EXCEPTION_ZERO( &ex ); 
    294  
    295     i_ret = libvlc_input_get_rate( p_input, &ex ); 
    296     libvlc_input_free( p_input ); 
     292    p_mi = libvlc_playlist_get_media_instance( self->p_instance, &ex ); 
     293    HANDLE_LIBVLC_EXCEPTION_ZERO( &ex ); 
     294 
     295    i_ret = libvlc_media_instance_get_rate( p_mi, &ex ); 
     296    libvlc_media_instance_destroy_and_detach( p_mi ); 
    297297    HANDLE_LIBVLC_EXCEPTION_ZERO( &ex ); 
    298298 
     
    306306{ 
    307307    libvlc_exception_t ex; 
    308     libvlc_input_t* p_input
    309  
    310     mediacontrol_exception_init( exception ); 
    311     libvlc_exception_init( &ex ); 
    312  
    313     p_input = libvlc_playlist_get_input( self->p_instance, &ex ); 
    314     HANDLE_LIBVLC_EXCEPTION_VOID( &ex ); 
    315  
    316     libvlc_input_set_rate( p_input, rate * 10, &ex ); 
    317     libvlc_input_free( p_input ); 
     308    libvlc_media_instance_t* p_mi
     309 
     310    mediacontrol_exception_init( exception ); 
     311    libvlc_exception_init( &ex ); 
     312 
     313    p_mi = libvlc_playlist_get_media_instance( self->p_instance, &ex ); 
     314    HANDLE_LIBVLC_EXCEPTION_VOID( &ex ); 
     315 
     316    libvlc_media_instance_set_rate( p_mi, rate * 10, &ex ); 
     317    libvlc_media_instance_destroy_and_detach( p_mi ); 
    318318    HANDLE_LIBVLC_EXCEPTION_VOID( &ex ); 
    319319} 
     
    324324{ 
    325325    libvlc_exception_t ex; 
    326     libvlc_input_t* p_input
     326    libvlc_media_instance_t* p_mi
    327327    int i_ret; 
    328328 
     
    330330    libvlc_exception_init( &ex ); 
    331331 
    332     p_input = libvlc_playlist_get_input( self->p_instance, &ex ); 
    333     HANDLE_LIBVLC_EXCEPTION_ZERO( &ex ); 
    334  
    335     i_ret = libvlc_get_fullscreen( p_input, &ex ); 
    336     libvlc_input_free( p_input ); 
     332    p_mi = libvlc_playlist_get_media_instance( self->p_instance, &ex ); 
     333    HANDLE_LIBVLC_EXCEPTION_ZERO( &ex ); 
     334 
     335    i_ret = libvlc_get_fullscreen( p_mi, &ex ); 
     336    libvlc_media_instance_destroy_and_detach( p_mi ); 
    337337    HANDLE_LIBVLC_EXCEPTION_ZERO( &ex ); 
    338338 
     
    346346{ 
    347347    libvlc_exception_t ex; 
    348     libvlc_input_t* p_input
    349  
    350     mediacontrol_exception_init( exception ); 
    351     libvlc_exception_init( &ex ); 
    352  
    353     p_input = libvlc_playlist_get_input( self->p_instance, &ex ); 
    354     HANDLE_LIBVLC_EXCEPTION_VOID( &ex ); 
    355  
    356     libvlc_set_fullscreen( p_input, b_fullscreen, &ex ); 
    357     libvlc_input_free( p_input ); 
    358     HANDLE_LIBVLC_EXCEPTION_VOID( &ex ); 
    359 } 
     348    libvlc_media_instance_t* p_mi
     349 
     350    mediacontrol_exception_init( exception ); 
     351    libvlc_exception_init( &ex ); 
     352 
     353    p_mi = libvlc_playlist_get_media_instance( self->p_instance, &ex ); 
     354    HANDLE_LIBVLC_EXCEPTION_VOID( &ex ); 
     355 
     356    libvlc_set_fullscreen( p_mi, b_fullscreen, &ex ); 
     357    libvlc_media_instance_destroy_and_detach( p_mi ); 
     358    HANDLE_LIBVLC_EXCEPTION_VOID( &ex ); 
     359} 
  • src/control/mediacontrol_core.c

    ra79c62a r34f8161  
    125125    libvlc_exception_t ex; 
    126126    vlc_int64_t pos; 
    127     libvlc_input_t * p_input
     127    libvlc_media_instance_t * p_mi
    128128 
    129129    mediacontrol_exception_init( exception ); 
     
    134134    retval->key = a_key; 
    135135 
    136     p_input = libvlc_playlist_get_input( self->p_instance, &ex); 
     136    p_mi = libvlc_playlist_get_media_instance( self->p_instance, &ex); 
    137137    HANDLE_LIBVLC_EXCEPTION_NULL( &ex ); 
    138138 
    139139    if(  an_origin != mediacontrol_AbsolutePosition ) 
    140140    { 
    141         libvlc_input_free( p_input ); 
     141        libvlc_media_instance_destroy_and_detach( p_mi ); 
    142142        /* Relative or ModuloPosition make no sense */ 
    143143        RAISE_NULL( mediacontrol_PositionOriginNotSupported, 
     
    146146 
    147147    /* We are asked for an AbsolutePosition. */ 
    148     pos = libvlc_input_get_time( p_input, &ex ); 
     148    pos = libvlc_media_instance_get_time( p_mi, &ex ); 
    149149 
    150150    if( a_key == mediacontrol_MediaTime ) 
     
    156156        if( ! self->p_playlist->p_input ) 
    157157        { 
    158             libvlc_input_free( p_input ); 
     158            libvlc_media_instance_destroy_and_detach( p_mi ); 
    159159            RAISE_NULL( mediacontrol_InternalException, 
    160160                        "No input" ); 
     
    165165                                                   pos ); 
    166166    } 
    167     libvlc_input_free( p_input ); 
     167    libvlc_media_instance_destroy_and_detach( p_mi ); 
    168168    return retval; 
    169169} 
     
    175175                                 mediacontrol_Exception *exception ) 
    176176{ 
    177     libvlc_input_t * p_input
     177    libvlc_media_instance_t * p_mi
    178178    libvlc_exception_t ex; 
    179179    vlc_int64_t i_pos; 
     
    182182    mediacontrol_exception_init( exception ); 
    183183 
    184     p_input = libvlc_playlist_get_input( self->p_instance, &ex); 
     184    p_mi = libvlc_playlist_get_media_instance( self->p_instance, &ex); 
    185185    HANDLE_LIBVLC_EXCEPTION_VOID( &ex ); 
    186186 
    187187    i_pos = mediacontrol_position2microsecond( self->p_playlist->p_input, a_position ); 
    188     libvlc_input_set_time( p_input, i_pos / 1000, &ex ); 
    189     libvlc_input_free( p_input ); 
     188    libvlc_media_instance_set_time( p_mi, i_pos / 1000, &ex );