- Add patch to fix build with pocketsphinx 5.0.3 in TW since

the API changed in the 5.0.0 release. Also, removed some
  parameters that don't seem to be configurable by pocketsphinx
  anymore:
  * use-pocketsphinx-5.0.0-api.patch

OBS-URL: https://build.opensuse.org/package/show/KDE:Extra/subtitlecomposer?expand=0&rev=47
This commit is contained in:
Christophe Marin 2024-12-24 11:58:10 +00:00 committed by Git OBS Bridge
commit 7e2072f1f1
18 changed files with 1593 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

View File

@ -0,0 +1,437 @@
From bc9f0507df17c42746ef5acc06313a7a058391d4 Mon Sep 17 00:00:00 2001
From: Mladen Milinkovic <maxrd2@smoothware.net>
Date: Fri, 18 Nov 2022 15:59:10 +0100
Subject: [PATCH 01/11] Replaced deprecated FFmpeg channel layout code
---
src/CMakeLists.txt | 8 ++++
src/streamprocessor/streamprocessor.cpp | 48 ++++++++++++-------
src/streamprocessor/streamprocessor.h | 17 +++----
src/videoplayer/backend/audiodecoder.cpp | 57 ++++++++++++-----------
src/videoplayer/backend/audiodecoder.h | 5 +-
src/videoplayer/backend/streamdemuxer.cpp | 22 +++++----
src/videoplayer/backend/videostate.cpp | 2 +-
7 files changed, 92 insertions(+), 67 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index bf0043ea..bacf025f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -5,6 +5,14 @@ endif()
if(CMAKE_COMPILER_IS_GNUCC)
message(STATUS "GNU C compiler detected")
+ if(SC_NO_DEPRECATED)
+ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-deprecated-declarations")
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-deprecated-declarations")
+ endif()
+ if(SC_WARN_ERRORS)
+ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror")
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror")
+ endif()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Og -g")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Og -g")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall -O3")
diff --git a/src/streamprocessor/streamprocessor.cpp b/src/streamprocessor/streamprocessor.cpp
index 1e883780..aa27a66e 100644
--- a/src/streamprocessor/streamprocessor.cpp
+++ b/src/streamprocessor/streamprocessor.cpp
@@ -35,13 +35,15 @@ StreamProcessor::StreamProcessor(QObject *parent)
m_avFormat(nullptr),
m_avStream(nullptr),
m_codecCtx(nullptr),
- m_swResample(nullptr)
+ m_swResample(nullptr),
+ m_audioChLayout(new AVChannelLayout{})
{
}
StreamProcessor::~StreamProcessor()
{
close();
+ delete m_audioChLayout;
}
bool
@@ -81,7 +83,7 @@ StreamProcessor::open(const QString &filename)
m_opened = true;
- return true;
+ return true;
}
void
@@ -92,6 +94,7 @@ StreamProcessor::close()
wait();
}
+ av_channel_layout_uninit(m_audioChLayout);
if(m_swResample)
swr_free(&m_swResample);
if(m_codecCtx)
@@ -273,28 +276,40 @@ StreamProcessor::initAudio(int streamIndex, const WaveFormat &waveFormat)
return false;
}
+ av_channel_layout_uninit(m_audioChLayout);
+
// figure channel layout or update stream format
- if(!m_codecCtx->channel_layout)
- m_codecCtx->channel_layout = av_get_default_channel_layout(m_codecCtx->channels);;
+ if(m_codecCtx->ch_layout.order != AV_CHANNEL_ORDER_NATIVE) {
+ const int cc = m_codecCtx->ch_layout.nb_channels;
+ av_channel_layout_uninit(&m_codecCtx->ch_layout);
+ av_channel_layout_default(&m_codecCtx->ch_layout, cc);
+ }
if(m_audioStreamFormat.channels() == 0) {
- m_audioStreamFormat.setChannels(m_codecCtx->channels);
- m_audioChannelLayout = m_codecCtx->channel_layout;
+ m_audioStreamFormat.setChannels(m_codecCtx->ch_layout.nb_channels);
+ av_channel_layout_copy(m_audioChLayout, &m_codecCtx->ch_layout);
} else {
- m_audioChannelLayout = av_get_default_channel_layout(m_audioStreamFormat.channels());
+ av_channel_layout_default(m_audioChLayout, m_audioStreamFormat.channels());
}
// setup resampler if needed
- const bool convChannels = m_codecCtx->channel_layout != m_audioChannelLayout;
+ const bool convChannels = av_channel_layout_compare(&m_codecCtx->ch_layout, m_audioChLayout) != 0;
const bool convSampleRate = m_codecCtx->sample_rate != m_audioStreamFormat.sampleRate();
const bool convSampleFormat = m_codecCtx->sample_fmt != m_audioSampleFormat;
if(convChannels || convSampleRate || convSampleFormat) {
- m_swResample = swr_alloc_set_opts(nullptr,
- m_audioChannelLayout, static_cast<AVSampleFormat>(m_audioSampleFormat), m_audioStreamFormat.sampleRate(),
- m_codecCtx->channel_layout, m_codecCtx->sample_fmt, m_codecCtx->sample_rate,
- 0, nullptr);
+ swr_alloc_set_opts2(&m_swResample,
+ m_audioChLayout, AVSampleFormat(m_audioSampleFormat), m_audioStreamFormat.sampleRate(),
+ &m_codecCtx->ch_layout, m_codecCtx->sample_fmt, m_codecCtx->sample_rate,
+ 0, nullptr);
// NOTE: swr_convert_frame() will call swr_init() and swr_config_frame() which is better as it seems m_codecCtx can
- // end up with different config that what is actually in the stream
+ // end up with different config than what is actually in the stream
+ if(!m_swResample) {
+ av_log(nullptr, AV_LOG_ERROR,
+ "Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n",
+ m_codecCtx->sample_rate, av_get_sample_fmt_name(m_codecCtx->sample_fmt), m_codecCtx->ch_layout.nb_channels,
+ m_audioStreamFormat.sampleRate(), av_get_sample_fmt_name(AVSampleFormat(m_audioSampleFormat)), m_audioChLayout->nb_channels);
+ return false;
+ }
}
return true;
@@ -363,7 +378,8 @@ StreamProcessor::processAudio()
if(m_swResample) {
frameResampled = av_frame_alloc();
Q_ASSERT(frameResampled != nullptr);
- frameResampled->channel_layout = m_audioChannelLayout;
+ av_channel_layout_uninit(&frameResampled->ch_layout);
+ av_channel_layout_copy(&frameResampled->ch_layout, m_audioChLayout);
frameResampled->sample_rate = m_audioStreamFormat.sampleRate();
frameResampled->format = m_audioSampleFormat;
}
@@ -448,12 +464,12 @@ StreamProcessor::processAudio()
if(m_swResample) {
Q_ASSERT(frameResampled != nullptr);
- emit audioDataAvailable(frameResampled->data[0], qint32(frameSize * frameResampled->channels),
+ emit audioDataAvailable(frameResampled->data[0], qint32(frameSize * frameResampled->ch_layout.nb_channels),
&m_audioStreamFormat, qint64(timeFrameStart + timeResampleDelay), qint64(timeFrameDuration));
drainSampleBuffer = swr_get_out_samples(m_swResample, 0) > 1000;
} else {
- emit audioDataAvailable(frame->data[0], qint32(frameSize * frame->channels),
+ emit audioDataAvailable(frame->data[0], qint32(frameSize * frame->ch_layout.nb_channels),
&m_audioStreamFormat, qint64(timeFrameStart), qint64(timeFrameDuration));
}
} while(!conversionComplete && !isInterruptionRequested() && drainSampleBuffer);
diff --git a/src/streamprocessor/streamprocessor.h b/src/streamprocessor/streamprocessor.h
index 152a985a..02e7f3b1 100644
--- a/src/streamprocessor/streamprocessor.h
+++ b/src/streamprocessor/streamprocessor.h
@@ -16,14 +16,11 @@
QT_FORWARD_DECLARE_CLASS(QTimer)
-QT_FORWARD_DECLARE_STRUCT(AVFormatContext)
-typedef struct AVFormatContext AVFormatContext;
-QT_FORWARD_DECLARE_STRUCT(AVCodecContext)
-typedef struct AVCodecContext AVCodecContext;
-QT_FORWARD_DECLARE_STRUCT(AVStream)
-typedef struct AVStream AVStream;
-QT_FORWARD_DECLARE_STRUCT(SwrContext)
-typedef struct SwrContext SwrContext;
+struct AVFormatContext;
+struct AVCodecContext;
+struct AVStream;
+struct SwrContext;
+struct AVChannelLayout;
namespace SubtitleComposer {
@@ -59,7 +56,7 @@ protected:
int findStream(int streamType, int streamIndex, bool imageSub);
void processAudio();
void processText();
- virtual void run() override;
+ virtual void run() override;
private:
bool m_opened;
@@ -86,7 +83,7 @@ private:
AVCodecContext *m_codecCtx;
SwrContext *m_swResample;
int m_audioSampleFormat;
- uint64_t m_audioChannelLayout;
+ AVChannelLayout *m_audioChLayout;
};
}
diff --git a/src/videoplayer/backend/audiodecoder.cpp b/src/videoplayer/backend/audiodecoder.cpp
index c0c99bb3..8c0b943e 100644
--- a/src/videoplayer/backend/audiodecoder.cpp
+++ b/src/videoplayer/backend/audiodecoder.cpp
@@ -37,6 +37,8 @@ using namespace SubtitleComposer;
AudioDecoder::AudioDecoder(VideoState *state, QObject *parent)
: Decoder(parent),
m_vs(state),
+ m_fmtSrc({}),
+ m_fmtTgt({}),
m_swrCtx(nullptr),
m_audioBuf(nullptr),
m_bufSize(0),
@@ -147,7 +149,7 @@ AudioDecoder::close()
}
bool
-AudioDecoder::open(int64_t wantChLayout, int wantNbChan, int wantSampleRate)
+AudioDecoder::open(AVChannelLayout *wantChLayout, int wantSampleRate)
{
const static QMap<int, const char *> bufFmtMap = {
{ 4, "AL_FORMAT_QUAD16" },
@@ -158,12 +160,12 @@ AudioDecoder::open(int64_t wantChLayout, int wantNbChan, int wantSampleRate)
int err;
- if(wantSampleRate <= 0 || wantNbChan <= 0) {
+ if(wantSampleRate <= 0 || !wantChLayout || wantChLayout->nb_channels <= 0) {
av_log(nullptr, AV_LOG_ERROR, "openal: invalid sample rate or channel count!\n");
return false;
}
- int availNbChan = wantNbChan;
+ int availNbChan = wantChLayout->nb_channels;
for(;;) {
while(availNbChan > 2 && !bufFmtMap.contains(availNbChan))
availNbChan--;
@@ -171,15 +173,15 @@ AudioDecoder::open(int64_t wantChLayout, int wantNbChan, int wantSampleRate)
m_bufFmt = availNbChan == 2 ? AL_FORMAT_STEREO16 : AL_FORMAT_MONO16;
break;
}
- m_bufFmt = alGetEnumValue(bufFmtMap[wantNbChan]);
+ m_bufFmt = alGetEnumValue(bufFmtMap[wantChLayout->nb_channels]);
if(m_bufFmt)
break;
availNbChan--;
}
- if(!wantChLayout || wantNbChan != availNbChan || wantNbChan != av_get_channel_layout_nb_channels(wantChLayout)) {
- wantChLayout = av_get_default_channel_layout(availNbChan);
- wantChLayout &= ~AV_CH_LAYOUT_STEREO_DOWNMIX;
+ if(wantChLayout->nb_channels != availNbChan || wantChLayout->order != AV_CHANNEL_ORDER_NATIVE) {
+ av_channel_layout_uninit(wantChLayout);
+ av_channel_layout_default(wantChLayout, availNbChan);
}
m_alDev = alcOpenDevice(nullptr);
@@ -212,10 +214,14 @@ AudioDecoder::open(int64_t wantChLayout, int wantNbChan, int wantSampleRate)
m_fmtTgt.fmt = AV_SAMPLE_FMT_S16;
m_fmtTgt.freq = wantSampleRate;
- m_fmtTgt.channelLayout = wantChLayout;
- m_fmtTgt.channels = availNbChan;
- m_fmtTgt.frameSize = av_samples_get_buffer_size(nullptr, m_fmtTgt.channels, 1, m_fmtTgt.fmt, 1);
- m_fmtTgt.bytesPerSec = av_samples_get_buffer_size(nullptr, m_fmtTgt.channels, m_fmtTgt.freq, m_fmtTgt.fmt, 1);
+ if((err = av_channel_layout_copy(&m_fmtTgt.chLayout, wantChLayout)) < 0) {
+ av_log(nullptr, AV_LOG_ERROR, "av_channel_layout_copy() failed (errL %d).\n", err);
+ close();
+ return false;
+ }
+
+ m_fmtTgt.frameSize = av_samples_get_buffer_size(nullptr, m_fmtTgt.chLayout.nb_channels, 1, m_fmtTgt.fmt, 1);
+ m_fmtTgt.bytesPerSec = av_samples_get_buffer_size(nullptr, m_fmtTgt.chLayout.nb_channels, m_fmtTgt.freq, m_fmtTgt.fmt, 1);
if(m_fmtTgt.bytesPerSec <= 0 || m_fmtTgt.frameSize <= 0) {
av_log(nullptr, AV_LOG_ERROR, "av_samples_get_buffer_size failed\n");
close();
@@ -349,47 +355,44 @@ AudioDecoder::syncAudio(int nbSamples)
int
AudioDecoder::decodeFrame(Frame *af)
{
+ // CONVERTED maxrd2
if(af->serial != m_queue->serial())
return -1;
- int dataSize = av_samples_get_buffer_size(nullptr, af->frame->channels,
+ int dataSize = av_samples_get_buffer_size(nullptr, af->frame->ch_layout.nb_channels,
af->frame->nb_samples,
(AVSampleFormat)af->frame->format, 1);
int resampledDataSize;
- uint64_t decChannelLayout =
- (af->frame->channel_layout &&
- af->frame->channels == av_get_channel_layout_nb_channels(af->frame->channel_layout)) ?
- af->frame->channel_layout : av_get_default_channel_layout(af->frame->channels);
int wantedNbSamples = syncAudio(af->frame->nb_samples);
if(af->frame->format != m_fmtSrc.fmt
- || decChannelLayout != m_fmtSrc.channelLayout
+ || av_channel_layout_compare(&af->frame->ch_layout, &m_fmtSrc.chLayout)
|| af->frame->sample_rate != m_fmtSrc.freq
|| (wantedNbSamples != af->frame->nb_samples && !m_swrCtx)) {
swr_free(&m_swrCtx);
- m_swrCtx = swr_alloc_set_opts(nullptr,
- m_fmtTgt.channelLayout, m_fmtTgt.fmt, m_fmtTgt.freq,
- decChannelLayout, (AVSampleFormat)af->frame->format, af->frame->sample_rate,
- 0, nullptr);
+ swr_alloc_set_opts2(&m_swrCtx,
+ &m_fmtTgt.chLayout, m_fmtTgt.fmt, m_fmtTgt.freq,
+ &af->frame->ch_layout, AVSampleFormat(af->frame->format), af->frame->sample_rate,
+ 0, nullptr);
if(!m_swrCtx || swr_init(m_swrCtx) < 0) {
av_log(nullptr, AV_LOG_ERROR,
"Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n",
af->frame->sample_rate, av_get_sample_fmt_name((AVSampleFormat)af->frame->format),
- af->frame->channels,
- m_fmtTgt.freq, av_get_sample_fmt_name(m_fmtTgt.fmt), m_fmtTgt.channels);
+ af->frame->ch_layout.nb_channels,
+ m_fmtTgt.freq, av_get_sample_fmt_name(m_fmtTgt.fmt), m_fmtTgt.chLayout.nb_channels);
swr_free(&m_swrCtx);
return -1;
}
- m_fmtSrc.channelLayout = decChannelLayout;
- m_fmtSrc.channels = af->frame->channels;
+ if(av_channel_layout_copy(&m_fmtSrc.chLayout, &af->frame->ch_layout) < 0)
+ return -1;
m_fmtSrc.freq = af->frame->sample_rate;
m_fmtSrc.fmt = (AVSampleFormat)af->frame->format;
}
if(m_swrCtx) {
const int outCount = (int64_t)wantedNbSamples * m_fmtTgt.freq / af->frame->sample_rate + 256;
- const int outSize = av_samples_get_buffer_size(nullptr, m_fmtTgt.channels, outCount, m_fmtTgt.fmt, 0);
+ const int outSize = av_samples_get_buffer_size(nullptr, m_fmtTgt.chLayout.nb_channels, outCount, m_fmtTgt.fmt, 0);
if(outSize < 0) {
av_log(nullptr, AV_LOG_ERROR, "av_samples_get_buffer_size() failed\n");
return -1;
@@ -417,7 +420,7 @@ AudioDecoder::decodeFrame(Frame *af)
swr_free(&m_swrCtx);
}
m_audioBuf = m_audioBuf1;
- resampledDataSize = outSamplesPerChannel * m_fmtTgt.channels * av_get_bytes_per_sample(m_fmtTgt.fmt);
+ resampledDataSize = outSamplesPerChannel * m_fmtTgt.chLayout.nb_channels * av_get_bytes_per_sample(m_fmtTgt.fmt);
} else {
m_audioBuf = af->frame->data[0];
resampledDataSize = dataSize;
diff --git a/src/videoplayer/backend/audiodecoder.h b/src/videoplayer/backend/audiodecoder.h
index ae579078..5b32b9a3 100644
--- a/src/videoplayer/backend/audiodecoder.h
+++ b/src/videoplayer/backend/audiodecoder.h
@@ -37,8 +37,7 @@ private:
struct Params {
int freq;
- int channels;
- uint64_t channelLayout;
+ AVChannelLayout chLayout;
AVSampleFormat fmt;
int frameSize;
int bytesPerSec;
@@ -50,7 +49,7 @@ private:
void queueBuffer(uint8_t *data, int len);
int syncAudio(int nbSamples);
- bool open(int64_t wanted_channel_layout, int wanted_nb_channels, int wanted_sample_rate);
+ bool open(AVChannelLayout *wantChLayout, int wantSampleRate);
void close();
void flush();
void play();
diff --git a/src/videoplayer/backend/streamdemuxer.cpp b/src/videoplayer/backend/streamdemuxer.cpp
index 72d21896..2eb59af1 100644
--- a/src/videoplayer/backend/streamdemuxer.cpp
+++ b/src/videoplayer/backend/streamdemuxer.cpp
@@ -233,9 +233,9 @@ StreamDemuxer::componentOpen(int streamIndex)
AVCodecContext *avCtx;
const AVCodec *codec;
AVDictionary *opts = nullptr;
- AVDictionaryEntry *t = nullptr;
- int sampleRate, nbChannels;
- int64_t channelLayout;
+ const AVDictionaryEntry *t = nullptr;
+ int sampleRate;
+ AVChannelLayout chLayout = {};
int ret = 0;
int stream_lowres = m_vs->lowres;
@@ -301,19 +301,21 @@ StreamDemuxer::componentOpen(int streamIndex)
switch(avCtx->codec_type) {
case AVMEDIA_TYPE_AUDIO:
sampleRate = avCtx->sample_rate;
- nbChannels = avCtx->channels;
- channelLayout = avCtx->channel_layout;
+ if((ret = av_channel_layout_copy(&chLayout, &avCtx->ch_layout)) < 0) {
+ av_log(nullptr, AV_LOG_ERROR, "av_channel_layout_copy() failed (errL %d).\n", ret);
+ goto fail;
+ }
// prepare audio output
- if(!m_vs->audDec.open(channelLayout, nbChannels, sampleRate))
+ if(!m_vs->audDec.open(&chLayout, sampleRate))
goto fail;
m_vs->audStreamIdx = streamIndex;
m_vs->audStream = ic->streams[streamIndex];
m_vs->audDec.init(avCtx, &m_vs->audPQ, nullptr, m_vs->continueReadThread);
- if((m_vs->fmtContext->iformat->flags & (AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK)) &&
- !m_vs->fmtContext->iformat->read_seek) {
+ if((m_vs->fmtContext->iformat->flags & (AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK))
+ && !m_vs->fmtContext->iformat->read_seek) {
m_vs->audDec.startPts(m_vs->audStream->start_time, m_vs->audStream->time_base);
}
m_vs->audDec.start();
@@ -342,6 +344,7 @@ StreamDemuxer::componentOpen(int streamIndex)
fail:
avcodec_free_context(&avCtx);
out:
+ av_channel_layout_uninit(&chLayout);
av_dict_free(&opts);
return ret;
@@ -397,8 +400,7 @@ StreamDemuxer::cycleStream(int codecType)
/* check that parameters are OK */
switch(codecType) {
case AVMEDIA_TYPE_AUDIO:
- if(st->codecpar->sample_rate != 0 &&
- st->codecpar->channels != 0)
+ if(st->codecpar->sample_rate != 0 && st->codecpar->ch_layout.nb_channels != 0)
goto the_end;
break;
case AVMEDIA_TYPE_VIDEO:
diff --git a/src/videoplayer/backend/videostate.cpp b/src/videoplayer/backend/videostate.cpp
index e34399df..a09f2466 100644
--- a/src/videoplayer/backend/videostate.cpp
+++ b/src/videoplayer/backend/videostate.cpp
@@ -131,7 +131,7 @@ VideoState::notifyLoaded()
continue;
*streamName += QStringLiteral(": ");
- AVDictionaryEntry *tag = av_dict_get(stream->metadata, "lang", nullptr, AV_DICT_IGNORE_SUFFIX);
+ const AVDictionaryEntry *tag = av_dict_get(stream->metadata, "lang", nullptr, AV_DICT_IGNORE_SUFFIX);
*streamName += tag ? QString("%2 (%3)").arg(LanguageCode::nameFromIso(tag->value)).arg(tag->value) : QStringLiteral("Unknown");
if((tag = av_dict_get(stream->metadata, "title", nullptr, 0)) != nullptr)
--
2.46.0

View File

@ -0,0 +1,27 @@
From cba7681e7931d7217cc063dc256939baec83a19e Mon Sep 17 00:00:00 2001
From: Mladen Milinkovic <maxrd2@smoothware.net>
Date: Thu, 1 Aug 2024 10:06:12 +0200
Subject: [PATCH 02/11] VideoPlayer: check AVFMT_NO_BYTE_SEEK flag for
seek_by_bytes
Applied ffplay release/5.1 patches
---
src/videoplayer/backend/streamdemuxer.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/videoplayer/backend/streamdemuxer.cpp b/src/videoplayer/backend/streamdemuxer.cpp
index 2eb59af1..3fb7476f 100644
--- a/src/videoplayer/backend/streamdemuxer.cpp
+++ b/src/videoplayer/backend/streamdemuxer.cpp
@@ -529,7 +529,7 @@ StreamDemuxer::run()
ic->pb->eof_reached = 0; // FIXME hack, ffplay maybe should not use avio_feof() to test for the end
if(m_vs->seek_by_bytes < 0)
- m_vs->seek_by_bytes = !!(ic->iformat->flags & AVFMT_TS_DISCONT) && strcmp("ogg", ic->iformat->name);
+ m_vs->seek_by_bytes = !(ic->iformat->flags & AVFMT_NO_BYTE_SEEK) && !!(ic->iformat->flags & AVFMT_TS_DISCONT) && strcmp("ogg", ic->iformat->name);
m_vs->maxFrameDuration = (ic->iformat->flags & AVFMT_TS_DISCONT) ? 10.0 : 3600.0;
--
2.46.0

View File

@ -0,0 +1,48 @@
From 3ea1fe04047fba05a333a48a2248c01edde8adbb Mon Sep 17 00:00:00 2001
From: Mladen Milinkovic <maxrd2@smoothware.net>
Date: Thu, 1 Aug 2024 10:26:07 +0200
Subject: [PATCH 03/11] VideoPlayer: drop an unused function argument
---
src/videoplayer/backend/renderthread.cpp | 4 ++--
src/videoplayer/backend/renderthread.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/videoplayer/backend/renderthread.cpp b/src/videoplayer/backend/renderthread.cpp
index d6a044c4..99c374bd 100644
--- a/src/videoplayer/backend/renderthread.cpp
+++ b/src/videoplayer/backend/renderthread.cpp
@@ -103,7 +103,7 @@ retry:
m_vs->vidFQ.m_mutex->lock();
if(!std::isnan(vp->pts))
- updateVideoPts(vp->pts, vp->pos, vp->serial);
+ updateVideoPts(vp->pts, vp->serial);
m_vs->vidFQ.m_mutex->unlock();
if(m_vs->vidFQ.nbRemaining() > 1) {
@@ -187,7 +187,7 @@ RenderThread::vpDuration(Frame *vp, Frame *nextvp)
}
void
-RenderThread::updateVideoPts(double pts, int64_t /*pos*/, int serial)
+RenderThread::updateVideoPts(double pts, int serial)
{
// update current video pts
m_vs->vidClk.set(pts, serial);
diff --git a/src/videoplayer/backend/renderthread.h b/src/videoplayer/backend/renderthread.h
index 80fc66d4..7768886e 100644
--- a/src/videoplayer/backend/renderthread.h
+++ b/src/videoplayer/backend/renderthread.h
@@ -33,7 +33,7 @@ private:
void videoRefresh(double *remainingTime);
void videoDisplay();
double vpDuration(Frame *vp, Frame *nextvp);
- void updateVideoPts(double pts, int64_t pos, int serial);
+ void updateVideoPts(double pts, int serial);
double computeTargetDelay(double delay);
void updateSampleDisplay(short *samples, int samplesSize);
void toggleAudioDisplay();
--
2.46.0

View File

@ -0,0 +1,93 @@
From 91b414a778cfc8fcee55f72352043aade2582627 Mon Sep 17 00:00:00 2001
From: Mladen Milinkovic <maxrd2@smoothware.net>
Date: Thu, 1 Aug 2024 10:46:54 +0200
Subject: [PATCH 04/11] VideoPlayer: stop using AVFrame.pkt_pos
This field is ad-hoc and will be deprecated. Use the recently-added
AV_CODEC_FLAG_COPY_OPAQUE to pass arbitrary user data from packets to
frames.
---
src/videoplayer/backend/audiodecoder.cpp | 4 +++-
src/videoplayer/backend/decoder.cpp | 17 +++++++++++++----
src/videoplayer/backend/decoder.h | 4 ++++
src/videoplayer/backend/videodecoder.cpp | 4 +++-
4 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/src/videoplayer/backend/audiodecoder.cpp b/src/videoplayer/backend/audiodecoder.cpp
index 8c0b943e..35144965 100644
--- a/src/videoplayer/backend/audiodecoder.cpp
+++ b/src/videoplayer/backend/audiodecoder.cpp
@@ -490,8 +490,10 @@ AudioDecoder::run()
if(!(af->frame = av_frame_alloc()))
break;
+ Decoder::FrameData *fd = reinterpret_cast<Decoder::FrameData*>(frame->opaque_ref ? frame->opaque_ref->data : nullptr);
+
af->pts = frame->pts == AV_NOPTS_VALUE ? NAN : double(frame->pts) / frame->sample_rate;
- af->pos = frame->pkt_pos;
+ af->pos = fd ? fd->pkt_pos : -1;
af->serial = m_pktSerial;
af->duration = double(frame->nb_samples) / frame->sample_rate;
diff --git a/src/videoplayer/backend/decoder.cpp b/src/videoplayer/backend/decoder.cpp
index 80fb993f..222056d0 100644
--- a/src/videoplayer/backend/decoder.cpp
+++ b/src/videoplayer/backend/decoder.cpp
@@ -133,10 +133,19 @@ Decoder::decodeFrame(AVFrame *frame, AVSubtitle *sub)
} else {
ret = pkt->data ? AVERROR(EAGAIN) : AVERROR_EOF;
}
- } else if(avcodec_send_packet(m_avCtx, pkt) == AVERROR(EAGAIN)) {
- av_log(m_avCtx, AV_LOG_ERROR, "Receive_frame and send_packet both returned EAGAIN, which is an API violation.\n");
- m_pkt = pkt;
- pkt = nullptr;
+ } else {
+ if(pkt->buf && !pkt->opaque_ref) {
+ pkt->opaque_ref = av_buffer_allocz(sizeof(Decoder::FrameData));
+ if(!pkt->opaque_ref)
+ return AVERROR(ENOMEM);
+ Decoder::FrameData *fd = reinterpret_cast<Decoder::FrameData*>(pkt->opaque_ref->data);
+ fd->pkt_pos = pkt->pos;
+ }
+ if(avcodec_send_packet(m_avCtx, pkt) == AVERROR(EAGAIN)) {
+ av_log(m_avCtx, AV_LOG_ERROR, "Receive_frame and send_packet both returned EAGAIN, which is an API violation.\n");
+ m_pkt = pkt;
+ pkt = nullptr;
+ }
}
av_packet_free(&pkt);
}
diff --git a/src/videoplayer/backend/decoder.h b/src/videoplayer/backend/decoder.h
index 55970668..f4dd8c7e 100644
--- a/src/videoplayer/backend/decoder.h
+++ b/src/videoplayer/backend/decoder.h
@@ -55,6 +55,10 @@ protected:
AVRational m_startPtsTb;
int64_t m_nextPts;
AVRational m_nextPtsTb;
+
+ struct FrameData {
+ int64_t pkt_pos;
+ };
};
}
diff --git a/src/videoplayer/backend/videodecoder.cpp b/src/videoplayer/backend/videodecoder.cpp
index 851f6268..d5bd111e 100644
--- a/src/videoplayer/backend/videodecoder.cpp
+++ b/src/videoplayer/backend/videodecoder.cpp
@@ -101,8 +101,10 @@ VideoDecoder::run()
if(!ret)
continue;
+ Decoder::FrameData *fd = reinterpret_cast<Decoder::FrameData*>(frame->opaque_ref ? frame->opaque_ref->data : nullptr);
+
double pts = (frame->pts == AV_NOPTS_VALUE) ? NAN : frame->pts * m_timeBase;
- ret = queuePicture(frame, pts, frameDuration, frame->pkt_pos, pktSerial());
+ ret = queuePicture(frame, pts, frameDuration, fd ? fd->pkt_pos : -1, pktSerial());
av_frame_unref(frame);
if(ret < 0)
--
2.46.0

View File

@ -0,0 +1,30 @@
From 6de245940eea868762021c5ba7ee4c621404feeb Mon Sep 17 00:00:00 2001
From: Mladen Milinkovic <maxrd2@smoothware.net>
Date: Thu, 4 Jul 2024 01:54:10 +0200
Subject: [PATCH 05/11] VideoPlayer: remove usage of internal
AVInputFormat.read_seek field
It's an internal field, so it should not be touched.
---
src/videoplayer/backend/streamdemuxer.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/videoplayer/backend/streamdemuxer.cpp b/src/videoplayer/backend/streamdemuxer.cpp
index 3fb7476f..9c949fa8 100644
--- a/src/videoplayer/backend/streamdemuxer.cpp
+++ b/src/videoplayer/backend/streamdemuxer.cpp
@@ -314,10 +314,8 @@ StreamDemuxer::componentOpen(int streamIndex)
m_vs->audStream = ic->streams[streamIndex];
m_vs->audDec.init(avCtx, &m_vs->audPQ, nullptr, m_vs->continueReadThread);
- if((m_vs->fmtContext->iformat->flags & (AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK))
- && !m_vs->fmtContext->iformat->read_seek) {
+ if(m_vs->fmtContext->iformat->flags & AVFMT_NOTIMESTAMPS)
m_vs->audDec.startPts(m_vs->audStream->start_time, m_vs->audStream->time_base);
- }
m_vs->audDec.start();
m_vs->audDec.pause();
break;
--
2.46.0

View File

@ -0,0 +1,27 @@
From 616d5d60572ba57fad45aa139a99eb6a43a73c5f Mon Sep 17 00:00:00 2001
From: Mladen Milinkovic <maxrd2@smoothware.net>
Date: Thu, 1 Aug 2024 10:56:02 +0200
Subject: [PATCH 06/11] VideoPlayer: stop injecting stream side data in packets
This is no longer needed as the side data is available for decoders in the
AVCodecContext.
---
src/videoplayer/backend/streamdemuxer.cpp | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/videoplayer/backend/streamdemuxer.cpp b/src/videoplayer/backend/streamdemuxer.cpp
index 9c949fa8..eda2b267 100644
--- a/src/videoplayer/backend/streamdemuxer.cpp
+++ b/src/videoplayer/backend/streamdemuxer.cpp
@@ -501,8 +501,6 @@ StreamDemuxer::run()
if(m_vs->genpts)
ic->flags |= AVFMT_FLAG_GENPTS;
- av_format_inject_global_side_data(ic);
-
{ // find_stream_info
const int origNbStreams = ic->nb_streams;
AVDictionary **opts = (AVDictionary **)av_calloc(origNbStreams, sizeof(*opts));
--
2.46.0

View File

@ -0,0 +1,31 @@
From 5ad0c6046828f842650de39438afa276902e1c94 Mon Sep 17 00:00:00 2001
From: Mladen Milinkovic <maxrd2@smoothware.net>
Date: Thu, 1 Aug 2024 10:18:38 +0200
Subject: [PATCH 07/11] VideoPlayer: check return of swr_alloc_set_opts2()
This probably makes no difference but its more correct
---
src/videoplayer/backend/audiodecoder.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/videoplayer/backend/audiodecoder.cpp b/src/videoplayer/backend/audiodecoder.cpp
index 35144965..d4675a52 100644
--- a/src/videoplayer/backend/audiodecoder.cpp
+++ b/src/videoplayer/backend/audiodecoder.cpp
@@ -371,11 +371,11 @@ AudioDecoder::decodeFrame(Frame *af)
|| af->frame->sample_rate != m_fmtSrc.freq
|| (wantedNbSamples != af->frame->nb_samples && !m_swrCtx)) {
swr_free(&m_swrCtx);
- swr_alloc_set_opts2(&m_swrCtx,
+ int ret = swr_alloc_set_opts2(&m_swrCtx,
&m_fmtTgt.chLayout, m_fmtTgt.fmt, m_fmtTgt.freq,
&af->frame->ch_layout, AVSampleFormat(af->frame->format), af->frame->sample_rate,
0, nullptr);
- if(!m_swrCtx || swr_init(m_swrCtx) < 0) {
+ if(ret < 0 || !m_swrCtx || swr_init(m_swrCtx) < 0) {
av_log(nullptr, AV_LOG_ERROR,
"Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n",
af->frame->sample_rate, av_get_sample_fmt_name((AVSampleFormat)af->frame->format),
--
2.46.0

View File

@ -0,0 +1,28 @@
From 7959dcc03a3943f551b21bbfeba97e8ae1e3814a Mon Sep 17 00:00:00 2001
From: Mladen Milinkovic <maxrd2@smoothware.net>
Date: Thu, 1 Aug 2024 10:51:08 +0200
Subject: [PATCH 08/11] StreamProcessor: stop using pkt_duration
Fixes compilation with FFmpeg6
---
src/streamprocessor/streamprocessor.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/streamprocessor/streamprocessor.cpp b/src/streamprocessor/streamprocessor.cpp
index aa27a66e..b30c9631 100644
--- a/src/streamprocessor/streamprocessor.cpp
+++ b/src/streamprocessor/streamprocessor.cpp
@@ -447,8 +447,8 @@ StreamProcessor::processAudio()
timeFrameDuration = frameResampled->nb_samples * 1000 / frameResampled->sample_rate;
} else {
frameSize = frame->nb_samples * av_get_bytes_per_sample(static_cast<AVSampleFormat>(frame->format));
- if(frame->pkt_duration)
- timeFrameDuration = frame->pkt_duration * 1000 * m_avStream->time_base.num / m_avStream->time_base.den;
+ if(frame->duration)
+ timeFrameDuration = frame->duration * 1000 * m_avStream->time_base.num / m_avStream->time_base.den;
}
timeFrameEnd = timeFrameStart + timeFrameDuration;
--
2.46.0

View File

@ -0,0 +1,28 @@
From 1e8f6320e8bb914c5dce50a90c8ae290bb5d9919 Mon Sep 17 00:00:00 2001
From: Mladen Milinkovic <maxrd2@smoothware.net>
Date: Thu, 1 Aug 2024 11:27:22 +0200
Subject: [PATCH 09/11] StreamProcessor: stop using AVFrame::duration
Calculate duration as duration field might be unknown, and
duration/pkt_duration do not exist on FFmpeg 5/6
---
src/streamprocessor/streamprocessor.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/streamprocessor/streamprocessor.cpp b/src/streamprocessor/streamprocessor.cpp
index b30c9631..f27fa667 100644
--- a/src/streamprocessor/streamprocessor.cpp
+++ b/src/streamprocessor/streamprocessor.cpp
@@ -447,8 +447,7 @@ StreamProcessor::processAudio()
timeFrameDuration = frameResampled->nb_samples * 1000 / frameResampled->sample_rate;
} else {
frameSize = frame->nb_samples * av_get_bytes_per_sample(static_cast<AVSampleFormat>(frame->format));
- if(frame->duration)
- timeFrameDuration = frame->duration * 1000 * m_avStream->time_base.num / m_avStream->time_base.den;
+ timeFrameDuration = int64_t(frame->nb_samples) * 1000 / frame->sample_rate;
}
timeFrameEnd = timeFrameStart + timeFrameDuration;
--
2.46.0

View File

@ -0,0 +1,25 @@
From 98a77fc69fc62b857054f3b1cdbb7a8a03e2ae36 Mon Sep 17 00:00:00 2001
From: Mladen Milinkovic <maxrd2@smoothware.net>
Date: Thu, 1 Aug 2024 11:32:04 +0200
Subject: [PATCH 10/11] Require FFmpeg >= 5.1.5
---
src/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index bacf025f..5fd2a09c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -33,7 +33,7 @@ if(APPIMAGE)
set(SC_APPIMAGE 1 CACHE INTERNAL EXPORTEDVARIABLE)
endif()
-find_package(FFmpeg 57.83.100 REQUIRED)
+find_package(FFmpeg 59.27.100 REQUIRED)
find_package(OpenAL REQUIRED)
find_package(ICU)
--
2.46.0

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:23c022768d7422c092149f41d51ebea80f54b27655573cf43f736efb88c30027
size 763276

View File

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEdveQB6VKS2jxVHko4kGHRu+dmyYFAmZnWHQACgkQ4kGHRu+d
myb0FRAAoPOW2UTpjPVwFTpHSWRXU6kF8mybG/jadN0xAlBDS2AZu1tKW221GJl+
F6/gpQoV2NYzLaTpn3zK4D/z9Ojunb2H9XDK0lGCqJ1e+BgcktVcjEa4P7Wdy8Wj
D+T5tCqUTo7pmUCbE//QTuT4SChZjg2rpRPBVAqHnYWBcZ3BAXCC6Fnkvq94/LWP
mnZQyqMhbIoVSLIp15eBLgcTKXE/yjHutxIkaAcaMZO6+c7afI+eCF3qz8JrT9nc
RO2a36a3jcJI3mH3o6ub2eZHnUXOEQ3ve3k5lUITp0J1UYqEuuFYOhdIfUEGqJSp
g2sbz66Jo9lkQq+oKiy9a2/2PitpCKGUIv4wcS31rmErmmacBhcax9h+qHpSexxp
6M3yqKDEAKg/rrlKWOHlZrBNvmsGuCYwLT1bULnIZv5b9h1oqDzE3cU6WEMKl1wO
/rT5ELCuYizkJZuXv2zn4T68Gm+d8vdM9ewqf/JvMfj0Hv36phE7Fuf6G5KVMSCM
jiytkJakJi52PXaRK//4KldDVFdQAQr7cxpuOaZ7DiRjzHa/uEmsKM9kL5BChkQw
4G5eVq2lWv1vU7h8M6B/ZH/3OGdQM9IGhoAzAUIOvn1gYJ/ZZMofDthuamJ44Tq0
ulNAb4TUk1vJGrPcETaDo5a1qihvHjEK+nDtymHUskOU/7DqOT4=
=fgNS
-----END PGP SIGNATURE-----

477
subtitlecomposer.changes Normal file
View File

@ -0,0 +1,477 @@
-------------------------------------------------------------------
Wed Dec 18 18:57:02 UTC 2024 - Antonio Larrosa <alarrosa@suse.com>
- Add patch to fix build with pocketsphinx 5.0.3 in TW since
the API changed in the 5.0.0 release. Also, removed some
parameters that don't seem to be configurable by pocketsphinx
anymore:
* use-pocketsphinx-5.0.0-api.patch
-------------------------------------------------------------------
Tue Aug 20 07:14:06 UTC 2024 - Christophe Marin <christophe@krop.fr>
- Add upstream changes:
* 0001-Replaced-deprecated-FFmpeg-channel-layout-code.patch
* 0002-VideoPlayer-check-AVFMT_NO_BYTE_SEEK-flag-for-seek_b.patch
* 0003-VideoPlayer-drop-an-unused-function-argument.patch
* 0004-VideoPlayer-stop-using-AVFrame.pkt_pos.patch
* 0005-VideoPlayer-remove-usage-of-internal-AVInputFormat.r.patch
* 0006-VideoPlayer-stop-injecting-stream-side-data-in-packe.patch
* 0007-VideoPlayer-check-return-of-swr_alloc_set_opts2.patch
* 0008-StreamProcessor-stop-using-pkt_duration.patch
* 0009-StreamProcessor-stop-using-AVFrame-duration.patch
* 0010-Require-FFmpeg-5.1.5.patch
-------------------------------------------------------------------
Tue Jun 11 12:19:54 UTC 2024 - Luigi Baldoni <aloisio@gmx.com>
- Update to version 0.8.1
* Fixed (rare) memory issues and crashes
* Fixed crashes on waveform widget
* Fixed video player rendering in Qt 6.7
* Fixed scripts manager assert failures
* Fixed inability to view non-script files in scripts manager
* Fixed seeking in some media formats
* Fixed video player subtitle rendering
* Fixed broken rendering on hi-res videos
* Fixed HDR video rendering (SMPTE-ST-2084 gamma transfer)
* Added check for maximum number of characters per line
* Added MinT translate engine
* Improved translation support and UI
* Improved video player scaling
* Dropped KIO file operations
- Drop 0001-Increased-required-std-to-C-17-100.patch (merged
upstream)
-------------------------------------------------------------------
Mon May 27 19:56:20 UTC 2024 - Christophe Marin <christophe@krop.fr>
- Add upstream build fix:
* 0001-Increased-required-std-to-C-17-100.patch
-------------------------------------------------------------------
Mon Nov 6 17:44:47 UTC 2023 - Luigi Baldoni <aloisio@gmx.com>
- Update to version 0.8.0
* Fixed video player on GLES only hardware
* Fixed skewed video on video player
* Fixed closing fullscreen video player
* Fixed subtitles under fullscreen video toolbar
* Fixed video player media state notifications
* Fixed subtitle video overlay font size accuracy
* Fixed deadlock/crash while changing audio stream on
paused/stopped media
* Improved Waveform widget performance
* Fixed waveform misalignment due to rounding error
* Fixed waveform widget drawing on null image and painting of
removed lines
* Fixed waveform default zoom scale
* Fixed subtitle text line separator draw on LinesWidget
* Fixed unbreak lines (newline searches in QTextDocument)
* Fixed crash in split lines
* Fixed VobSub import ignoring Text styles
* Fixed VobSub crash when moving to previous image
* Fixed YouTubeCaptions format parsing/saving
* Fixed undo/redo actions creation order, incorrect state
* Fixed some memory and saving issues
* Fixed embedded ASS decoding
* Fixed example remove hearing impaired script
* Fixed broken about dialog
* Added Qt6 support
* Added WebVTT format support
* Added subtitle positioning UI and support
* Added subtitle class/comments/voice UI and support
* Improved rich text editing/preview
* Rich text rendering on waveform/video/editors
* Added DeepL translate engine
* Added Google Cloud translate engine
* Recreated translation interface
* Added/improved ffmpeg 5 support
* Subtitle lines are always time sorted; remove sort lines
menu action
* Replaced Kross with QJSEngine, removed ruby and python
support
* Improved script manager and tools menu
- Drop subtitlecomposer-ARM_GLES.patch,
subtitlecomposer-fix_empty_lines_crash.patch,
0001-Fix-compilation-with-ffmpeg5-63.patch,
0001-VideoPlayer-Fix-usage-of-deprecated-removed-AVCodec-.patch,
and 0001-Use-non-deprecated-ffmpeg-api.patch (merged upstream)
-------------------------------------------------------------------
Tue May 9 08:28:01 UTC 2023 - Christophe Marin <christophe@krop.fr>
- Add patch:
* 0001-Use-non-deprecated-ffmpeg-api.patch
- Rename 4f4f560e40ba0b760cf688eb024be3cc734ca347.patch to
0001-Fix-compilation-with-ffmpeg5-63.patch
- Rename d8f9797d9c0d45fa9f4402f79c539544b74d2cc7.patch to
0001-VideoPlayer-Fix-usage-of-deprecated-removed-AVCodec-.patch
-------------------------------------------------------------------
Sun Apr 16 09:14:38 UTC 2023 - Benoît Monin <benoit.monin@gmx.fr>
- Add d8f9797d9c0d45fa9f4402f79c539544b74d2cc7.patch: Fix video
player with newer version of ffmpeg
-------------------------------------------------------------------
Tue Jul 12 20:38:48 UTC 2022 - Bjørn Lie <bjorn.lie@gmail.com>
- Add 4f4f560e40ba0b760cf688eb024be3cc734ca347.patch: Fix build
with ffmpeg 5, patch from upstream git.
-------------------------------------------------------------------
Thu Nov 4 10:48:42 UTC 2021 - Luigi Baldoni <aloisio@gmx.com>
- Add subtitlecomposer-fix_empty_lines_crash.patch
(fixes boo#1192342)
-------------------------------------------------------------------
Sat Oct 16 05:19:18 UTC 2021 - Luigi Baldoni <aloisio@gmx.com>
- Add subtitlecomposer-ARM_GLES.patch
- Allow build on more targets
-------------------------------------------------------------------
Tue Oct 5 20:05:25 UTC 2021 - Luigi Baldoni <aloisio@gmx.com>
- Update to version 0.7.1
* Fixed theme/icons/look outside KDE environment
* Fixed various bugs and rare crashes
* Fixed Undo stack and improved text editing undo
* Improved/replaced Video player(s) (performance, Wayland
support, OpenGL/FFmpeg)
* Improved Waveform performance
* Improved LinesWidget/Model performance
* Improved Wayland support
* Improved open/save file dialogs to use native dialogs
* Improved text charsets/encodings/end-of-line selection,
detection and handling
* Improved VobSub support
* Improved inline editor to support text styles
* Improved subtitle style rendering
* Improved character/sec support and added coloring
* Improvide command line - ability to open all subtitle/media
files
* Added Pause/Duration columns to list view
* Removed invalid subpicture/x-pgs mime
* Updated/added many translations - thanks to KDE community
- Drop 0001-Use-a-local-qthelper.cpp-copy.patch and qthelper.hpp
(no longer necessary)
- Add .sig file and subtitlecomposer.keyring as sources
- Spec cleanup
-------------------------------------------------------------------
Thu Aug 27 16:37:02 UTC 2020 - Christophe Giboudeaux <christophe@krop.fr>
- Spec cleanup
-------------------------------------------------------------------
Sat Mar 14 11:37:30 UTC 2020 - Antonio Larrosa <alarrosa@suse.com>
- Move URL to the new upstream location at invent.kde.org
- Remove the dependency on python-base (python2) by removing the
python examples (so we don't install any python scripts anymore).
The python scripts can't be used anyway since we build
kross-interpreters without python support.
-------------------------------------------------------------------
Wed Mar 11 10:30:18 UTC 2020 - Christophe Giboudeaux <christophe@krop.fr>
- Add a local qthelper.cpp copy. mpv >= 0.33 doesn't provide this
header anymore and suggest keeping a local copy until using a
better wrapper.
- Add 0001-Use-a-local-qthelper.cpp-copy.patch
-------------------------------------------------------------------
Thu Jun 27 19:10:58 UTC 2019 - Luigi Baldoni <aloisio@gmx.com>
- Update to version 0.7.0
* Fixed parsing of absolute paths containing '#' character
* Fixed open dialogs not showing all supported files
* Fixed subtitle text not respecting system font configuration
* Fixed waveform not rendering correctly/completely on some
formats
* Fixed waveform displaying subtitles at wrong times
* Fixed waveform not working with some
* Fixes to MPV, GStreamer and Xine video player backends
* Waveform scrolling is configurable
* PocketSphinx language models and VAD are configurable
* Added show status bar action to main window popup menu
* Improved (scripting) performance
* Spell checker will use translation text when it is selected
* Waveform and video docks can be hidden
* Split lines won't split text on spaces while there are
multiple lines
* Subtitle lines will always stay sorted by their time
* Improved fullscreen video player
* Added ability to step by frame
* Added play rate controls to video menu
* Updated Croatian translation
* Updated Italian translation
* Updated Russian translation
- Dropped fix_build_with_qt5.11.patch (merged upstream)
-------------------------------------------------------------------
Tue Jun 12 17:58:02 UTC 2018 - asterios.dramis@gmail.com
- Added a patch (fix_build_with_qt5.11.patch), taken from upstream,
to fix build failure with Qt 5.11.
-------------------------------------------------------------------
Sun Feb 11 09:30:06 UTC 2018 - aloisio@gmx.com
- Update to version 0.6.6
* Fixed open video dialog filters
* Fixed "Insert Line" on waveform adding at the wrong index -
thanks @qsniyg
* Added MMB seeking on waveform - thanks @qsniyg
* Fixed some compilation issues
* Updated translations - thanks @gogogogi, @muzena
* Fixed vobsub when opening from video file and symbol cache
filename
* Fixed subtitle loading times of huge files
* Improved vobsub text detection
* Fixed ASS rich text parsing on import subtitle stream action
* Replaced buggy mplayer vobsub import code with ffmpeg
* Fixed memory leaks/usage of WaveformWidget's scroll animation
* Optimized import subtitle stream from video action
* Replaced gstreamer with ffmpeg libraries in application core
usage
* Added abort button to speech recognition
* Waveform smooth scrolling
* Added join/split lines actions to waveform context menu
* Fixed some crashes, memory leaks and overall code cleanups
* Cleaned up settings widget and texts
- Dropped subtitlecomposer-Qt56.patch (merged upstream)
- Spec cleanup
-------------------------------------------------------------------
Fri Nov 3 08:36:25 UTC 2017 - aloisio@gmx.com
- Update to version 0.6.5
add:
* Added support for binary subtitle formats
* fine control video playback speed
* controls for video playback speed
mod:
* GStreamer backend audio improvements.
* Moved open video actions under File menu
* More tolerant parsing of SubRip subtitles.
* Improved split lines command
* Updated Czech translation - thanks @goliashcz
* Updated Croatian translations - thanks @muzena
fix:
* Waveform widget dragging and speed improvements, fixed
buffer overflow
* WaveformWidget: zoom out wasn't working on movies without
audio
* Fixed cases where subtitle hide time would end up before
show time.
* Improved context menus.
* Fixed moving of anchored lines.
* Open subtitle wouldn't autoload video in some cases
* Open video now includes .divx and .webm extensions
* Tools menu scripts are filtered based on installed kross
interpreters
* Moved custom icons to more standard location, using
QIcon::fromTheme()
* Error Check > Absolute Duration config fields were changing
incorrect values.
* MPV Backend: fixed deprecated options, updated vo devices -
thanks @luzfcb
* better rendering on high DPI screens.
* MPV Backend: framerate/video length wasn't reported to
subtitle composer anymore
* detection/handling of current playing line
* Parsing text containing <font> without color attribute
* compilation without xine - thanks @pinotree
* ASS parsing - thanks @Martchus
- Added subtitlecomposer-Qt56.patch to be able to build against
Qt 5.6 on Leap
-------------------------------------------------------------------
Tue Jun 13 13:30:08 UTC 2017 - jengelh@inai.de
- Reword vague description.
-------------------------------------------------------------------
Mon Oct 31 19:06:55 UTC 2016 - asterios.dramis@gmail.com
- Update directories not owned by package to cover also
Factory/Tumbleweed.
-------------------------------------------------------------------
Thu Jun 23 20:03:40 UTC 2016 - asterios.dramis@gmail.com
- Update to 0.6.4:
* ADD: WaveformWidget: context menu
* MOD: Updated German translations - thanks @Martchus
* MOD: Updated Croatian translations - thanks @muzena
* FIX: Inserting subtitle line would corrupt subtitle indexes
* FIX: Display audio of WebM/FLV files in waveform - thanks
@Martchus
From 0.6.3:
* ADD: WaveformWidget: customization settings page
* ADD: Speech recognition with PocketSphinx
* MOD: Waveform and Player widgets can be docked to any side of
the main window
* MOD: WaveformWidget: can be manually scrolled even if
autoscroll is enabled
* MOD: WaveformWidget: ability to drag whole subtitle line
* MOD: Updated croatian translation - thanks @muzena
* FIX: Video player fullscreen and icon display under was not
right under some desktop environments - thanks @Martchus
* FIX: WaveformWidget: when dragging subtitle borders (or
clicking near them), show/hide time was jumping to mouse
position
* FIX: po/Messages.sh will generate .po files compatible with Qt
Linguist, and will run from any path
* FIX: Build cleanups - thanks @pinotree
From 0.6.2:
* ADD: Ability to demux text streams from loaded video
* MOD: WaveformWidget: added scrollbar and manual scrolling mode,
improved zoom, widget state is loaded/saved
* MOD: WaveformWidget: double click will seek in video player
* MOD: WaveformWidget: subtitle show/hide time can be dragged
* MOD: Added default shortcut for play/pause video.
* MOD: Support for building with cmake older version than 3.3
* FIX: Changing player backend setting will reopen loaded video
in new player backend.
* FIX: Timeline after last anchored subtitle was scaled
incorrectly.
* FIX: WaveformWidget: optimizations and speed improvements
* FIX: Recent files list was not saved properly in some cases
(subtitle list full).
* FIX: WaveformWidget: fixed crash after closing subtitle
* FIX: WaveformWidget: editing of non-anchored lines is not
allowed
* FIX: StreamProcessor was not freeing it's resources.
* FIX: Updated configure and install scripts
* FIX: Removed "Decoder backend" entry from video player settings
page.
From 0.6.1:
* FIX: Anchor points syncing wasn't working right in some cases
From 0.6.0:
* ADD: Anchor points syncing
* ADD: Waveform widget.
* MOD: Improved precision of the Time class.
* MOD: GStreamerPlayerBackend will pause when reaching
end-of-stream instead of stopping/resetting player.
* MOD: Converted playerbackends to plugins
* MOD: updated German translation
* FIX: Video player widget will repaint background correctly.
* FIX: Code refactoring, cleanups and optimizations.
* FIX: fixed/enabled Drag & Drop
From 0.5.9:
* FIX: Improved error reporting during video open.
* MOD: Added italian translation.
From 0.5.8:
* ADD: MPV player support
* MOD: Replaced remaining KDE4 deprecated code, removed
KDELibs4Support dependency. Finalized KF5 porting.
* MOD: Update croatian translation and README.md
* MOD: Added option not to resume playback after subtitle
doubleclick if player is paused
* FIX: Gettext translations were not created during build
process.
* FIX: FindGStreamer.cmake was not searching for and including
arch-specific include dir
* FIX: Errors/Spelling in "Error Check" settings
* FIX: Build process fixes
* FIX: improved player/decoder backends, solved crashes when
switching backends
* FIX: Added option to antialias subtitles
* FIX: Phonon player backend was displaying embeded subtitles
* FIX: OBS (OpenSuse) package creation was failing
- Updated build/runtime requirements to KF5/Qt5.
- Added new build requirement mpv-devel.
- Removed fdupes macro (not needed anymore).
- Removed NULL-pointer.patch and
Find-platform-dependant-include-files-of-GStreamer.patch (fixed
upstream).
-------------------------------------------------------------------
Sun Jan 3 17:57:44 UTC 2016 - asterios.dramis@gmail.com
- Added Find-platform-dependant-include-files-of-GStreamer.patch in
order to fix finding of platform-dependant include files of
GStreamer (fixes compilation failure).
-------------------------------------------------------------------
Sun Nov 16 23:30:51 UTC 2014 - hrvoje.senjan@gmail.com
- Update to 0.5.7
* GStreamer 1.0 API support
- Switch BuildRequires to reflect above change
- Added NULL-pointer.patch from upstream, to resolve post-buid-check
failure
-------------------------------------------------------------------
Wed Dec 4 20:34:36 UTC 2013 - asterios.dramis@gmail.com
- Update to 0.5.6
# Continuation of original package since initial author stopped development
* SubStation Alpha format fixes and color support
* source cleanup
From 0.5.5:
* text color support
* SubRip text color support
* reworked MicroDVD open/save
From 0.5.4:
* mplayer2 support
* mplayer VDPAU decoding support
* minor cmake build fixes
- Added libicu-devel build requirement.
- Removed all previous patches (fixed upstream).
-------------------------------------------------------------------
Sun Jan 29 15:08:50 UTC 2012 - asterios.dramis@gmail.com
- Updated no-copy-dt-needed-entries.patch to fix a new linking error with
libX11.
-------------------------------------------------------------------
Mon Dec 5 21:47:07 UTC 2011 - asterios.dramis@gmail.com
- Added a patch (no-copy-dt-needed-entries.patch) to fix linking with
--no-copy-dt-needed-entries.
- Spec file updates:
* Changes based on spec-cleaner run.
* Changed License: to GPL-2.0+ (SPDX style).
-------------------------------------------------------------------
Thu Jun 2 18:40:29 UTC 2011 - asterios.dramis@gmail.com
- Spec file updates:
* Recommend instead of Suggest the subtitlecomposer-lang package.
* Added update-mime-database in %post/%postun scripts for the mime file
installed by the package.
* Minor other updates.
-------------------------------------------------------------------
Tue Jan 18 18:17:00 UTC 2011 - asterios.dramis@gmail.com
- Spec file updates:
* Added a subtitlecomposer-lang package.
* Changes based on rpmdevtools templates and spec-cleaner run.
* Updates in Buildrequires:, %prep and %install sections.
* Fixed rpmlint warnings (devel-file-in-non-devel-package,
non-executable-script).
* Fixed rpm post build check about directoriesnotownedbyapackage.
- Add a patch to fix installation of python scripting examples.
-------------------------------------------------------------------
Thu Jun 24 08:17:49 UTC 2010 - cmorve69@yahoo.es
- Fix compilation with GCC 4.5
-------------------------------------------------------------------
Sun Jul 5 01:35:46 CEST 2009 - cmorve69@yahoo.es
- First version

52
subtitlecomposer.keyring Normal file
View File

@ -0,0 +1,52 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
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
wnFHTqh0Ix5Y2oHbqs4xpTQ=
=K8XE
-----END PGP PUBLIC KEY BLOCK-----

127
subtitlecomposer.spec Normal file
View File

@ -0,0 +1,127 @@
#
# spec file for package subtitlecomposer
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: subtitlecomposer
Version: 0.8.1
Release: 0
Summary: A text-based subtitle editor
License: GPL-2.0-or-later
Group: Productivity/Multimedia/Video/Editors and Convertors
URL: https://invent.kde.org/multimedia/subtitlecomposer
Source0: https://download.kde.org/stable/subtitlecomposer/%{name}-%{version}.tar.xz
Source1: https://download.kde.org/stable/subtitlecomposer/%{name}-%{version}.tar.xz.sig
Source2: subtitlecomposer.keyring
# PATCH-FIX-UPSTREAM refreshment of ffmpeg related code
Patch0: 0001-Replaced-deprecated-FFmpeg-channel-layout-code.patch
Patch1: 0002-VideoPlayer-check-AVFMT_NO_BYTE_SEEK-flag-for-seek_b.patch
Patch2: 0003-VideoPlayer-drop-an-unused-function-argument.patch
Patch3: 0004-VideoPlayer-stop-using-AVFrame.pkt_pos.patch
Patch4: 0005-VideoPlayer-remove-usage-of-internal-AVInputFormat.r.patch
Patch5: 0006-VideoPlayer-stop-injecting-stream-side-data-in-packe.patch
Patch6: 0007-VideoPlayer-check-return-of-swr_alloc_set_opts2.patch
Patch7: 0008-StreamProcessor-stop-using-pkt_duration.patch
Patch8: 0009-StreamProcessor-stop-using-AVFrame-duration.patch
Patch9: 0010-Require-FFmpeg-5.1.5.patch
# PATCH-FIX-UPSTREAM https://invent.kde.org/multimedia/subtitlecomposer/-/merge_requests/48
Patch10: use-pocketsphinx-5.0.0-api.patch
BuildRequires: cmake >= 3.10
BuildRequires: extra-cmake-modules
BuildRequires: libQt5Widgets-private-headers-devel
BuildRequires: pkgconfig
BuildRequires: update-desktop-files
BuildRequires: cmake(KF5Auth)
BuildRequires: cmake(KF5Codecs)
BuildRequires: cmake(KF5Config)
BuildRequires: cmake(KF5ConfigWidgets)
BuildRequires: cmake(KF5CoreAddons)
BuildRequires: cmake(KF5I18n)
BuildRequires: cmake(KF5KIO)
BuildRequires: cmake(KF5Kross)
BuildRequires: cmake(KF5Sonnet)
BuildRequires: cmake(KF5TextWidgets)
BuildRequires: cmake(KF5WidgetsAddons)
BuildRequires: cmake(KF5XmlGui)
BuildRequires: cmake(Qt5Core)
BuildRequires: cmake(Qt5Gui)
BuildRequires: cmake(Qt5Qml)
BuildRequires: cmake(Qt5Test)
BuildRequires: cmake(Qt5Widgets)
BuildRequires: pkgconfig(icu-i18n)
BuildRequires: pkgconfig(icu-uc)
BuildRequires: pkgconfig(libavcodec)
BuildRequires: pkgconfig(libavformat) >= 59.27.100
BuildRequires: pkgconfig(libavutil)
BuildRequires: pkgconfig(libswscale)
BuildRequires: pkgconfig(openal)
BuildRequires: pkgconfig(openssl)
%if 0%{?suse_version} > 1500
%ifnarch ppc64 s390x
BuildRequires: pkgconfig(pocketsphinx) >= 5
%endif
%endif
%description
A text-based subtitles editor that supports basic operations. It supports
SubRip (SRT), MicroDVD, SSA/ASS, MPlayer, TMPlayer and YouTube captions, and
has speech Recognition using PocketSphinx.
%lang_package
%prep
%autosetup -p1
%build
%cmake_kf5 -d build
%cmake_build
%install
%kf5_makeinstall -C build
# Fix rpmlint error (devel-file-in-non-devel-package) and install header files as doc (since they are installed just for help)
mkdir files_for_doc
cp -a %{buildroot}%{_kf5_appsdir}/%{name}/scripts/api/ files_for_doc/
rm -r %{buildroot}%{_kf5_appsdir}/%{name}/scripts/api/
# Point to the correct path of the header files directory (doc)
perl -pi -e "s|'api'|'%{_docdir}/subtitlecomposer/api'|" %{buildroot}%{_kf5_appsdir}/%{name}/scripts/README
%find_lang %{name}
%{kf5_post_install}
%files
%doc ChangeLog README.md files_for_doc/api
%license LICENSE
%config(noreplace) %{_kf5_configdir}/%{name}rc
%dir %{_kf5_iconsdir}/hicolor/256x256
%dir %{_kf5_iconsdir}/hicolor/256x256/apps
%{_kf5_applicationsdir}/org.kde.%{name}.desktop
%{_kf5_appsdir}/%{name}/
%{_kf5_appstreamdir}/org.kde.%{name}.appdata.xml
%{_kf5_bindir}/%{name}
%{_kf5_iconsdir}/hicolor/*/*/*
%{_kf5_sharedir}/mime/packages/%{name}.xml
%if 0%{?suse_version} > 1500
%ifnarch ppc64 s390x
%{_kf5_libdir}/%{name}/
%endif
%endif
%files lang -f %{name}.lang
%changelog

View File

@ -0,0 +1,120 @@
From: Antonio Larrosa <alarrosa@suse.com>
Subject: Use the pocketsphinx 5.0.0 api
This uses the new pocketsphinx 5.0.0 api and stops using the vad_* parameters
that don't seem to be available in pocketsphinx anymore. Thus, I also removed
the section to set those parameters in the config dialog.
Index: subtitlecomposer-0.8.1/src/speechplugins/pocketsphinx/pocketsphinxplugin.cpp
===================================================================
--- subtitlecomposer-0.8.1.orig/src/speechplugins/pocketsphinx/pocketsphinxplugin.cpp
+++ subtitlecomposer-0.8.1/src/speechplugins/pocketsphinx/pocketsphinxplugin.cpp
@@ -40,6 +40,12 @@ PocketSphinxPlugin::waveFormat() const
/*virtual*/ bool
PocketSphinxPlugin::init()
{
+#ifdef HAS_POCKETSPHINX_5_0_0
+ m_psConfig = ps_config_init(ps_args());
+ ps_config_set_str(m_psConfig, "hmm", QUrl(PocketSphinxConfig::acousticModelPath()).toLocalFile().toUtf8().constData());
+ ps_config_set_str(m_psConfig, "lm", QUrl(PocketSphinxConfig::trigramModelFile()).toLocalFile().toUtf8().constData());
+ ps_config_set_str(m_psConfig, "dict", QUrl(PocketSphinxConfig::lexiconFile()).toLocalFile().toUtf8().constData());
+#else
m_psConfig = cmd_ln_init(nullptr, ps_args(), true,
"-hmm", QUrl(PocketSphinxConfig::acousticModelPath()).toLocalFile().toUtf8().constData(),
"-lm", QUrl(PocketSphinxConfig::trigramModelFile()).toLocalFile().toUtf8().constData(),
@@ -55,6 +61,7 @@ PocketSphinxPlugin::init()
// Log-ratio between signal level and noise level. (pocketsphinx default: 2.0)
"-vad_threshold", QByteArray::number(PocketSphinxConfig::vadTreshold()).constData(),
nullptr);
+#endif
if(m_psConfig == nullptr) {
qWarning() << "Failed to create PocketSphinx config object";
return false;
@@ -66,7 +73,12 @@ PocketSphinxPlugin::init()
return false;
}
+
+#ifdef HAS_POCKETSPHINX_5_0_0
+ m_psFrameRate = ps_config_int(m_psConfig, "frate");
+#else
m_psFrameRate = cmd_ln_int32_r(m_psConfig, "-frate");
+#endif
m_lineText.clear();
m_lineIn = m_lineOut = 0;
@@ -85,7 +97,11 @@ PocketSphinxPlugin::cleanup()
m_psDecoder = nullptr;
}
if(m_psConfig != nullptr) {
+#ifdef HAS_POCKETSPHINX_5_0_0
+ ps_config_free(m_psConfig);
+#else
cmd_ln_free_r(m_psConfig);
+#endif
m_psConfig = nullptr;
}
}
Index: subtitlecomposer-0.8.1/src/speechplugins/pocketsphinx/CMakeLists.txt
===================================================================
--- subtitlecomposer-0.8.1.orig/src/speechplugins/pocketsphinx/CMakeLists.txt
+++ subtitlecomposer-0.8.1/src/speechplugins/pocketsphinx/CMakeLists.txt
@@ -8,8 +8,9 @@ set(CMAKE_REQUIRED_INCLUDES ${POCKETSPHI
set(CMAKE_REQUIRED_LIBRARIES ${POCKETSPHINX_LIBRARIES})
check_cxx_source_compiles("#include <pocketsphinx.h>\nint main(){ ps_seg_iter(nullptr); return 0; }" PocketSphinx_NEW_ps_seg_iter)
check_cxx_source_compiles("#include <pocketsphinx.h>\nint main(){ cmd_ln_free_r(nullptr); return 0; }" PocketSphinx_OK_prealpha5)
+check_cxx_source_compiles("#include <pocketsphinx.h>\nint main(){ ps_config_init(nullptr); return 0; }" PocketSphinx_5_0_0_api)
-if(NOT PocketSphinx_OK_prealpha5)
+if(NOT PocketSphinx_OK_prealpha5 AND NOT PocketSphinx_5_0_0_api)
message(STATUS "Have found BROKEN PocketSphinx 5 - Speech plugin will not be built")
return()
endif()
@@ -47,3 +48,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DI
if(PocketSphinx_NEW_ps_seg_iter)
target_compile_definitions(pocketsphinxasr PRIVATE HAS_NEW_PS_SEG_ITER=1)
endif()
+
+if(PocketSphinx_5_0_0_api)
+ target_compile_definitions(pocketsphinxasr PRIVATE HAS_POCKETSPHINX_5_0_0=1)
+endif()
Index: subtitlecomposer-0.8.1/src/speechplugins/pocketsphinx/pocketsphinxconfigwidget.cpp
===================================================================
--- subtitlecomposer-0.8.1.orig/src/speechplugins/pocketsphinx/pocketsphinxconfigwidget.cpp
+++ subtitlecomposer-0.8.1/src/speechplugins/pocketsphinx/pocketsphinxconfigwidget.cpp
@@ -28,6 +28,9 @@ PocketSphinxConfigWidget::PocketSphinxCo
kcfg_lexiconFile->setFilter(QLatin1String("*.dict *.dic|") + i18n("Sphinx Dictionaries") + QLatin1String("\n*|") + i18n("All Files"));
kcfg_trigramModelFile->setFilter(QStringLiteral("*.lm.bin *.lm|") + i18n("Trigram Models") + QLatin1String("\n*|") + i18n("All Files"));
#endif
+#if HAS_POCKETSPHINX_5_0_0
+ grpVAD->hide();
+#endif
}
PocketSphinxConfigWidget::~PocketSphinxConfigWidget()
Index: subtitlecomposer-0.8.1/src/speechplugins/pocketsphinx/pocketsphinxplugin.h
===================================================================
--- subtitlecomposer-0.8.1.orig/src/speechplugins/pocketsphinx/pocketsphinxplugin.h
+++ subtitlecomposer-0.8.1/src/speechplugins/pocketsphinx/pocketsphinxplugin.h
@@ -11,6 +11,9 @@
typedef struct ps_decoder_s ps_decoder_t;
typedef struct cmd_ln_s cmd_ln_t;
+#ifdef HAS_POCKETSPHINX_5_0_0
+typedef struct cmd_ln_s ps_config_t;
+#endif
typedef struct SpeexPreprocessState_ SpeexPreprocessState;
namespace SubtitleComposer {
@@ -40,7 +43,11 @@ private:
void processUtterance();
private:
+#ifdef HAS_POCKETSPHINX_5_0_0
+ ps_config_t *m_psConfig;
+#else
cmd_ln_t *m_psConfig;
+#endif
ps_decoder_t *m_psDecoder;
qint32 m_psFrameRate;