summaryrefslogtreecommitdiffstats
path: root/contrib/ffmpeg
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2019-12-15 12:09:55 -0800
committerJohn Stebbins <[email protected]>2020-03-29 08:23:21 -0600
commit9394acba3525b97dc5861490e587a705a410e3a7 (patch)
tree05cbf820a7f25685f7f6595bec84185657ca42ac /contrib/ffmpeg
parent91d9533ee71acc85e7f3a2a8b851fd12a108ab68 (diff)
decavsub: patch ffmpeg to fix workaround hacks
Diffstat (limited to 'contrib/ffmpeg')
-rw-r--r--contrib/ffmpeg/A16-ccaption_dec-return-number-of-bytes-used.patch27
-rw-r--r--contrib/ffmpeg/A17-dvdsubdec-return-number-of-bytes-used.patch31
-rw-r--r--contrib/ffmpeg/A18-dvdsubdec-use-pts-of-initial-packet.patch73
3 files changed, 131 insertions, 0 deletions
diff --git a/contrib/ffmpeg/A16-ccaption_dec-return-number-of-bytes-used.patch b/contrib/ffmpeg/A16-ccaption_dec-return-number-of-bytes-used.patch
new file mode 100644
index 000000000..14bcfe0ce
--- /dev/null
+++ b/contrib/ffmpeg/A16-ccaption_dec-return-number-of-bytes-used.patch
@@ -0,0 +1,27 @@
+From 244befc535a5f4a2cf5caa8eacb3150ca390921f Mon Sep 17 00:00:00 2001
+From: John Stebbins <[email protected]>
+Date: Sun, 15 Dec 2019 11:30:39 -0800
+Subject: [PATCH] ccaption_dec: return number of bytes used
+
+Documentation says avcodec_decode_subtitle2 returns the number of bytes
+used.
+---
+ libavcodec/ccaption_dec.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
+index bf3563a0bc..4aeb4e7e0f 100644
+--- a/libavcodec/ccaption_dec.c
++++ b/libavcodec/ccaption_dec.c
+@@ -812,7 +812,7 @@ static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avp
+ }
+
+ *got_sub = sub->num_rects > 0;
+- return ret;
++ return len;
+ }
+
+ #define OFFSET(x) offsetof(CCaptionSubContext, x)
+--
+2.23.0
+
diff --git a/contrib/ffmpeg/A17-dvdsubdec-return-number-of-bytes-used.patch b/contrib/ffmpeg/A17-dvdsubdec-return-number-of-bytes-used.patch
new file mode 100644
index 000000000..e1a6f0405
--- /dev/null
+++ b/contrib/ffmpeg/A17-dvdsubdec-return-number-of-bytes-used.patch
@@ -0,0 +1,31 @@
+From a8b24f214429667d2f7c784ecfe93b81fc61f818 Mon Sep 17 00:00:00 2001
+From: John Stebbins <[email protected]>
+Date: Sun, 15 Dec 2019 11:49:25 -0800
+Subject: [PATCH] dvdsubdec: return number of bytes used
+
+Documentation says avcodec_decode_subtitle2 returns the number of bytes
+used.
+---
+ libavcodec/dvdsubdec.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
+index c0c9962bad..9220285877 100644
+--- a/libavcodec/dvdsubdec.c
++++ b/libavcodec/dvdsubdec.c
+@@ -591,7 +591,11 @@ static int dvdsub_decode(AVCodecContext *avctx,
+ is_menu = decode_dvd_subtitles(ctx, sub, buf, buf_size);
+ if (is_menu == AVERROR(EAGAIN)) {
+ *data_size = 0;
+- return appended ? 0 : append_to_cached_buf(avctx, buf, buf_size);
++ int ret = appended ? 0 : append_to_cached_buf(avctx, buf, buf_size);
++ if (ret < 0) {
++ return ret;
++ }
++ return buf_size;
+ }
+
+ if (is_menu < 0) {
+--
+2.23.0
+
diff --git a/contrib/ffmpeg/A18-dvdsubdec-use-pts-of-initial-packet.patch b/contrib/ffmpeg/A18-dvdsubdec-use-pts-of-initial-packet.patch
new file mode 100644
index 000000000..e3276a31d
--- /dev/null
+++ b/contrib/ffmpeg/A18-dvdsubdec-use-pts-of-initial-packet.patch
@@ -0,0 +1,73 @@
+From b83dae62884a79b4e673edaeac86923fb9700701 Mon Sep 17 00:00:00 2001
+From: John Stebbins <[email protected]>
+Date: Sun, 15 Dec 2019 11:58:52 -0800
+Subject: [PATCH] dvdsubdec: use pts of initial packet
+
+When the source is DVD, only the initial packet of a subtitle that spans
+multiple packets will have a pts value.
+---
+ libavcodec/dvdsubdec.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
+index 9220285877..49007383c3 100644
+--- a/libavcodec/dvdsubdec.c
++++ b/libavcodec/dvdsubdec.c
+@@ -43,6 +43,7 @@ typedef struct DVDSubContext
+ int buf_size;
+ int forced_subs_only;
+ uint8_t used_color[256];
++ int64_t pts;
+ #ifdef DEBUG
+ int sub_id;
+ #endif
+@@ -577,10 +578,13 @@ static int dvdsub_decode(AVCodecContext *avctx,
+ int appended = 0;
+ int is_menu;
+
++ if (ctx->pts == AV_NOPTS_VALUE && sub->pts != AV_NOPTS_VALUE)
++ ctx->pts = sub->pts;
+ if (ctx->buf_size) {
+ int ret = append_to_cached_buf(avctx, buf, buf_size);
+ if (ret < 0) {
+ *data_size = 0;
++ ctx->pts = AV_NOPTS_VALUE;
+ return ret;
+ }
+ buf = ctx->buf;
+@@ -593,6 +597,7 @@ static int dvdsub_decode(AVCodecContext *avctx,
+ *data_size = 0;
+ int ret = appended ? 0 : append_to_cached_buf(avctx, buf, buf_size);
+ if (ret < 0) {
++ ctx->pts = AV_NOPTS_VALUE;
+ return ret;
+ }
+ return buf_size;
+@@ -604,6 +609,7 @@ static int dvdsub_decode(AVCodecContext *avctx,
+ reset_rects(sub);
+ *data_size = 0;
+
++ ctx->pts = AV_NOPTS_VALUE;
+ return buf_size;
+ }
+ if (!is_menu && find_smallest_bounding_rectangle(ctx, sub) == 0)
+@@ -627,6 +633,8 @@ static int dvdsub_decode(AVCodecContext *avctx,
+
+ ctx->buf_size = 0;
+ *data_size = 1;
++ sub->pts = ctx->pts;
++ ctx->pts = AV_NOPTS_VALUE;
+ return buf_size;
+ }
+
+@@ -761,6 +769,7 @@ static av_cold int dvdsub_init(AVCodecContext *avctx)
+ av_log(avctx, AV_LOG_DEBUG, " 0x%06"PRIx32, ctx->palette[i]);
+ av_log(avctx, AV_LOG_DEBUG, "\n");
+ }
++ ctx->pts = AV_NOPTS_VALUE;
+
+ return 1;
+ }
+--
+2.23.0
+