Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subtitles do not work in mpv 0.16.0 #2888

Closed
LoneFox78 opened this issue Feb 29, 2016 · 4 comments
Closed

Subtitles do not work in mpv 0.16.0 #2888

LoneFox78 opened this issue Feb 29, 2016 · 4 comments

Comments

@LoneFox78
Copy link

[sub/ass] Could not open libavcodec subtitle converter
[sub] Could not find subtitle decoder for format 'srt'.

This seems to be yet another difference between libav and ffmpeg. In libav, av_malloc(0) returns NULL. In ffmpeg, it passes the parameter to malloc(), and return value depends on libc implementation (and I believe glibc returns a valid pointer in this case).
Suggested fix:

diff -ur mpv-0.16.0-orig/sub/lavc_conv.c mpv-0.16.0/sub/lavc_conv.c
--- mpv-0.16.0-orig/sub/lavc_conv.c     2016-02-29 01:22:04.000000000 +0200
+++ mpv-0.16.0/sub/lavc_conv.c  2016-02-29 18:41:16.000000000 +0200
@@ -79,11 +79,13 @@
     avctx = avcodec_alloc_context3(codec);
     if (!avctx)
         goto error;
-    avctx->extradata_size = extradata_len;
-    avctx->extradata = av_malloc(extradata_len);
-    if (!avctx->extradata)
-        goto error;
-    memcpy(avctx->extradata, extradata, extradata_len);
+    if (extradata_len > 0) {
+        avctx->extradata_size = extradata_len;
+        avctx->extradata = av_malloc(extradata_len);
+        if (!avctx->extradata)
+            goto error;
+        memcpy(avctx->extradata, extradata, extradata_len);
+    }
     if (strcmp(codec_name, "eia_608") == 0)
         av_dict_set(&opts, "real_time", "1", 0);
     if (avcodec_open2(avctx, codec, &opts) < 0)
@ghost ghost closed this as completed in 041c9f1 Feb 29, 2016
@ghost
Copy link

ghost commented Feb 29, 2016

av_malloc(0) is probably just as OS-specific as malloc(0). Fixed slightly different, but should amount to the same thing.

@evgkrsk
Copy link

evgkrsk commented Aug 17, 2016

Same problem in v0.19.0 with at least some mediafiles:

[sub/ass] Could not open libavcodec subtitle converter
[sub] Could not find subtitle decoder for format 'subrip'.

@ghost
Copy link

ghost commented Aug 17, 2016

Uh ok? Great way to get your bug report ignored.

@ghost
Copy link

ghost commented Aug 17, 2016

(PS: this means you should report your bug properly.)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants