DVBLAST: trying to teach it how to use a file as input
Posted: 03 Jul 2011 13:49
Trying to teach dvblast to use a file as input but having a small problem, using ubuntu 64bit
gcc 4.4.3
Code below works if i keep the msg_Warn in, now with it in i get messages like this
warning: read from file ../aa.ts (Success) 188 0xd094c8
Now remove ONLY the msg_Warn and i get
error: couldn't read from file ../aa.ts (Success) 0 0x7fff4c68fab8
// these 2 values taken from a seperate include file
#define TS_SIZE 188
const int i_bufsize = TS_SIZE*32;
/*****************************************************************************
* file_Read : read packets from the device
*****************************************************************************/
block_t *file_Read( mtime_t i_poll_timeout )
{
i_wallclock = mdate();
{
block_t *p_ts, **pp_current = &p_ts;
int i, i_len;
if ( !i_last_packet )
{
switch (i_print_type) {
case PRINT_XML:
printf("<STATUS type=\"lock\" status=\"1\"/>\n");
break;
default:
printf("frontend has acquired lock\n" );
}
}
i_last_packet = i_wallclock;
i_len = 0;
for ( i = 0; i < i_bufsize / TS_SIZE; i++ )
{
*pp_current = block_New();
i_len2 = fread( (*pp_current)->p_ts, 1, TS_SIZE, file_input);
// If i remove this code the following if check fails
// But leave the code like this and the warning says i_len2 is 188 bytes
msg_Warn( NULL, "read from file %s (%s) %d %p",
filename, strerror(errno), i_len2, pp_current );
if ( i_len2 < 188 )
{
msg_Err( NULL, "couldn't read from file %s (%s) %d %p",
filename, strerror(errno), i_len2, pp_current );
i_len = 0;
break;
}
i_len++;
pp_current = &(*pp_current)->p_next;
}
pp_current = &p_ts;
while ( i_len && *pp_current )
{
pp_current = &(*pp_current)->p_next;
i_len--;
}
if ( *pp_current )
msg_Dbg( NULL, "partial buffer received" );
block_DeleteChain( *pp_current );
*pp_current = NULL;
return p_ts;
}
return NULL;
}
Whats wrong with this code?
Any ideas, got blinked on this one
joolz
gcc 4.4.3
Code below works if i keep the msg_Warn in, now with it in i get messages like this
warning: read from file ../aa.ts (Success) 188 0xd094c8
Now remove ONLY the msg_Warn and i get
error: couldn't read from file ../aa.ts (Success) 0 0x7fff4c68fab8
// these 2 values taken from a seperate include file
#define TS_SIZE 188
const int i_bufsize = TS_SIZE*32;
/*****************************************************************************
* file_Read : read packets from the device
*****************************************************************************/
block_t *file_Read( mtime_t i_poll_timeout )
{
i_wallclock = mdate();
{
block_t *p_ts, **pp_current = &p_ts;
int i, i_len;
if ( !i_last_packet )
{
switch (i_print_type) {
case PRINT_XML:
printf("<STATUS type=\"lock\" status=\"1\"/>\n");
break;
default:
printf("frontend has acquired lock\n" );
}
}
i_last_packet = i_wallclock;
i_len = 0;
for ( i = 0; i < i_bufsize / TS_SIZE; i++ )
{
*pp_current = block_New();
i_len2 = fread( (*pp_current)->p_ts, 1, TS_SIZE, file_input);
// If i remove this code the following if check fails
// But leave the code like this and the warning says i_len2 is 188 bytes
msg_Warn( NULL, "read from file %s (%s) %d %p",
filename, strerror(errno), i_len2, pp_current );
if ( i_len2 < 188 )
{
msg_Err( NULL, "couldn't read from file %s (%s) %d %p",
filename, strerror(errno), i_len2, pp_current );
i_len = 0;
break;
}
i_len++;
pp_current = &(*pp_current)->p_next;
}
pp_current = &p_ts;
while ( i_len && *pp_current )
{
pp_current = &(*pp_current)->p_next;
i_len--;
}
if ( *pp_current )
msg_Dbg( NULL, "partial buffer received" );
block_DeleteChain( *pp_current );
*pp_current = NULL;
return p_ts;
}
return NULL;
}
Whats wrong with this code?
Any ideas, got blinked on this one
joolz