static void PSInit( input_thread_t * p_input )
{
thread_ps_data_t * p_method;
- stream_ps_data_t * p_demux;
if( (p_method =
(thread_ps_data_t *)malloc( sizeof(thread_ps_data_t) )) == NULL )
/* Pre-parse the stream to gather stream_descriptor_t. */
- /* FIXME */
- p_input->stream.pp_programs =
- (pgrm_descriptor_t **)malloc( sizeof(pgrm_descriptor_t *) );
- p_input->stream.pp_programs[0] =
- (pgrm_descriptor_t *)malloc( sizeof(pgrm_descriptor_t) );
- p_input->stream.pp_programs[0]->i_synchro_state = SYNCHRO_START;
- p_input->stream.pp_programs[0]->delta_cr = 0;
- p_input->stream.pp_programs[0]->last_cr = 0;
- p_input->stream.pp_programs[0]->c_average_count = 0;
-
- p_demux = (stream_ps_data_t *)malloc( sizeof( stream_ps_data_t) );
- p_input->stream.p_demux_data = (void *)p_demux;
- p_demux->b_is_PSM_complete = 0;
+ input_InitStream( p_input, 0 );
+ input_AddProgram( p_input, 0, sizeof( stream_ps_data_t ) );
}
/*****************************************************************************
if( (U32_AT(p_header) & 0xFFFFFF00) != 0x100L )
{
u32 i_buffer = U32_AT(p_header);
- intf_ErrMsg( "Garbage at input (%x)\n", i_buffer );
+ intf_WarnMsg( 1, "Garbage at input (%x)\n", i_buffer );
while( (i_buffer & 0xFFFFFF00) != 0x100L )
{
i_buffer <<= 8;
return;
}
}
- *(u32 *)p_header = i_buffer;
+ *(u32 *)p_header = U32_AT(&i_buffer);
fread( p_header + 4, 2, 1, p_method->stream );
}
p_method->stream );
}
}
- else
- {
- /* FIXME: kludge to avoid SCR to block everything (SCR
- * calculus appears to be wrong). */
- p_data->p_buffer[4] = p_data->p_buffer[5] =
- p_data->p_buffer[6] = p_data->p_buffer[7] =
- p_data->p_buffer[8] = 0;
- }
}
memset( p_packets, 0, sizeof(p_packets) );
return( p_data );
}
+/*****************************************************************************
+ * NewPES: allocates a pes packet
+ *****************************************************************************/
+static pes_packet_t * NewPES( void * p_garbage )
+{
+ pes_packet_t * p_pes;
+
+ if( (p_pes = (pes_packet_t *)malloc( sizeof(pes_packet_t) )) == NULL )
+ {
+ intf_DbgMsg( "Out of memory" );
+ return NULL;
+ }
+
+ p_pes->b_messed_up = p_pes->b_data_alignment = p_pes->b_discontinuity =
+ p_pes->b_has_pts = 0;
+ p_pes->i_pes_size = 0;
+ p_pes->p_first = NULL;
+
+ return( p_pes );
+}
+
/*****************************************************************************
* DeletePacket: deletes a data packet
*****************************************************************************/
p_plugin->pf_read = PSRead;
p_plugin->pf_demux = input_DemuxPS; /* FIXME: use i_p_config_t ! */
p_plugin->pf_new_packet = NewPacket;
+ p_plugin->pf_new_pes = NewPES;
p_plugin->pf_delete_packet = DeletePacket;
p_plugin->pf_delete_pes = DeletePES;
p_plugin->pf_rewind = NULL;