20 QString durationStr =
"P%1%2";
24 dayStr = QString(
"D%1").arg((msec % 24h).count());
28 return durationStr.arg(dayStr, timeStr);
33 QString timeStr = time.toString(
"HH:mm:ss");
39 QTime time = QTime::fromMSecsSinceStartOfDay(msec.count());
40 return time.toString(
"HH:mm:ss");
45 QString dateTimeStr = dateTime.toString(
Qt::ISODate);
60 switch (date.dayOfWeek())
91 QTime time = QTime::fromMSecsSinceStartOfDay(msec.count());
92 return time.toString(
"H:mm:ss.zzz");
101 const double ,
const QString &container,
102 const QString &vidCodec,
const QString &audioCodec)
104 QString sProfileName;
105 bool isHD = (resolution.height() >= 720) || (resolution.width() > 720);
112 bool isNorthAmerica = (sCountryCode ==
"us" || sCountryCode ==
"ca" ||
113 sCountryCode ==
"mx");
115 if (container ==
"MPEG2-PS")
117 if (isHD && audioCodec ==
"DTS")
118 sProfileName =
"MPEG_PS_HD_DTS";
123 else if (audioCodec ==
"DTS")
124 sProfileName =
"MPEG_PS_SD_DTS";
128 sProfileName =
"MPEG_PS_NTSC";
130 sProfileName =
"MPEG_PS_PAL";
133 else if (container ==
"MPEG2-TS")
137 if (vidCodec ==
"H264")
138 sProfileName =
"AVC_TS_NA_ISO";
140 sProfileName =
"MPEG_TS_HD_NA_ISO";
142 sProfileName =
"MPEG_TS_SD_NA_ISO";
146 if (vidCodec ==
"H264" || isHD)
147 sProfileName =
"AVC_TS_EU_ISO";
149 sProfileName =
"MPEG_TS_SD_EU_ISO";
152 else if (mimeType ==
"video/x-matroska" || container ==
"MATROSKA")
158 if (vidCodec ==
"H264")
163 if (audioCodec ==
"AAC")
165 sProfileName =
"AVC_MKV_HP_HD_AAC_MULT5";
167 else if (audioCodec ==
"AC3")
169 sProfileName =
"AVC_MKV_HP_HD_AC3";
171 else if (audioCodec ==
"E-AC3")
173 sProfileName =
"AVC_MKV_HP_HD_EAC3";
175 else if (audioCodec ==
"MP3")
177 sProfileName =
"AVC_MKV_HP_HD_MPEG1_L3";
179 else if (audioCodec ==
"DTS")
181 sProfileName =
"AVC_MKV_HP_HD_DTS";
183 else if (audioCodec ==
"MLP")
185 sProfileName =
"AVC_MKV_HP_HD_MLP";
189 else if (mimeType ==
"audio/mpeg")
191 sProfileName =
"MP3X";
193 else if (mimeType ==
"audio/x-ms-wma")
195 sProfileName =
"WMAFULL";
197 else if (mimeType ==
"audio/vnd.dolby.dd-raw")
199 sProfileName =
"AC3";
201 else if (mimeType ==
"audio/mp4")
203 sProfileName =
"AAC_ISO_320";
205 else if (mimeType ==
"image/jpeg")
207 if (resolution.width() <= 160 && resolution.height() <= 160)
208 sProfileName =
"JPEG_TN";
209 else if (resolution.width() <= 640 && resolution.height() <= 480)
210 sProfileName =
"JPEG_SM";
211 else if (resolution.width() <= 1024 && resolution.height() <= 768)
212 sProfileName =
"JPEG_MED";
213 else if (resolution.width() <= 4096 && resolution.height() <= 4096)
214 sProfileName =
"JPEG_LRG";
216 else if (mimeType ==
"image/png")
218 if (resolution.width() <= 160 && resolution.height() <= 160)
219 sProfileName =
"PNG_TN";
220 else if (resolution.width() <= 4096 && resolution.height() <= 4096)
221 sProfileName =
"PNG_LRG";
223 else if (mimeType ==
"image/gif")
225 if (resolution.width() <= 1600 && resolution.height() <= 1200)
226 sProfileName =
"GIF_LRG";
237 const QString &mimeType,
const QSize resolution,
238 double videoFrameRate,
const QString &container,
239 const QString &videoCodec,
const QString &audioCodec,
243 QStringList sAdditionalInfoList;
251 QString sProfileName =
DLNAProfileName(mimeType, resolution, videoFrameRate,
252 container, videoCodec, audioCodec);
253 if (!sProfileName.isEmpty())
254 sAdditionalInfoList << QString(
"DLNA.ORG_PN=%1").arg(sProfileName);
276 if (mimeType.startsWith(
"audio") || mimeType.startsWith(
"video"))
293 QString sAdditionalInfo =
"*";
306 if (!sAdditionalInfoList.isEmpty() &&
307 sAdditionalInfoList.first().startsWith(
"DLNA.ORG_PN"))
308 sAdditionalInfo = sAdditionalInfoList.join(
";");
310 return sAdditionalInfo;
316 const QString &mimeType,
const QSize resolution,
317 double videoFrameRate,
const QString &container,
318 const QString &videoCodec,
const QString &audioCodec,
321 QStringList protocolInfoFields;
328 protocolInfoFields <<
"http-get";
330 protocolInfoFields <<
"rtsp-rtp-udp";
337 protocolInfoFields <<
"*";
342 protocolInfoFields << mimeType;
348 videoFrameRate, container,
349 videoCodec, audioCodec,
352 if (protocolInfoFields.size() != 4)
353 LOG(VB_GENERAL, LOG_CRIT,
"DLNA::ProtocolInfoString() : Invalid number of fields in string");
355 QString str = protocolInfoFields.join(
":");
357 if (str.length() > 256)
359 LOG(VB_GENERAL, LOG_WARNING,
"DLNA::ProtocolInfoString() : ProtocolInfo string exceeds "
360 "256 byte limit for compatibility with older UPnP devices. "
361 "Consider omitting optional DLNA information such as ci-param");
377 LOG(VB_GENERAL, LOG_ERR,
"Programmer Error: 'Streaming' and 'Interactive' mode flags are mutally exclusive");
385 return QString(
"DLNA.ORG_FLAGS=%1")
386 .arg(flags,8,10,QChar(
'0')) +
"000000000000000000000000";
391 QString str =
"DLNA.ORG_OP=%1%2";
411 QString str =
"DLNA.ORG_CI=%1";
413 return str.arg(wasConverted ?
"1" :
"0");