input_internal.h

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

Generated on Mon Nov 22 07:55:20 2010 for VLC by  doxygen 1.5.6