Esempio n. 1
0
static void eosd_ass_update(struct mp_eosd_source *src, const struct mp_eosd_settings *res, double ts)
{
	long long ts_ms = (ts + sub_delay) * 1000 + .5;
	ASS_Image *aimg;
	struct mp_eosd_image *img;
	if (res->changed || !src->initialized) {
		double dar = (double) (res->w - res->ml - res->mr) / (res->h - res->mt - res->mb);
		ass_configure(ass_renderer, res->w, res->h, res->unscaled);
		ass_set_margins(ass_renderer, res->mt, res->mb, res->ml, res->mr);
		ass_set_aspect_ratio(ass_renderer, dar, (double)res->srcw / res->srch);
		src->initialized = 1;
	}
	aimg = sub_visibility && ass_track && ts != MP_NOPTS_VALUE ?
		ass_mp_render_frame(ass_renderer, ass_track, ts_ms, &src->changed) :
		NULL;
	if (!aimg != !src->images)
		src->changed = 2;
	if (src->changed) {
		eosd_image_remove_all(src);
		while (aimg) {
			img = eosd_image_alloc();
			img->w      = aimg->w;
			img->h      = aimg->h;
			img->bitmap = aimg->bitmap;
			img->stride = aimg->stride;
			img->color  = aimg->color;
			img->dst_x  = aimg->dst_x;
			img->dst_y  = aimg->dst_y;
			eosd_image_append(src, img);
			aimg = aimg->next;
		}
	}
	prev_visibility = sub_visibility;
}
Esempio n. 2
0
static int config(struct vf_instance_s* vf,
        int width, int height, int d_width, int d_height,
	unsigned int flags, unsigned int outfmt){

    if ((width <= 0) || (height <= 0) || (d_width <= 0) || (d_height <= 0))
    {
	mp_msg(MSGT_CPLAYER, MSGL_ERR, "VO: invalid dimensions!\n");
	return 0;
    }

  if(video_out->info)
  { const vo_info_t *info = video_out->info;
    mp_msg(MSGT_CPLAYER,MSGL_INFO,"VO: [%s] %dx%d => %dx%d %s %s%s%s%s\n",info->short_name,
         width, height,
         d_width, d_height,
	 vo_format_name(outfmt),
         (flags&VOFLAG_FULLSCREEN)?" [fs]":"",
         (flags&VOFLAG_MODESWITCHING)?" [vm]":"",
         (flags&VOFLAG_SWSCALE)?" [zoom]":"",
         (flags&VOFLAG_FLIPPING)?" [flip]":"");
    mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Description: %s\n",info->name);
    mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Author: %s\n", info->author);
    if(info->comment && strlen(info->comment) > 0)
        mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Comment: %s\n", info->comment);
  }

    // save vo's stride capability for the wanted colorspace:
    vf->default_caps=query_format(vf,outfmt);

    if(config_video_out(video_out,width,height,d_width,d_height,flags,"MPlayer",outfmt))
	return 0;

#ifdef USE_ASS
    if (vf->priv->ass_priv)
	ass_configure(vf->priv->ass_priv, width, height, !!(vf->default_caps & VFCAP_EOSD_UNSCALED));
#endif

    ++vo_config_count;
    return 1;
}