Changeset 11fddaa6fa3d16939419a14f7a31a10db8369a52
- Timestamp:
- 15/10/04 17:42:01
(4 years ago)
- Author:
- Gildas Bazin <gbazin@videolan.org>
- git-committer:
- Gildas Bazin <gbazin@videolan.org> 1097854921 +0000
- git-parent:
[8b1965a7e9f20db5c98a7a2004c5ad95d5c22f7f]
- git-author:
- Gildas Bazin <gbazin@videolan.org> 1097854921 +0000
- Message:
* src/stream_output/stream_output.c:
- for muxers that request some preparsing before starting muxing,
we now wait for 1.5 seconds worth of data to be in the fifo instead
of waiting for 1.5 seconds of real-time.
- if we have have control over the output pace, we also wait before
starting muxing (produces nicer streams).
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rf0251c5 |
r11fddaa |
|
| 42 | 42 | static void sout_CfgDestroy( sout_cfg_t * ); |
|---|
| 43 | 43 | |
|---|
| 44 | | #define sout_stream_url_to_chain( p, s ) _sout_stream_url_to_chain( VLC_OBJECT(p), s ) |
|---|
| | 44 | #define sout_stream_url_to_chain( p, s ) \ |
|---|
| | 45 | _sout_stream_url_to_chain( VLC_OBJECT(p), s ) |
|---|
| 45 | 46 | static char *_sout_stream_url_to_chain( vlc_object_t *, char * ); |
|---|
| 46 | 47 | |
|---|
| … | … | |
| 365 | 366 | char *psz_next; |
|---|
| 366 | 367 | |
|---|
| 367 | | p_mux = vlc_object_create( p_sout, |
|---|
| 368 | | sizeof( sout_mux_t ) ); |
|---|
| | 368 | p_mux = vlc_object_create( p_sout, sizeof( sout_mux_t ) ); |
|---|
| 369 | 369 | if( p_mux == NULL ) |
|---|
| 370 | 370 | { |
|---|
| … | … | |
| 373 | 373 | } |
|---|
| 374 | 374 | |
|---|
| 375 | | p_mux->p_sout = p_sout; |
|---|
| | 375 | p_mux->p_sout = p_sout; |
|---|
| 376 | 376 | psz_next = sout_CfgCreate( &p_mux->psz_mux, &p_mux->p_cfg, psz_mux ); |
|---|
| 377 | | if( psz_next ) |
|---|
| 378 | | { |
|---|
| 379 | | free( psz_next ); |
|---|
| 380 | | } |
|---|
| | 377 | if( psz_next ) free( psz_next ); |
|---|
| | 378 | |
|---|
| 381 | 379 | p_mux->p_access = p_access; |
|---|
| 382 | 380 | p_mux->pf_control = NULL; |
|---|
| … | … | |
| 388 | 386 | |
|---|
| 389 | 387 | p_mux->p_sys = NULL; |
|---|
| 390 | | p_mux->p_module = NULL; |
|---|
| | 388 | p_mux->p_module = NULL; |
|---|
| | 389 | |
|---|
| | 390 | p_mux->b_add_stream_any_time = VLC_FALSE; |
|---|
| | 391 | p_mux->b_waiting_stream = VLC_TRUE; |
|---|
| | 392 | p_mux->i_add_stream_start = -1; |
|---|
| 391 | 393 | |
|---|
| 392 | 394 | vlc_object_attach( p_mux, p_sout ); |
|---|
| 393 | 395 | |
|---|
| 394 | | p_mux->p_module = |
|---|
| | 396 | p_mux->p_module = |
|---|
| 395 | 397 | module_Need( p_mux, "sout mux", p_mux->psz_mux, VLC_TRUE ); |
|---|
| 396 | 398 | |
|---|
| … | … | |
| 407 | 409 | if( p_mux->pf_control ) |
|---|
| 408 | 410 | { |
|---|
| 409 | | int b_answer; |
|---|
| 410 | | if( sout_MuxControl( p_mux, MUX_CAN_ADD_STREAM_WHILE_MUXING, &b_answer ) ) |
|---|
| | 411 | int b_answer = VLC_FALSE; |
|---|
| | 412 | |
|---|
| | 413 | if( sout_MuxControl( p_mux, MUX_CAN_ADD_STREAM_WHILE_MUXING, |
|---|
| | 414 | &b_answer ) ) |
|---|
| 411 | 415 | { |
|---|
| 412 | 416 | b_answer = VLC_FALSE; |
|---|
| 413 | 417 | } |
|---|
| | 418 | |
|---|
| 414 | 419 | if( b_answer ) |
|---|
| 415 | 420 | { |
|---|
| … | … | |
| 418 | 423 | p_mux->b_waiting_stream = VLC_FALSE; |
|---|
| 419 | 424 | |
|---|
| 420 | | if( sout_MuxControl( p_mux, MUX_GET_ADD_STREAM_WAIT, &b_answer ) ) |
|---|
| | 425 | /* If we control the output pace then it's better to wait before |
|---|
| | 426 | * starting muxing (generates better streams/files). */ |
|---|
| | 427 | if( !p_sout->i_out_pace_nocontrol ) |
|---|
| | 428 | { |
|---|
| | 429 | b_answer = VLC_TRUE; |
|---|
| | 430 | } |
|---|
| | 431 | else if( sout_MuxControl( p_mux, MUX_GET_ADD_STREAM_WAIT, |
|---|
| | 432 | &b_answer ) ) |
|---|
| 421 | 433 | { |
|---|
| 422 | 434 | b_answer = VLC_FALSE; |
|---|
| 423 | 435 | } |
|---|
| | 436 | |
|---|
| 424 | 437 | if( b_answer ) |
|---|
| 425 | 438 | { |
|---|
| … | … | |
| 429 | 442 | } |
|---|
| 430 | 443 | } |
|---|
| 431 | | else |
|---|
| 432 | | { |
|---|
| 433 | | p_mux->b_add_stream_any_time = VLC_FALSE; |
|---|
| 434 | | p_mux->b_waiting_stream = VLC_TRUE; |
|---|
| 435 | | } |
|---|
| 436 | | } |
|---|
| 437 | | else |
|---|
| 438 | | { |
|---|
| 439 | | p_mux->b_add_stream_any_time = VLC_FALSE; |
|---|
| 440 | | p_mux->b_waiting_stream = VLC_TRUE; |
|---|
| 441 | | } |
|---|
| 442 | | p_mux->i_add_stream_start = -1; |
|---|
| | 444 | } |
|---|
| 443 | 445 | |
|---|
| 444 | 446 | return p_mux; |
|---|
| … | … | |
| 474 | 476 | "for this format)" ); |
|---|
| 475 | 477 | return NULL; |
|---|
| 476 | | } |
|---|
| 477 | | if( p_mux->i_add_stream_start < 0 ) |
|---|
| 478 | | { |
|---|
| 479 | | /* we wait for one second */ |
|---|
| 480 | | p_mux->i_add_stream_start = mdate(); |
|---|
| 481 | 478 | } |
|---|
| 482 | 479 | |
|---|
| … | … | |
| 549 | 546 | if( p_mux->b_waiting_stream ) |
|---|
| 550 | 547 | { |
|---|
| 551 | | if( p_mux->i_add_stream_start > 0 && |
|---|
| 552 | | p_mux->i_add_stream_start + (mtime_t)1500000 < mdate() ) |
|---|
| 553 | | { |
|---|
| 554 | | /* more than 1.5 second, start muxing */ |
|---|
| | 548 | if( p_mux->i_add_stream_start < 0 ) |
|---|
| | 549 | { |
|---|
| | 550 | p_mux->i_add_stream_start = p_buffer->i_dts; |
|---|
| | 551 | } |
|---|
| | 552 | |
|---|
| | 553 | if( p_mux->i_add_stream_start >= 0 && |
|---|
| | 554 | p_mux->i_add_stream_start + I64C(15000000) < p_buffer->i_dts ) |
|---|
| | 555 | { |
|---|
| | 556 | /* Wait until we have more than 1.5 seconds worth of data |
|---|
| | 557 | * before start muxing */ |
|---|
| 555 | 558 | p_mux->b_waiting_stream = VLC_FALSE; |
|---|
| 556 | 559 | } |
|---|