1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-26 09:02:38 +00:00

Fix crash with avisynth audio-only files and take audio length into account when length is queried.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22448 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2007-03-04 14:53:26 +00:00
parent 9a90222cc9
commit 8849f44f77

View File

@ -362,14 +362,17 @@ static demuxer_t* demux_open_avs(demuxer_t* demuxer)
static int demux_avs_control(demuxer_t *demuxer, int cmd, void *arg) static int demux_avs_control(demuxer_t *demuxer, int cmd, void *arg)
{ {
sh_video_t *sh_video=demuxer->video->sh; sh_video_t *sh_video=demuxer->video->sh;
sh_audio_t *sh_audio=demuxer->audio->sh;
AVS_T *AVS = demuxer->priv; AVS_T *AVS = demuxer->priv;
switch(cmd) switch(cmd)
{ {
case DEMUXER_CTRL_GET_TIME_LENGTH: case DEMUXER_CTRL_GET_TIME_LENGTH:
{ {
if (!AVS->video_info->num_frames) return DEMUXER_CTRL_DONTKNOW; double res = sh_video ? (double)AVS->video_info->num_frames / sh_video->fps : 0;
*((double *)arg) = (double)AVS->video_info->num_frames / sh_video->fps; if (sh_audio)
res = FFMAX(res, (double)AVS->video_info->num_audio_samples / sh_audio->samplerate);
*((double *)arg) = res;
return DEMUXER_CTRL_OK; return DEMUXER_CTRL_OK;
} }
case DEMUXER_CTRL_GET_PERCENT_POS: case DEMUXER_CTRL_GET_PERCENT_POS: