* Preamble
*****************************************************************************/
-#include <stdlib.h>
#include <vlc/vlc.h>
-#include <vlc/input.h>
+#include <vlc_demux.h>
#include "vlc_codec.h"
#define SERIES1_PES_LENGTH (11)
set_description(_("TY Stream audio/video demux"));
set_category( CAT_INPUT );
set_subcategory( SUBCAT_INPUT_DEMUX );
- set_capability("demux2", 8);
+ set_capability("demux2", 6);
/* FIXME: there seems to be a segfault when using PVR access
* and TY demux has a bigger priority than PS
* Something must be wrong.
b/e0: video B-frame header start
c/e0: video GOP header start
e/01: closed-caption data
- e/02: Extended data services data
+ e/02: Extended data services data
e/03: ipreview data ("thumbs up to record" signal)
*/
"continuing anyway..." );
}
- /* at this point, we assume we have a valid TY stream */
+ /* at this point, we assume we have a valid TY stream */
msg_Dbg( p_demux, "valid TY stream detected" );
/* Set exported functions */
if( offset < 0 )
{
/* no header found, fake some 00's (this works, believe me) */
- memset( p_sys->pes_buffer, 4, 0 );
+ memset( p_sys->pes_buffer, 0, 4 );
p_sys->i_pes_buf_cnt = 4;
if( rec_len > 4 )
msg_Err( p_demux, "PES header not found in record of %d bytes!",
demux_sys_t *p_sys = p_demux->p_sys;
/*msg_Dbg(p_demux, "ty demux processing" );*/
-
+
/* did we hit EOF earlier? */
if (p_sys->eof) return 0;
* - set PTS for data packets
* - pass the data on to the proper codec via es_out_Send()
- * if this is the first time or
+ * if this is the first time or
* if we're at the end of this chunk, start a new one
*/
/* parse the next chunk's record headers */
{
/*msg_Dbg(p_demux, "Record Type 0x%x/%02x %ld bytes",
subrec_type, rec_type, l_rec_size );*/
-
+
/* some normal records are 0 length, so check for that... */
if (l_rec_size > 0)
{
if (p_sys->lastVideoPTS > 0)
{
p_block_in->i_pts = p_sys->lastVideoPTS;
- /* PTS gets used ONCE.
+ /* PTS gets used ONCE.
* Any subsequent frames we get BEFORE next PES
* header will have their PTS computed in the codec */
p_sys->lastVideoPTS = 0;
}
- }
+ }
es_out_Send(p_demux->out, p_sys->p_video, p_block_in);
}
} /* end if video rec type */
}
else
{
- p_sys->lastAudioPTS = get_pts(
+ p_sys->lastAudioPTS = get_pts(
&p_sys->pes_buffer[ esOffset1 + DTIVO_PTS_OFFSET ] );
p_block_in->i_pts = p_sys->lastAudioPTS;
}
if (check_sync_pes(p_demux, p_block_in, esOffset1,
l_rec_size) == -1)
{
- /* partial PES header found, nothing else.
+ /* partial PES header found, nothing else.
* we're done. */
p_sys->i_cur_rec++;
block_Release(p_block_in);
}
/* load the chunk */
get_chunk_header(p_demux);
-
+
/* seek within the chunk to get roughly to where we want */
p_sys->i_cur_rec = (int)
((double) ((seek_pos % CHUNK_SIZE) / (double) (CHUNK_SIZE)) * p_sys->i_num_recs);
- msg_Dbg(p_demux, "Seeked to file pos " I64Fd, seek_pos);
+ msg_Dbg(p_demux, "seeked to file pos " I64Fd, seek_pos);
msg_Dbg(p_demux, " (chunk %d, record %d)",
p_sys->i_chunk_count - 1, p_sys->i_cur_rec);
demux_sys_t *p_sys = p_demux->p_sys;
double f, *pf;
int64_t i64, *p_i64;
-
+
/*msg_Info(p_demux, "control cmd %d", i_query);*/
switch( i_query )
{
/* read the TY packet header */
i_readSize = stream_Read( p_demux->s, packet_header, 4 );
p_sys->i_chunk_count++;
-
+
if ( i_readSize < 4 )
{
/* EOF */
p_sys->eof = 1;
return 0;
}
-
+
/* if it's a PART Header, then try again. */
if( U32_AT( &packet_header[ 0 ] ) == TIVO_PES_FILEID )
{
}
p_sys->i_cur_rec = 0;
p_sys->b_first_chunk = VLC_FALSE;
-
+
/*msg_Dbg( p_demux, "chunk has %d records", i_num_recs );*/
/* parse headers into array */
{
unsigned char b1, b2;
/* marker bit 2 set, so read extended data */
- b1 = ( ( ( record_header[ 0 ] & 0x0f ) << 4 ) |
+ b1 = ( ( ( record_header[ 0 ] & 0x0f ) << 4 ) |
( ( record_header[ 1 ] & 0xf0 ) >> 4 ) );
b1 &= 0x7f;
- b2 = ( ( ( record_header[ 1 ] & 0x0f ) << 4 ) |
+ b2 = ( ( ( record_header[ 1 ] & 0x0f ) << 4 ) |
( ( record_header[ 2 ] & 0xf0 ) >> 4 ) );
b2 &= 0x7f;