diff options
author | Sebastian Parborg <darkdefende@gmail.com> | 2021-07-06 20:48:06 +0300 |
---|---|---|
committer | Sebastian Parborg <darkdefende@gmail.com> | 2021-08-16 16:10:58 +0300 |
commit | ded68fb10275c9f9a66e7019171b83cab0e9485d (patch) | |
tree | 8a7d8ad343433070b79f6bceec92871c564da1ec /extern/audaspace/plugins/ffmpeg/FFMPEGReader.h | |
parent | 6df81ddb84c60876ac3ebd87d1d134109f34eabd (diff) |
VSE: Fix audaspace not reading ffmpeg files with start offset correctly
The duration and start time for audio strips were not correctly read in
audaspace.
Some video files have a "lead in" section of audio that plays before the
video starts playing back. Before this patch, we would play this lead in
audio at the same time as the video started and thus the audio would not
be in sync anymore.
Now the lead in audio is cut off and the duration should be correctly
calculated with this in mind.
If the audio starts after the video, the audio strip is shifted to
account for this, but it will also lead to cut off audio which might not
be wanted. However we don't have a simple way to solve this at this
point.
Differential Revision: http://developer.blender.org/D11917
Diffstat (limited to 'extern/audaspace/plugins/ffmpeg/FFMPEGReader.h')
-rw-r--r-- | extern/audaspace/plugins/ffmpeg/FFMPEGReader.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/extern/audaspace/plugins/ffmpeg/FFMPEGReader.h b/extern/audaspace/plugins/ffmpeg/FFMPEGReader.h index f62436ac83b..d613457c220 100644 --- a/extern/audaspace/plugins/ffmpeg/FFMPEGReader.h +++ b/extern/audaspace/plugins/ffmpeg/FFMPEGReader.h @@ -55,6 +55,22 @@ private: int m_position; /** + * The start offset in seconds relative to the media container start time. + * IE how much the sound should be delayed to be kept in sync with the rest of the containter streams. + */ + double m_start_offset; + + /** + * The start time pts of the stream. All packets before this timestamp shouldn't be played back (only decoded). + */ + int64_t m_st_time; + + /** + * The duration of the audio stream in samples. + */ + int64_t m_duration; + + /** * The specification of the audio data. */ DeviceSpecs m_specs; @@ -182,6 +198,7 @@ public: virtual void seek(int position); virtual int getLength() const; virtual int getPosition() const; + virtual double getStartOffset() const; virtual Specs getSpecs() const; virtual void read(int& length, bool& eos, sample_t* buffer); }; |