changeset 31792:55dacfca4a43

Rename libass types to match upstream libass >= 0.9.7
author greg
date Fri, 30 Jul 2010 18:14:35 +0000
parents d6549cdf9c95
children 9fdee6f96925
files command.c libass/ass_mp.c libass/ass_mp.h libmpcodecs/vf_ass.c libmpcodecs/vf_vo.c libmpdemux/stheader.h libvo/vo_gl.c libvo/vo_vdpau.c mencoder.c mp_core.h mpcommon.c mpcommon.h mplayer.c
diffstat 13 files changed, 57 insertions(+), 64 deletions(-) [+]
line wrap: on
line diff
--- a/command.c	Fri Jul 30 17:02:58 2010 +0000
+++ b/command.c	Fri Jul 30 18:14:35 2010 +0000
@@ -2425,7 +2425,7 @@
     int after = mpctx->set_of_sub_size - end;
     sub_data **subs = mpctx->set_of_subtitles;
 #ifdef CONFIG_ASS
-    ass_track_t **ass_tracks = mpctx->set_of_ass_tracks;
+    ASS_Track **ass_tracks = mpctx->set_of_ass_tracks;
 #endif
     if (count < 0 || count > mpctx->set_of_sub_size ||
         start < 0 || start > mpctx->set_of_sub_size - count) {
--- a/libass/ass_mp.c	Fri Jul 30 17:02:58 2010 +0000
+++ b/libass/ass_mp.c	Fri Jul 30 18:14:35 2010 +0000
@@ -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,8 +70,8 @@
 static char* sub_cp = 0;
 #endif
 
-ass_track_t* ass_default_track(ass_library_t* library) {
-	ass_track_t* track = ass_new_track(library);
+ASS_Track* ass_default_track(ASS_Library* library) {
+	ASS_Track* track = ass_new_track(library);
 
 	track->track_type = TRACK_TYPE_ASS;
 	track->Timer = 100.;
@@ -82,7 +82,7 @@
 		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;
@@ -120,14 +120,14 @@
 		style->ScaleY = 1.;
 	}
 
-	process_force_style(track);
+	ass_process_force_style(track);
 	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 &&
@@ -138,17 +138,17 @@
 }
 
 /**
- * \brief Convert subtitle to ass_event_t for the given track
- * \param ass_track_t track
+ * \brief Convert subtitle to ASS_Event for the given track
+ * \param track ASS_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;
@@ -194,13 +194,13 @@
 
 
 /**
- * \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_t* track;
+ASS_Track* ass_read_subdata(ASS_Library* library, sub_data* subdata, double fps) {
+	ASS_Track* track;
 	int i;
 
 	track = ass_default_track(library);
@@ -218,10 +218,10 @@
 	return track;
 }
 
-ass_track_t* ass_read_stream(ass_library_t* library, const char *fname, char *charset) {
+ASS_Track* ass_read_stream(ASS_Library* library, const char *fname, char *charset) {
 	int i;
 	char *buf = NULL;
-	ass_track_t *track;
+	ASS_Track *track;
 	size_t sz = 0;
 	size_t buf_alloc = 0;
 	stream_t *fd;
@@ -263,7 +263,7 @@
 	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);
 	ass_set_margins(priv, ass_top_margin, ass_bottom_margin, 0, 0);
@@ -277,7 +277,7 @@
 	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");
 	if (font_fontconfig < 0 && sub_font_name) path = strdup(sub_font_name);
@@ -309,8 +309,8 @@
 	}
 }
 
-ass_library_t* ass_init(void) {
-	ass_library_t* priv;
+ASS_Library* ass_init(void) {
+	ASS_Library* priv;
 	char* path = get_path("fonts");
 	priv = ass_library_init();
 	ass_set_message_cb(priv, message_callback, NULL);
@@ -323,7 +323,7 @@
 
 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);
 		ass_set_use_margins(priv, ass_use_margins);
--- a/libass/ass_mp.h	Fri Jul 30 17:02:58 2010 +0000
+++ b/libass/ass_mp.h	Fri Jul 30 18:14:35 2010 +0000
@@ -23,23 +23,16 @@
 #ifndef LIBASS_MP_H
 #define LIBASS_MP_H
 
+#include <stdint.h>
+
 #include "subreader.h"
 #if defined(CONFIG_ASS_INTERNAL) || !defined(CONFIG_ASS)
 #include "ass.h"
 #else
 #include <ass/ass.h>
 #endif
-// FIXME: rename types used by MPlayer
-#define ass_library_t ASS_Library
-#define ass_track_t ASS_Track
-#define ass_track_s ASS_Track
-#define ass_renderer_t ASS_Renderer
-#define ass_image_t ASS_Image
-#define ass_style_t ASS_Style
-#define ass_event_t ASS_Event
-#define process_force_style(t) ass_process_force_style(t)
 
-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;
@@ -53,21 +46,21 @@
 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_t* ass_read_stream(ass_library_t* library, const char *fname, char *charset);
+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);
+ASS_Track* ass_read_stream(ASS_Library* library, const char *fname, char *charset);
 
-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);
 
 typedef struct {
-	ass_image_t* imgs;
+	ASS_Image* imgs;
 	int changed;
-} mp_eosd_images_t;
+} EOSD_ImageList;
 
 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);
 
 #endif /* LIBASS_MP_H */
--- a/libmpcodecs/vf_ass.c	Fri Jul 30 17:02:58 2010 +0000
+++ b/libmpcodecs/vf_ass.c	Fri Jul 30 18:14:35 2010 +0000
@@ -62,7 +62,7 @@
 	// 0 = insert always
 	int auto_insert;
 
-	ass_renderer_t* ass_priv;
+	ASS_Renderer* ass_priv;
 
 	unsigned char* planes[3];
 	unsigned char* dirty_rows;
@@ -307,7 +307,7 @@
 	}
 }
 
