comparison libmpdemux/network.c @ 4289:973c6912c586

Set the cache value if the network layer was able to compute it.
author bertrand
date Sun, 20 Jan 2002 21:39:56 +0000
parents 05affdf4bdcd
children 1b6f6519b037
comparison
equal deleted inserted replaced
4288:b84e9861461c 4289:973c6912c586
16 16
17 #include "config.h" 17 #include "config.h"
18 18
19 #include "stream.h" 19 #include "stream.h"
20 #include "demuxer.h" 20 #include "demuxer.h"
21 #include "../cfgparser.h"
21 22
22 #include "network.h" 23 #include "network.h"
23 #include "http.h" 24 #include "http.h"
24 #include "url.h" 25 #include "url.h"
25 #include "asf.h" 26 #include "asf.h"
26 #include "rtp.h" 27 #include "rtp.h"
27 28
28 extern int verbose; 29 extern int verbose;
30 extern m_config_t *mconfig;
29 31
30 static struct { 32 static struct {
31 char *mime_type; 33 char *mime_type;
32 int demuxer_type; 34 int demuxer_type;
33 } mime_type_table[] = { 35 } mime_type_table[] = {
544 stream->streaming_ctrl->data = NULL; 546 stream->streaming_ctrl->data = NULL;
545 } 547 }
546 548
547 stream->streaming_ctrl->streaming_read = nop_streaming_read; 549 stream->streaming_ctrl->streaming_read = nop_streaming_read;
548 stream->streaming_ctrl->streaming_seek = nop_streaming_seek; 550 stream->streaming_ctrl->streaming_seek = nop_streaming_seek;
549 stream->streaming_ctrl->prebuffer_size = 180000; 551 stream->streaming_ctrl->prebuffer_size = 4096; // KBytes
550 // stream->streaming_ctrl->prebuffer_size = 0;
551 stream->streaming_ctrl->buffering = 1; 552 stream->streaming_ctrl->buffering = 1;
552 // stream->streaming_ctrl->buffering = 0;
553 stream->streaming_ctrl->status = streaming_playing_e; 553 stream->streaming_ctrl->status = streaming_playing_e;
554 return 0; 554 return 0;
555 } 555 }
556 556
557 // Start listening on a UDP port. If multicast, join the group. 557 // Start listening on a UDP port. If multicast, join the group.
647 stream->fd = fd; 647 stream->fd = fd;
648 } 648 }
649 649
650 streaming_ctrl->streaming_read = rtp_streaming_read; 650 streaming_ctrl->streaming_read = rtp_streaming_read;
651 streaming_ctrl->streaming_seek = nop_streaming_seek; 651 streaming_ctrl->streaming_seek = nop_streaming_seek;
652 streaming_ctrl->prebuffer_size = 180000; 652 streaming_ctrl->prebuffer_size = 4096; // KBytes
653 streaming_ctrl->buffering = 0; //1; 653 streaming_ctrl->buffering = 0;
654 streaming_ctrl->status = streaming_playing_e; 654 streaming_ctrl->status = streaming_playing_e;
655 return 0; 655 return 0;
656 } 656 }
657 657
658 int 658 int
698 case DEMUXER_TYPE_UNKNOWN: 698 case DEMUXER_TYPE_UNKNOWN:
699 // Generic start, doesn't need to filter 699 // Generic start, doesn't need to filter
700 // the network stream, it's a raw stream 700 // the network stream, it's a raw stream
701 ret = nop_streaming_start( stream ); 701 ret = nop_streaming_start( stream );
702 if( ret<0 ) { 702 if( ret<0 ) {
703 printf("asf_streaming_start failed\n"); 703 printf("nop_streaming_start failed\n");
704 } 704 }
705 break; 705 break;
706 default: 706 default:
707 printf("Unable to detect the streaming type\n"); 707 printf("Unable to detect the streaming type\n");
708 ret = -1; 708 ret = -1;
709 } 709 }
710 710
711 if( ret<0 ) { 711 if( ret<0 ) {
712 streaming_ctrl_free( stream->streaming_ctrl ); 712 streaming_ctrl_free( stream->streaming_ctrl );
713 stream->streaming_ctrl = NULL; 713 stream->streaming_ctrl = NULL;
714 } 714 } else if( stream->streaming_ctrl->buffering ) {
715 char cache_size[10];
716 int ret=-1;
717 // buffer in KBytes, *5 because the prefill is 20% of the buffer.
718 sprintf( cache_size, "%d", (stream->streaming_ctrl->prebuffer_size/1024)*5 );
719 printf("Cache size = %s KBytes\n", cache_size );
720 ret = m_config_set_option(mconfig, "cache", cache_size );
721 if( ret<0 ) {
722 printf("Unable to set the cache size option (return=%d)\n", ret );
723 } else {
724 printf("Cache size set to %s KBytes\n", cache_size );
725 }
726 }
715 return ret; 727 return ret;
716 } 728 }
717 729
718 int 730 int
719 streaming_stop( stream_t *stream ) { 731 streaming_stop( stream_t *stream ) {