Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 575058 | Differences between
and this patch

Collapse All | Expand All

(-)src/ffDiaporama/engine/cBaseMediaFile.cpp (-4 / +17 lines)
Lines 113-122 Link Here
113
#define VC_USERDATA     0x00000008
113
#define VC_USERDATA     0x00000008
114
#define VC_FLUSHED      0x00000010
114
#define VC_FLUSHED      0x00000010
115
115
116
#define PIXFMT          PIX_FMT_RGB24
116
#if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=300))
117
  #define PIXELFORMAT AVPixelFormat
118
  #define PIXFMT AV_PIX_FMT_RGB24
119
#else
120
  #define PIXELFORMAT PixelFormat
121
  #define PIXFMT PIX_FMT_RGB24
122
#endif
117
#define QTPIXFMT        QImage::Format_RGB888
123
#define QTPIXFMT        QImage::Format_RGB888
118
124
119
AVFrame *ALLOCFRAME()           { return avcodec_alloc_frame(); }
125
AVFrame *ALLOCFRAME()           { return 
126
  #if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=300))
127
    av_frame_alloc();
128
  #else
129
    avcodec_alloc_frame();
130
  #endif
131
}
132
120
void    FREEFRAME(AVFrame **Buf){ avcodec_free_frame(Buf); *Buf=NULL; }
133
void    FREEFRAME(AVFrame **Buf){ avcodec_free_frame(Buf); *Buf=NULL; }
121
134
122
//****************************************************************************************************************************************************************
135
//****************************************************************************************************************************************************************
Lines 2402-2408 Link Here
2402
                            AVFrame *FrameRGB=ALLOCFRAME();
2415
                            AVFrame *FrameRGB=ALLOCFRAME();
2403
                            if ((FrameRGB)&&(!Thumbnail.isNull())) {
2416
                            if ((FrameRGB)&&(!Thumbnail.isNull())) {
2404
                                avpicture_fill((AVPicture *)FrameRGB,Thumbnail.bits(),PIXFMT,RealW,RealH);
2417
                                avpicture_fill((AVPicture *)FrameRGB,Thumbnail.bits(),PIXFMT,RealW,RealH);
2405
                                struct SwsContext *img_convert_ctx=sws_getContext(FrameYUV->width,FrameYUV->height,(PixelFormat)FrameYUV->format,RealW,RealH,PIXFMT,SWS_FAST_BILINEAR,NULL,NULL,NULL);
2418
                                struct SwsContext *img_convert_ctx=sws_getContext(FrameYUV->width,FrameYUV->height,(PIXELFORMAT)FrameYUV->format,RealW,RealH,PIXFMT,SWS_FAST_BILINEAR,NULL,NULL,NULL);
2406
                                if (img_convert_ctx!=NULL) {
2419
                                if (img_convert_ctx!=NULL) {
2407
                                    int ret = sws_scale(img_convert_ctx,FrameYUV->data,FrameYUV->linesize,0,FrameYUV->height,FrameRGB->data,FrameRGB->linesize);
2420
                                    int ret = sws_scale(img_convert_ctx,FrameYUV->data,FrameYUV->linesize,0,FrameYUV->height,FrameRGB->data,FrameRGB->linesize);
2408
                                    if (ret>0) {
2421
                                    if (ret>0) {
Lines 3482-3488 Link Here
3482
        struct SwsContext *img_convert_ctx=sws_getContext(
3495
        struct SwsContext *img_convert_ctx=sws_getContext(
3483
            Frame->width,                                                     // Src width
3496
            Frame->width,                                                     // Src width
3484
            Frame->height,                                                    // Src height
3497
            Frame->height,                                                    // Src height
3485
            (PixelFormat)Frame->format,                                       // Src Format
3498
            (PIXELFORMAT)Frame->format,                                       // Src Format
3486
            W,                                                                // Destination width
3499
            W,                                                                // Destination width
3487
            H,                                                                // Destination height
3500
            H,                                                                // Destination height
3488
            PIXFMT,                                                           // Destination Format
3501
            PIXFMT,                                                           // Destination Format
(-)src/ffDiaporama/engine/cDeviceModelDef.h (-5 / +14 lines)
Lines 53-59 Link Here
53
53
54
#include <libavutil/mathematics.h>
54
#include <libavutil/mathematics.h>
55
#include <libavutil/pixdesc.h>
55
#include <libavutil/pixdesc.h>
56
#include <libavutil/audioconvert.h>
56
#if (LIBAVUTIL_VERSION_INT<AV_VERSION_INT(54,31,100))
57
    #include <libavutil/audioconvert.h>
58
#endif
57
59
58
#include <libavcodec/avcodec.h>
60
#include <libavcodec/avcodec.h>
59
61
Lines 90-99 Link Here
90
      #define RESAMPLE_MAX_CHANNELS 32
92
      #define RESAMPLE_MAX_CHANNELS 32
91
    #endif
93
    #endif
92
    
94
    
93
    #include "libavfilter/avcodec.h"
95
    #if     ((LIBAVUTIL_VERSION_INT>=AV_VERSION_INT(55,17,103))&&(LIBAVCODEC_VERSION_INT>=AV_VERSION_INT(57,24,102))&&(LIBAVFORMAT_VERSION_INT>=AV_VERSION_INT(57,25,100))&&(LIBAVDEVICE_VERSION_INT>=AV_VERSION_INT(57,0,101))&&(LIBAVFILTER_VERSION_INT>=AV_VERSION_INT(6,31,100))&&(LIBSWSCALE_VERSION_INT>=AV_VERSION_INT(4,0,100))&&(LIBSWRESAMPLE_VERSION_INT>=AV_VERSION_INT(2,0,101)))
94
    #include "libavfilter/buffersink.h"
96
        #define FFMPEGVERSIONINT    300
95
    #include "libavfilter/buffersrc.h"
97
        #define FFMPEGVERSION       "FFmpeg 3.0 or higher"
96
    #if     ((LIBAVUTIL_VERSION_INT>=AV_VERSION_INT(52,48,100))&&(LIBAVCODEC_VERSION_INT>=AV_VERSION_INT(55,39,100))&&(LIBAVFORMAT_VERSION_INT>=AV_VERSION_INT(55,19,104))&&(LIBAVDEVICE_VERSION_INT>=AV_VERSION_INT(55,5,100))&&(LIBAVFILTER_VERSION_INT>=AV_VERSION_INT(3,90,100))&&(LIBSWSCALE_VERSION_INT>=AV_VERSION_INT(2,5,101))&&(LIBSWRESAMPLE_VERSION_INT>=AV_VERSION_INT(0,17,104)))
98
    #elif     ((LIBAVUTIL_VERSION_INT>=AV_VERSION_INT(52,48,100))&&(LIBAVCODEC_VERSION_INT>=AV_VERSION_INT(55,39,100))&&(LIBAVFORMAT_VERSION_INT>=AV_VERSION_INT(55,19,104))&&(LIBAVDEVICE_VERSION_INT>=AV_VERSION_INT(55,5,100))&&(LIBAVFILTER_VERSION_INT>=AV_VERSION_INT(3,90,100))&&(LIBSWSCALE_VERSION_INT>=AV_VERSION_INT(2,5,101))&&(LIBSWRESAMPLE_VERSION_INT>=AV_VERSION_INT(0,17,104)))
97
        #define FFMPEGVERSIONINT    210
99
        #define FFMPEGVERSIONINT    210
98
        #define FFMPEGVERSION       "FFmpeg 2.1 or higher"
100
        #define FFMPEGVERSION       "FFmpeg 2.1 or higher"
99
    #elif   ((LIBAVUTIL_VERSION_INT>=AV_VERSION_INT(52,38,100))&&(LIBAVCODEC_VERSION_INT>=AV_VERSION_INT(55,18,102))&&(LIBAVFORMAT_VERSION_INT>=AV_VERSION_INT(55,12,100))&&(LIBAVDEVICE_VERSION_INT>=AV_VERSION_INT(55,3,100))&&(LIBAVFILTER_VERSION_INT>=AV_VERSION_INT(3,79,101))&&(LIBSWSCALE_VERSION_INT>=AV_VERSION_INT(2,3,100))&&(LIBSWRESAMPLE_VERSION_INT>=AV_VERSION_INT(0,17,102)))
101
    #elif   ((LIBAVUTIL_VERSION_INT>=AV_VERSION_INT(52,38,100))&&(LIBAVCODEC_VERSION_INT>=AV_VERSION_INT(55,18,102))&&(LIBAVFORMAT_VERSION_INT>=AV_VERSION_INT(55,12,100))&&(LIBAVDEVICE_VERSION_INT>=AV_VERSION_INT(55,3,100))&&(LIBAVFILTER_VERSION_INT>=AV_VERSION_INT(3,79,101))&&(LIBSWSCALE_VERSION_INT>=AV_VERSION_INT(2,3,100))&&(LIBSWRESAMPLE_VERSION_INT>=AV_VERSION_INT(0,17,102)))
Lines 108-113 Link Here
108
    #else
110
    #else
109
        // unsupported version
111
        // unsupported version
110
    #endif
112
    #endif
113
    #if (FFMPEGVERSIONINT<300)
114
      #include "libavfilter/avcodec.h"
115
    #else
116
      #include "libavcodec/avcodec.h"
117
    #endif
118
    #include "libavfilter/buffersink.h"
119
    #include "libavfilter/buffersrc.h"
111
#endif
120
#endif
112
}
121
}
113
122
(-)src/ffDiaporama/engine/_EncodeVideo.cpp (-11 / +33 lines)
Lines 20-26 Link Here
20
20
21
#include "_EncodeVideo.h"
21
#include "_EncodeVideo.h"
22
22
23
#define PIXFMT      PIX_FMT_RGB24
23
#if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=300))
24
  #define PIXFMT AV_PIX_FMT_RGB24
25
#else
26
  #define PIXFMT PIX_FMT_RGB24
27
#endif
24
#define QTPIXFMT    QImage::Format_RGB888
28
#define QTPIXFMT    QImage::Format_RGB888
25
29
26
//*************************************************************************************************************************************************
30
//*************************************************************************************************************************************************
Lines 410-418 Link Here
410
    // Setup codec parameters
414
    // Setup codec parameters
411
    VideoStream->codec->width               =ImageWidth;
415
    VideoStream->codec->width               =ImageWidth;
412
    VideoStream->codec->height              =ImageHeight;
416
    VideoStream->codec->height              =ImageHeight;
417
    #if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=300))
418
    VideoStream->codec->pix_fmt             =AV_PIX_FMT_YUV420P;
419
    #else
413
    VideoStream->codec->pix_fmt             =PIX_FMT_YUV420P;
420
    VideoStream->codec->pix_fmt             =PIX_FMT_YUV420P;
421
    #endif
414
    VideoStream->codec->time_base           =VideoFrameRate;
422
    VideoStream->codec->time_base           =VideoFrameRate;
415
    VideoStream->time_base                  =VideoFrameRate;
416
    VideoStream->codec->sample_aspect_ratio =PixelAspectRatio;
423
    VideoStream->codec->sample_aspect_ratio =PixelAspectRatio;
417
    VideoStream->sample_aspect_ratio        =PixelAspectRatio;
424
    VideoStream->sample_aspect_ratio        =PixelAspectRatio;
418
    if ((codec->id!=AV_CODEC_ID_H264)||(!VBR)) {
425
    if ((codec->id!=AV_CODEC_ID_H264)||(!VBR)) {
Lines 435-441 Link Here
435
442
436
    } else if (codec->id==AV_CODEC_ID_MJPEG) {
443
    } else if (codec->id==AV_CODEC_ID_MJPEG) {
437
        //-qscale 2 -qmin 2 -qmax 2
444
        //-qscale 2 -qmin 2 -qmax 2
445
        #if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=300))
446
        VideoStream->codec->pix_fmt             =AV_PIX_FMT_YUVJ420P;
447
        #else
438
        VideoStream->codec->pix_fmt             =PIX_FMT_YUVJ420P;
448
        VideoStream->codec->pix_fmt             =PIX_FMT_YUVJ420P;
449
        #endif
439
        VideoStream->codec->qmin                =2;
450
        VideoStream->codec->qmin                =2;
440
        VideoStream->codec->qmax                =2;
451
        VideoStream->codec->qmax                =2;
441
        VideoStream->codec->bit_rate_tolerance  =(ImageWidth*ImageHeight*2*VideoFrameRate.den/VideoFrameRate.num)*2;
452
        VideoStream->codec->bit_rate_tolerance  =(ImageWidth*ImageHeight*2*VideoFrameRate.den/VideoFrameRate.num)*2;
Lines 565-571 Link Here
565
    #endif
576
    #endif
566
577
567
    // Create and prepare VideoFrame and VideoFrameBuf
578
    // Create and prepare VideoFrame and VideoFrameBuf
568
    VideoFrame=avcodec_alloc_frame();  // Allocate structure for RGB image
579
    #if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=300))
580
    VideoFrame=av_frame_alloc();
581
    #else
582
    VideoFrame=avcodec_alloc_frame();
583
    #endif
569
    if (!VideoFrame) {
584
    if (!VideoFrame) {
570
        ToLog(LOGMSG_CRITICAL,"EncodeVideo-OpenVideoStream: avcodec_alloc_frame() failed");
585
        ToLog(LOGMSG_CRITICAL,"EncodeVideo-OpenVideoStream: avcodec_alloc_frame() failed");
571
        return false;
586
        return false;
Lines 655-661 Link Here
655
        return false;
670
        return false;
656
    }
671
    }
657
672
673
    #if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=300))
674
    AudioFrame=av_frame_alloc();
675
    #else
658
    AudioFrame=avcodec_alloc_frame();
676
    AudioFrame=avcodec_alloc_frame();
677
    #endif
659
    if (AudioFrame==NULL) {
678
    if (AudioFrame==NULL) {
660
        ToLog(LOGMSG_CRITICAL,QString("EncodeVideo-OpenAudioStream:: avcodec_alloc_frame failed"));
679
        ToLog(LOGMSG_CRITICAL,QString("EncodeVideo-OpenAudioStream:: avcodec_alloc_frame failed"));
661
        return false;
680
        return false;
Lines 1096-1102 Link Here
1096
            if (Continue) {
1115
            if (Continue) {
1097
                // Init AudioFrame
1116
                // Init AudioFrame
1098
                AVRational AVR;
1117
                AVRational AVR;
1118
                #if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=300))
1119
                av_frame_unref(AudioFrame);
1120
                #else
1099
                avcodec_get_frame_defaults(AudioFrame);
1121
                avcodec_get_frame_defaults(AudioFrame);
1122
                #endif
1100
                AVR.num                     =1;
1123
                AVR.num                     =1;
1101
                AVR.den                     =AudioStream->codec->sample_rate;
1124
                AVR.den                     =AudioStream->codec->sample_rate;
1102
                AudioFrame->nb_samples      =DestPacketSize/DestSampleSize;
1125
                AudioFrame->nb_samples      =DestPacketSize/DestSampleSize;
Lines 1181-1187 Link Here
1181
    int     errcode;
1204
    int     errcode;
1182
1205
1183
    if (Image) {
1206
    if (Image) {
1184
        avcodec_get_frame_defaults(VideoFrame);
1207
        #if (defined(FFMPEG)&&(FFMPEGVERSIONINT>=300))
1208
        av_frame_unref(AudioFrame);
1209
        #else
1210
        avcodec_get_frame_defaults(AudioFrame);
1211
        #endif
1185
        if (avpicture_fill(
1212
        if (avpicture_fill(
1186
            (AVPicture *)VideoFrame,            // Frame to prepare
1213
            (AVPicture *)VideoFrame,            // Frame to prepare
1187
            VideoFrameBuf,                      // Buffer which will contain the image data
1214
            VideoFrameBuf,                      // Buffer which will contain the image data
Lines 1226-1239 Link Here
1226
        }
1253
        }
1227
    }
1254
    }
1228
1255
1229
    if ((VideoFrameNbr%VideoStream->codec->gop_size)==0)
1256
    if ((VideoFrameNbr%VideoStream->codec->gop_size)==0) VideoFrame->pict_type=AV_PICTURE_TYPE_I;
1230
      VideoFrame->pict_type=AV_PICTURE_TYPE_I;
1257
        else VideoFrame->pict_type=(AVPictureType)0;
1231
    else
1232
      VideoFrame->pict_type=(AVPictureType)0;
1233
    VideoFrame->pts=VideoFrameNbr;
1258
    VideoFrame->pts=VideoFrameNbr;
1234
    VideoFrame->format=VideoStream->codec->pix_fmt;
1235
    VideoFrame->width=VideoStream->codec->width;
1236
    VideoFrame->height=VideoStream->codec->height;
1237
1259
1238
    if ((Continue)&&(!StopProcessWanted)) {
1260
    if ((Continue)&&(!StopProcessWanted)) {
1239
1261

Return to bug 575058