diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-03-04 14:53:26 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-03-04 14:53:26 +0000 |
commit | 8849f44f77e35bdde726bd09bf6adc039cbd7047 (patch) | |
tree | 1b8beea0d87283449d2f783878a7d793d2aaeb83 | |
parent | 9a90222cc950e96710b72daf6bf04c08a3b672db (diff) | |
download | mpv-8849f44f77e35bdde726bd09bf6adc039cbd7047.tar.bz2 mpv-8849f44f77e35bdde726bd09bf6adc039cbd7047.tar.xz |
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
-rw-r--r-- | libmpdemux/demux_avs.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libmpdemux/demux_avs.c b/libmpdemux/demux_avs.c index 31288d4d50..c73082b9b3 100644 --- a/libmpdemux/demux_avs.c +++ b/libmpdemux/demux_avs.c @@ -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) { sh_video_t *sh_video=demuxer->video->sh; + sh_audio_t *sh_audio=demuxer->audio->sh; AVS_T *AVS = demuxer->priv; switch(cmd) { case DEMUXER_CTRL_GET_TIME_LENGTH: { - if (!AVS->video_info->num_frames) return DEMUXER_CTRL_DONTKNOW; - *((double *)arg) = (double)AVS->video_info->num_frames / sh_video->fps; + double res = sh_video ? (double)AVS->video_info->num_frames / sh_video->fps : 0; + if (sh_audio) + res = FFMAX(res, (double)AVS->video_info->num_audio_samples / sh_audio->samplerate); + *((double *)arg) = res; return DEMUXER_CTRL_OK; } case DEMUXER_CTRL_GET_PERCENT_POS: |