/*****************************************************************************
* Module descriptor
*****************************************************************************/
-static int Open ( vlc_object_t * );
-static void Close( vlc_object_t * );
+static int Open ( vlc_object_t * );
+static int OpenAlt( vlc_object_t * );
+static void Close ( vlc_object_t * );
vlc_module_begin();
set_description( _("PS demuxer") );
+ set_category( CAT_INPUT );
+ set_subcategory( SUBCAT_INPUT_DEMUX );
set_capability( "demux2", 1 );
set_callbacks( Open, Close );
add_shortcut( "ps" );
+
+ add_submodule();
+ set_description( _("PS demuxer") );
+ set_capability( "demux2", 9 );
+ set_callbacks( OpenAlt, Close );
vlc_module_end();
/*****************************************************************************
return VLC_EGENERIC;
}
- if( p_peek[0] != 0 || p_peek[1] != 0 || p_peek[2] != 1 ||
- p_peek[3] < 0xb9 )
+ if( p_peek[0] != 0 || p_peek[1] != 0 ||
+ p_peek[2] != 1 || p_peek[3] < 0xb9 )
{
msg_Warn( p_demux, "this does not look like an MPEG PS stream, "
"continuing anyway" );
return VLC_SUCCESS;
}
+static int OpenAlt( vlc_object_t *p_this )
+{
+ demux_t *p_demux = (demux_t*)p_this;
+ uint8_t *p_peek;
+
+ if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 )
+ {
+ msg_Err( p_demux, "cannot peek" );
+ return VLC_EGENERIC;
+ }
+
+ if( p_peek[0] != 0 || p_peek[1] != 0 ||
+ p_peek[2] != 1 || p_peek[3] < 0xb9 )
+ {
+ if( !p_demux->b_force ) return VLC_EGENERIC;
+ }
+
+ return Open( p_this );
+}
+
/*****************************************************************************
* Close
*****************************************************************************/
case 0x1ba:
if( !ps_pkt_parse_pack( p_pkt, &p_sys->i_scr, &i_mux_rate ) )
{
- es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_sys->i_scr );
+ /* done later on to work around bad vcd/svcd streams */
+ /* es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_sys->i_scr ); */
if( i_mux_rate > 0 ) p_sys->i_mux_rate = i_mux_rate;
}
block_Release( p_pkt );
break;
case 0x1bc:
- msg_Dbg( p_demux, "received PSM");
- ps_psm_fill( &p_sys->psm, p_pkt );
+ /* msg_Dbg( p_demux, "received PSM"); */
+ ps_psm_fill( &p_sys->psm, p_pkt, p_sys->tk, p_demux->out );
block_Release( p_pkt );
break;
}
tk->b_seen = VLC_TRUE;
}
+
+ /* The popular VCD/SVCD subtitling WinSubMux does not
+ * renumber the SCRs when merging subtitles into the PES */
+ if( tk->b_seen &&
+ ( tk->fmt.i_codec == VLC_FOURCC('o','g','t',' ') ||
+ tk->fmt.i_codec == VLC_FOURCC('c','v','d',' ') ) )
+ {
+ p_sys->i_scr = -1;
+ }
+
+ if( p_sys->i_scr > 0 )
+ es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_sys->i_scr );
+
+ p_sys->i_scr = -1;
+
if( tk->b_seen && tk->es &&
!ps_pkt_parse_pes( p_pkt, tk->i_skip ) )
{