1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
|
/* ======================================================================
This file is part of ffDiaporama
ffDiaporama is a tools to make diaporama as video
Copyright (C) 2011-2012 Dominique Levray <levray.dominique@bbox.fr>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
====================================================================== */
#ifndef CDEVICEMODELDEF_H
#define CDEVICEMODELDEF_H
// Basic inclusions (common to all files)
#include "_GlobalDefines.h"
#include "_QCustomDialog.h"
// Include some additional standard class
#include <QString>
#include <QStringList>
#include <QtXml/QDomDocument>
#include <QtXml/QDomElement>
// Include some common various class
#include "cBaseApplicationConfig.h"
//****************************************************************************************************************************************************************
// LIBAV inclusion
//****************************************************************************************************************************************************************
extern "C" {
#ifndef INT64_C
#define INT64_C(c) (c ## LL)
#define UINT64_C(c) (c ## ULL)
#endif
#include <libavcodec/version.h>
#include <libavformat/version.h>
#include <libavutil/avutil.h>
#include <libswscale/swscale.h>
#include <libavutil/mathematics.h>
#include <libavutil/pixdesc.h>
#include <libavutil/audioconvert.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavformat/avio.h>
}
/* ********************************************************************************
Create define depending on libav version to control code creation
********************************************************************************
VERSIONS:
---------
OPERATING SYSTEM DATE BINARY BIN.VERSION LIBAVUTIL LIBAVCODEC LIBAVFORMAT LIBAVDEVICE LIBAVFILTER LIBSWSCALE
---------------- ---------- ------ ----------- ---------- ---------- ----------- ----------- ----------- ----------
WINDOWS LIBAV_08 avconv 0.8-1036 51.25.0 54.8.0 54.2.0 53.2.0 2.15.0 2.1.0
UBUNTU 12.04 LIBAV_08 avconv 0.8.1-4 51.22.1 53.35.0 53.21.0 53.2.0 2.15.0 2.1.0
UBUNTU 11.10 LIBAV_08 ffmpeg 0.7.3-4 51.7.0 53.6.0 53.3.0 53.0.0 2.4.0 2.0.0
OPENSUSE 12.1 LIBAV_08 ffmpeg 0.10.2 51.35.100 53.61.100 53.32.100 53.4.100 2.61.100 2.1.100
OPENSUSE 11.4 LIBAV_08 ffmpeg 0.10.2 51.35.100 53.61.100 53.32.100 53.4.100 2.61.100 2.1.100
FEDORA 16 LIBAV_07 ffmpeg 0.8.10 51.9.1 53.8.0 53.5.0 53.1.1 2.23.0 2.0.0
MAGEIA 2 LIBAV_08 ffmpeg 0.10.2 51.35.100 53.61.100 53.32.100 53.4.100 2.61.100 2.1.100
*************************************************************************************************************************** */
// LIBAV 0.7 = LIBAVUTIL from 51.7 to 51.21 + LIBAVCODEC from 53.6 to 53.34 + LIBAVFORMAT from 53.3 to 53.20
#if ( ( (LIBAVUTIL_VERSION_MAJOR ==51)&&(LIBAVUTIL_VERSION_MINOR >=7)&&(LIBAVUTIL_VERSION_MINOR <=21) ) && \
( (LIBAVCODEC_VERSION_MAJOR ==53)&&(LIBAVCODEC_VERSION_MINOR >=6)&&(LIBAVCODEC_VERSION_MINOR <=34) ) && \
( (LIBAVFORMAT_VERSION_MAJOR ==53)&&(LIBAVFORMAT_VERSION_MINOR>=3)&&(LIBAVFORMAT_VERSION_MINOR<=20) ) )
#define LIBAV_07 // LIBAV 0.7
#define LIBAV_FFMPEG // FFMPEG binary encoder support
#define LIBAV_TAGCHAPTERS // Support for TAG & CHAPTERS
// LIBAV 0.8 = LIBAVUTIL from 51.22 + LIBAVCODEC from 53.35 to 54.20 + LIBAVFORMAT from 53.21 to 54.20
#elif ( ( (LIBAVUTIL_VERSION_MAJOR==51)&&(LIBAVUTIL_VERSION_MINOR>=22) ) && \
( ((LIBAVCODEC_VERSION_MAJOR==53)&&(LIBAVCODEC_VERSION_MINOR>=35)) || ((LIBAVCODEC_VERSION_MAJOR==54)&&(LIBAVCODEC_VERSION_MINOR<20)) ) && \
( ((LIBAVFORMAT_VERSION_MAJOR==53)&&(LIBAVFORMAT_VERSION_MINOR>=21)) || ((LIBAVFORMAT_VERSION_MAJOR==54)&&(LIBAVFORMAT_VERSION_MINOR<20)) ) )
#define LIBAV_08 // LIBAV 0.8
#define LIBAV_FFMPEG // FFMPEG binary encoder support
#define LIBAV_AVCONV // AVCONV binary encoder support
#define LIBAV_TAGCHAPTERS // Support for TAG & CHAPTERS
#ifdef CODEC_FLAG2_SHOW_ALL
// #define LIBAV_AVCHD // Support for AVCHD format (.mts)
#endif
#endif
//****************************************************************************************************************************************************************
#define CONFIGFILENAME "Devices"
#define CONFIGDOCNAME "DEVICES"
#define CONFIGROOTNAME "Configuration"
// Export mode definition
#define EXPORTMODE_ADVANCED 0
#define ICON_ADVANCED ":/img/render.png"
#define MODE_SMARTPHONE 1
#define ICON_SMARTPHONE ":/img/Smartphone.png"
#define MODE_MULTIMEDIASYS 2
#define ICON_MULTIMEDIASYS ":/img/tv.png"
#define MODE_FORTHEWEB 3
#define ICON_FORTHEWEB ":/img/Internet.png"
#define MODE_LOSSLESS 4
#define ICON_LOSSLESS ":/img/Lossless.png"
//============================================
// Standard definition
#define STANDARD_PAL 0
#define STANDARD_NTSC 1
// Image size definition
#define NBR_SIZEDEF 9
#define SIZE_QVGA 0
#define SIZE_HVGA 1
#define SIZE_VGA 2
#define SIZE_DVD 3
#define SIZE_WVGA 4
#define SIZE_XGA 5
#define SIZE_720P 6
#define SIZE_1080p 7
#define SIZE_RIM240 8
//============================================
// Image format definition
//============================================
struct sIMAGEDEF {
int Width; // Width
int Height; // Height
int PARNUM; // Pixel aspect ratio (num)
int PARDEN; // Pixel aspect ratio (den)
double dFPS; // Frame per second
char FPS[20]; // Frame per second
char Name[100]; // Display name
int Extend; // Padding for cinema mode with DVD
};
extern sIMAGEDEF DefImageFormat [2][3][NBR_SIZEDEF]; // Image format definition
extern QString IMAGEDEFGENNAME[2][NBR_SIZEDEF]; // Image format generic name
extern int ORDERIMAGENAME[NBR_SIZEDEF]; // Display order of image size
//============================================
// Video codec definitions
//============================================
#define VCODEC_MJPEG 0 // Motion JPEG
#define VCODECST_MJPEG "MJPEG" // String Motion JPEG
#define VCODEC_MPEG 1 // MPEG-2 video
#define VCODECST_MPEG "MPEG" // String MPEG-2 video
#define VCODEC_MPEG4 2 // DivX/XVid/MPEG-4
#define VCODECST_MPEG4 "MPEG4" // String DivX/XVid/MPEG-4
#define VCODEC_H264HQ 3 // H.264 AVC/MPEG-4 AVC + VPRE libx264-hq.ffpreset
#define VCODECST_H264HQ "H264HQ" // String H.264 AVC/MPEG-4 AVC + VPRE libx264-hq.ffpreset
#define VCODEC_H264PQ 4 // H.264 AVC/MPEG-4 AVC + VPRE libx264-hq.ffpreset ********
#define VCODECST_H264PQ "H264PQ" // String H.264 AVC/MPEG-4 AVC + VPRE libx264-hq.ffpreset ********
#define VCODEC_VP8 5 // WebM-VP8
#define VCODECST_VP8 "VP8" // String WebM-VP8
#define VCODEC_H263 6 // Flash Video / Sorenson H.263
#define VCODECST_H263 "H263" // String Flash Video / Sorenson H.263
#define VCODEC_THEORA 7 // Theora
#define VCODECST_THEORA "THEORA" // String Theora
#define VCODEC_X264LL 8 // x264 lossless + VPRE libx264-lossless.ffpreset ********
#define VCODECST_X264LL "X264LL" // String x264 lossless ********
struct sVideoCodecDef {
bool IsFind; // true if codec is supported by installed version of libav
int Codec_id; // libav codec id
int FFD_VCODEC; // ffDiaporama video codec id
char FFD_VCODECST[10]; // ffDiaporama video codec id string
char ShortName[50]; // short name of the codec (copy of the libav value)
char LongName[200]; // long name of the codec (define by this application)
char PossibleBitrate[200]; // list of possible compression bit rate (define by this application)
char DefaultBitrate[NBR_SIZEDEF][10]; // prefered compression bit rate for each possible size
};
#define NBR_VIDEOCODECDEF 9
extern struct sVideoCodecDef VIDEOCODECDEF[NBR_VIDEOCODECDEF];
//============================================
// Audio codec definitions
//============================================
struct sAudioCodecDef {
bool IsFind; // true if codec is supported by installed version of libav
int Codec_id; // libav codec id
char ShortName[50]; // short name of the codec (copy of the libav value)
char LongName[200]; // long name of the codec (define by this application)
char PossibleBitrate2CH[200]; // list of possible compression bit rate in stereo mode (define by this application)
bool Possibly6CH; // true if this codec support 5.1/6 chanels mode
char PossibleBitrate6CH[200]; // list of possible compression bit rate in 5.1/6 chanels mode (define by this application)
char Default[10]; // prefered compression bit rate
};
#define NBR_AUDIOCODECDEF 9
extern struct sAudioCodecDef AUDIOCODECDEF[NBR_AUDIOCODECDEF];
//============================================
// Format container definitions
//============================================
struct sFormatDef {
bool IsFind; // true if format container is supported by installed version of libav
char ShortName[50]; // short name of the format container (copy of the libav value)
char FileExtension[10]; // prefered file extension for the format container (define by this application)
char LongName[200]; // long name of the codec (define by this application)
char PossibleVideoCodec[200]; // list of possible video codec for this format container (using VCODECST String define)
char PossibleAudioCodec[200]; // list of possible audio codec for this format container (define by this application)
};
#define NBR_FORMATDEF 10
extern struct sFormatDef FORMATDEF[NBR_FORMATDEF];
#define NBR_AUDIOFORMATDEF 5
extern struct sFormatDef AUDIOFORMATDEF[NBR_AUDIOFORMATDEF];
//============================================
// Device model class definition
//============================================
class cDeviceModelDef {
public:
bool FromGlobalConf; // true if device model is defined in global config file
bool FromUserConf; // true if device model is defined in user config file
bool IsFind; // true if device model format is supported by installed version of ffmpeg
int DeviceIndex; // Device number index key
QString DeviceName; // long name for the device model
int DeviceType; // device type
int DeviceSubtype; // device Subtype
int Standard; // standard : PAL/NTSC
int FileFormat; // sFormatDef number
int ImageSize; // DefImageFormat number
int VideoCodec; // sVideoCodecDef number
int VideoBitrate; // Bitrate number in sVideoCodecDef
int AudioCodec; // sAudioCodecDef number
int AudioBitrate; // Bitrate number in sAudioCodecDef
// Save value to be able to reset to default
QString BckDeviceName; // long name for the device model
int BckDeviceType; // device type
int BckDeviceSubtype; // device Subtype
int BckStandard; // standard : PAL/NTSC
int BckFileFormat; // sFormatDef number
int BckImageSize; // DefImageFormat number
int BckVideoCodec; // sVideoCodecDef number
int BckVideoBitrate; // Bitrate number in sVideoCodecDef
int BckAudioCodec; // sAudioCodecDef number
int BckAudioBitrate; // Bitrate number in sAudioCodecDef
cDeviceModelDef(bool IsGlobalConf,int IndexKey);
~cDeviceModelDef();
virtual void SaveToXML(QDomElement &domDocument,QString ElementName);
virtual bool LoadFromXML(QDomElement domDocument,QString ElementName,bool IsUserConfigFile);
};
//============================================
// Device model list definition
//============================================
class cDeviceModelList {
public:
QList<cDeviceModelDef *> RenderDeviceModel; // List of known rendering device model
QStringList TranslatedRenderType; // Translated render device type
QStringList TranslatedRenderSubtype[4]; // Translated render device subtype
cDeviceModelList();
~cDeviceModelList();
virtual bool LoadConfigurationFile(QString ConfigFileName,cBaseApplicationConfig::LoadConfigFileType TypeConfigFile);
virtual bool SaveConfigurationFile(QString ConfigFileName);
virtual bool LoadFromXML(QDomElement domDocument,cBaseApplicationConfig::LoadConfigFileType TypeConfigFile);
virtual void TranslatRenderType();
virtual bool Initffmpeg(QString &BinaryEncoderPath);
};
#endif // CDEVICEMODELDEF_H
|