Ticket #69: aspect.diff

File aspect.diff, 6.2 KB (added by Ian Caulfield <imc25@…>, 19 years ago)
  • libs/libmythtv/NuppelVideoPlayer.h

     
    101101    OSD *GetOSD(void) { return osd; }
    102102
    103103    // don't use this on something you're playing
    104     char *GetScreenGrab(int secondsin, int &buflen, int &vw, int &vh);
     104    char *GetScreenGrab(int secondsin, int &buflen, int &vw, int &vh, float &ar);
    105105
    106106    void SetLength(int len) { totalLength = len; }
    107107    int GetLength(void) { return totalLength; }
  • libs/libmythtv/NuppelVideoPlayer.cpp

     
    33573357}
    33583358
    33593359char *NuppelVideoPlayer::GetScreenGrab(int secondsin, int &bufflen, int &vw,
    3360                                        int &vh)
     3360                                       int &vh, float &ar)
    33613361{
    33623362    using_null_videoout = true;
    33633363
     
    34233423    {
    34243424        bufflen = 0;
    34253425        vw = vh = 0;
     3426        ar = 0;
    34263427        return NULL;
    34273428    }
    34283429
     
    34323433    {
    34333434        bufflen = 0;
    34343435        vw = vh = 0;
     3436        ar = 0;
    34353437        return NULL;
    34363438    }
    34373439
     
    34523454
    34533455    vw = video_width;
    34543456    vh = video_height;
     3457    ar = video_aspect;
    34553458
    34563459    return (char *)outputbuf;
    34573460}
  • libs/libmythtv/tv_rec.cpp

     
    967967 */
    968968char *TVRec::GetScreenGrab(const ProgramInfo *pginfo, const QString &filename,
    969969                           int secondsin, int &bufferlen,
    970                            int &video_width, int &video_height)
     970                           int &video_width, int &video_height,
     971                           float &video_aspect)
    971972{
    972973    (void) pginfo;
    973974    (void) filename;
     
    987988    nupvidplay->SetAudioSampleRate(audioSampleRateDB);
    988989
    989990    char *retbuf = nupvidplay->GetScreenGrab(secondsin, bufferlen, video_width,
    990                                              video_height);
     991                                             video_height, video_aspect);
    991992
    992993    delete nupvidplay;
    993994    delete tmprbuf;
  • libs/libmythtv/tv_rec.h

     
    7575
    7676    char *GetScreenGrab(const ProgramInfo *pginfo, const QString &filename,
    7777                        int secondsin, int &bufferlen,
    78                         int &video_width, int &video_height);
     78                        int &video_width, int &video_height,
     79                        float &video_aspect);
    7980
    8081    /// \brief Returns true if event loop has not been told to shut down
    8182    bool IsRunning(void) { return runMainLoop; }
  • programs/mythbackend/encoderlink.h

     
    109109
    110110    char *GetScreenGrab(const ProgramInfo *pginfo, const QString &filename,
    111111                        int secondsin, int &bufferlen,
    112                         int &video_width, int &video_height);
     112                        int &video_width, int &video_height,
     113                        float &video_aspect);
    113114
    114115  private:
    115116    int m_capturecardnum;
  • programs/mythbackend/mainserver.cpp

     
    1010
    1111#include <cstdlib>
    1212#include <cerrno>
     13#include <math.h>
    1314#include <unistd.h>
    1415#include <fcntl.h>
    1516#include "../../config.h"
     
    31713172
    31723173    int len = 0;
    31733174    int width = 0, height = 0;
     3175    float aspect = 0;
    31743176    int secondsin = gContext->GetNumSetting("PreviewPixmapOffset", 64) +
    31753177                    gContext->GetNumSetting("RecordPreRoll",0);
    31763178
     
    31783180                                                                filename,
    31793181                                                                secondsin,
    31803182                                                                len, width,
    3181                                                                 height);
     3183                                                                height, aspect);
    31823184
    31833185    if (data)
    31843186    {
    31853187        QImage img(data, width, height, 32, NULL, 65536 * 65536,
    31863188                   QImage::LittleEndian);
    3187         img = img.smoothScale(gContext->GetNumSetting("PreviewPixmapWidth", 160),
    3188                               gContext->GetNumSetting("PreviewPixmapHeight", 120),
    3189                               QImage::ScaleMin);
    31903189
     3190        float ppw = gContext->GetNumSetting("PreviewPixmapWidth", 160);
     3191        float pph = gContext->GetNumSetting("PreviewPixmapHeight", 120);
     3192
     3193        if (aspect <= 0)
     3194            aspect = ((float) width) / height;
     3195
     3196        if (aspect > ppw / pph)
     3197            pph = rint(ppw / aspect);
     3198        else
     3199            ppw = rint(pph * aspect);
     3200
     3201        img = img.smoothScale((int) ppw, (int) pph);
     3202
    31913203        filename += ".png";
    31923204        img.save(filename.ascii(), "PNG");
    31933205
  • programs/mythbackend/encoderlink.cpp

     
    993993char *EncoderLink::GetScreenGrab(const ProgramInfo *pginfo,
    994994                                 const QString &filename,
    995995                                 int secondsin, int &bufferlen,
    996                                  int &video_width, int &video_height)
     996                                 int &video_width, int &video_height,
     997                                 float &video_aspect)
    997998{
    998999    if (local)
    9991000        return tv->GetScreenGrab(pginfo, filename, secondsin, bufferlen,
    1000                                  video_width, video_height);
     1001                                 video_width, video_height, video_aspect);
    10011002
    10021003    VERBOSE(VB_IMPORTANT, "Should be local only query: GetScreenGrab");
    10031004    return NULL;