[MPlayer-users] Blu-ray subtitles (forced)
Carl Eugen Hoyos
cehoyos at ag.or.at
Tue Jan 31 11:53:31 CET 2012
On Tuesday 31 January 2012 03:03:15 am Alexander Roalter wrote:
> Just a question: is the information for forced/not forced in the m2ts
> stream, or does it need some additional information from the clip
> information also found on the Blu-ray? (in the BDMV/CLIPINF folder).
The information is part of the subtitles themselves, see FFmpeg commit
36436a40
> For the Salt (UK) Blu-ray, I can also provide a sample where forced
> subtitles should appear.
Please test attached patch.
Carl Eugen
-------------- next part --------------
Index: sub/av_sub.c
===================================================================
--- sub/av_sub.c (revision 34641)
+++ sub/av_sub.c (working copy)
@@ -23,6 +23,7 @@
#include "spudec.h"
#include "av_helpers.h"
#include "av_sub.h"
+#include "mpcommon.h"
void reset_avsub(struct sh_sub *sh)
{
@@ -46,6 +47,9 @@
int got_sub;
AVSubtitle sub;
AVPacket pkt;
+ AVDictionary *opts = NULL;
+ if (forced_subs_only)
+ av_dict_set(&opts, "forced_subs_only", "1", 0);
switch (sh->type) {
case 'b':
@@ -67,12 +71,14 @@
init_avcodec();
ctx = avcodec_alloc_context();
sub_codec = avcodec_find_decoder(cid);
- if (!ctx || !sub_codec || avcodec_open(ctx, sub_codec) < 0) {
+ if (!ctx || !sub_codec || avcodec_open2(ctx, sub_codec, &opts) < 0) {
mp_msg(MSGT_SUBREADER, MSGL_FATAL,
"Could not open subtitle decoder\n");
av_freep(&ctx);
+ av_freep(&opts);
return -1;
}
+ av_freep(&opts);
sh->context = ctx;
}
res = avcodec_decode_subtitle2(ctx, &sub, &got_sub, &pkt);
More information about the MPlayer-users
mailing list