*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
static int Run ( input_thread_t *p_input );
static int RunAndClean ( input_thread_t *p_input );
-static input_thread_t * Create ( vlc_object_t *, input_item_t *, vlc_bool_t );
+static input_thread_t * Create ( vlc_object_t *, input_item_t *, char *,
+ vlc_bool_t );
static int Init ( input_thread_t *p_input, vlc_bool_t b_quick );
static void Error ( input_thread_t *p_input );
static void End ( input_thread_t *p_input );
* TODO complete this list (?)
*****************************************************************************/
static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
- vlc_bool_t b_quick )
+ char *psz_header, vlc_bool_t b_quick )
{
input_thread_t *p_input; /* thread descriptor */
vlc_value_t val;
msg_Err( p_parent, "out of memory" );
return NULL;
}
+ p_input->psz_header = psz_header ? strdup( psz_header ) : NULL;
/* Init Common fields */
p_input->b_eof = VLC_FALSE;
p_input->input.b_eof = VLC_FALSE;
p_input->input.i_cr_average = 0;
+ stats_ReinitInputStats( p_item->p_stats );
+
/* No slave */
p_input->i_slave = 0;
p_input->slave = NULL;
*/
input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
input_item_t *p_item )
+{
+ __input_CreateThread2( p_parent, p_item, NULL );
+}
+
+/* Gruik ! */
+input_thread_t *__input_CreateThread2( vlc_object_t *p_parent,
+ input_item_t *p_item,
+ char *psz_header )
{
input_thread_t *p_input; /* thread descriptor */
- p_input = Create( p_parent, p_item, VLC_FALSE );
+ p_input = Create( p_parent, p_item, psz_header, VLC_FALSE );
/* Now we can attach our new input */
vlc_object_attach( p_input, p_parent );
* \param p_parent a vlc_object
* \param p_item an input item
* \param b_block should we block until read is finished ?
+ * \return the input object id if non blocking, an error code else
*/
-void __input_Read( vlc_object_t *p_parent, input_item_t *p_item,
+int __input_Read( vlc_object_t *p_parent, input_item_t *p_item,
vlc_bool_t b_block )
{
input_thread_t *p_input; /* thread descriptor */
- p_input = Create( p_parent, p_item, VLC_FALSE );
+ p_input = Create( p_parent, p_item, NULL, VLC_FALSE );
/* Now we can attach our new input */
vlc_object_attach( p_input, p_parent );
if( b_block )
{
RunAndClean( p_input );
+ return VLC_SUCCESS;
}
else
{
msg_Err( p_input, "cannot create input thread" );
vlc_object_detach( p_input );
vlc_object_destroy( p_input );
- return;
+ return VLC_EGENERIC;
}
}
+ return p_input->i_object_id;
}
/**
input_thread_t *p_input; /* thread descriptor */
/* Allocate descriptor */
- p_input = Create( p_parent, p_item, VLC_TRUE );
+ p_input = Create( p_parent, p_item, NULL, VLC_TRUE );
/* Now we can attach our new input */
vlc_object_attach( p_input, p_parent );
*/
if( !b_quick )
{
+ counter_t *p_counter;
+ stats_Create( p_input, "read_bytes", VLC_VAR_INTEGER, STATS_COUNTER );
+ stats_Create( p_input, "read_packets", VLC_VAR_INTEGER, STATS_COUNTER );
+ stats_Create( p_input, "demux_read", VLC_VAR_INTEGER, STATS_COUNTER );
+ stats_Create( p_input, "input_bitrate", VLC_VAR_FLOAT,
+ STATS_DERIVATIVE );
+ stats_Create( p_input, "demux_bitrate", VLC_VAR_FLOAT,
+ STATS_DERIVATIVE );
+ p_counter = stats_CounterGet( p_input, p_input->i_object_id,
+ "input_bitrate" );
+ if( p_counter ) p_counter->update_interval = 1000000;
+ p_counter = stats_CounterGet( p_input, p_input->i_object_id,
+ "demux_bitrate" );
+ if( p_counter ) p_counter->update_interval = 1000000;
+
psz = var_GetString( p_input, "sout" );
if( *psz && strncasecmp( p_input->input.p_item->psz_uri, "vlc:", 4 ) )
{
if( in->p_access == NULL )
{
msg_Err( p_input, "no suitable access module for `%s'", psz_mrl );
- intf_UserFatal( VLC_OBJECT( p_input), DIALOG_NOACCESS,
- "Error opening stream",
- "Unable to open '%s'", psz_mrl );
+ intf_UserFatal( VLC_OBJECT( p_input),
+ _("Errors"),"Unable to open '%s'", psz_mrl );
goto error;
}
{
msg_Err( p_input, "no suitable demux module for `%s/%s://%s'",
psz_access, psz_demux, psz_path );
+ intf_UserFatal( VLC_OBJECT( p_input), _("Errors"),
+ "Unrecognized format for '%s'", psz_mrl );
goto error;
}