fixed some major audio bugs

This commit is contained in:
itsmattkc
2018-09-29 13:19:45 +10:00
parent ee7b5476bf
commit 8f67b46714
2 changed files with 13 additions and 11 deletions
+2 -2
View File
@@ -224,7 +224,7 @@ double playhead_to_seconds(Clip* c, long playhead) {
long seconds_to_clip_frame(Clip* c, double seconds) {
// returns time as frame number (according to clip's frame rate)
if (c->stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
return floor(seconds*av_q2d(av_guess_frame_rate(c->formatCtx, c->stream, c->frame)));
return floor(seconds*av_q2d(c->stream->avg_frame_rate));
} else {
qDebug() << "[ERROR] seconds_to_clip_frame only works on video streams";
return 0;
@@ -233,7 +233,7 @@ long seconds_to_clip_frame(Clip* c, double seconds) {
double clip_frame_to_seconds(Clip* c, long clip_frame) {
// returns frame number in decimal seconds
return (double) clip_frame / av_q2d(av_guess_frame_rate(c->formatCtx, c->stream, c->frame));
return (double) clip_frame / av_q2d(c->stream->avg_frame_rate);
}
int retrieve_next_frame(Clip* c, AVFrame* f) {