-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) {
 		memset(vf->priv->dirty_rows, 0, vf->priv->outh); // reset dirty rows
@@ -324,7 +324,7 @@
 
 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);
 
@@ -349,7 +349,7 @@
 {
 	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;
--- a/libmpcodecs/vf_vo.c	Fri Jul 30 17:02:58 2010 +0000
+++ b/libmpcodecs/vf_vo.c	Fri Jul 30 18:14:35 2010 +0000
@@ -39,7 +39,7 @@
     double pts;
     const vo_functions_t *vo;
 #ifdef CONFIG_ASS
-    ass_renderer_t* ass_priv;
+    ASS_Renderer* ass_priv;
     int prev_visibility;
 #endif
 };
@@ -130,7 +130,7 @@
 #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;
@@ -138,7 +138,7 @@
     }
     case VFCTRL_DRAW_EOSD:
     {
-        mp_eosd_images_t images = {NULL, 2};
+        EOSD_ImageList images = {NULL, 2};
         double pts = vf->priv->pts;
         if (!vo_config_count || !vf->priv->ass_priv) return CONTROL_FALSE;
         if (sub_visibility && vf->priv->ass_priv && ass_track && (pts != MP_NOPTS_VALUE)) {
--- a/libmpdemux/stheader.h	Fri Jul 30 17:02:58 2010 +0000
+++ b/libmpdemux/stheader.h	Fri Jul 30 18:14:35 2010 +0000
@@ -126,7 +126,7 @@
   unsigned char* extradata; // extra header data passed from demuxer
   int extradata_len;
 #ifdef CONFIG_ASS
-  ass_track_t* ass_track;  // for SSA/ASS streams (type == 'a')
+  ASS_Track* ass_track;  // for SSA/ASS streams (type == 'a')
 #endif
 } sh_sub_t;
 
--- a/libvo/vo_gl.c	Fri Jul 30 17:02:58 2010 +0000
+++ b/libvo/vo_gl.c	Fri Jul 30 18:14:35 2010 +0000
@@ -313,11 +313,11 @@
   eosdtex = NULL;
 }
 
-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;
 }
 
@@ -336,14 +336,14 @@
  * \param img image list to create OSD from.
  *            A value of NULL has the same effect as clearEOSD()
  */
-static void genEOSD(mp_eosd_images_t *imgs) {
+static void genEOSD(EOSD_ImageList *imgs) {
   int sx, sy;
   int tinytexcur = 0;
   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;
--- a/libvo/vo_vdpau.c	Fri Jul 30 17:02:58 2010 +0000
+++ b/libvo/vo_vdpau.c	Fri Jul 30 18:14:35 2010 +0000
@@ -854,13 +854,13 @@
     }
 }
 
-static void generate_eosd(mp_eosd_images_t *imgs)
+static void generate_eosd(EOSD_ImageList *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)
--- a/mencoder.c	Fri Jul 30 17:02:58 2010 +0000
+++ b/mencoder.c	Fri Jul 30 18:14:35 2010 +0000
@@ -325,7 +325,7 @@
 {
     sub_data *subd;
 #ifdef CONFIG_ASS
-    ass_track_t *asst = 0;
+    ASS_Track *asst = 0;
 #endif
 
     if (!filename) return;
--- a/mp_core.h	Fri Jul 30 17:02:58 2010 +0000
+++ b/mp_core.h	Fri Jul 30 18:14:35 2010 +0000
@@ -114,7 +114,7 @@
 #ifdef CONFIG_ASS
     // set_of_ass_tracks[i] contains subtitles from set_of_subtitles[i]
     // parsed by libass or NULL if format unsupported
-    ass_track_t* set_of_ass_tracks[MAX_SUBTITLE_FILES];
+    ASS_Track* set_of_ass_tracks[MAX_SUBTITLE_FILES];
 #endif
     sub_data* set_of_subtitles[MAX_SUBTITLE_FILES];
 
--- a/mpcommon.c	Fri Jul 30 17:02:58 2010 +0000
+++ b/mpcommon.c	Fri Jul 30 18:14:35 2010 +0000
@@ -39,7 +39,7 @@
 
 #ifdef CONFIG_ASS
 #include "libass/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;
--- a/mpcommon.h	Fri Jul 30 17:02:58 2010 +0000
+++ b/mpcommon.h	Fri Jul 30 18:14:35 2010 +0000
@@ -26,7 +26,7 @@
 #include "libass/ass_mp.h"
 
 extern double sub_last_pts;
-extern ass_track_t *ass_track;
+extern ASS_Track *ass_track;
 extern subtitle *vo_sub_last;
 
 extern float sub_delay;
--- a/mplayer.c	Fri Jul 30 17:02:58 2010 +0000
+++ b/mplayer.c	Fri Jul 30 18:14:35 2010 +0000
@@ -1091,7 +1091,7 @@
 {
     sub_data *subd;
 #ifdef CONFIG_ASS
-    ass_track_t *asst = 0;
+    ASS_Track *asst = 0;
 #endif
 
     if (filename == NULL || mpctx->set_of_sub_size >= MAX_SUBTITLE_FILES) {