fixed #95 and added minimal support for #66

This commit is contained in:
itsmattkc
2018-07-08 12:19:07 +01:00
parent a31a3d8c75
commit 0b739fcb76
17 changed files with 261 additions and 165 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ void clear_audio_ibuffer() {
int get_buffer_offset_from_frame(long frame) {
if (frame >= audio_ibuffer_frame) {
return av_samples_get_buffer_size(NULL, av_get_channel_layout_nb_channels(sequence->audio_layout), qFloor(((frame-audio_ibuffer_frame)/sequence->frame_rate)*sequence->audio_frequency), AV_SAMPLE_FMT_S16, 1);
return av_samples_get_buffer_size(NULL, av_get_channel_layout_nb_channels(sequence->audio_layout), qRound(((frame-audio_ibuffer_frame)/sequence->frame_rate)*sequence->audio_frequency), AV_SAMPLE_FMT_S16, 1);
} else {
qDebug() << "[WARNING] get_buffer_offset_from_frame called incorrectly";
return 0;
+2 -6
View File
@@ -189,12 +189,8 @@ long seconds_to_clip_frame(Clip* c, float seconds) {
}
float clip_frame_to_seconds(Clip* c, long clip_frame) {
// returns frame number as seconds (decimal)
if (c->stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
return (double) clip_frame / av_q2d(c->stream->avg_frame_rate);
} else {
return (double) clip_frame / c->sequence->frame_rate;
}
// returns frame number in decimal seconds
return (float) clip_frame / c->sequence->frame_rate;
}
int retrieve_next_frame(Clip* c, AVFrame* f) {