Ticket #2198: 1080iTranscode.patch

File 1080iTranscode.patch, 2.5 KB (added by wagspat@…, 17 years ago)

preliminary patch that seems to address the 1088 high 1080i feed transcoding issue

  • programs/mythtranscode/transcode.cpp

     
    348348
    349349    int video_width = nvp->GetVideoWidth();
    350350    int video_height = nvp->GetVideoHeight();
     351     
     352    if (video_height == 1088) {
     353       VERBOSE(VB_IMPORTANT, QString("Unlikely the video height really is 1088, using hacks..."));
     354    }
     355
    351356    float video_aspect = nvp->GetVideoAspect();
    352357    float video_frame_rate = nvp->GetFrameRate();
    353358    long long total_frame_count = nvp->GetTotalFrameCount();
     
    382387        {
    383388            newWidth = profile.byName("width")->getValue().toInt();
    384389            newHeight = profile.byName("height")->getValue().toInt();
    385 
    386             if (profile.byName("transcodepreserveaspect")->getValue().toInt())
    387                 newHeight = (int)(1.0 * newWidth * video_height / video_width);
    388 
     390            if (profile.byName("transcodepreserveaspect")->getValue().toInt()) {
     391                if (video_height==1088) {
     392                    newHeight = (int)(1.0 * newWidth * 1080 / video_width);
     393                } else {
     394                    newHeight = (int)(1.0 * newWidth * video_height / video_width);
     395                }
     396            }
    389397            if (encodingType.left(4).lower() == "mpeg")
    390398            {
    391399                // make sure dimensions are valid for MPEG codecs
     
    702710                                   video_width, video_height);
    703711                    avpicture_fill(&imageOut, frame.buf, PIX_FMT_YUV420P,
    704712                                   newWidth, newHeight);
    705                     scontext = img_resample_init(newWidth, newHeight,
    706                                                  video_width, video_height);
     713                    if (video_height != 1088) {
     714                        scontext = img_resample_init(newWidth, newHeight,
     715                                                     video_width, video_height);
     716                    } else {
     717                        scontext = img_resample_full_init(newWidth, newHeight,
     718                                                          video_width, video_height,
     719                                                          0,8,0,0,
     720                                                          0,0,0,0);
     721                    }
    707722                    img_resample(scontext, &imageOut, &imageIn);
    708723                    img_resample_close(scontext);
    709724                }