1
mirror of https://github.com/mpv-player/mpv synced 2024-11-03 03:19:24 +01:00

cleanup: rename ass_* functions to mp_ass_*

The various ass_* functions were created when libass was part of the
MPlayer tree and the distinction between MPlayer-specific and other
functions was less clear. Now that libass is a clearly separate
library, using the same ass_* namespace for player functions is ugly.
Rename the functions to use mp_ass_ prefix instead.
This commit is contained in:
Uoti Urpala 2011-01-20 18:47:18 +02:00
parent 966340b31a
commit a248c2c7a1
6 changed files with 38 additions and 37 deletions

View File

@ -72,7 +72,7 @@ static char *sub_cp = 0;
void process_force_style(ASS_Track *track); void process_force_style(ASS_Track *track);
ASS_Track *ass_default_track(ASS_Library *library) ASS_Track *mp_ass_default_track(ASS_Library *library)
{ {
ASS_Track *track = ass_new_track(library); ASS_Track *track = ass_new_track(library);
@ -211,13 +211,13 @@ static int ass_process_subtitle(ASS_Track *track, subtitle *sub)
* \param fps video framerate * \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 *ass_read_subdata(ASS_Library *library, sub_data *subdata, ASS_Track *mp_ass_read_subdata(ASS_Library *library, sub_data *subdata,
double fps) double fps)
{ {
ASS_Track *track; ASS_Track *track;
int i; int i;
track = ass_default_track(library); track = mp_ass_default_track(library);
track->name = subdata->filename ? strdup(subdata->filename) : 0; track->name = subdata->filename ? strdup(subdata->filename) : 0;
for (i = 0; i < subdata->sub_num; ++i) { for (i = 0; i < subdata->sub_num; ++i) {
@ -232,7 +232,8 @@ ASS_Track *ass_read_subdata(ASS_Library *library, sub_data *subdata,
return track; return track;
} }
ASS_Track *ass_read_stream(ASS_Library *library, const char *fname, char *charset) ASS_Track *mp_ass_read_stream(ASS_Library *library, const char *fname,
char *charset)
{ {
int i; int i;
char *buf = NULL; char *buf = NULL;
@ -281,7 +282,7 @@ ASS_Track *ass_read_stream(ASS_Library *library, const char *fname, char *charse
return track; return track;
} }
void ass_configure(ASS_Renderer *priv, int w, int h, bool unscaled) void mp_ass_configure(ASS_Renderer *priv, int w, int h, bool unscaled)
{ {
int hinting; int hinting;
ass_set_frame_size(priv, w, h); ass_set_frame_size(priv, w, h);
@ -296,7 +297,7 @@ void ass_configure(ASS_Renderer *priv, int w, int h, bool unscaled)
ass_set_line_spacing(priv, ass_line_spacing); ass_set_line_spacing(priv, ass_line_spacing);
} }
void ass_configure_fonts(ASS_Renderer *priv) void mp_ass_configure_fonts(ASS_Renderer *priv)
{ {
char *dir, *path, *family; char *dir, *path, *family;
dir = get_path("fonts"); dir = get_path("fonts");
@ -328,7 +329,7 @@ static void message_callback(int level, const char *format, va_list va, void *ct
mp_msg(MSGT_ASS, level, "\n"); mp_msg(MSGT_ASS, level, "\n");
} }
ASS_Library *ass_init(void) ASS_Library *mp_ass_init(void)
{ {
ASS_Library *priv; ASS_Library *priv;
char *path = get_path("fonts"); char *path = get_path("fonts");
@ -343,7 +344,7 @@ ASS_Library *ass_init(void)
int ass_force_reload = 0; // flag set if global ass-related settings were changed int ass_force_reload = 0; // flag set if global ass-related settings were changed
ASS_Image *ass_mp_render_frame(ASS_Renderer *priv, ASS_Track *track, ASS_Image *mp_ass_render_frame(ASS_Renderer *priv, ASS_Track *track,
long long now, int *detect_change) long long now, int *detect_change)
{ {
if (ass_force_reload) { if (ass_force_reload) {

View File

@ -44,18 +44,18 @@ extern char *ass_border_color;
extern char *ass_styles_file; extern char *ass_styles_file;
extern int ass_hinting; extern int ass_hinting;
ASS_Track *ass_default_track(ASS_Library *library); ASS_Track *mp_ass_default_track(ASS_Library *library);
ASS_Track *ass_read_subdata(ASS_Library *library, sub_data *subdata, ASS_Track *mp_ass_read_subdata(ASS_Library *library, sub_data *subdata,
double fps); double fps);
ASS_Track *ass_read_stream(ASS_Library *library, const char *fname, ASS_Track *mp_ass_read_stream(ASS_Library *library, const char *fname,
char *charset); char *charset);
void ass_configure(ASS_Renderer *priv, int w, int h, bool unscaled); void mp_ass_configure(ASS_Renderer *priv, int w, int h, bool unscaled);
void ass_configure_fonts(ASS_Renderer *priv); void mp_ass_configure_fonts(ASS_Renderer *priv);
ASS_Library *ass_init(void); ASS_Library *mp_ass_init(void);
extern int ass_force_reload; extern int ass_force_reload;
ASS_Image *ass_mp_render_frame(ASS_Renderer *priv, ASS_Track *track, ASS_Image *mp_ass_render_frame(ASS_Renderer *priv, ASS_Track *track,
long long now, int *detect_change); long long now, int *detect_change);
#else /* CONFIG_ASS */ #else /* CONFIG_ASS */

View File

@ -94,10 +94,10 @@ static int config(struct vf_instance *vf,
vf->priv->line_limits = malloc((vf->priv->outh + 1) / 2 * sizeof(*vf->priv->line_limits)); vf->priv->line_limits = malloc((vf->priv->outh + 1) / 2 * sizeof(*vf->priv->line_limits));
if (vf->priv->renderer_realaspect) { if (vf->priv->renderer_realaspect) {
ass_configure(vf->priv->renderer_realaspect, mp_ass_configure(vf->priv->renderer_realaspect,
vf->priv->outw, vf->priv->outh, 0); vf->priv->outw, vf->priv->outh, 0);
ass_configure(vf->priv->renderer_vsfilter, mp_ass_configure(vf->priv->renderer_vsfilter,
vf->priv->outw, vf->priv->outh, 0); vf->priv->outw, vf->priv->outh, 0);
ass_set_aspect_ratio(vf->priv->renderer_realaspect, ass_set_aspect_ratio(vf->priv->renderer_realaspect,
(double)width / height * d_height / d_width, 1); (double)width / height * d_height / d_width, 1);
ass_set_aspect_ratio(vf->priv->renderer_vsfilter, 1, 1); ass_set_aspect_ratio(vf->priv->renderer_vsfilter, 1, 1);
@ -361,7 +361,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
vf->priv->renderer_vsfilter : vf->priv->renderer_realaspect; vf->priv->renderer_vsfilter : vf->priv->renderer_realaspect;
if (sub_visibility && renderer && vf->priv->osd->ass_track if (sub_visibility && renderer && vf->priv->osd->ass_track
&& (pts != MP_NOPTS_VALUE)) && (pts != MP_NOPTS_VALUE))
images = ass_mp_render_frame(renderer, images = mp_ass_render_frame(renderer,
vf->priv->osd->ass_track, vf->priv->osd->ass_track,
(pts + sub_delay) * 1000 + .5, NULL); (pts + sub_delay) * 1000 + .5, NULL);
@ -398,8 +398,8 @@ static int control(vf_instance_t *vf, int request, void *data)
ass_renderer_done(vf->priv->renderer_realaspect); ass_renderer_done(vf->priv->renderer_realaspect);
return CONTROL_FALSE; return CONTROL_FALSE;
} }
ass_configure_fonts(vf->priv->renderer_realaspect); mp_ass_configure_fonts(vf->priv->renderer_realaspect);
ass_configure_fonts(vf->priv->renderer_vsfilter); mp_ass_configure_fonts(vf->priv->renderer_vsfilter);
return CONTROL_TRUE; return CONTROL_TRUE;
case VFCTRL_DRAW_EOSD: case VFCTRL_DRAW_EOSD:
if (vf->priv->renderer_realaspect) if (vf->priv->renderer_realaspect)

View File

@ -85,10 +85,10 @@ static int config(struct vf_instance *vf,
vf->priv->scale_ratio = (double) d_width / d_height * height / width; vf->priv->scale_ratio = (double) d_width / d_height * height / width;
if (vf->priv->renderer_realaspect) { if (vf->priv->renderer_realaspect) {
ass_configure(vf->priv->renderer_realaspect, width, height, mp_ass_configure(vf->priv->renderer_realaspect, width, height,
vf->default_caps & VFCAP_EOSD_UNSCALED); vf->default_caps & VFCAP_EOSD_UNSCALED);
ass_configure(vf->priv->renderer_vsfilter, width, height, mp_ass_configure(vf->priv->renderer_vsfilter, width, height,
vf->default_caps & VFCAP_EOSD_UNSCALED); vf->default_caps & VFCAP_EOSD_UNSCALED);
} }
#endif #endif
@ -143,8 +143,8 @@ static int control(struct vf_instance *vf, int request, void* data)
ass_renderer_done(vf->priv->renderer_realaspect); ass_renderer_done(vf->priv->renderer_realaspect);
return CONTROL_FALSE; return CONTROL_FALSE;
} }
ass_configure_fonts(vf->priv->renderer_realaspect); mp_ass_configure_fonts(vf->priv->renderer_realaspect);
ass_configure_fonts(vf->priv->renderer_vsfilter); mp_ass_configure_fonts(vf->priv->renderer_vsfilter);
vf->priv->prev_visibility = false; vf->priv->prev_visibility = false;
return CONTROL_TRUE; return CONTROL_TRUE;
} }
@ -175,7 +175,7 @@ static int control(struct vf_instance *vf, int request, void* data)
ass_set_aspect_ratio(renderer, scale, 1); ass_set_aspect_ratio(renderer, scale, 1);
} }
images.imgs = ass_mp_render_frame(renderer, images.imgs = mp_ass_render_frame(renderer,
osd->ass_track, osd->ass_track,
(pts+sub_delay) * 1000 + .5, (pts+sub_delay) * 1000 + .5,
&images.changed); &images.changed);

View File

@ -1100,15 +1100,15 @@ void add_subtitles(struct MPContext *mpctx, char *filename, float fps, int noerr
#ifdef CONFIG_ASS #ifdef CONFIG_ASS
if (opts->ass_enabled) { if (opts->ass_enabled) {
#ifdef CONFIG_ICONV #ifdef CONFIG_ICONV
asst = ass_read_stream(ass_library, filename, sub_cp); asst = mp_ass_read_stream(ass_library, filename, sub_cp);
#else #else
asst = ass_read_stream(ass_library, filename, 0); asst = mp_ass_read_stream(ass_library, filename, 0);
#endif #endif
is_native_ass = asst; is_native_ass = asst;
if (!asst) { if (!asst) {
subd = sub_read_file(filename, fps, &mpctx->opts); subd = sub_read_file(filename, fps, &mpctx->opts);
if (subd) { if (subd) {
asst = ass_read_subdata(ass_library, subd, fps); asst = mp_ass_read_subdata(ass_library, subd, fps);
sub_free(subd); sub_free(subd);
subd = NULL; subd = NULL;
} }
@ -4091,7 +4091,7 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){
#endif #endif
#ifdef CONFIG_ASS #ifdef CONFIG_ASS
ass_library = ass_init(); ass_library = mp_ass_init();
#endif #endif
#ifdef HAVE_RTC #ifdef HAVE_RTC

View File

@ -57,7 +57,7 @@ static void init(struct sh_sub *sh, struct osd_state *osd)
ass_process_codec_private(ctx->ass_track, sh->extradata, ass_process_codec_private(ctx->ass_track, sh->extradata,
sh->extradata_len); sh->extradata_len);
} else } else
ctx->ass_track = ass_default_track(ass_library); ctx->ass_track = mp_ass_default_track(ass_library);
} }
assert(osd->ass_track == NULL); assert(osd->ass_track == NULL);