Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/LAVFilters.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2015-03-25 01:34:39 +0300
committerHendrik Leppkes <h.leppkes@gmail.com>2015-03-25 01:38:44 +0300
commitc374e1faf0791169a6d71cb80c4ced0a3868ee53 (patch)
tree32e447abb973a3362fd76439026e22d64f952e8a /decoder
parentb3ea3eae67055e03bee73046c3e092cb2294c93a (diff)
Move subtitle timestamp handling further down into the processing function
Diffstat (limited to 'decoder')
-rw-r--r--decoder/LAVVideo/subtitles/LAVSubtitleProvider.cpp23
-rw-r--r--decoder/LAVVideo/subtitles/LAVSubtitleProvider.h2
2 files changed, 13 insertions, 12 deletions
diff --git a/decoder/LAVVideo/subtitles/LAVSubtitleProvider.cpp b/decoder/LAVVideo/subtitles/LAVSubtitleProvider.cpp
index 4c3dc2ef..1a01b9f1 100644
--- a/decoder/LAVVideo/subtitles/LAVSubtitleProvider.cpp
+++ b/decoder/LAVVideo/subtitles/LAVSubtitleProvider.cpp
@@ -294,16 +294,7 @@ STDMETHODIMP CLAVSubtitleProvider::Decode(BYTE *buf, int buflen, REFERENCE_TIME
}
if (got_sub) {
- REFERENCE_TIME rtSubStart = rtStart, rtSubStop = AV_NOPTS_VALUE;
- if (rtSubStart != AV_NOPTS_VALUE) {
- if (sub.end_display_time > 0) {
- rtSubStop = rtSubStart + (sub.end_display_time * 10000i64);
- }
- rtSubStart += sub.start_display_time * 10000i64;
- }
- DbgLog((LOG_TRACE, 10, L"Decoded Sub: rtStart: %I64d, rtStop: %I64d, num_rects: %u, num_dvd_palette: %d", rtSubStart, rtSubStop, sub.num_rects, sub.num_dvd_palette));
-
- ProcessSubtitleFrame(&sub, rtSubStart, rtSubStop);
+ ProcessSubtitleFrame(&sub, rtStart);
}
avsubtitle_free(&sub);
@@ -312,8 +303,9 @@ STDMETHODIMP CLAVSubtitleProvider::Decode(BYTE *buf, int buflen, REFERENCE_TIME
return S_OK;
}
-void CLAVSubtitleProvider::ProcessSubtitleFrame(AVSubtitle *sub, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop)
+void CLAVSubtitleProvider::ProcessSubtitleFrame(AVSubtitle *sub, REFERENCE_TIME rtStart)
{
+ DbgLog((LOG_TRACE, 10, L"Decoded Sub: rtStart: %I64d, start_display_time: %d, end_display_time: %d, num_rects: %u, num_dvd_palette: %d", rtStart, sub->start_display_time, sub->end_display_time, sub->num_rects, sub->num_dvd_palette));
if (sub->num_rects > 0) {
if (m_pAVCtx->codec_id == AV_CODEC_ID_DVD_SUBTITLE) {
// DVD subs have the limitation that only one subtitle can be shown at a given time,
@@ -327,6 +319,15 @@ void CLAVSubtitleProvider::ProcessSubtitleFrame(AVSubtitle *sub, REFERENCE_TIME
}
}
}
+
+ REFERENCE_TIME rtStop = AV_NOPTS_VALUE;
+ if (rtStart != AV_NOPTS_VALUE) {
+ if (sub->end_display_time > 0) {
+ rtStop = rtStart + (sub->end_display_time * 10000i64);
+ }
+ rtStart += sub->start_display_time * 10000i64;
+ }
+
for (unsigned i = 0; i < sub->num_rects; i++) {
if (sub->num_dvd_palette > 1 && rtStart != AV_NOPTS_VALUE) {
REFERENCE_TIME rtStartRect = rtStart - (sub->start_display_time * 10000i64);
diff --git a/decoder/LAVVideo/subtitles/LAVSubtitleProvider.h b/decoder/LAVVideo/subtitles/LAVSubtitleProvider.h
index f4716620..f8e17b24 100644
--- a/decoder/LAVVideo/subtitles/LAVSubtitleProvider.h
+++ b/decoder/LAVVideo/subtitles/LAVSubtitleProvider.h
@@ -61,7 +61,7 @@ public:
private:
void CloseDecoder();
- void ProcessSubtitleFrame(AVSubtitle *sub, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop);
+ void ProcessSubtitleFrame(AVSubtitle *sub, REFERENCE_TIME rtStart);
void ProcessSubtitleRect(AVSubtitleRect *rect, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop);
void AddSubtitleRect(CLAVSubRect *rect);
CLAVSubRect* ProcessDVDHLI(CLAVSubRect *rect);