mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-07 08:15:59 -10:00
This adds a playback property for making the movie loop to the start when the end is reached. The way this is done is by simply keeping the decoder running even if the end of the movie is reached. Then the movie is reset to the beginning and decoding continues. The player detects this reset by examining the frame times which keeps the playback constant. This also includes support for this in the movie scripting API.
38 lines
638 B
C++
38 lines
638 B
C++
#pragma once
|
|
|
|
#include "cutscene/ffmpeg/internal.h"
|
|
#include "cutscene/ffmpeg/FFMPEGDecoder.h"
|
|
|
|
namespace cutscene {
|
|
namespace ffmpeg {
|
|
|
|
class AudioDecoder: public FFMPEGStreamDecoder<AudioFrame> {
|
|
private:
|
|
SwrContext* m_resampleCtx;
|
|
|
|
uint8_t** m_outData;
|
|
int m_outLinesize;
|
|
|
|
int m_maxOutNumSamples;
|
|
int m_outNumSamples;
|
|
|
|
SCP_vector<short> m_audioBuffer;
|
|
|
|
void handleDecodedFrame(AVFrame* frame);
|
|
|
|
void flushAudioBuffer();
|
|
|
|
public:
|
|
explicit AudioDecoder(DecoderStatus* status);
|
|
|
|
~AudioDecoder() override;
|
|
|
|
void decodePacket(AVPacket* packet) override;
|
|
|
|
void finishDecoding() override;
|
|
|
|
void flushBuffers() override;
|
|
};
|
|
}
|
|
}
|