X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faccess%2Fsdi.cpp;h=c2a2bdaf725fc3eb8608a456823397b7c72a3d00;hb=aedd2db49bd6d4f26b5dc6113f1cb6e92e50ff50;hp=61bb92ac8540dd2f93469c63b5e6876dca27ba2f;hpb=de98a24ddcc13572b2cb7a37307e0b6777cc5c5a;p=vlc diff --git a/modules/access/sdi.cpp b/modules/access/sdi.cpp index 61bb92ac85..c2a2bdaf72 100644 --- a/modules/access/sdi.cpp +++ b/modules/access/sdi.cpp @@ -110,6 +110,7 @@ struct demux_sys_t es_out_id_t *p_video_es; es_out_id_t *p_audio_es; bool b_first_frame; + int i_last_pts; int i_width, i_height, i_fps_num, i_fps_den; uint32_t i_dominance_flags; @@ -305,11 +306,13 @@ static int Open( vlc_object_t *p_this ) if( result != S_OK ) { msg_Err( p_demux, "Could not get model name" ); + free( psz_model_name ); Close( p_this ); return VLC_EGENERIC; } msg_Dbg( p_demux, "Opened DeckLink PCI card %d (%s)", i_card_index, psz_model_name ); + free( psz_model_name ); if( p_sys->p_card->QueryInterface( IID_IDeckLinkInput, (void**)&p_sys->p_input) != S_OK ) { @@ -379,6 +382,7 @@ static int Open( vlc_object_t *p_this ) { msg_Err( p_demux, "Invalid --sdi-audio-connection specified; choose one of " \ "embedded, aesebu, or analog." ); + p_config->Release(); Close( p_this ); return VLC_EGENERIC; } @@ -448,6 +452,7 @@ static int Open( vlc_object_t *p_this ) if( result != S_OK ) { msg_Err( p_demux, "Failed to get display mode name" ); + free( psz_mode_name ); p_display_iterator->Release(); Close( p_this ); return VLC_EGENERIC; @@ -458,6 +463,7 @@ static int Open( vlc_object_t *p_this ) if( result != S_OK ) { msg_Err( p_demux, "Failed to get frame rate" ); + free( psz_mode_name ); p_display_iterator->Release(); Close( p_this ); return VLC_EGENERIC; @@ -491,6 +497,7 @@ static int Open( vlc_object_t *p_this ) sz_mode_id_text, psz_mode_name, p_display_mode->GetWidth(), p_display_mode->GetHeight(), double(time_scale) / frame_duration, psz_field_dominance ); + free( psz_mode_name ); if( wanted_mode_id == mode_id ) { @@ -617,6 +624,7 @@ static void Close( vlc_object_t *p_this ) static int Control( demux_t *p_demux, int i_query, va_list args ) { + demux_sys_t *p_sys = p_demux->p_sys; bool *pb; int64_t *pi64; @@ -637,7 +645,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) case DEMUX_GET_TIME: pi64 = (int64_t*)va_arg( args, int64_t * ); - *pi64 = mdate(); /* FIXME */ + *pi64 = p_sys->i_last_pts; return VLC_SUCCESS; /* TODO implement others */ @@ -669,12 +677,16 @@ static int Demux( demux_t *p_demux ) if( p_video_block ) { + if( p_video_block->i_pts > p_sys->i_last_pts ) + p_sys->i_last_pts = p_video_block->i_pts; es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_video_block->i_pts ); es_out_Send( p_demux->out, p_sys->p_video_es, p_video_block ); } if( p_audio_block ) { + if( p_audio_block->i_pts > p_sys->i_last_pts ) + p_sys->i_last_pts = p_audio_block->i_pts; es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_audio_block->i_pts ); es_out_Send( p_demux->out, p_sys->p_audio_es, p_audio_block ); }