Commit 7bec8db2 authored by Jean-Paul Saman's avatar Jean-Paul Saman

dvb/access.c - properly cast memory returned by malloc()

             - fix small memory leak on closing of dvb plugin.
dvb/linux-dvb.c - remove astray spaces
                - always empty the event queue before FE_SET_FRONTEND and FrontendCheck(). 
                  dvbstream does the same for OFDM and QAM. 

Summary: 
   DVB-C is working (did a few tests) 
   DVB-T not tested. 
   Using polarization=A doesn't work anymore INVERSION_AUTO is not honered for tuning. 
   SEC_VOLTAGE_OFF is missing when using latest code DVB-1.1.7 from http://www.metzlerbros.org/dvb/index.html. While include/linux/dvb/version.h is not updated and still reflects this API version: #define DVB_API_VERSION 3
parent bdb8fad0
...@@ -227,7 +227,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -227,7 +227,7 @@ static int Open( vlc_object_t *p_this )
int i_test; int i_test;
/* Initialize structure */ /* Initialize structure */
p_dvb = malloc( sizeof( thread_dvb_data_t ) ); p_dvb = (thread_dvb_data_t *)malloc( sizeof( thread_dvb_data_t ) );
if( p_dvb == NULL ) if( p_dvb == NULL )
{ {
msg_Err( p_input, "out of memory" ); msg_Err( p_input, "out of memory" );
...@@ -424,6 +424,9 @@ static void Close( vlc_object_t *p_this ) ...@@ -424,6 +424,9 @@ static void Close( vlc_object_t *p_this )
E_(DMXUnsetFilter)( p_input, p_dvb->p_demux_handles[0].i_handle ); E_(DMXUnsetFilter)( p_input, p_dvb->p_demux_handles[0].i_handle );
p_dvb->p_demux_handles[0].i_type = 0; p_dvb->p_demux_handles[0].i_type = 0;
} }
E_(FrontendClose)( p_input );
free( p_dvb );
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -99,7 +99,13 @@ int E_(FrontendOpen)( input_thread_t * p_input ) ...@@ -99,7 +99,13 @@ int E_(FrontendOpen)( input_thread_t * p_input )
frontend[sizeof(frontend) - 1] = '\0'; frontend[sizeof(frontend) - 1] = '\0';
} }
p_frontend = malloc(sizeof(frontend_t)); p_frontend = (frontend_t *) malloc(sizeof(frontend_t));
if( p_frontend == NULL )
{
msg_Err( p_input, "FrontEndOpen: out of memory" );
return -1;
}
p_dvb->p_frontend = p_frontend; p_dvb->p_frontend = p_frontend;
msg_Dbg( p_input, "Opening device %s", frontend ); msg_Dbg( p_input, "Opening device %s", frontend );
...@@ -630,6 +636,7 @@ static int FrontendSetQPSK( input_thread_t * p_input ) ...@@ -630,6 +636,7 @@ static int FrontendSetQPSK( input_thread_t * p_input )
} }
msleep(100000); msleep(100000);
/* Empty the event queue */ /* Empty the event queue */
for ( ; ; ) for ( ; ; )
{ {
...@@ -676,6 +683,14 @@ static int FrontendSetQAM( input_thread_t * p_input ) ...@@ -676,6 +683,14 @@ static int FrontendSetQAM( input_thread_t * p_input )
fep.u.qam.modulation = DecodeModulation( p_input ); fep.u.qam.modulation = DecodeModulation( p_input );
/* Empty the event queue */
for ( ; ; )
{
struct dvb_frontend_event event;
if ( ioctl( p_frontend->i_handle, FE_GET_EVENT, &event ) < 0 )
break;
}
/* Now send it all to the frontend device */ /* Now send it all to the frontend device */
if ( (i_ret = ioctl( p_frontend->i_handle, FE_SET_FRONTEND, &fep )) < 0 ) if ( (i_ret = ioctl( p_frontend->i_handle, FE_SET_FRONTEND, &fep )) < 0 )
{ {
...@@ -805,6 +820,14 @@ static int FrontendSetOFDM( input_thread_t * p_input ) ...@@ -805,6 +820,14 @@ static int FrontendSetOFDM( input_thread_t * p_input )
fep.u.ofdm.guard_interval = DecodeGuardInterval( p_input ); fep.u.ofdm.guard_interval = DecodeGuardInterval( p_input );
fep.u.ofdm.hierarchy_information = DecodeHierarchy( p_input ); fep.u.ofdm.hierarchy_information = DecodeHierarchy( p_input );
/* Empty the event queue */
for ( ; ; )
{
struct dvb_frontend_event event;
if ( ioctl( p_frontend->i_handle, FE_GET_EVENT, &event ) < 0 )
break;
}
/* Now send it all to the frontend device */ /* Now send it all to the frontend device */
if ( (ret = ioctl( p_frontend->i_handle, FE_SET_FRONTEND, &fep )) < 0 ) if ( (ret = ioctl( p_frontend->i_handle, FE_SET_FRONTEND, &fep )) < 0 )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment