Ticket #13186: 007_avpicture_plugins.patch

File 007_avpicture_plugins.patch, 3.7 KB (added by Peter Bennett, 6 years ago)

007 AVPicture fixes for Plugins

  • mythplugins/mytharchive/mytharchive/thumbfinder.cpp

    diff --git a/mythplugins/mytharchive/mytharchive/thumbfinder.cpp b/mythplugins/mytharchive/mytharchive/thumbfinder.cpp
    index b90c69c..87b7b57 100644
    a b  
    5656#include <mythimage.h>
    5757#include <mythconfig.h>
    5858
     59extern "C" {
     60#include "libavutil/imgutils.h"
     61}
     62
    5963#ifndef INT64_C    // Used in FFmpeg headers to define some constants
    6064#define INT64_C(v)   (v ## LL)
    6165#endif
    bool ThumbFinder::seekBackward() 
    788792bool ThumbFinder::getFrameImage(bool needKeyFrame, int64_t requiredPTS)
    789793{
    790794    AVPacket pkt;
    791     AVPicture orig;
    792     AVPicture retbuf;
    793     memset(&orig, 0, sizeof(AVPicture));
    794     memset(&retbuf, 0, sizeof(AVPicture));
     795    AVFrame orig;
     796    AVFrame retbuf;
     797    memset(&orig, 0, sizeof(AVFrame));
     798    memset(&retbuf, 0, sizeof(AVFrame));
    795799
    796800    av_init_packet(&pkt);
    797801
    bool ThumbFinder::getFrameImage(bool needKeyFrame, int64_t requiredPTS) 
    840844
    841845    if (frameFinished)
    842846    {
    843         avpicture_fill(&retbuf, m_outputbuf, AV_PIX_FMT_RGB32, m_frameWidth, m_frameHeight);
    844         AVPicture *tmp = m_frame;
     847        // avpicture_fill(&retbuf, m_outputbuf, AV_PIX_FMT_RGB32, m_frameWidth, m_frameHeight);
     848        av_image_fill_arrays(retbuf.data, retbuf.linesize, m_outputbuf,
     849            AV_PIX_FMT_RGB32, m_frameWidth, m_frameHeight, IMAGE_ALIGN);
     850        AVFrame *tmp = m_frame;
    845851
    846852        m_deinterlacer->DeinterlaceSingle(tmp, tmp);
    847853
  • mythplugins/mytharchive/mytharchivehelper/main.cpp

    diff --git a/mythplugins/mytharchive/mytharchivehelper/main.cpp b/mythplugins/mytharchive/mytharchivehelper/main.cpp
    index 8f6fd77..bff6693 100644
    a b extern "C" { 
    7171#include <libavcodec/avcodec.h>
    7272#include <libavformat/avformat.h>
    7373#include "external/pxsup2dast.h"
     74#include "libavutil/imgutils.h"
    7475}
    7576
    7677// mytharchive headers
    static int grabThumbnail(QString inFile, QString thumbList, QString outFile, int 
    16341635        return 1;
    16351636    }
    16361637    AVPacket pkt;
    1637     AVPicture orig;
    1638     AVPicture retbuf;
    1639     memset(&orig, 0, sizeof(AVPicture));
    1640     memset(&retbuf, 0, sizeof(AVPicture));
     1638    AVFrame orig;
     1639    AVFrame retbuf;
     1640    memset(&orig, 0, sizeof(AVFrame));
     1641    memset(&retbuf, 0, sizeof(AVFrame));
    16411642    MythAVCopy copyframe;
    16421643    MythPictureDeinterlacer deinterlacer(codecCtx->pix_fmt, width, height);
    16431644
    static int grabThumbnail(QString inFile, QString thumbList, QString outFile, int 
    16931694                        else if (filename.contains("%1"))
    16941695                            filename = filename.arg(thumbCount);
    16951696
    1696                         avpicture_fill(&retbuf, outputbuf,
    1697                                        AV_PIX_FMT_RGB32, width, height);
     1697                        // avpicture_fill(&retbuf, outputbuf,
     1698                        //     AV_PIX_FMT_RGB32, width, height);
     1699                        av_image_fill_arrays(retbuf.data, retbuf.linesize, outputbuf,
     1700                            AV_PIX_FMT_RGB32, width, height, IMAGE_ALIGN);
    16981701
    16991702                        AVFrame *tmp = frame;
    1700                         deinterlacer.DeinterlaceSingle((AVPicture*)tmp,
    1701                                                        (AVPicture*)tmp);
     1703                        deinterlacer.DeinterlaceSingle((AVFrame*)tmp,
     1704                                                       (AVFrame*)tmp);
    17021705
    17031706                        copyframe.Copy(&retbuf, AV_PIX_FMT_RGB32,
    1704                                        (AVPicture*) tmp,
     1707                                       (AVFrame*) tmp,
    17051708                                       codecCtx->pix_fmt, width, height);
    17061709
    17071710                        QImage img(outputbuf, width, height,