mirror of https://github.com/mpv-player/mpv
sub/osd: mp_msg conversions
This commit is contained in:
parent
92f9b51426
commit
3846fc7587
|
@ -313,6 +313,7 @@ typedef struct MPContext {
|
||||||
*/
|
*/
|
||||||
struct ass_renderer *ass_renderer;
|
struct ass_renderer *ass_renderer;
|
||||||
struct ass_library *ass_library;
|
struct ass_library *ass_library;
|
||||||
|
struct mp_log *ass_log;
|
||||||
|
|
||||||
int last_dvb_step;
|
int last_dvb_step;
|
||||||
|
|
||||||
|
|
|
@ -842,8 +842,10 @@ static void init_sub_renderer(struct MPContext *mpctx)
|
||||||
assert(!mpctx->ass_renderer);
|
assert(!mpctx->ass_renderer);
|
||||||
|
|
||||||
mpctx->ass_renderer = ass_renderer_init(mpctx->ass_library);
|
mpctx->ass_renderer = ass_renderer_init(mpctx->ass_library);
|
||||||
if (mpctx->ass_renderer)
|
if (mpctx->ass_renderer) {
|
||||||
mp_ass_configure_fonts(mpctx->ass_renderer, mpctx->opts->sub_text_style);
|
mp_ass_configure_fonts(mpctx->ass_renderer, mpctx->opts->sub_text_style,
|
||||||
|
mpctx->global, mpctx->ass_log);
|
||||||
|
}
|
||||||
mpctx->initialized_flags |= INITIALIZED_LIBASS;
|
mpctx->initialized_flags |= INITIALIZED_LIBASS;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,13 +399,14 @@ static int mpv_main(int argc, char *argv[])
|
||||||
getch2_enable();
|
getch2_enable();
|
||||||
|
|
||||||
#if HAVE_LIBASS
|
#if HAVE_LIBASS
|
||||||
mpctx->ass_library = mp_ass_init(opts);
|
mpctx->ass_log = mp_log_new(mpctx, mpctx->global->log, "!libass");
|
||||||
|
mpctx->ass_library = mp_ass_init(mpctx->global, mpctx->ass_log);
|
||||||
#else
|
#else
|
||||||
MP_WARN(mpctx, "Compiled without libass.\n");
|
MP_WARN(mpctx, "Compiled without libass.\n");
|
||||||
MP_WARN(mpctx, "There will be no OSD and no text subtitles.\n");
|
MP_WARN(mpctx, "There will be no OSD and no text subtitles.\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mpctx->osd = osd_create(opts);
|
mpctx->osd = osd_create(mpctx->global);
|
||||||
|
|
||||||
if (opts->force_vo) {
|
if (opts->force_vo) {
|
||||||
opts->fixed_vo = 1;
|
opts->fixed_vo = 1;
|
||||||
|
|
|
@ -185,7 +185,7 @@ void reinit_subs(struct MPContext *mpctx)
|
||||||
|
|
||||||
if (!sh->sub->dec_sub) {
|
if (!sh->sub->dec_sub) {
|
||||||
assert(!mpctx->d_sub);
|
assert(!mpctx->d_sub);
|
||||||
sh->sub->dec_sub = sub_create(opts);
|
sh->sub->dec_sub = sub_create(mpctx->global);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(!mpctx->d_sub || sh->sub->dec_sub == mpctx->d_sub);
|
assert(!mpctx->d_sub || sh->sub->dec_sub == mpctx->d_sub);
|
||||||
|
|
18
sub/ass_mp.c
18
sub/ass_mp.c
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
#include <libavutil/common.h>
|
#include <libavutil/common.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "common/global.h"
|
||||||
#include "common/msg.h"
|
#include "common/msg.h"
|
||||||
#include "options/path.h"
|
#include "options/path.h"
|
||||||
#include "ass_mp.h"
|
#include "ass_mp.h"
|
||||||
|
@ -150,7 +150,8 @@ void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts,
|
||||||
ass_set_line_spacing(priv, set_line_spacing);
|
ass_set_line_spacing(priv, set_line_spacing);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mp_ass_configure_fonts(ASS_Renderer *priv, struct osd_style_opts *opts)
|
void mp_ass_configure_fonts(ASS_Renderer *priv, struct osd_style_opts *opts,
|
||||||
|
struct mpv_global *global, struct mp_log *log)
|
||||||
{
|
{
|
||||||
char *default_font = mp_find_user_config_file("subfont.ttf");
|
char *default_font = mp_find_user_config_file("subfont.ttf");
|
||||||
char *config = mp_find_config_file("fonts.conf");
|
char *config = mp_find_config_file("fonts.conf");
|
||||||
|
@ -216,22 +217,25 @@ static int map_ass_level[] = {
|
||||||
|
|
||||||
static void message_callback(int level, const char *format, va_list va, void *ctx)
|
static void message_callback(int level, const char *format, va_list va, void *ctx)
|
||||||
{
|
{
|
||||||
|
struct mp_log *log = ctx;
|
||||||
|
if (!log)
|
||||||
|
return;
|
||||||
level = map_ass_level[level];
|
level = map_ass_level[level];
|
||||||
mp_msg_va(MSGT_ASS, level, format, va);
|
mp_msg_log_va(log, level, format, va);
|
||||||
// libass messages lack trailing \n
|
// libass messages lack trailing \n
|
||||||
mp_msg(MSGT_ASS, level, "\n");
|
mp_msg_log(log, level, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
ASS_Library *mp_ass_init(struct MPOpts *opts)
|
ASS_Library *mp_ass_init(struct mpv_global *global, struct mp_log *log)
|
||||||
{
|
{
|
||||||
char *path = mp_find_user_config_file("fonts");
|
char *path = mp_find_user_config_file("fonts");
|
||||||
ASS_Library *priv = ass_library_init();
|
ASS_Library *priv = ass_library_init();
|
||||||
if (!priv)
|
if (!priv)
|
||||||
abort();
|
abort();
|
||||||
ass_set_message_cb(priv, message_callback, NULL);
|
ass_set_message_cb(priv, message_callback, log);
|
||||||
if (path)
|
if (path)
|
||||||
ass_set_fonts_dir(priv, path);
|
ass_set_fonts_dir(priv, path);
|
||||||
ass_set_extract_fonts(priv, opts->use_embedded_fonts);
|
ass_set_extract_fonts(priv, global->opts->use_embedded_fonts);
|
||||||
talloc_free(path);
|
talloc_free(path);
|
||||||
return priv;
|
return priv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include <ass/ass_types.h>
|
#include <ass/ass_types.h>
|
||||||
|
|
||||||
struct MPOpts;
|
struct MPOpts;
|
||||||
|
struct mpv_global;
|
||||||
struct mp_osd_res;
|
struct mp_osd_res;
|
||||||
struct osd_style_opts;
|
struct osd_style_opts;
|
||||||
|
|
||||||
|
@ -54,8 +55,9 @@ ASS_Track *mp_ass_default_track(ASS_Library *library, struct MPOpts *opts);
|
||||||
struct MPOpts;
|
struct MPOpts;
|
||||||
void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts,
|
void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts,
|
||||||
struct mp_osd_res *dim);
|
struct mp_osd_res *dim);
|
||||||
void mp_ass_configure_fonts(ASS_Renderer *priv, struct osd_style_opts *opts);
|
void mp_ass_configure_fonts(ASS_Renderer *priv, struct osd_style_opts *opts,
|
||||||
ASS_Library *mp_ass_init(struct MPOpts *opts);
|
struct mpv_global *global, struct mp_log *log);
|
||||||
|
ASS_Library *mp_ass_init(struct mpv_global *global, struct mp_log *log);
|
||||||
|
|
||||||
struct sub_bitmap;
|
struct sub_bitmap;
|
||||||
struct sub_bitmaps;
|
struct sub_bitmaps;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "sd.h"
|
#include "sd.h"
|
||||||
#include "dec_sub.h"
|
#include "dec_sub.h"
|
||||||
#include "options/options.h"
|
#include "options/options.h"
|
||||||
|
#include "common/global.h"
|
||||||
#include "common/msg.h"
|
#include "common/msg.h"
|
||||||
#include "misc/charset_conv.h"
|
#include "misc/charset_conv.h"
|
||||||
|
|
||||||
|
@ -56,6 +57,7 @@ static const struct sd_functions *sd_list[] = {
|
||||||
#define MAX_NUM_SD 3
|
#define MAX_NUM_SD 3
|
||||||
|
|
||||||
struct dec_sub {
|
struct dec_sub {
|
||||||
|
struct mp_log *log;
|
||||||
struct MPOpts *opts;
|
struct MPOpts *opts;
|
||||||
struct sd init_sd;
|
struct sd init_sd;
|
||||||
|
|
||||||
|
@ -71,10 +73,11 @@ struct packet_list {
|
||||||
int num_packets;
|
int num_packets;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dec_sub *sub_create(struct MPOpts *opts)
|
struct dec_sub *sub_create(struct mpv_global *global)
|
||||||
{
|
{
|
||||||
struct dec_sub *sub = talloc_zero(NULL, struct dec_sub);
|
struct dec_sub *sub = talloc_zero(NULL, struct dec_sub);
|
||||||
sub->opts = opts;
|
sub->log = mp_log_new(sub, global->log, "sub");
|
||||||
|
sub->opts = global->opts;
|
||||||
return sub;
|
return sub;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,13 +136,13 @@ void sub_set_ass_renderer(struct dec_sub *sub, struct ass_library *ass_library,
|
||||||
|
|
||||||
static void print_chain(struct dec_sub *sub)
|
static void print_chain(struct dec_sub *sub)
|
||||||
{
|
{
|
||||||
mp_msg(MSGT_OSD, MSGL_V, "Subtitle filter chain: ");
|
MP_VERBOSE(sub, "Subtitle filter chain: ");
|
||||||
for (int n = 0; n < sub->num_sd; n++) {
|
for (int n = 0; n < sub->num_sd; n++) {
|
||||||
struct sd *sd = sub->sd[n];
|
struct sd *sd = sub->sd[n];
|
||||||
mp_msg(MSGT_OSD, MSGL_V, "%s%s (%s)", n > 0 ? " -> " : "",
|
MP_VERBOSE(sub, "%s%s (%s)", n > 0 ? " -> " : "",
|
||||||
sd->driver->name, sd->codec);
|
sd->driver->name, sd->codec);
|
||||||
}
|
}
|
||||||
mp_msg(MSGT_OSD, MSGL_V, "\n");
|
MP_VERBOSE(sub, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sub_init_decoder(struct dec_sub *sub, struct sd *sd)
|
static int sub_init_decoder(struct dec_sub *sub, struct sd *sd)
|
||||||
|
@ -155,6 +158,7 @@ static int sub_init_decoder(struct dec_sub *sub, struct sd *sd)
|
||||||
if (!sd->driver)
|
if (!sd->driver)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
sd->log = mp_log_new(sd, sub->log, sd->driver->name);
|
||||||
if (sd->driver->init(sd) < 0)
|
if (sd->driver->init(sd) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -198,7 +202,7 @@ void sub_init_from_sh(struct dec_sub *sub, struct sh_stream *sh)
|
||||||
}
|
}
|
||||||
|
|
||||||
sub_uninit(sub);
|
sub_uninit(sub);
|
||||||
mp_msg(MSGT_OSD, MSGL_ERR, "Could not find subtitle decoder for format '%s'.\n",
|
MP_ERR(sub, "Could not find subtitle decoder for format '%s'.\n",
|
||||||
sh->codec ? sh->codec : "<unknown>");
|
sh->codec ? sh->codec : "<unknown>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +227,8 @@ static void decode_chain(struct sd **sd, int num_sd, struct demux_packet *packet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct demux_packet *recode_packet(struct demux_packet *in,
|
static struct demux_packet *recode_packet(struct mp_log *log,
|
||||||
|
struct demux_packet *in,
|
||||||
const char *charset)
|
const char *charset)
|
||||||
{
|
{
|
||||||
struct demux_packet *pkt = NULL;
|
struct demux_packet *pkt = NULL;
|
||||||
|
@ -249,7 +254,7 @@ static void decode_chain_recode(struct dec_sub *sub, struct sd **sd, int num_sd,
|
||||||
if (num_sd > 0) {
|
if (num_sd > 0) {
|
||||||
struct demux_packet *recoded = NULL;
|
struct demux_packet *recoded = NULL;
|
||||||
if (sub->charset)
|
if (sub->charset)
|
||||||
recoded = recode_packet(packet, sub->charset);
|
recoded = recode_packet(sub->log, packet, sub->charset);
|
||||||
decode_chain(sd, num_sd, recoded ? recoded : packet);
|
decode_chain(sd, num_sd, recoded ? recoded : packet);
|
||||||
talloc_free(recoded);
|
talloc_free(recoded);
|
||||||
}
|
}
|
||||||
|
@ -260,7 +265,8 @@ void sub_decode(struct dec_sub *sub, struct demux_packet *packet)
|
||||||
decode_chain_recode(sub, sub->sd, sub->num_sd, packet);
|
decode_chain_recode(sub, sub->sd, sub->num_sd, packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *guess_sub_cp(struct packet_list *subs, const char *usercp)
|
static const char *guess_sub_cp(struct mp_log *log, struct packet_list *subs,
|
||||||
|
const char *usercp)
|
||||||
{
|
{
|
||||||
if (!mp_charset_requires_guess(usercp))
|
if (!mp_charset_requires_guess(usercp))
|
||||||
return usercp;
|
return usercp;
|
||||||
|
@ -405,10 +411,10 @@ bool sub_read_all_packets(struct dec_sub *sub, struct sh_stream *sh)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts->sub_cp && !sh->sub->is_utf8)
|
if (opts->sub_cp && !sh->sub->is_utf8)
|
||||||
sub->charset = guess_sub_cp(subs, opts->sub_cp);
|
sub->charset = guess_sub_cp(sub->log, subs, opts->sub_cp);
|
||||||
|
|
||||||
if (sub->charset && sub->charset[0] && !mp_charset_is_utf8(sub->charset))
|
if (sub->charset && sub->charset[0] && !mp_charset_is_utf8(sub->charset))
|
||||||
mp_msg(MSGT_OSD, MSGL_INFO, "Using subtitle charset: %s\n", sub->charset);
|
MP_INFO(sub, "Using subtitle charset: %s\n", sub->charset);
|
||||||
|
|
||||||
double sub_speed = 1.0;
|
double sub_speed = 1.0;
|
||||||
|
|
||||||
|
@ -537,7 +543,7 @@ void sd_conv_add_packet(struct sd *sd, void *data, int data_len, double pts,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
out_of_space:
|
out_of_space:
|
||||||
mp_msg(MSGT_OSD, MSGL_ERR, "Subtitle too big.\n");
|
MP_ERR(sd, "Subtitle too big.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
struct demux_packet *sd_conv_def_get_converted(struct sd *sd)
|
struct demux_packet *sd_conv_def_get_converted(struct sd *sd)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
struct sh_stream;
|
struct sh_stream;
|
||||||
struct ass_track;
|
struct ass_track;
|
||||||
struct MPOpts;
|
struct mpv_global;
|
||||||
struct demux_packet;
|
struct demux_packet;
|
||||||
struct ass_library;
|
struct ass_library;
|
||||||
struct ass_renderer;
|
struct ass_renderer;
|
||||||
|
@ -22,7 +22,7 @@ enum sd_ctrl {
|
||||||
SD_CTRL_GET_RESOLUTION,
|
SD_CTRL_GET_RESOLUTION,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dec_sub *sub_create(struct MPOpts *opts);
|
struct dec_sub *sub_create(struct mpv_global *global);
|
||||||
void sub_destroy(struct dec_sub *sub);
|
void sub_destroy(struct dec_sub *sub);
|
||||||
|
|
||||||
void sub_set_video_res(struct dec_sub *sub, int w, int h);
|
void sub_set_video_res(struct dec_sub *sub, int w, int h);
|
||||||
|
|
10
sub/osd.c
10
sub/osd.c
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include "talloc.h"
|
#include "talloc.h"
|
||||||
#include "options/options.h"
|
#include "options/options.h"
|
||||||
|
#include "common/global.h"
|
||||||
#include "common/msg.h"
|
#include "common/msg.h"
|
||||||
#include "osd.h"
|
#include "osd.h"
|
||||||
#include "dec_sub.h"
|
#include "dec_sub.h"
|
||||||
|
@ -79,11 +80,13 @@ static bool osd_res_equals(struct mp_osd_res a, struct mp_osd_res b)
|
||||||
&& a.display_par == b.display_par;
|
&& a.display_par == b.display_par;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct osd_state *osd_create(struct MPOpts *opts)
|
struct osd_state *osd_create(struct mpv_global *global)
|
||||||
{
|
{
|
||||||
struct osd_state *osd = talloc_zero(NULL, struct osd_state);
|
struct osd_state *osd = talloc_zero(NULL, struct osd_state);
|
||||||
*osd = (struct osd_state) {
|
*osd = (struct osd_state) {
|
||||||
.opts = opts,
|
.opts = global->opts,
|
||||||
|
.global = global,
|
||||||
|
.log = mp_log_new(osd, global->log, "osd"),
|
||||||
.osd_text = talloc_strdup(osd, ""),
|
.osd_text = talloc_strdup(osd, ""),
|
||||||
.sub_text = talloc_strdup(osd, ""),
|
.sub_text = talloc_strdup(osd, ""),
|
||||||
.progbar_type = -1,
|
.progbar_type = -1,
|
||||||
|
@ -246,8 +249,7 @@ void osd_draw(struct osd_state *osd, struct mp_osd_res res,
|
||||||
if (formats[imgs.format]) {
|
if (formats[imgs.format]) {
|
||||||
cb(cb_ctx, &imgs);
|
cb(cb_ctx, &imgs);
|
||||||
} else {
|
} else {
|
||||||
mp_msg(MSGT_OSD, MSGL_ERR,
|
MP_ERR(osd, "Can't render OSD part %d (format %d).\n",
|
||||||
"Can't render OSD part %d (format %d).\n",
|
|
||||||
obj->type, imgs.format);
|
obj->type, imgs.format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,6 +154,8 @@ struct osd_state {
|
||||||
void *highlight_priv;
|
void *highlight_priv;
|
||||||
|
|
||||||
struct MPOpts *opts;
|
struct MPOpts *opts;
|
||||||
|
struct mpv_global *global;
|
||||||
|
struct mp_log *log;
|
||||||
|
|
||||||
// Internal to sub.c
|
// Internal to sub.c
|
||||||
struct mp_draw_sub_cache *draw_cache;
|
struct mp_draw_sub_cache *draw_cache;
|
||||||
|
@ -202,7 +204,7 @@ struct osd_style_opts {
|
||||||
|
|
||||||
extern const struct m_sub_options osd_style_conf;
|
extern const struct m_sub_options osd_style_conf;
|
||||||
|
|
||||||
struct osd_state *osd_create(struct MPOpts *opts);
|
struct osd_state *osd_create(struct mpv_global *global);
|
||||||
void osd_set_text(struct osd_state *osd, const char *text);
|
void osd_set_text(struct osd_state *osd, const char *text);
|
||||||
void osd_set_sub(struct osd_state *osd, const char *text);
|
void osd_set_sub(struct osd_state *osd, const char *text);
|
||||||
void osd_changed(struct osd_state *osd, int new_value);
|
void osd_changed(struct osd_state *osd, int new_value);
|
||||||
|
|
|
@ -48,7 +48,8 @@ static void create_ass_renderer(struct osd_state *osd, struct osd_object *obj)
|
||||||
if (obj->osd_render)
|
if (obj->osd_render)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
obj->osd_ass_library = mp_ass_init(osd->opts);
|
struct mp_log *ass_log = mp_log_new(obj, osd->log, "libass");
|
||||||
|
obj->osd_ass_library = mp_ass_init(osd->global, ass_log);
|
||||||
ass_add_font(obj->osd_ass_library, "mpv-osd-symbols", (void *)osd_font_pfb,
|
ass_add_font(obj->osd_ass_library, "mpv-osd-symbols", (void *)osd_font_pfb,
|
||||||
sizeof(osd_font_pfb) - 1);
|
sizeof(osd_font_pfb) - 1);
|
||||||
|
|
||||||
|
@ -56,7 +57,8 @@ static void create_ass_renderer(struct osd_state *osd, struct osd_object *obj)
|
||||||
if (!obj->osd_render)
|
if (!obj->osd_render)
|
||||||
abort();
|
abort();
|
||||||
|
|
||||||
mp_ass_configure_fonts(obj->osd_render, osd->opts->osd_style);
|
mp_ass_configure_fonts(obj->osd_render, osd->opts->osd_style,
|
||||||
|
osd->global, ass_log);
|
||||||
ass_set_aspect_ratio(obj->osd_render, 1.0, 1.0);
|
ass_set_aspect_ratio(obj->osd_render, 1.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
sub/sd.h
1
sub/sd.h
|
@ -5,6 +5,7 @@
|
||||||
#include "demux/packet.h"
|
#include "demux/packet.h"
|
||||||
|
|
||||||
struct sd {
|
struct sd {
|
||||||
|
struct mp_log *log;
|
||||||
struct MPOpts *opts;
|
struct MPOpts *opts;
|
||||||
|
|
||||||
const struct sd_functions *driver;
|
const struct sd_functions *driver;
|
||||||
|
|
|
@ -102,12 +102,12 @@ static void decode(struct sd *sd, struct demux_packet *packet)
|
||||||
}
|
}
|
||||||
// plaintext subs
|
// plaintext subs
|
||||||
if (packet->pts == MP_NOPTS_VALUE) {
|
if (packet->pts == MP_NOPTS_VALUE) {
|
||||||
mp_msg(MSGT_SUBREADER, MSGL_WARN, "Subtitle without pts, ignored\n");
|
MP_WARN(sd, "Subtitle without pts, ignored\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (packet->duration <= 0) {
|
if (packet->duration <= 0) {
|
||||||
mp_msg(MSGT_SUBREADER, MSGL_WARN, "Subtitle without duration or "
|
MP_WARN(sd, "Subtitle without duration or "
|
||||||
"duration set to 0 at pts %f, ignored\n", packet->pts);
|
"duration set to 0 at pts %f, ignored\n", packet->pts);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
unsigned char *text = packet->buffer;
|
unsigned char *text = packet->buffer;
|
||||||
|
@ -390,7 +390,7 @@ static void mangle_colors(struct sd *sd, struct sub_bitmaps *parts)
|
||||||
{
|
{
|
||||||
int msgl = basic_conv ? MSGL_V : MSGL_WARN;
|
int msgl = basic_conv ? MSGL_V : MSGL_WARN;
|
||||||
ctx->last_params = params;
|
ctx->last_params = params;
|
||||||
mp_msg(MSGT_SUBREADER, msgl, "[sd_ass] mangling colors like vsfilter: "
|
MP_MSG(sd, msgl, "mangling colors like vsfilter: "
|
||||||
"RGB -> %s %s -> %s %s -> RGB\n", mp_csp_names[csp],
|
"RGB -> %s %s -> %s %s -> RGB\n", mp_csp_names[csp],
|
||||||
mp_csp_levels_names[levels], mp_csp_names[params.colorspace],
|
mp_csp_levels_names[levels], mp_csp_names[params.colorspace],
|
||||||
mp_csp_levels_names[params.colorlevels]);
|
mp_csp_levels_names[params.colorlevels]);
|
||||||
|
|
|
@ -111,8 +111,7 @@ static int init(struct sd *sd)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
mp_msg(MSGT_SUBREADER, MSGL_ERR,
|
MP_FATAL(sd, "Could not open libavcodec subtitle decoder\n");
|
||||||
"Could not open libavcodec subtitle decoder\n");
|
|
||||||
av_free(ctx);
|
av_free(ctx);
|
||||||
talloc_free(priv);
|
talloc_free(priv);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -202,8 +201,7 @@ static void decode(struct sd *sd, struct demux_packet *packet)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mp_msg(MSGT_SUBREADER, MSGL_ERR, "sd_lavc: unsupported subtitle "
|
MP_ERR(sd, "unsupported subtitle type from libavcodec\n");
|
||||||
"type from libavcodec\n");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,8 +110,7 @@ static int init(struct sd *sd)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
mp_msg(MSGT_SUBREADER, MSGL_ERR,
|
MP_FATAL(sd, "Could not open libavcodec subtitle converter\n");
|
||||||
"Could not open libavcodec subtitle converter\n");
|
|
||||||
av_free(avctx);
|
av_free(avctx);
|
||||||
talloc_free(priv);
|
talloc_free(priv);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -243,7 +242,7 @@ static void decode(struct sd *sd, struct demux_packet *packet)
|
||||||
|
|
||||||
if (sd->codec && strcmp(sd->codec, "webvtt-webm") == 0) {
|
if (sd->codec && strcmp(sd->codec, "webvtt-webm") == 0) {
|
||||||
if (parse_webvtt(&pkt, &parsed_pkt) < 0) {
|
if (parse_webvtt(&pkt, &parsed_pkt) < 0) {
|
||||||
mp_msg(MSGT_OSD, MSGL_ERR, "Error parsing subtitle\n");
|
MP_ERR(sd, "Error parsing subtitle\n");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
pkt = parsed_pkt;
|
pkt = parsed_pkt;
|
||||||
|
@ -251,7 +250,7 @@ static void decode(struct sd *sd, struct demux_packet *packet)
|
||||||
|
|
||||||
ret = avcodec_decode_subtitle2(avctx, &sub, &got_sub, &pkt);
|
ret = avcodec_decode_subtitle2(avctx, &sub, &got_sub, &pkt);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
mp_msg(MSGT_OSD, MSGL_ERR, "Error decoding subtitle\n");
|
MP_ERR(sd, "Error decoding subtitle\n");
|
||||||
} else if (got_sub) {
|
} else if (got_sub) {
|
||||||
for (int i = 0; i < sub.num_rects; i++) {
|
for (int i = 0; i < sub.num_rects; i++) {
|
||||||
char *ass_line = sub.rects[i]->ass;
|
char *ass_line = sub.rects[i]->ass;
|
||||||
|
|
|
@ -42,7 +42,7 @@ static bool supports_format(const char *format)
|
||||||
|
|
||||||
static int init(struct sd *sd)
|
static int init(struct sd *sd)
|
||||||
{
|
{
|
||||||
void *spudec = spudec_new_scaled(sd->sub_video_w, sd->sub_video_h,
|
void *spudec = spudec_new_scaled(sd->log, sd->sub_video_w, sd->sub_video_h,
|
||||||
sd->extradata, sd->extradata_len);
|
sd->extradata, sd->extradata_len);
|
||||||
if (!spudec)
|
if (!spudec)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
12
sub/sd_srt.c
12
sub/sd_srt.c
|
@ -273,7 +273,8 @@ static int read_attr(char **s, struct bstr *attr, struct bstr *val)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void convert_subrip(const char *orig, char *dest, int dest_buffer_size)
|
static void convert_subrip(struct sd *sd, const char *orig,
|
||||||
|
char *dest, int dest_buffer_size)
|
||||||
{
|
{
|
||||||
/* line is not const to avoid warnings with strtol, etc.
|
/* line is not const to avoid warnings with strtol, etc.
|
||||||
* orig content won't be changed */
|
* orig content won't be changed */
|
||||||
|
@ -392,8 +393,7 @@ static void convert_subrip(const char *orig, char *dest, int dest_buffer_size)
|
||||||
tag->has_color = true;
|
tag->has_color = true;
|
||||||
} else {
|
} else {
|
||||||
// We didn't find any matching color
|
// We didn't find any matching color
|
||||||
mp_msg(MSGT_SUBREADER, MSGL_WARN,
|
MP_WARN(sd, "unknown font color in subtitle: >%s<\n",
|
||||||
"SubRip: unknown font color in subtitle: >%s<\n",
|
|
||||||
orig);
|
orig);
|
||||||
append_text(&new_line, "{\\c}");
|
append_text(&new_line, "{\\c}");
|
||||||
}
|
}
|
||||||
|
@ -406,8 +406,8 @@ static void convert_subrip(const char *orig, char *dest, int dest_buffer_size)
|
||||||
tag->has_face = true;
|
tag->has_face = true;
|
||||||
has_valid_attr = true;
|
has_valid_attr = true;
|
||||||
} else
|
} else
|
||||||
mp_msg(MSGT_SUBREADER, MSGL_WARN,"SubRip: unrecognized "
|
MP_WARN(sd, "unrecognized attribute \"%.*s\" in font tag\n",
|
||||||
"attribute \"%.*s\" in font tag\n", BSTR_P(attr));
|
BSTR_P(attr));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!has_valid_attr || *line != '>') { /* Not valid font tag */
|
if (!has_valid_attr || *line != '>') { /* Not valid font tag */
|
||||||
|
@ -463,7 +463,7 @@ static void decode(struct sd *sd, struct demux_packet *packet)
|
||||||
{
|
{
|
||||||
char dest[SD_MAX_LINE_LEN];
|
char dest[SD_MAX_LINE_LEN];
|
||||||
// Assume input buffer is padded with 0
|
// Assume input buffer is padded with 0
|
||||||
convert_subrip(packet->buffer, dest, sizeof(dest));
|
convert_subrip(sd, packet->buffer, dest, sizeof(dest));
|
||||||
sd_conv_add_packet(sd, dest, strlen(dest), packet->pts, packet->duration);
|
sd_conv_add_packet(sd, dest, strlen(dest), packet->pts, packet->duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
53
sub/spudec.c
53
sub/spudec.c
|
@ -67,6 +67,7 @@ struct spu_packet_t {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
struct mp_log *log;
|
||||||
packet_t *queue_head;
|
packet_t *queue_head;
|
||||||
packet_t *queue_tail;
|
packet_t *queue_tail;
|
||||||
unsigned int global_palette[16];
|
unsigned int global_palette[16];
|
||||||
|
@ -143,12 +144,12 @@ static void next_line(packet_t *packet)
|
||||||
packet->deinterlace_oddness = (packet->deinterlace_oddness + 1) % 2;
|
packet->deinterlace_oddness = (packet->deinterlace_oddness + 1) % 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned char get_nibble(packet_t *packet)
|
static inline unsigned char get_nibble(spudec_handle_t *this, packet_t *packet)
|
||||||
{
|
{
|
||||||
unsigned char nib;
|
unsigned char nib;
|
||||||
unsigned int *nibblep = packet->current_nibble + packet->deinterlace_oddness;
|
unsigned int *nibblep = packet->current_nibble + packet->deinterlace_oddness;
|
||||||
if (*nibblep / 2 >= packet->control_start) {
|
if (*nibblep / 2 >= packet->control_start) {
|
||||||
mp_msg(MSGT_SPUDEC,MSGL_WARN, "SPUdec: ERROR: get_nibble past end of packet\n");
|
MP_WARN(this, "SPUdec: ERROR: get_nibble past end of packet\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
nib = packet->packet[*nibblep / 2];
|
nib = packet->packet[*nibblep / 2];
|
||||||
|
@ -273,14 +274,14 @@ static void spudec_process_data(spudec_handle_t *this, packet_t *packet)
|
||||||
&& y < this->pal_height) {
|
&& y < this->pal_height) {
|
||||||
unsigned int len, color;
|
unsigned int len, color;
|
||||||
unsigned int rle = 0;
|
unsigned int rle = 0;
|
||||||
rle = get_nibble(packet);
|
rle = get_nibble(this, packet);
|
||||||
if (rle < 0x04) {
|
if (rle < 0x04) {
|
||||||
if (rle == 0) {
|
if (rle == 0) {
|
||||||
rle = (rle << 4) | get_nibble(packet);
|
rle = (rle << 4) | get_nibble(this, packet);
|
||||||
if (rle < 0x04)
|
if (rle < 0x04)
|
||||||
rle = (rle << 4) | get_nibble(packet);
|
rle = (rle << 4) | get_nibble(this, packet);
|
||||||
}
|
}
|
||||||
rle = (rle << 4) | get_nibble(packet);
|
rle = (rle << 4) | get_nibble(this, packet);
|
||||||
}
|
}
|
||||||
color = 3 - (rle & 0x3);
|
color = 3 - (rle & 0x3);
|
||||||
len = rle >> 2;
|
len = rle >> 2;
|
||||||
|
@ -371,14 +372,14 @@ static void spudec_process_control(spudec_handle_t *this, int pts100)
|
||||||
start_off = next_off;
|
start_off = next_off;
|
||||||
date = get_be16(this->packet + start_off) * 1024;
|
date = get_be16(this->packet + start_off) * 1024;
|
||||||
next_off = get_be16(this->packet + start_off + 2);
|
next_off = get_be16(this->packet + start_off + 2);
|
||||||
mp_msg(MSGT_SPUDEC,MSGL_DBG2, "date=%d\n", date);
|
MP_DBG(this, "date=%d\n", date);
|
||||||
off = start_off + 4;
|
off = start_off + 4;
|
||||||
for (type = this->packet[off++]; type != 0xff; type = this->packet[off++]) {
|
for (type = this->packet[off++]; type != 0xff; type = this->packet[off++]) {
|
||||||
mp_msg(MSGT_SPUDEC,MSGL_DBG2, "cmd=%d ",type);
|
MP_DBG(this, "cmd=%d ",type);
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
/* Menu ID, 1 byte */
|
/* Menu ID, 1 byte */
|
||||||
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Menu ID\n");
|
MP_DBG(this, "Menu ID\n");
|
||||||
/* shouldn't a Menu ID type force display start? */
|
/* shouldn't a Menu ID type force display start? */
|
||||||
start_pts = pts100 < 0 && -pts100 >= date ? 0 : pts100 + date;
|
start_pts = pts100 < 0 && -pts100 >= date ? 0 : pts100 + date;
|
||||||
end_pts = UINT_MAX;
|
end_pts = UINT_MAX;
|
||||||
|
@ -387,7 +388,7 @@ static void spudec_process_control(spudec_handle_t *this, int pts100)
|
||||||
break;
|
break;
|
||||||
case 0x01:
|
case 0x01:
|
||||||
/* Start display */
|
/* Start display */
|
||||||
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Start display!\n");
|
MP_DBG(this, "Start display!\n");
|
||||||
start_pts = pts100 < 0 && -pts100 >= date ? 0 : pts100 + date;
|
start_pts = pts100 < 0 && -pts100 >= date ? 0 : pts100 + date;
|
||||||
end_pts = UINT_MAX;
|
end_pts = UINT_MAX;
|
||||||
display = 1;
|
display = 1;
|
||||||
|
@ -395,7 +396,7 @@ static void spudec_process_control(spudec_handle_t *this, int pts100)
|
||||||
break;
|
break;
|
||||||
case 0x02:
|
case 0x02:
|
||||||
/* Stop display */
|
/* Stop display */
|
||||||
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Stop display!\n");
|
MP_DBG(this, "Stop display!\n");
|
||||||
end_pts = pts100 < 0 && -pts100 >= date ? 0 : pts100 + date;
|
end_pts = pts100 < 0 && -pts100 >= date ? 0 : pts100 + date;
|
||||||
break;
|
break;
|
||||||
case 0x03:
|
case 0x03:
|
||||||
|
@ -404,7 +405,7 @@ static void spudec_process_control(spudec_handle_t *this, int pts100)
|
||||||
this->palette[1] = this->packet[off] & 0xf;
|
this->palette[1] = this->packet[off] & 0xf;
|
||||||
this->palette[2] = this->packet[off + 1] >> 4;
|
this->palette[2] = this->packet[off + 1] >> 4;
|
||||||
this->palette[3] = this->packet[off + 1] & 0xf;
|
this->palette[3] = this->packet[off + 1] & 0xf;
|
||||||
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Palette %d, %d, %d, %d\n",
|
MP_DBG(this, "Palette %d, %d, %d, %d\n",
|
||||||
this->palette[0], this->palette[1], this->palette[2], this->palette[3]);
|
this->palette[0], this->palette[1], this->palette[2], this->palette[3]);
|
||||||
off+=2;
|
off+=2;
|
||||||
break;
|
break;
|
||||||
|
@ -426,7 +427,7 @@ static void spudec_process_control(spudec_handle_t *this, int pts100)
|
||||||
this->alpha[1] = b;
|
this->alpha[1] = b;
|
||||||
this->alpha[2] = c;
|
this->alpha[2] = c;
|
||||||
this->alpha[3] = d;
|
this->alpha[3] = d;
|
||||||
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Alpha %d, %d, %d, %d\n",
|
MP_DBG(this, "Alpha %d, %d, %d, %d\n",
|
||||||
this->alpha[0], this->alpha[1], this->alpha[2], this->alpha[3]);
|
this->alpha[0], this->alpha[1], this->alpha[2], this->alpha[3]);
|
||||||
off+=2;
|
off+=2;
|
||||||
break;
|
break;
|
||||||
|
@ -441,7 +442,7 @@ static void spudec_process_control(spudec_handle_t *this, int pts100)
|
||||||
start_row = b >> 12;
|
start_row = b >> 12;
|
||||||
end_row = b & 0xfff;
|
end_row = b & 0xfff;
|
||||||
height = (end_row < start_row) ? 0 : end_row - start_row /* + 1 */;
|
height = (end_row < start_row) ? 0 : end_row - start_row /* + 1 */;
|
||||||
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Coords col: %d - %d row: %d - %d (%dx%d)\n",
|
MP_DBG(this, "Coords col: %d - %d row: %d - %d (%dx%d)\n",
|
||||||
start_col, end_col, start_row, end_row,
|
start_col, end_col, start_row, end_row,
|
||||||
width, height);
|
width, height);
|
||||||
off+=6;
|
off+=6;
|
||||||
|
@ -450,12 +451,12 @@ static void spudec_process_control(spudec_handle_t *this, int pts100)
|
||||||
/* Graphic lines */
|
/* Graphic lines */
|
||||||
current_nibble[0] = 2 * get_be16(this->packet + off);
|
current_nibble[0] = 2 * get_be16(this->packet + off);
|
||||||
current_nibble[1] = 2 * get_be16(this->packet + off + 2);
|
current_nibble[1] = 2 * get_be16(this->packet + off + 2);
|
||||||
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Graphic offset 1: %d offset 2: %d\n",
|
MP_DBG(this, "Graphic offset 1: %d offset 2: %d\n",
|
||||||
current_nibble[0] / 2, current_nibble[1] / 2);
|
current_nibble[0] / 2, current_nibble[1] / 2);
|
||||||
off+=4;
|
off+=4;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mp_msg(MSGT_SPUDEC,MSGL_WARN,"spudec: Error determining control type 0x%02x. Skipping %d bytes.\n",
|
MP_WARN(this, "spudec: Error determining control type 0x%02x. Skipping %d bytes.\n",
|
||||||
type, next_off - off);
|
type, next_off - off);
|
||||||
goto next_control;
|
goto next_control;
|
||||||
}
|
}
|
||||||
|
@ -502,12 +503,13 @@ int spudec_changed(void * this)
|
||||||
return spu->spu_changed || spu->now_pts > spu->end_pts;
|
return spu->spu_changed || spu->now_pts > spu->end_pts;
|
||||||
}
|
}
|
||||||
|
|
||||||
void spudec_assemble(void *this, unsigned char *packet, unsigned int len, int pts100)
|
void spudec_assemble(void *idontknowc, unsigned char *packet, unsigned int len, int pts100)
|
||||||
{
|
{
|
||||||
|
spudec_handle_t *this = idontknowc;
|
||||||
spudec_handle_t *spu = this;
|
spudec_handle_t *spu = this;
|
||||||
// spudec_heartbeat(this, pts100);
|
// spudec_heartbeat(this, pts100);
|
||||||
if (len < 2) {
|
if (len < 2) {
|
||||||
mp_msg(MSGT_SPUDEC,MSGL_WARN,"SPUasm: packet too short\n");
|
MP_WARN(this, "SPUasm: packet too short\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
spu->packet_pts = pts100;
|
spu->packet_pts = pts100;
|
||||||
|
@ -522,7 +524,7 @@ void spudec_assemble(void *this, unsigned char *packet, unsigned int len, int pt
|
||||||
if (spu->packet != NULL) {
|
if (spu->packet != NULL) {
|
||||||
spu->packet_size = len2;
|
spu->packet_size = len2;
|
||||||
if (len > len2) {
|
if (len > len2) {
|
||||||
mp_msg(MSGT_SPUDEC,MSGL_WARN,"SPUasm: invalid frag len / len2: %d / %d \n", len, len2);
|
MP_WARN(this, "SPUasm: invalid frag len / len2: %d / %d \n", len, len2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memcpy(spu->packet, packet, len);
|
memcpy(spu->packet, packet, len);
|
||||||
|
@ -532,7 +534,7 @@ void spudec_assemble(void *this, unsigned char *packet, unsigned int len, int pt
|
||||||
} else {
|
} else {
|
||||||
// Continue current fragment
|
// Continue current fragment
|
||||||
if (spu->packet_size < spu->packet_offset + len){
|
if (spu->packet_size < spu->packet_offset + len){
|
||||||
mp_msg(MSGT_SPUDEC,MSGL_WARN,"SPUasm: invalid fragment\n");
|
MP_WARN(this, "SPUasm: invalid fragment\n");
|
||||||
spu->packet_size = spu->packet_offset = 0;
|
spu->packet_size = spu->packet_offset = 0;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
@ -549,16 +551,16 @@ void spudec_assemble(void *this, unsigned char *packet, unsigned int len, int pt
|
||||||
unsigned int x=0,y;
|
unsigned int x=0,y;
|
||||||
while(x+4<=spu->packet_offset){
|
while(x+4<=spu->packet_offset){
|
||||||
y=get_be16(spu->packet+x+2); // next control pointer
|
y=get_be16(spu->packet+x+2); // next control pointer
|
||||||
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"SPUtest: x=%d y=%d off=%d size=%d\n",x,y,spu->packet_offset,spu->packet_size);
|
MP_DBG(this, "SPUtest: x=%d y=%d off=%d size=%d\n",x,y,spu->packet_offset,spu->packet_size);
|
||||||
if(x>=4 && x==y){ // if it points to self - we're done!
|
if(x>=4 && x==y){ // if it points to self - we're done!
|
||||||
// we got it!
|
// we got it!
|
||||||
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"SPUgot: off=%d size=%d \n",spu->packet_offset,spu->packet_size);
|
MP_DBG(this, "SPUgot: off=%d size=%d \n",spu->packet_offset,spu->packet_size);
|
||||||
spudec_decode(spu, pts100);
|
spudec_decode(spu, pts100);
|
||||||
spu->packet_offset = 0;
|
spu->packet_offset = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(y<=x || y>=spu->packet_size){ // invalid?
|
if(y<=x || y>=spu->packet_size){ // invalid?
|
||||||
mp_msg(MSGT_SPUDEC,MSGL_WARN,"SPUtest: broken packet!!!!! y=%d < x=%d\n",y,x);
|
MP_WARN(this, "SPUtest: broken packet!!!!! y=%d < x=%d\n",y,x);
|
||||||
spu->packet_size = spu->packet_offset = 0;
|
spu->packet_size = spu->packet_offset = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -750,10 +752,11 @@ static void spudec_parse_extradata(spudec_handle_t *this,
|
||||||
free(buffer);
|
free(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *spudec_new_scaled(unsigned int frame_width, unsigned int frame_height, uint8_t *extradata, int extradata_len)
|
void *spudec_new_scaled(struct mp_log *log, unsigned int frame_width, unsigned int frame_height, uint8_t *extradata, int extradata_len)
|
||||||
{
|
{
|
||||||
spudec_handle_t *this = calloc(1, sizeof(spudec_handle_t));
|
spudec_handle_t *this = calloc(1, sizeof(spudec_handle_t));
|
||||||
if (this){
|
if (this){
|
||||||
|
this->log = log;
|
||||||
this->orig_frame_height = frame_height;
|
this->orig_frame_height = frame_height;
|
||||||
this->orig_frame_width = frame_width;
|
this->orig_frame_width = frame_width;
|
||||||
// set up palette:
|
// set up palette:
|
||||||
|
@ -773,7 +776,7 @@ void *spudec_new_scaled(unsigned int frame_width, unsigned int frame_height, uin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mp_msg(MSGT_SPUDEC,MSGL_FATAL, "FATAL: spudec_init: calloc");
|
MP_FATAL(this, "FATAL: spudec_init: calloc");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,11 +23,12 @@
|
||||||
|
|
||||||
struct sub_bitmaps;
|
struct sub_bitmaps;
|
||||||
struct mp_osd_res;
|
struct mp_osd_res;
|
||||||
|
struct mp_log;
|
||||||
|
|
||||||
void spudec_heartbeat(void *this, unsigned int pts100);
|
void spudec_heartbeat(void *this, unsigned int pts100);
|
||||||
void spudec_assemble(void *this, unsigned char *packet, unsigned int len, int pts100);
|
void spudec_assemble(void *this, unsigned char *packet, unsigned int len, int pts100);
|
||||||
void spudec_get_indexed(void *this, struct mp_osd_res *dim, double xstretch, double ystretch, struct sub_bitmaps *res);
|
void spudec_get_indexed(void *this, struct mp_osd_res *dim, double xstretch, double ystretch, struct sub_bitmaps *res);
|
||||||
void *spudec_new_scaled(unsigned int frame_width, unsigned int frame_height, uint8_t *extradata, int extradata_len);
|
void *spudec_new_scaled(struct mp_log *log, unsigned int frame_width, unsigned int frame_height, uint8_t *extradata, int extradata_len);
|
||||||
void spudec_free(void *this);
|
void spudec_free(void *this);
|
||||||
void spudec_reset(void *this); // called after seek
|
void spudec_reset(void *this); // called after seek
|
||||||
int spudec_visible(void *this); // check if spu is visible
|
int spudec_visible(void *this); // check if spu is visible
|
||||||
|
|
Loading…
Reference in New Issue