//#define AVFORMAT_DEBUG 1
/* Version checking */
-#if (LIBAVFORMAT_BUILD >= 4611) && defined(HAVE_LIBAVFORMAT)
-
-#if LIBAVFORMAT_BUILD < 4619
-# define av_seek_frame(a,b,c,d) av_seek_frame(a,b,c)
-#endif
+#if (LIBAVFORMAT_BUILD >= 4629) && defined(HAVE_LIBAVFORMAT)
/*****************************************************************************
* demux_sys_t: demux descriptor
return VLC_EGENERIC;
}
- if( av_find_stream_info( p_sys->ic ) )
+ if( av_find_stream_info( p_sys->ic ) < 0 )
{
msg_Err( p_demux, "av_find_stream_info failed" );
E_(CloseDemux)( p_this );
for( i = 0; i < p_sys->ic->nb_streams; i++ )
{
- AVCodecContext *cc = &p_sys->ic->streams[i]->codec;
+ AVCodecContext *cc = p_sys->ic->streams[i]->codec;
es_out_id_t *es;
es_format_t fmt;
vlc_fourcc_t fcc;
msg_Dbg( p_demux, " - format = %s (%s)",
p_sys->fmt->name, p_sys->fmt->long_name );
msg_Dbg( p_demux, " - start time = "I64Fd,
- ( p_sys->ic->start_time != (signed int) AV_NOPTS_VALUE ) ?
+ ( p_sys->ic->start_time != AV_NOPTS_VALUE ) ?
p_sys->ic->start_time * 1000000 / AV_TIME_BASE : -1 );
msg_Dbg( p_demux, " - duration = "I64Fd,
- ( p_sys->ic->duration != (signed int) AV_NOPTS_VALUE ) ?
+ ( p_sys->ic->duration != AV_NOPTS_VALUE ) ?
p_sys->ic->duration * 1000000 / AV_TIME_BASE : -1 );
return VLC_SUCCESS;
memcpy( p_frame->p_buffer, pkt.data, pkt.size );
- i_start_time = ( p_sys->ic->start_time != (signed int) AV_NOPTS_VALUE ) ?
+ i_start_time = ( p_sys->ic->start_time != AV_NOPTS_VALUE ) ?
p_sys->ic->start_time : 0;
- p_frame->i_dts = ( pkt.dts == (signed int) AV_NOPTS_VALUE ) ?
- 0 : (pkt.dts - i_start_time) * 1000000 / AV_TIME_BASE;
- p_frame->i_pts = ( pkt.pts == (signed int) AV_NOPTS_VALUE ) ?
- 0 : (pkt.pts - i_start_time) * 1000000 / AV_TIME_BASE;
+ p_frame->i_dts = ( pkt.dts == AV_NOPTS_VALUE ) ?
+ 0 : (pkt.dts - i_start_time) * 1000000 *
+ p_sys->ic->streams[pkt.stream_index]->time_base.num /
+ p_sys->ic->streams[pkt.stream_index]->time_base.den;
+ p_frame->i_pts = ( pkt.pts == AV_NOPTS_VALUE ) ?
+ 0 : (pkt.pts - i_start_time) * 1000000 *
+ p_sys->ic->streams[pkt.stream_index]->time_base.num /
+ p_sys->ic->streams[pkt.stream_index]->time_base.den;
#ifdef AVFORMAT_DEBUG
msg_Dbg( p_demux, "tk[%d] dts="I64Fd" pts="I64Fd,
( pkt.stream_index == p_sys->i_pcr_tk || p_sys->i_pcr_tk < 0 ) )
{
p_sys->i_pcr_tk = pkt.stream_index;
- p_sys->i_pcr = pkt.dts - i_start_time;
+ p_sys->i_pcr = p_frame->i_dts;
es_out_Control( p_demux->out, ES_OUT_SET_PCR, (int64_t)p_sys->i_pcr );
}
*pf = (double)stream_Tell( p_demux->s ) / (double)i64;
}
- if( p_sys->ic->duration != (signed int) AV_NOPTS_VALUE && p_sys->i_pcr > 0 )
+ if( p_sys->ic->duration != AV_NOPTS_VALUE && p_sys->i_pcr > 0 )
{
*pf = (double)p_sys->i_pcr / (double)p_sys->ic->duration;
}
int64_t i_size = stream_Size( p_demux->s );
i64 = p_sys->i_pcr * i_size / i64 * f;
- if( p_sys->ic->start_time != (signed int) AV_NOPTS_VALUE )
+ if( p_sys->ic->start_time != AV_NOPTS_VALUE )
i64 += p_sys->ic->start_time;
- if( p_sys->ic->duration != (signed int) AV_NOPTS_VALUE )
+ if( p_sys->ic->duration != AV_NOPTS_VALUE )
i64 = p_sys->ic->duration * f;
msg_Warn( p_demux, "DEMUX_SET_POSITION: "I64Fd, i64 );
case DEMUX_GET_LENGTH:
pi64 = (int64_t*)va_arg( args, int64_t * );
- if( p_sys->ic->duration != (signed int) AV_NOPTS_VALUE )
+ if( p_sys->ic->duration != AV_NOPTS_VALUE )
{
*pi64 = p_sys->ic->duration;
}
case DEMUX_SET_TIME:
i64 = (int64_t)va_arg( args, int64_t );
- if( p_sys->ic->start_time != (signed int) AV_NOPTS_VALUE )
+ if( p_sys->ic->start_time != AV_NOPTS_VALUE )
i64 += p_sys->ic->start_time;
msg_Warn( p_demux, "DEMUX_SET_TIME: "I64Fd, i64 );
{
}
-#endif /* LIBAVFORMAT_BUILD >= 4611 */
+#endif /* LIBAVFORMAT_BUILD >= 4629 */