sd_lavc: remove mp4 vobsub extradata hack

The proper fix is now available in all supported FFmpeg and Libav
releases.
This commit is contained in:
wm4 2015-03-03 12:30:35 +01:00
parent c31e5da734
commit 97940e0f48
1 changed files with 0 additions and 35 deletions

View File

@ -28,7 +28,6 @@
#include "common/av_common.h"
#include "options/options.h"
#include "video/mp_image.h"
#include "video/csputils.h"
#include "sd.h"
#include "dec_sub.h"
@ -98,35 +97,6 @@ static void get_resolution(struct sd *sd, int wh[2])
}
}
static void set_mp4_vobsub_idx(AVCodecContext *avctx, char *src, int w, int h)
{
char pal_s[128];
int pal_s_pos = 0;
for (int i = 0; i < 16; i++) {
unsigned int e = AV_RB32(src + i * 4);
// lavc doesn't accept YUV palette - "does god hate me?"
struct mp_csp_params csp = MP_CSP_PARAMS_DEFAULTS;
csp.int_bits_in = 8;
csp.int_bits_out = 8;
struct mp_cmat cmatrix;
mp_get_yuv2rgb_coeffs(&csp, &cmatrix);
int c[3] = {(e >> 16) & 0xff, (e >> 8) & 0xff, e & 0xff};
mp_map_int_color(&cmatrix, 8, c);
e = (c[2] << 16) | (c[1] << 8) | c[0];
snprintf(pal_s + pal_s_pos, sizeof(pal_s) - pal_s_pos, "%06x%s", e,
i != 15 ? ", " : "");
pal_s_pos = strlen(pal_s);
if (pal_s_pos >= sizeof(pal_s))
break;
}
char buf[256] = "";
snprintf(buf, sizeof(buf), "size: %dx%d\npalette: %s\n", w, h, pal_s);
mp_lavc_set_extradata(avctx, buf, strlen(buf));
}
static int init(struct sd *sd)
{
struct sd_lavc_priv *priv = talloc_zero(NULL, struct sd_lavc_priv);
@ -139,11 +109,6 @@ static int init(struct sd *sd)
if (!ctx)
goto error;
mp_lavc_set_extradata(ctx, sd->extradata, sd->extradata_len);
if (sd->extradata_len == 64 && sd->sub_stream_w && sd->sub_stream_h &&
cid == AV_CODEC_ID_DVD_SUBTITLE)
{
set_mp4_vobsub_idx(ctx, sd->extradata, sd->sub_stream_w, sd->sub_stream_h);
}
if (avcodec_open2(ctx, sub_codec, NULL) < 0)
goto error;
priv->avctx = ctx;