X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fdemux%2Fnuv.c;h=3fbcfa5cf381fb3439414f83233587a613895ad3;hb=314d91aaf1fcd5807caf3be7ab2c7da78751f837;hp=31abc9765dabec184f94fa52bee09f3d3371c01e;hpb=15643af12d9eb61eff8a8e89d8170f3d2b73d7e1;p=vlc diff --git a/modules/demux/nuv.c b/modules/demux/nuv.c index 31abc9765d..3fbcfa5cf3 100644 --- a/modules/demux/nuv.c +++ b/modules/demux/nuv.c @@ -32,7 +32,6 @@ #include #include #include -#include /* TODO: * - test @@ -284,8 +283,10 @@ static int Open( vlc_object_t * p_this ) if( !p_sys->b_seekable ) msg_Warn( p_demux, "stream is not seekable, skipping seektable" ); else if( SeekTableLoad( p_demux, p_sys ) ) - goto error; - + { + p_sys->b_index = false; + msg_Warn( p_demux, "Seektable is broken, seek won't be accurate" ); + } } else { @@ -307,7 +308,8 @@ static int Open( vlc_object_t * p_this ) fmt.video.i_height = p_sys->hdr.i_height; fmt.i_extra = p_sys->i_extra_f; fmt.p_extra = p_sys->p_extra_f; - fmt.video.i_aspect = VOUT_ASPECT_FACTOR * p_sys->hdr.d_aspect; + fmt.video.i_sar_num = p_sys->hdr.d_aspect * fmt.video.i_height; + fmt.video.i_sar_den = fmt.video.i_width; p_sys->p_es_video = es_out_Add( p_demux->out, &fmt ); } @@ -389,18 +391,20 @@ static int Demux( demux_t *p_demux ) if( ( p_data = stream_Block( p_demux->s, fh.i_length ) ) == NULL ) return 0; - p_data->i_dts = (int64_t)fh.i_timecode * 1000; - p_data->i_pts = (fh.i_type == 'V') ? 0 : p_data->i_dts; + p_data->i_dts = VLC_TS_0 + (int64_t)fh.i_timecode * 1000; + p_data->i_pts = (fh.i_type == 'V') ? VLC_TS_INVALID : p_data->i_dts; /* only add keyframes to index */ if( !fh.i_keyframe && !p_sys->b_index ) - demux_IndexAppend( &p_sys->idx, p_data->i_dts, stream_Tell(p_demux->s) - NUV_FH_SIZE ); + demux_IndexAppend( &p_sys->idx, + p_data->i_dts - VLC_TS_0, + stream_Tell(p_demux->s) - NUV_FH_SIZE ); /* */ - if( p_data->i_dts > p_sys->i_pcr ) + if( p_sys->i_pcr < 0 || p_sys->i_pcr < p_data->i_dts - VLC_TS_0 ) { - p_sys->i_pcr = p_data->i_dts; - es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_sys->i_pcr ); + p_sys->i_pcr = p_data->i_dts - VLC_TS_0; + es_out_Control( p_demux->out, ES_OUT_SET_PCR, VLC_TS_0 + p_sys->i_pcr ); } if( fh.i_type == 'A' && p_sys->p_es_audio ) @@ -924,9 +928,8 @@ static void demux_IndexAppend( demux_index_t *p_idx, else { p_idx->i_idx_max += 1000; - p_idx->idx = realloc_or_free( p_idx->idx, + p_idx->idx = xrealloc( p_idx->idx, p_idx->i_idx_max*sizeof(demux_index_entry_t)); - assert( p_idx->idx ); } }