mirror of
https://github.com/mpv-player/mpv
synced 2024-12-23 07:12:39 +00:00
Change type names to match upstream libass
This commit is contained in:
parent
4a36b51ea6
commit
1e98ef7789
44
ass_mp.c
44
ass_mp.c
@ -36,7 +36,7 @@
|
||||
#endif
|
||||
|
||||
// libass-related command line options
|
||||
ass_library_t *ass_library;
|
||||
ASS_Library *ass_library;
|
||||
int ass_enabled = 0;
|
||||
float ass_font_scale = 1.;
|
||||
float ass_line_spacing = 0.;
|
||||
@ -70,11 +70,11 @@ extern char *sub_cp;
|
||||
static char *sub_cp = 0;
|
||||
#endif
|
||||
|
||||
void process_force_style(ass_track_t *track);
|
||||
void process_force_style(ASS_Track *track);
|
||||
|
||||
ass_track_t *ass_default_track(ass_library_t *library)
|
||||
ASS_Track *ass_default_track(ASS_Library *library)
|
||||
{
|
||||
ass_track_t *track = ass_new_track(library);
|
||||
ASS_Track *track = ass_new_track(library);
|
||||
|
||||
track->track_type = TRACK_TYPE_ASS;
|
||||
track->Timer = 100.;
|
||||
@ -85,7 +85,7 @@ ass_track_t *ass_default_track(ass_library_t *library)
|
||||
ass_read_styles(track, ass_styles_file, sub_cp);
|
||||
|
||||
if (track->n_styles == 0) {
|
||||
ass_style_t *style;
|
||||
ASS_Style *style;
|
||||
int sid;
|
||||
double fs;
|
||||
uint32_t c1, c2;
|
||||
@ -134,10 +134,10 @@ ass_track_t *ass_default_track(ass_library_t *library)
|
||||
return track;
|
||||
}
|
||||
|
||||
static int check_duplicate_plaintext_event(ass_track_t *track)
|
||||
static int check_duplicate_plaintext_event(ASS_Track *track)
|
||||
{
|
||||
int i;
|
||||
ass_event_t *evt = track->events + track->n_events - 1;
|
||||
ASS_Event *evt = track->events + track->n_events - 1;
|
||||
|
||||
for (i = 0; i < track->n_events - 1; ++i) // ignoring last event, it is the one we are comparing with
|
||||
if (track->events[i].Start == evt->Start &&
|
||||
@ -148,17 +148,17 @@ static int check_duplicate_plaintext_event(ass_track_t *track)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Convert subtitle to ass_event_t for the given track
|
||||
* \param ass_track_t track
|
||||
* \brief Convert subtitle to ASS_Events for the given track
|
||||
* \param track track
|
||||
* \param sub subtitle to convert
|
||||
* \return event id
|
||||
* note: assumes that subtitle is _not_ fps-based; caller must manually correct
|
||||
* Start and Duration in other case.
|
||||
**/
|
||||
int ass_process_subtitle(ass_track_t *track, subtitle *sub)
|
||||
int ass_process_subtitle(ASS_Track *track, subtitle *sub)
|
||||
{
|
||||
int eid;
|
||||
ass_event_t *event;
|
||||
ASS_Event *event;
|
||||
int len = 0, j;
|
||||
char *p;
|
||||
char *end;
|
||||
@ -206,15 +206,15 @@ int ass_process_subtitle(ass_track_t *track, subtitle *sub)
|
||||
|
||||
|
||||
/**
|
||||
* \brief Convert subdata to ass_track
|
||||
* \brief Convert subdata to ASS_Track
|
||||
* \param subdata subtitles struct from subreader
|
||||
* \param fps video framerate
|
||||
* \return newly allocated ass_track, filled with subtitles from subdata
|
||||
* \return newly allocated ASS_Track, filled with subtitles from subdata
|
||||
*/
|
||||
ass_track_t *ass_read_subdata(ass_library_t *library, sub_data *subdata,
|
||||
double fps)
|
||||
ASS_Track *ass_read_subdata(ASS_Library *library, sub_data *subdata,
|
||||
double fps)
|
||||
{
|
||||
ass_track_t *track;
|
||||
ASS_Track *track;
|
||||
int i;
|
||||
|
||||
track = ass_default_track(library);
|
||||
@ -232,7 +232,7 @@ ass_track_t *ass_read_subdata(ass_library_t *library, sub_data *subdata,
|
||||
return track;
|
||||
}
|
||||
|
||||
void ass_configure(ass_renderer_t *priv, int w, int h, int unscaled)
|
||||
void ass_configure(ASS_Renderer *priv, int w, int h, int unscaled)
|
||||
{
|
||||
int hinting;
|
||||
ass_set_frame_size(priv, w, h);
|
||||
@ -247,7 +247,7 @@ void ass_configure(ass_renderer_t *priv, int w, int h, int unscaled)
|
||||
ass_set_line_spacing(priv, ass_line_spacing);
|
||||
}
|
||||
|
||||
void ass_configure_fonts(ass_renderer_t *priv)
|
||||
void ass_configure_fonts(ASS_Renderer *priv)
|
||||
{
|
||||
char *dir, *path, *family;
|
||||
dir = get_path("fonts");
|
||||
@ -279,9 +279,9 @@ static void message_callback(int level, const char *format, va_list va, void *ct
|
||||
mp_msg(MSGT_ASS, level, "\n");
|
||||
}
|
||||
|
||||
ass_library_t *ass_init(void)
|
||||
ASS_Library *ass_init(void)
|
||||
{
|
||||
ass_library_t *priv;
|
||||
ASS_Library *priv;
|
||||
char *path = get_path("fonts");
|
||||
priv = ass_library_init();
|
||||
ass_set_message_cb(priv, message_callback, NULL);
|
||||
@ -294,8 +294,8 @@ ass_library_t *ass_init(void)
|
||||
|
||||
int ass_force_reload = 0; // flag set if global ass-related settings were changed
|
||||
|
||||
ass_image_t *ass_mp_render_frame(ass_renderer_t *priv, ass_track_t *track,
|
||||
long long now, int *detect_change)
|
||||
ASS_Image *ass_mp_render_frame(ASS_Renderer *priv, ASS_Track *track,
|
||||
long long now, int *detect_change)
|
||||
{
|
||||
if (ass_force_reload) {
|
||||
ass_set_margins(priv, ass_top_margin, ass_bottom_margin, 0, 0);
|
||||
|
24
ass_mp.h
24
ass_mp.h
@ -31,7 +31,7 @@
|
||||
#include <ass/ass.h>
|
||||
#include <ass/ass_types.h>
|
||||
|
||||
extern ass_library_t *ass_library;
|
||||
extern ASS_Library *ass_library;
|
||||
extern int ass_enabled;
|
||||
extern float ass_font_scale;
|
||||
extern float ass_line_spacing;
|
||||
@ -45,18 +45,18 @@ extern char *ass_border_color;
|
||||
extern char *ass_styles_file;
|
||||
extern int ass_hinting;
|
||||
|
||||
ass_track_t *ass_default_track(ass_library_t *library);
|
||||
int ass_process_subtitle(ass_track_t *track, subtitle *sub);
|
||||
ass_track_t *ass_read_subdata(ass_library_t *library, sub_data *subdata,
|
||||
double fps);
|
||||
ASS_Track *ass_default_track(ASS_Library *library);
|
||||
int ass_process_subtitle(ASS_Track *track, subtitle *sub);
|
||||
ASS_Track *ass_read_subdata(ASS_Library *library, sub_data *subdata,
|
||||
double fps);
|
||||
|
||||
void ass_configure(ass_renderer_t *priv, int w, int h, int hinting);
|
||||
void ass_configure_fonts(ass_renderer_t *priv);
|
||||
ass_library_t *ass_init(void);
|
||||
void ass_configure(ASS_Renderer *priv, int w, int h, int hinting);
|
||||
void ass_configure_fonts(ASS_Renderer *priv);
|
||||
ASS_Library *ass_init(void);
|
||||
|
||||
extern int ass_force_reload;
|
||||
ass_image_t *ass_mp_render_frame(ass_renderer_t *priv, ass_track_t *track,
|
||||
long long now, int *detect_change);
|
||||
ASS_Image *ass_mp_render_frame(ASS_Renderer *priv, ASS_Track *track,
|
||||
long long now, int *detect_change);
|
||||
|
||||
#else /* CONFIG_ASS */
|
||||
|
||||
@ -69,12 +69,12 @@ typedef struct ass_image {
|
||||
uint32_t color;
|
||||
int dst_x, dst_y;
|
||||
struct ass_image *next;
|
||||
} ass_image_t;
|
||||
} ASS_Image;
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
ass_image_t *imgs;
|
||||
ASS_Image *imgs;
|
||||
int changed;
|
||||
} mp_eosd_images_t;
|
||||
|
||||
|
@ -62,7 +62,7 @@ static const struct vf_priv_s {
|
||||
// 0 = insert always
|
||||
int auto_insert;
|
||||
|
||||
ass_renderer_t* ass_priv;
|
||||
ASS_Renderer* ass_priv;
|
||||
|
||||
unsigned char* planes[3];
|
||||
struct line_limits {
|
||||
@ -71,7 +71,7 @@ static const struct vf_priv_s {
|
||||
} *line_limits;
|
||||
} vf_priv_dflt;
|
||||
|
||||
extern ass_track_t* ass_track;
|
||||
extern ASS_Track *ass_track;
|
||||
extern float sub_delay;
|
||||
extern int sub_visibility;
|
||||
|
||||
@ -309,12 +309,12 @@ static void my_draw_bitmap(struct vf_instance* vf, unsigned char* bitmap, int bi
|
||||
}
|
||||
}
|
||||
|
||||
static int render_frame(struct vf_instance* vf, mp_image_t *mpi, const ass_image_t* img)
|
||||
static int render_frame(struct vf_instance* vf, mp_image_t *mpi, const ASS_Image *img)
|
||||
{
|
||||
if (img) {
|
||||
for (int i = 0; i < (vf->priv->outh + 1) / 2; i++)
|
||||
vf->priv->line_limits[i] = (struct line_limits){65535, 0};
|
||||
for (const ass_image_t *im = img; im; im = im->next)
|
||||
for (const ASS_Image *im = img; im; im = im->next)
|
||||
update_limits(vf, im->dst_y, im->dst_y + im->h, im->dst_x, im->dst_x + im->w);
|
||||
copy_from_image(vf);
|
||||
while (img) {
|
||||
@ -329,7 +329,7 @@ static int render_frame(struct vf_instance* vf, mp_image_t *mpi, const ass_image
|
||||
|
||||
static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
|
||||
{
|
||||
ass_image_t* images = 0;
|
||||
ASS_Image* images = 0;
|
||||
if (sub_visibility && vf->priv->ass_priv && ass_track && (pts != MP_NOPTS_VALUE))
|
||||
images = ass_mp_render_frame(vf->priv->ass_priv, ass_track, (pts+sub_delay) * 1000 + .5, NULL);
|
||||
|
||||
@ -354,7 +354,7 @@ static int control(vf_instance_t *vf, int request, void *data)
|
||||
{
|
||||
switch (request) {
|
||||
case VFCTRL_INIT_EOSD:
|
||||
vf->priv->ass_priv = ass_renderer_init((ass_library_t*)data);
|
||||
vf->priv->ass_priv = ass_renderer_init((ASS_Library*)data);
|
||||
if (!vf->priv->ass_priv) return CONTROL_FALSE;
|
||||
ass_configure_fonts(vf->priv->ass_priv);
|
||||
return CONTROL_TRUE;
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#ifdef CONFIG_ASS
|
||||
#include "ass_mp.h"
|
||||
extern ass_track_t* ass_track;
|
||||
extern ASS_Track *ass_track;
|
||||
#endif
|
||||
|
||||
//===========================================================================//
|
||||
@ -25,7 +25,7 @@ struct vf_priv_s {
|
||||
double pts;
|
||||
struct vo *vo;
|
||||
#ifdef CONFIG_ASS
|
||||
ass_renderer_t* ass_priv;
|
||||
ASS_Renderer *ass_priv;
|
||||
int prev_visibility;
|
||||
double scale_ratio;
|
||||
#endif
|
||||
@ -118,7 +118,7 @@ static int control(struct vf_instance* vf, int request, void* data)
|
||||
#ifdef CONFIG_ASS
|
||||
case VFCTRL_INIT_EOSD:
|
||||
{
|
||||
vf->priv->ass_priv = ass_renderer_init((ass_library_t*)data);
|
||||
vf->priv->ass_priv = ass_renderer_init((ASS_Library*)data);
|
||||
if (!vf->priv->ass_priv) return CONTROL_FALSE;
|
||||
ass_configure_fonts(vf->priv->ass_priv);
|
||||
vf->priv->prev_visibility = 0;
|
||||
|
@ -289,11 +289,11 @@ static void clearEOSD(void) {
|
||||
|
||||
static void do_render_osd(int);
|
||||
|
||||
static inline int is_tinytex(ass_image_t *i, int tinytexcur) {
|
||||
static inline int is_tinytex(ASS_Image *i, int tinytexcur) {
|
||||
return i->w < TINYTEX_SIZE && i->h < TINYTEX_SIZE && tinytexcur < TINYTEX_MAX;
|
||||
}
|
||||
|
||||
static inline int is_smalltex(ass_image_t *i, int smalltexcur) {
|
||||
static inline int is_smalltex(ASS_Image *i, int smalltexcur) {
|
||||
return i->w < SMALLTEX_SIZE && i->h < SMALLTEX_SIZE && smalltexcur < SMALLTEX_MAX;
|
||||
}
|
||||
|
||||
@ -318,8 +318,8 @@ static void genEOSD(mp_eosd_images_t *imgs) {
|
||||
int smalltexcur = 0;
|
||||
GLuint *curtex;
|
||||
GLint scale_type = scaled_osd ? GL_LINEAR : GL_NEAREST;
|
||||
ass_image_t *img = imgs->imgs;
|
||||
ass_image_t *i;
|
||||
ASS_Image *img = imgs->imgs;
|
||||
ASS_Image *i;
|
||||
|
||||
if (imgs->changed == 0) // there are elements, but they are unchanged
|
||||
return;
|
||||
|
@ -733,8 +733,8 @@ static void generate_eosd(mp_eosd_images_t *imgs) {
|
||||
VdpStatus vdp_st;
|
||||
VdpRect destRect;
|
||||
int j, found;
|
||||
ass_image_t *img = imgs->imgs;
|
||||
ass_image_t *i;
|
||||
ASS_Image *img = imgs->imgs;
|
||||
ASS_Image *i;
|
||||
|
||||
// Nothing changed, no need to redraw
|
||||
if (imgs->changed == 0)
|
||||
|
@ -23,7 +23,7 @@ double sub_last_pts = -303;
|
||||
|
||||
#ifdef CONFIG_ASS
|
||||
#include "ass_mp.h"
|
||||
ass_track_t* ass_track = 0; // current track to render
|
||||
ASS_Track *ass_track = 0; // current track to render
|
||||
#endif
|
||||
|
||||
sub_data* subdata = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user