mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-09 04:49:39 -10:00
This adds support for displaying subtitles embedded in movie files. This supports files with multiple subtitle streams where each stream contains the subtitles for one language. When the movie file is opened, the stream for the currently active language will be used and displayed. This resolves one of the points mentioned in #1522. This also depends on PR #1484.
49 lines
1.0 KiB
C++
49 lines
1.0 KiB
C++
|
|
#include "cutscene/ffmpeg/internal.h"
|
|
|
|
|
|
namespace cutscene {
|
|
namespace ffmpeg {
|
|
DecoderStatus::DecoderStatus() {}
|
|
|
|
DecoderStatus::~DecoderStatus() {
|
|
videoStreamIndex = -1;
|
|
videoStream = nullptr;
|
|
videoCodec = nullptr;
|
|
|
|
if (videoCodecCtx != nullptr) {
|
|
avcodec_close(videoCodecCtx);
|
|
#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(57, 24, 255)
|
|
avcodec_free_context(&videoCodecCtx);
|
|
#endif
|
|
videoCodecCtx = nullptr;
|
|
}
|
|
|
|
audioStreamIndex = -1;
|
|
audioStream = nullptr;
|
|
audioCodec = nullptr;
|
|
|
|
if (audioCodecCtx != nullptr) {
|
|
avcodec_close(audioCodecCtx);
|
|
#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(57, 24, 255)
|
|
avcodec_free_context(&audioCodecCtx);
|
|
#endif
|
|
audioCodecCtx = nullptr;
|
|
}
|
|
|
|
subtitleStreamIndex = -1;
|
|
subtitleStream = nullptr;
|
|
subtitleCodec = nullptr;
|
|
|
|
if (subtitleCodecCtx != nullptr) {
|
|
avcodec_close(subtitleCodecCtx);
|
|
#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(57, 24, 255)
|
|
avcodec_free_context(&subtitleCodecCtx);
|
|
#endif
|
|
subtitleCodecCtx = nullptr;
|
|
}
|
|
}
|
|
|
|
} // namespace ffmpeg
|
|
} // namespace cutscene
|