Commit aea3c907 authored by Adam Leggett's avatar Adam Leggett Committed by Jean-Baptiste Kempf

Fix crash when playing DCP with no audio; allow DCPs to

 not have audio
Signed-off-by: default avatarJean-Paul Saman <jpsaman@videolan.org>
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 4457f17d
......@@ -483,13 +483,8 @@ static int Open( vlc_object_t *obj )
EssenceType_t AudioEssType;
EssenceType_t AudioEssTypeCompare;
if( p_sys->p_dcp->audio_reels.size() == 0 )
if( !p_sys->p_dcp->audio_reels.empty() )
{
msg_Err( p_demux, "No audio reel found" );
retval = VLC_EGENERIC;
goto error;
}
EssenceType( p_sys->p_dcp->audio_reels[0].filename.c_str(), AudioEssType );
if ( (AudioEssType == ESS_PCM_24b_48k) || (AudioEssType == ESS_PCM_24b_96k) ) {
......@@ -576,6 +571,7 @@ static int Open( vlc_object_t *obj )
retval = VLC_EGENERIC;
goto error;
}
}
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
p_sys->frame_no = p_sys->p_dcp->video_reels[0].i_entrypoint;
......@@ -623,7 +619,7 @@ static int Demux( demux_t *p_demux )
}
/* swaping audio reels */
if ( p_sys->frame_no == p_sys->p_dcp->audio_reels[p_sys->i_audio_reel].i_absolute_end )
if ( !p_sys->p_dcp->audio_reels.empty() && p_sys->frame_no == p_sys->p_dcp->audio_reels[p_sys->i_audio_reel].i_absolute_end )
{
if ( p_sys->i_audio_reel + 1 == p_sys->v_audioReader.size() )
{
......@@ -704,6 +700,8 @@ static int Demux( demux_t *p_demux )
p_video_frame->i_length = CLOCK_FREQ * p_sys->frame_rate_denom / p_sys->frame_rate_num;
p_video_frame->i_pts = CLOCK_FREQ * p_sys->frame_no * p_sys->frame_rate_denom / p_sys->frame_rate_num;
if( !p_sys->p_dcp->audio_reels.empty() )
{
/* audio frame */
if ( ( p_audio_frame = block_Alloc( p_sys->i_audio_buffer )) == NULL ) {
goto error;
......@@ -745,10 +743,13 @@ static int Demux( demux_t *p_demux )
if ( p_audio_frame->i_pts != p_video_frame->i_pts ) {
msg_Err( p_demux, "Audio and video frame pts are not in sync" );
}
}
p_sys->i_pts = p_video_frame->i_pts;
es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_sys->i_pts );
if(p_video_frame)
es_out_Send( p_demux->out, p_sys->p_video_es, p_video_frame );
if(p_audio_frame)
es_out_Send( p_demux->out, p_sys->p_audio_es, p_audio_frame );
p_sys->frame_no++;
......
......@@ -227,7 +227,7 @@ class Reel
{
public:
Reel(demux_t * demux, AssetList *asset_list, xml_reader_t *xmlReader)
: p_asset_list(asset_list), p_xmlReader(xmlReader), p_demux(demux)
: p_asset_list(asset_list), p_xmlReader(xmlReader), p_demux(demux), p_picture_track(NULL), p_sound_track(NULL), p_subtitle_track(NULL)
{};
int Parse(string p_node, int p_type);
Asset * getTrack(TrackType_t e_track);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment