]> git.sesse.net Git - vlc/blobdiff - src/input/stream.c
fix --no-stats in a few cases (there are more remaining)
[vlc] / src / input / stream.c
index f7baea1bf93e199bc0000766cf6f3876febec9b9..905248ff07ce7b5be7dcf844ae6722d37b2fac51 100644 (file)
@@ -1465,6 +1465,7 @@ char * stream_ReadLine( stream_t *s )
             /* Open the converter if we need it */
             if( psz_encoding != NULL )
             {
+                input_thread_t *p_input;
                 msg_Dbg( s, "%s BOM detected", psz_encoding );
                 if( s->i_char_width > 1 )
                 {
@@ -1473,6 +1474,15 @@ char * stream_ReadLine( stream_t *s )
                     {
                         msg_Err( s, "iconv_open failed" );
                     }
+                    var_Create( s->p_parent->p_parent, "subsdec-encoding", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
+                    var_SetString( s->p_parent->p_parent, "subsdec-encoding", "UTF-8" );
+                }
+                p_input = (input_thread_t *)vlc_object_find( s, VLC_OBJECT_INPUT, FIND_PARENT );
+                if( p_input != NULL)
+                {
+                    var_Create( p_input, "subsdec-encoding", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
+                    var_SetString( p_input, "subsdec-encoding", "UTF-8" );
+                    vlc_object_release( p_input );
                 }
                 if( psz_encoding ) free( psz_encoding );
             }
@@ -1619,11 +1629,22 @@ static block_t *AReadBlock( stream_t *s, vlc_bool_t *pb_eof )
     access_t *p_access = p_sys->p_access;
     block_t *p_block;
     vlc_bool_t b_eof;
+    int i_total;
 
     if( !p_sys->i_list )
     {
         p_block = p_access->pf_block( p_access );
         if( pb_eof ) *pb_eof = p_access->info.b_eof;
+        if( p_block && p_access->p_libvlc->b_stats )
+        {
+            stats_UpdateInteger( s->p_parent->p_parent, "read_bytes",
+                                 p_block->i_buffer );
+            stats_GetInteger( s, s->p_parent->p_parent->i_object_id,
+                              "read_bytes", &i_total );
+            stats_UpdateFloat( s->p_parent->p_parent , "input_bitrate",
+                              (float)i_total );
+            stats_UpdateInteger( s->p_parent->p_parent , "read_packets", 1 );
+        }
         return p_block;
     }
 
@@ -1651,6 +1672,16 @@ static block_t *AReadBlock( stream_t *s, vlc_bool_t *pb_eof )
         /* We have to read some data */
         return AReadBlock( s, pb_eof );
     }
+    if( p_block )
+    {
+        stats_UpdateInteger( s->p_parent->p_parent, "read_bytes",
+                             p_block->i_buffer );
+        stats_GetInteger( s, s->p_parent->p_parent->i_object_id,
+                          "read_bytes", &i_total );
+        stats_UpdateFloat( s->p_parent->p_parent , "input_bitrate",
+                          (float)i_total );
+        stats_UpdateInteger( s->p_parent->p_parent , "read_packets", 1 );
+    }
 
     return p_block;
 }