[MPlayer-dev-eng] help request for a dvb-input patch

nsabbi@libero.it nsabbi at libero.it
Sat Sep 14 01:40:32 CEST 2002


Hi, I'm trying to write a patch to enable input from my Hauppage Nova 
dvb card (without hardware mpeg decoder). 
Tuning and the flow of data in MPEG PS format are working correctly 
(thanks to dvbstream! ), but I don't fully understand how the 
mechanism of streaming works. 
 
The initial part of the patch (in dvb_streaming_start) looks like:  
 
str_ctrl = (streaming_ctrl_t *) malloc(sizeof(streaming_ctrl_t)); 
        if(str_ctrl == NULL) 
        { 
                fprintf(stderr, "ALLOCAZIONE STREAMING_CTRL 
FALLITA\n"); 
                return -1; 
        } 
 
        memset(str_ctrl, 0, sizeof(streaming_ctrl_t)); 
        stream->streaming_ctrl = str_ctrl; 
        stream->fd = fd_dvr; 
 
        //stream->streaming_ctrl->buffer = (char *) 
malloc(BUFFER_SIZE*1000UL); 
 
        #define MYSIZE 8192 
 
        stream->streaming_ctrl->buffer = (char*)malloc(MYSIZE); 
        if( stream->streaming_ctrl->buffer==NULL ) 
        { 
                mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation 
failed\n"); 
                return -1; 
        } 
        stream->streaming_ctrl->buffer_size = MYSIZE; 
 
 
        global_s = stream->streaming_ctrl; 
        fprintf(stderr, "GLOBAL_S: %p\n", global_s); 
 
        stream->streaming_ctrl->streaming_read = dvb_streaming_read; 
        stream->streaming_ctrl->streaming_seek = dvb_streaming_seek; 
        //stream->streaming_ctrl->prebuffer_size = 8192;  // KBytes 
        stream->streaming_ctrl->buffering = 0; 
        stream->streaming_ctrl->status = streaming_playing_e; 
(I tried buffering=1 sooner). 
 
 
In dvb_streaming_read I put a copy of nop_streaming_read plus all the 
necessary code to read from the card (if the buffer isn't full 
enough). 
 
The code that fills the buffer is triggered as a call_back of a 
function of mpegtools:  
	init_ipack(&pa, IPACKS, my_write_out, 1); 
        init_ipack(&pv, IPACKS, my_write_out, 1); 
 
This trigger is working, because in my_write_out I  
1) flush the received b
t's a real 
mpeg ps); 
2) try to fill the buffer of stream->streaming_ctrl->buffer and to 
update buffer_pos, but here is the problem: the members buffer, 
buffer_size and buffer_pos are aways reported as 0, so nothing goes 
on! 
 
Please, can anyone explain how the mechanism of streaming works? 
I will appreciate any suggestion. 
Thanks very much, 
 
	Nico 
 
 




More information about the MPlayer-dev-eng mailing list