Ticket #15: y4m_asp.diff

File y4m_asp.diff, 1.3 KB (added by reimar, 20 years ago)

Set aspect in -vo yuv4mpeg

  • libvo/vo_yuv4mpeg.c

     
    4141#include "fastmemcpy.h"
    4242#include "libswscale/swscale.h"
    4343#include "libmpcodecs/vf_scale.h"
     44#include "libavutil/rational.h"
    4445
    4546static vo_info_t info =
    4647{
    … …  
    8283       uint32_t d_height, uint32_t flags, char *title,
    8384       uint32_t format)
    8485{
     86        AVRational pixelaspect = av_div_q((AVRational){d_width, d_height},
     87                                          (AVRational){width, height});
    8588        if (image_width == width && image_height == height &&
    8689             image_fps == vo_fps && vo_config_count)
    8790          return 0;
    … …  
    153156        image_u = image_y + image_width * image_height;
    154157        image_v = image_u + image_width * image_height / 4;
    155158       
    156         // This isn't right. 
    157         // But it should work as long as the file isn't interlaced
    158         // or otherwise unusual (the "Ip A0:0" part).
    159 
    160         /* At least the interlacing is ok now */
    161         fprintf(yuv_out, "YUV4MPEG2 W%d H%d F%ld:%ld I%c A0:0\n",
     159        fprintf(yuv_out, "YUV4MPEG2 W%d H%d F%ld:%ld I%c A%"PRId64":%"PRId64"\n",
    162160                        image_width, image_height, (long)(image_fps * 1000000.0),
    163                         (long)1000000, config_interlace);
     161                        (long)1000000, config_interlace,
     162                        pixelaspect.num, pixelaspect.den);
    164163
    165164        fflush(yuv_out);
    166165        return 0;