[gegl] ff-load: fix audio track decoding for pure audio files



commit 5eb799ecd2446619bbdbb8ba3c3e2b9b799e64d0
Author: Øyvind Kolås <pippin gimp org>
Date:   Wed May 8 15:38:59 2019 +0200

    ff-load: fix audio track decoding for pure audio files
    
    This special cases files without a video track to compute relevant pre-decoded
    audio segment based on frame and frame rate, rather than presentation time
    stamps as when decoding video.

 operations/external/ff-load.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/operations/external/ff-load.c b/operations/external/ff-load.c
index 9dedd7916..0d9a4f3fb 100644
--- a/operations/external/ff-load.c
+++ b/operations/external/ff-load.c
@@ -704,7 +704,6 @@ process (GeglOperation       *operation,
           gegl_audio_fragment_set_sample_rate (o->audio, p->audio_stream->codecpar->sample_rate);
           gegl_audio_fragment_set_channels    (o->audio, 2);
           gegl_audio_fragment_set_channel_layout    (o->audio, GEGL_CH_LAYOUT_STEREO);
-
           samples_per_frame (o->frame,
                o->frame_rate, p->audio_stream->codecpar->sample_rate,
                &sample_count,
@@ -712,7 +711,18 @@ process (GeglOperation       *operation,
 
           gegl_audio_fragment_set_sample_count (o->audio, sample_count);
 
-          decode_audio (operation, p->prevpts, p->prevpts + 5.0);
+          if (p->video_stream != NULL)
+          {
+            /* if we got video stream
+               request audio to be decoded between prevpts and 5s into future*/
+            decode_audio (operation, p->prevpts, p->prevpts + 5.0);
+
+          }
+          else
+          {
+            decode_audio (operation, o->frame / o->frame_rate, o->frame / o->frame_rate + 5);
+          }
+
           {
             int i;
             for (i = 0; i < sample_count; i++)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]