diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2011-01-19 18:00:22 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2011-01-26 13:04:17 +0200 |
commit | 8612c771fcb7321a2d6e0ba79f6f3cf26ee7f70c (patch) | |
tree | 9beda246875d7df74496c78f3dace0404260b6ff | |
parent | 6d65f6889af5c4ad8874f59d97e73053fa31aba5 (diff) | |
download | mpv-8612c771fcb7321a2d6e0ba79f6f3cf26ee7f70c.tar.bz2 mpv-8612c771fcb7321a2d6e0ba79f6f3cf26ee7f70c.tar.xz |
cleanup: some random minor code simplification and cleanup
-rw-r--r-- | ass_mp.c | 3 | ||||
-rw-r--r-- | ass_mp.h | 6 | ||||
-rw-r--r-- | defaultopts.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_vo.c | 17 | ||||
-rw-r--r-- | libvo/video_out.h | 2 | ||||
-rw-r--r-- | libvo/vo_vdpau.c | 2 | ||||
-rw-r--r-- | mplayer.c | 9 |
7 files changed, 19 insertions, 22 deletions
@@ -22,6 +22,7 @@ #include <string.h> #include <stdlib.h> #include <stdarg.h> +#include <stdbool.h> #include <ass/ass.h> #include <ass/ass_types.h> @@ -280,7 +281,7 @@ ASS_Track *ass_read_stream(ASS_Library *library, const char *fname, char *charse return track; } -void ass_configure(ASS_Renderer *priv, int w, int h, int unscaled) +void ass_configure(ASS_Renderer *priv, int w, int h, bool unscaled) { int hinting; ass_set_frame_size(priv, w, h); @@ -22,6 +22,7 @@ #define MPLAYER_ASS_MP_H #include <stdint.h> +#include <stdbool.h> #include "config.h" #include "subreader.h" @@ -46,9 +47,10 @@ extern int ass_hinting; ASS_Track *ass_default_track(ASS_Library *library); 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); +ASS_Track *ass_read_stream(ASS_Library *library, const char *fname, + char *charset); -void ass_configure(ASS_Renderer *priv, int w, int h, int hinting); +void ass_configure(ASS_Renderer *priv, int w, int h, bool unscaled); void ass_configure_fonts(ASS_Renderer *priv); ASS_Library *ass_init(void); diff --git a/defaultopts.c b/defaultopts.c index abdd5e16f3..f42b6618b1 100644 --- a/defaultopts.c +++ b/defaultopts.c @@ -60,8 +60,6 @@ void set_default_mplayer_options(struct MPOpts *opts) .use_lircc = 1, #ifdef CONFIG_APPLE_REMOTE .use_ar = 1, -#else - .use_ar = 0, #endif .default_bindings = 1, } diff --git a/libmpcodecs/vf_vo.c b/libmpcodecs/vf_vo.c index 92513f5028..7e6697d527 100644 --- a/libmpcodecs/vf_vo.c +++ b/libmpcodecs/vf_vo.c @@ -40,7 +40,7 @@ struct vf_priv_s { struct vo *vo; #ifdef CONFIG_ASS ASS_Renderer *ass_priv; - int prev_visibility; + bool prev_visibility; double scale_ratio; #endif }; @@ -84,7 +84,8 @@ static int config(struct vf_instance *vf, vf->priv->scale_ratio = (double) d_width / d_height * height / width; if (vf->priv->ass_priv) - ass_configure(vf->priv->ass_priv, width, height, !!(vf->default_caps & VFCAP_EOSD_UNSCALED)); + ass_configure(vf->priv->ass_priv, width, height, + vf->default_caps & VFCAP_EOSD_UNSCALED); #endif return 1; @@ -133,7 +134,7 @@ static int control(struct vf_instance *vf, int request, void* 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; + vf->priv->prev_visibility = false; return CONTROL_TRUE; } case VFCTRL_DRAW_EOSD: @@ -142,10 +143,8 @@ static int control(struct vf_instance *vf, int request, void* data) mp_eosd_images_t images = {NULL, 2}; double pts = video_out->next_pts; if (!video_out->config_ok || !vf->priv->ass_priv) return CONTROL_FALSE; - if (sub_visibility && vf->priv->ass_priv && osd->ass_track - && (pts != MP_NOPTS_VALUE)) { - mp_eosd_res_t res; - memset(&res, 0, sizeof(res)); + if (sub_visibility && osd->ass_track && (pts != MP_NOPTS_VALUE)) { + struct mp_eosd_res res = {0}; if (vo_control(video_out, VOCTRL_GET_EOSD_RES, &res) == VO_TRUE) { ass_set_frame_size(vf->priv->ass_priv, res.w, res.h); ass_set_margins(vf->priv->ass_priv, res.mt, res.mb, res.ml, res.mr); @@ -158,9 +157,9 @@ static int control(struct vf_instance *vf, int request, void* data) &images.changed); if (!vf->priv->prev_visibility) images.changed = 2; - vf->priv->prev_visibility = 1; + vf->priv->prev_visibility = true; } else - vf->priv->prev_visibility = 0; + vf->priv->prev_visibility = false; return vo_control(video_out, VOCTRL_DRAW_EOSD, &images) == VO_TRUE; } #endif diff --git a/libvo/video_out.h b/libvo/video_out.h index 0630aee9ca..5fac7dd02d 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h @@ -77,7 +77,7 @@ struct voctrl_get_equalizer_args { #define VOCTRL_BORDER 27 #define VOCTRL_DRAW_EOSD 28 #define VOCTRL_GET_EOSD_RES 29 -typedef struct { +typedef struct mp_eosd_res { int w, h; // screen dimensions, including black borders int mt, mb, ml, mr; // borders (top, bottom, left, right) } mp_eosd_res_t; diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c index f8748b5574..68ff7c2573 100644 --- a/libvo/vo_vdpau.c +++ b/libvo/vo_vdpau.c @@ -1803,7 +1803,7 @@ static int control(struct vo *vo, uint32_t request, void *data) draw_eosd(vo); return VO_TRUE; case VOCTRL_GET_EOSD_RES: { - mp_eosd_res_t *r = data; + struct mp_eosd_res *r = data; r->w = vo->dwidth; r->h = vo->dheight; r->ml = r->mr = vc->border_x; @@ -1093,9 +1093,8 @@ void add_subtitles(struct MPContext *mpctx, char *filename, float fps, int noerr sub_data *subd = NULL; struct ass_track *asst = NULL; - if (filename == NULL || mpctx->set_of_sub_size >= MAX_SUBTITLE_FILES) { + if (filename == NULL || mpctx->set_of_sub_size >= MAX_SUBTITLE_FILES) return; - } #ifdef CONFIG_ASS if (opts->ass_enabled) { @@ -1108,10 +1107,8 @@ void add_subtitles(struct MPContext *mpctx, char *filename, float fps, int noerr subd = sub_read_file(filename, fps, &mpctx->opts); if (subd) { asst = ass_read_subdata(ass_library, subd, fps); - if (asst) { - sub_free(subd); - subd = NULL; - } + sub_free(subd); + subd = NULL; } } } else |