Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Feb 9th, 2010 | Syntax: None | Size: 2.76 KB | Hits: 28 | Expires: Never
Copy text to clipboard
  1. diff --git a/ass_mp.c b/ass_mp.c
  2. index 959f985..8eeb2d3 100644
  3. --- a/ass_mp.c
  4. +++ b/ass_mp.c
  5.  -71,7 +71,7 @@ ASS_Track *ass_default_track(ASS_Library *library)
  6.  {
  7.      ASS_Track *track = ass_new_track(library);
  8.  
  9. -    track->track_type = TRACK_TYPE_ASS;
  10. +    track->track_type = -1;
  11.      track->Timer = 100.;
  12.      track->PlayResY = 288;
  13.      track->WrapStyle = 0;
  14. diff --git a/libmpcodecs/vf_ass.c b/libmpcodecs/vf_ass.c
  15. index 9076ed0..49e9f94 100644
  16. --- a/libmpcodecs/vf_ass.c
  17. +++ b/libmpcodecs/vf_ass.c
  18.  -55,6 +55,7 @@
  19.  
  20.  static const struct vf_priv_s {
  21.         int outh, outw;
  22. +       double scale_ratio;
  23.  
  24.         unsigned int outfmt;
  25.  
  26.  -90,13 +91,14 @@ static int config(struct vf_instance* vf,
  27.                 d_height = d_height * vf->priv->outh / height;
  28.         }
  29.  
  30. +       vf->priv->scale_ratio = (double) width / height * d_height / d_width;
  31. +
  32.         vf->priv->planes[1] = malloc(vf->priv->outw * vf->priv->outh);
  33.         vf->priv->planes[2] = malloc(vf->priv->outw * vf->priv->outh);
  34.         vf->priv->line_limits = malloc((vf->priv->outh + 1) / 2 * sizeof(*vf->priv->line_limits));
  35.  
  36.         if (vf->priv->ass_priv) {
  37.                 ass_configure(vf->priv->ass_priv, vf->priv->outw, vf->priv->outh, 0);
  38. -               ass_set_aspect_ratio(vf->priv->ass_priv, 1, 1);
  39.         }
  40.  
  41.         return vf_next_config(vf, vf->priv->outw, vf->priv->outh, d_width, d_height, flags, outfmt);
  42.  -330,8 +332,10 @@ static int render_frame(struct vf_instance* vf, mp_image_t *mpi, const ASS_Image
  43.  static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
  44.  {
  45.         ASS_Image* images = 0;
  46. -       if (sub_visibility && vf->priv->ass_priv && ass_track && (pts != MP_NOPTS_VALUE))
  47. +       if (sub_visibility && vf->priv->ass_priv && ass_track && (pts != MP_NOPTS_VALUE)) {
  48. +               ass_set_aspect_ratio(vf->priv->ass_priv, (ass_track->track_type == -1) ? vf->priv->scale_ratio : 1, 1);
  49.                 images = ass_mp_render_frame(vf->priv->ass_priv, ass_track, (pts+sub_delay) * 1000 + .5, NULL);
  50. +       }
  51.  
  52.         prepare_image(vf, mpi);
  53.         if (images) render_frame(vf, mpi, images);
  54. diff --git a/libmpcodecs/vf_vo.c b/libmpcodecs/vf_vo.c
  55. index b15e488..cedad3e 100644
  56. --- a/libmpcodecs/vf_vo.c
  57. +++ b/libmpcodecs/vf_vo.c
  58.  -132,7 +132,7 @@ static int control(struct vf_instance* vf, int request, void* data)
  59.              if (vo_control(video_out, VOCTRL_GET_EOSD_RES, &res) == VO_TRUE) {
  60.                  ass_set_frame_size(vf->priv->ass_priv, res.w, res.h);
  61.                  ass_set_margins(vf->priv->ass_priv, res.mt, res.mb, res.ml, res.mr);
  62. -                ass_set_aspect_ratio(vf->priv->ass_priv, vf->priv->scale_ratio, 1);
  63. +                ass_set_aspect_ratio(vf->priv->ass_priv, (ass_track->track_type == -1) ? 1 : vf->priv->scale_ratio, 1);
  64.              }
  65.  
  66.              images.imgs = ass_mp_render_frame(vf->priv->ass_priv, ass_track, (pts+sub_delay) * 1000 + .5, &images.changed);