Changeset e7d9e5601fe3603405749091d0eef49630ac7ee8
- Timestamp:
- 21/10/07 01:22:48 (1 year ago)
- git-parent:
- Files:
-
- include/vlc_sout.h (modified) (1 diff)
- modules/stream_out/transcode.c (modified) (7 diffs)
- src/stream_output/stream_output.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
include/vlc_sout.h
r8da8aa9 re7d9e56 58 58 sout_instance_sys_t *p_sys; 59 59 }; 60 61 /** Stream output statistics */ 62 typedef enum 63 { 64 SOUT_STATISTIC_DECODED_VIDEO, 65 SOUT_STATISTIC_DECODED_AUDIO, 66 SOUT_STATISTIC_DECODED_SUBTITLE, 67 68 /* Use them only if you do not goes through a access_out module */ 69 SOUT_STATISTIC_SENT_PACKET, 70 SOUT_STATISTIC_SENT_BYTE, 71 72 } sout_statistic_t; 73 74 VLC_EXPORT( void, sout_UpdateStatistic, ( sout_instance_t *p_sout, sout_statistic_t, int ) ); 60 75 61 76 /**************************************************************************** modules/stream_out/transcode.c
r646e343 re7d9e56 40 40 41 41 #define MASTER_SYNC_MAX_DRIFT 100000 42 43 /* FIXME Ugly, needed for (disabled) stats updates */44 #if 045 #include "../../src/input/input_internal.h"46 #endif47 42 48 43 /***************************************************************************** … … 1320 1315 id->p_decoder->fmt_out.i_extra = 0; 1321 1316 id->p_decoder->fmt_out.p_extra = 0; 1322 id->p_decoder->pf_decode_audio = 0;1317 id->p_decoder->pf_decode_audio = NULL; 1323 1318 id->p_decoder->pf_aout_buffer_new = audio_new_buffer; 1324 1319 id->p_decoder->pf_aout_buffer_del = audio_del_buffer; … … 1552 1547 int i; 1553 1548 *out = NULL; 1554 input_thread_t *p_input = NULL;1555 1556 if( p_stream->p_parent->p_parent && p_stream->p_parent->p_parent->1557 i_object_type == VLC_OBJECT_INPUT )1558 p_input = (input_thread_t *)p_stream->p_parent->p_parent;1559 1549 1560 1550 while( (p_audio_buf = id->p_decoder->pf_decode_audio( id->p_decoder, 1561 1551 &in )) ) 1562 1552 { 1563 #warning Stats not implemented! 1564 #if 0 1565 if( p_input ) 1566 stats_UpdateInteger( p_input, p_input->p->counters.p_decoded_audio, 1567 1, NULL ); 1568 #endif 1553 sout_UpdateStatistic( p_stream->p_sout, SOUT_STATISTIC_DECODED_AUDIO, 1 ); 1569 1554 if( p_sys->b_master_sync ) 1570 1555 { … … 1684 1669 id->p_decoder->fmt_out.i_extra = 0; 1685 1670 id->p_decoder->fmt_out.p_extra = 0; 1686 id->p_decoder->pf_decode_video = 0; 1671 id->p_decoder->pf_decode_video = NULL; 1672 id->p_decoder->pf_get_cc = NULL; 1687 1673 id->p_decoder->pf_get_cc = 0; 1688 1674 id->p_decoder->pf_vout_buffer_new = video_new_buffer_decoder; … … 2156 2142 picture_t *p_pic, *p_pic2 = NULL; 2157 2143 *out = NULL; 2158 input_thread_t *p_input = NULL;2159 2160 if( p_stream->p_parent->p_parent && p_stream->p_parent->p_parent->2161 i_object_type == VLC_OBJECT_INPUT )2162 p_input = (input_thread_t *)p_stream->p_parent->p_parent;2163 2144 2164 2145 while( (p_pic = id->p_decoder->pf_decode_video( id->p_decoder, &in )) ) 2165 2146 { 2166 2147 subpicture_t *p_subpic = NULL; 2167 #warning Stats not implemented! 2168 #if 0 2169 if( p_input ) 2170 stats_UpdateInteger( p_input, p_input->p->counters.p_decoded_video, 2171 1, NULL ); 2172 #endif 2148 2149 sout_UpdateStatistic( p_stream->p_sout, SOUT_STATISTIC_DECODED_VIDEO, 1 ); 2173 2150 2174 2151 if( p_stream->p_sout->i_out_pace_nocontrol && p_sys->b_hurry_up ) … … 2709 2686 2710 2687 /* Initialization of decoder structures */ 2688 id->p_decoder->pf_decode_sub = NULL; 2711 2689 id->p_decoder->pf_spu_buffer_new = spu_new_buffer; 2712 2690 id->p_decoder->pf_spu_buffer_del = spu_del_buffer; … … 2772 2750 2773 2751 p_subpic = id->p_decoder->pf_decode_sub( id->p_decoder, &in ); 2774 if( !p_subpic ) return VLC_EGENERIC; 2752 if( !p_subpic ) 2753 return VLC_EGENERIC; 2754 2755 sout_UpdateStatistic( p_stream->p_sout, SOUT_STATISTIC_DECODED_SUBTITLE, 1 ); 2775 2756 2776 2757 if( p_sys->b_master_sync && p_sys->i_master_drift ) src/stream_output/stream_output.c
rc4d19b8 re7d9e56 149 149 150 150 /***************************************************************************** 151 * 152 *****************************************************************************/ 153 void sout_UpdateStatistic( sout_instance_t *p_sout, sout_statistic_t i_type, int i_delta ) 154 { 155 input_thread_t *p_input; 156 int i_bytes; /* That's pretty stupid to define it as an integer, it will overflow 157 really fast ... */ 158 159 if( !p_sout->p_libvlc->b_stats ) 160 return; 161 162 /* FIXME that's ugly 163 * TODO add a private (ie not VLC_EXPORTed) input_UpdateStatistic for that */ 164 p_input = vlc_object_find( p_sout, VLC_OBJECT_INPUT, FIND_PARENT ); 165 if( !p_input || p_input->i_state == INIT_S || p_input->i_state == ERROR_S ) 166 return; 167 168 switch( i_type ) 169 { 170 #define I(c) stats_UpdateInteger( p_input, p_input->p->counters.c, i_delta, NULL ) 171 case SOUT_STATISTIC_DECODED_VIDEO: 172 I(p_decoded_video); 173 break; 174 case SOUT_STATISTIC_DECODED_AUDIO: 175 I(p_decoded_audio); 176 break; 177 case SOUT_STATISTIC_DECODED_SUBTITLE: 178 I(p_decoded_sub); 179 break; 180 #if 0 181 case SOUT_STATISTIC_ENCODED_VIDEO: 182 case SOUT_STATISTIC_ENCODED_AUDIO: 183 case SOUT_STATISTIC_ENCODED_SUBTITLE: 184 msg_Warn( p_sout, "Not yet supported statistic type %d", i_type ); 185 break; 186 #endif 187 188 case SOUT_STATISTIC_SENT_PACKET: 189 I(p_sout_sent_packets); 190 break; 191 #undef I 192 case SOUT_STATISTIC_SENT_BYTE: 193 if( !stats_UpdateInteger( p_input, p_input->p->counters.p_sout_sent_bytes, i_delta, &i_bytes ) ) 194 stats_UpdateFloat( p_input, p_input->p->counters.p_sout_send_bitrate, i_bytes, NULL ); 195 break; 196 197 default: 198 msg_Err( p_sout, "Invalid statistic type %d (internal error)", i_type ); 199 break; 200 } 201 vlc_object_release( p_input ); 202 } 203 /***************************************************************************** 151 204 * Packetizer/Input 152 205 *****************************************************************************/ … … 324 377 int sout_AccessOutWrite( sout_access_out_t *p_access, block_t *p_buffer ) 325 378 { 326 int i_total =0;379 const int i_packets_gather = 30; 327 380 p_access->i_writes++; 328 381 p_access->i_sent_bytes += p_buffer->i_buffer; 329 if( p_access->p_libvlc->b_stats && p_access->i_writes % 30 == 0 ) 330 { 331 /* Access_out -> sout_instance -> input_thread_t */ 332 input_thread_t *p_input = 333 (input_thread_t *)vlc_object_find( p_access, VLC_OBJECT_INPUT, 334 FIND_PARENT ); 335 if( p_input ) 336 { 337 stats_UpdateInteger( p_input, p_input->p->counters.p_sout_sent_packets, 338 30, NULL ); 339 stats_UpdateInteger( p_input, p_input->p->counters.p_sout_sent_bytes, 340 p_access->i_sent_bytes, &i_total ); 341 stats_UpdateFloat( p_input, p_input->p->counters.p_sout_send_bitrate, 342 (float)i_total, NULL ); 343 p_access->i_sent_bytes = 0; 344 vlc_object_release( p_input ); 345 } 382 if( (p_access->i_writes % i_packets_gather) == 0 ) 383 { 384 sout_UpdateStatistic( p_access->p_sout, SOUT_STATISTIC_SENT_PACKET, i_packets_gather ); 385 sout_UpdateStatistic( p_access->p_sout, SOUT_STATISTIC_SENT_BYTE, p_access->i_sent_bytes ); 386 p_access->i_sent_bytes = 0; 346 387 } 347 388 return p_access->pf_write( p_access, p_buffer );
