input_internal.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * input_internal.h: Internal input structures
00003  *****************************************************************************
00004  * Copyright (C) 1998-2006 VLC authors and VideoLAN
00005  * $Id: e65acdfb74ac8f99f146503c91c0304b8ede840f $
00006  *
00007  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
00008  *
00009  * This program is free software; you can redistribute it and/or modify it
00010  * under the terms of the GNU Lesser General Public License as published by
00011  * the Free Software Foundation; either version 2.1 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00017  * GNU Lesser General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public License
00020  * along with this program; if not, write to the Free Software Foundation,
00021  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00022  *****************************************************************************/
00023 
00024 #ifndef LIBVLC_INPUT_INTERNAL_H
00025 #define LIBVLC_INPUT_INTERNAL_H 1
00026 
00027 #include <vlc_access.h>
00028 #include <vlc_demux.h>
00029 #include <vlc_input.h>
00030 #include <libvlc.h>
00031 #include "input_interface.h"
00032 
00033 /*****************************************************************************
00034  *  Private input fields
00035  *****************************************************************************/
00036 
00037 #define INPUT_CONTROL_FIFO_SIZE    100
00038 
00039 /* input_source_t: gathers all information per input source */
00040 typedef struct
00041 {
00042     /* Access/Stream/Demux plugins */
00043     access_t *p_access;
00044     stream_t *p_stream;
00045     demux_t  *p_demux;
00046 
00047     /* Title infos for that input */
00048     bool         b_title_demux; /* Titles/Seekpoints provided by demux */
00049     int          i_title;
00050     input_title_t **title;
00051 
00052     int i_title_offset;
00053     int i_seekpoint_offset;
00054 
00055     int i_title_start;
00056     int i_title_end;
00057     int i_seekpoint_start;
00058     int i_seekpoint_end;
00059 
00060     /* Properties */
00061     bool b_can_pause;
00062     bool b_can_pace_control;
00063     bool b_can_rate_control;
00064     bool b_can_stream_record;
00065     bool b_rescale_ts;
00066 
00067     /* */
00068     int64_t i_pts_delay;
00069 
00070     bool       b_eof;   /* eof of demuxer */
00071 
00072 } input_source_t;
00073 
00074 typedef struct
00075 {
00076     int         i_type;
00077     vlc_value_t val;
00078 } input_control_t;
00079 
00080 /** Private input fields */
00081 struct input_thread_private_t
00082 {
00083     /* Global properties */
00084     double      f_fps;
00085     int         i_state;
00086     bool        b_can_pause;
00087     bool        b_can_rate_control;
00088     bool        b_can_pace_control;
00089 
00090     /* Current state */
00091     bool        b_recording;
00092     int         i_rate;
00093 
00094     /* Playtime configuration and state */
00095     int64_t     i_start;    /* :start-time,0 by default */
00096     int64_t     i_stop;     /* :stop-time, 0 if none */
00097     int64_t     i_run;      /* :run-time, 0 if none */
00098     int64_t     i_time;     /* Current time */
00099     bool        b_fast_seek;/* :input-fast-seek */
00100 
00101     /* Output */
00102     bool            b_out_pace_control; /* XXX Move it ot es_sout ? */
00103     sout_instance_t *p_sout;            /* Idem ? */
00104     es_out_t        *p_es_out;
00105     es_out_t        *p_es_out_display;
00106 
00107     /* Title infos FIXME multi-input (not easy) ? */
00108     int          i_title;
00109     input_title_t **title;
00110 
00111     int i_title_offset;
00112     int i_seekpoint_offset;
00113 
00114     /* User bookmarks FIXME won't be easy with multiples input */
00115     seekpoint_t bookmark;
00116     int         i_bookmark;
00117     seekpoint_t **pp_bookmark;
00118 
00119     /* Input attachment */
00120     int i_attachment;
00121     input_attachment_t **attachment;
00122 
00123     /* Main input properties */
00124 
00125     /* Input item */
00126     input_item_t   *p_item;
00127 
00128     /* Main source */
00129     input_source_t input;
00130     /* Slave sources (subs, and others) */
00131     int            i_slave;
00132     input_source_t **slave;
00133 
00134     /* Resources */
00135     input_resource_t *p_resource;
00136     input_resource_t *p_resource_private;
00137 
00138     /* Stats counters */
00139     struct {
00140         counter_t *p_read_packets;
00141         counter_t *p_read_bytes;
00142         counter_t *p_input_bitrate;
00143         counter_t *p_demux_read;
00144         counter_t *p_demux_bitrate;
00145         counter_t *p_demux_corrupted;
00146         counter_t *p_demux_discontinuity;
00147         counter_t *p_decoded_audio;
00148         counter_t *p_decoded_video;
00149         counter_t *p_decoded_sub;
00150         counter_t *p_sout_sent_packets;
00151         counter_t *p_sout_sent_bytes;
00152         counter_t *p_sout_send_bitrate;
00153         counter_t *p_played_abuffers;
00154         counter_t *p_lost_abuffers;
00155         counter_t *p_displayed_pictures;
00156         counter_t *p_lost_pictures;
00157         vlc_mutex_t counters_lock;
00158     } counters;
00159 
00160     /* Buffer of pending actions */
00161     vlc_mutex_t lock_control;
00162     vlc_cond_t  wait_control;
00163     int i_control;
00164     input_control_t control[INPUT_CONTROL_FIFO_SIZE];
00165 
00166     bool b_abort;
00167     bool is_running;
00168     vlc_thread_t thread;
00169 };
00170 
00171 /***************************************************************************
00172  * Internal control helpers
00173  ***************************************************************************/
00174 enum input_control_e
00175 {
00176     INPUT_CONTROL_SET_DIE,
00177 
00178     INPUT_CONTROL_SET_STATE,
00179 
00180     INPUT_CONTROL_SET_RATE,
00181 
00182     INPUT_CONTROL_SET_POSITION,
00183 
00184     INPUT_CONTROL_SET_TIME,
00185 
00186     INPUT_CONTROL_SET_PROGRAM,
00187 
00188     INPUT_CONTROL_SET_TITLE,
00189     INPUT_CONTROL_SET_TITLE_NEXT,
00190     INPUT_CONTROL_SET_TITLE_PREV,
00191 
00192     INPUT_CONTROL_SET_SEEKPOINT,
00193     INPUT_CONTROL_SET_SEEKPOINT_NEXT,
00194     INPUT_CONTROL_SET_SEEKPOINT_PREV,
00195 
00196     INPUT_CONTROL_SET_BOOKMARK,
00197 
00198     INPUT_CONTROL_SET_ES,
00199     INPUT_CONTROL_RESTART_ES,
00200 
00201     INPUT_CONTROL_SET_AUDIO_DELAY,
00202     INPUT_CONTROL_SET_SPU_DELAY,
00203 
00204     INPUT_CONTROL_ADD_SLAVE,
00205 
00206     INPUT_CONTROL_ADD_SUBTITLE,
00207 
00208     INPUT_CONTROL_SET_RECORD_STATE,
00209 
00210     INPUT_CONTROL_SET_FRAME_NEXT,
00211 };
00212 
00213 /* Internal helpers */
00214 
00215 /* XXX for string value you have to allocate it before calling
00216  * input_ControlPush
00217  */
00218 void input_ControlPush( input_thread_t *, int i_type, vlc_value_t * );
00219 
00220 /* Bound pts_delay */
00221 #define INPUT_PTS_DELAY_MAX INT64_C(60000000)
00222 
00223 /**********************************************************************
00224  * Item metadata
00225  **********************************************************************/
00226 /* input_ExtractAttachmentAndCacheArt:
00227  *  Becarefull; p_item lock HAS to be taken */
00228 void input_ExtractAttachmentAndCacheArt( input_thread_t *p_input );
00229 
00230 /***************************************************************************
00231  * Internal prototypes
00232  ***************************************************************************/
00233 
00234 /* var.c */
00235 void input_ControlVarInit ( input_thread_t * );
00236 void input_ControlVarStop( input_thread_t * );
00237 void input_ControlVarNavigation( input_thread_t * );
00238 void input_ControlVarTitle( input_thread_t *, int i_title );
00239 
00240 void input_ConfigVarInit ( input_thread_t * );
00241 
00242 /* Subtitles */
00243 char **subtitles_Detect( input_thread_t *, char* path, const char *fname );
00244 int subtitles_Filter( const char *);
00245 
00246 /* input.c */
00247 void input_SplitMRL( const char **, const char **, const char **,
00248                      const char **, char * );
00249 
00250 #endif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines