Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Trying to teach dvblast to use a file as input but having a small problem
- // 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement