Commit ff2f9a52 authored by Gildas Bazin's avatar Gildas Bazin

* modules/demux/mp4/mp4.c: don't segfault on reference files.
parent c3e5226b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mp4.c : MP4 file input module for vlc * mp4.c : MP4 file input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: mp4.c,v 1.55 2004/01/18 22:00:00 fenrir Exp $ * $Id: mp4.c,v 1.56 2004/01/23 08:07:17 gbazin Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -575,7 +575,7 @@ static int Seek ( input_thread_t *p_input, mtime_t i_date ) ...@@ -575,7 +575,7 @@ static int Seek ( input_thread_t *p_input, mtime_t i_date )
/***************************************************************************** /*****************************************************************************
* Control: * Control:
*****************************************************************************/ *****************************************************************************/
static int Control ( input_thread_t *p_input, int i_query, va_list args ) static int Control( input_thread_t *p_input, int i_query, va_list args )
{ {
demux_sys_t *p_sys = p_input->p_demux_data; demux_sys_t *p_sys = p_input->p_demux_data;
...@@ -598,17 +598,24 @@ static int Control ( input_thread_t *p_input, int i_query, va_list args ) ...@@ -598,17 +598,24 @@ static int Control ( input_thread_t *p_input, int i_query, va_list args )
case DEMUX_SET_POSITION: case DEMUX_SET_POSITION:
f = (double)va_arg( args, double ); f = (double)va_arg( args, double );
i64 = (int64_t)( f * if( p_sys->i_timescale > 0 )
(double)1000000 * {
i64 = (int64_t)( f * (double)1000000 *
(double)p_sys->i_duration / (double)p_sys->i_duration /
(double)p_sys->i_timescale ); (double)p_sys->i_timescale );
return Seek( p_input, i64 ); return Seek( p_input, i64 );
}
else return VLC_SUCCESS;
case DEMUX_GET_TIME: case DEMUX_GET_TIME:
pi64 = (int64_t*)va_arg( args, int64_t * ); pi64 = (int64_t*)va_arg( args, int64_t * );
if( p_sys->i_timescale > 0 )
{
*pi64 = (mtime_t)1000000 * *pi64 = (mtime_t)1000000 *
(mtime_t)p_sys->i_time / (mtime_t)p_sys->i_time /
(mtime_t)p_sys->i_timescale; (mtime_t)p_sys->i_timescale;
}
else *pi64 = 0;
return VLC_SUCCESS; return VLC_SUCCESS;
case DEMUX_SET_TIME: case DEMUX_SET_TIME:
...@@ -617,13 +624,19 @@ static int Control ( input_thread_t *p_input, int i_query, va_list args ) ...@@ -617,13 +624,19 @@ static int Control ( input_thread_t *p_input, int i_query, va_list args )
case DEMUX_GET_LENGTH: case DEMUX_GET_LENGTH:
pi64 = (int64_t*)va_arg( args, int64_t * ); pi64 = (int64_t*)va_arg( args, int64_t * );
if( p_sys->i_timescale > 0 )
{
*pi64 = (mtime_t)1000000 * *pi64 = (mtime_t)1000000 *
(mtime_t)p_sys->i_duration / (mtime_t)p_sys->i_duration /
(mtime_t)p_sys->i_timescale; (mtime_t)p_sys->i_timescale;
}
else *pi64 = 0;
return VLC_SUCCESS; return VLC_SUCCESS;
case DEMUX_GET_FPS: case DEMUX_GET_FPS:
msg_Warn( p_input, "DEMUX_GET_FPS unimplemented !!" ); msg_Warn( p_input, "DEMUX_GET_FPS unimplemented !!" );
return VLC_EGENERIC; return VLC_EGENERIC;
default: default:
msg_Err( p_input, "control query unimplemented !!!" ); msg_Err( p_input, "control query unimplemented !!!" );
return demux_vaControlDefault( p_input, i_query, args ); return demux_vaControlDefault( p_input, i_query, args );
......
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