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")
125 sProfileName =
"MPEG_PS_SD_DTS";
130 sProfileName =
"MPEG_PS_NTSC";
132 sProfileName =
"MPEG_PS_PAL";
135 else if (container ==
"MPEG2-TS")
139 if (vidCodec ==
"H264")
140 sProfileName =
"AVC_TS_NA_ISO";
142 sProfileName =
"MPEG_TS_HD_NA_ISO";
144 sProfileName =
"MPEG_TS_SD_NA_ISO";
148 if (vidCodec ==
"H264" || isHD)
149 sProfileName =
"AVC_TS_EU_ISO";
151 sProfileName =
"MPEG_TS_SD_EU_ISO";
154 else if (mimeType ==
"video/x-matroska" || container ==
"MATROSKA")
160 if (vidCodec ==
"H264")
165 if (audioCodec ==
"AAC")
167 sProfileName =
"AVC_MKV_HP_HD_AAC_MULT5";
169 else if (audioCodec ==
"AC3")
171 sProfileName =
"AVC_MKV_HP_HD_AC3";
173 else if (audioCodec ==
"E-AC3")
175 sProfileName =
"AVC_MKV_HP_HD_EAC3";
177 else if (audioCodec ==
"MP3")
179 sProfileName =
"AVC_MKV_HP_HD_MPEG1_L3";
181 else if (audioCodec ==
"DTS")
183 sProfileName =
"AVC_MKV_HP_HD_DTS";
185 else if (audioCodec ==
"MLP")
187 sProfileName =
"AVC_MKV_HP_HD_MLP";
191 else if (mimeType ==
"audio/mpeg")
193 sProfileName =
"MP3X";
195 else if (mimeType ==
"audio/x-ms-wma")
197 sProfileName =
"WMAFULL";
199 else if (mimeType ==
"audio/vnd.dolby.dd-raw")
201 sProfileName =
"AC3";
203 else if (mimeType ==
"audio/mp4")
205 sProfileName =
"AAC_ISO_320";
207 else if (mimeType ==
"image/jpeg")
209 if (resolution.width() <= 160 && resolution.height() <= 160)
210 sProfileName =
"JPEG_TN";
211 else if (resolution.width() <= 640 && resolution.height() <= 480)
212 sProfileName =
"JPEG_SM";
213 else if (resolution.width() <= 1024 && resolution.height() <= 768)
214 sProfileName =
"JPEG_MED";
215 else if (resolution.width() <= 4096 && resolution.height() <= 4096)
216 sProfileName =
"JPEG_LRG";
218 else if (mimeType ==
"image/png")
220 if (resolution.width() <= 160 && resolution.height() <= 160)
221 sProfileName =
"PNG_TN";
222 else if (resolution.width() <= 4096 && resolution.height() <= 4096)
223 sProfileName =
"PNG_LRG";
225 else if (mimeType ==
"image/gif")
227 if (resolution.width() <= 1600 && resolution.height() <= 1200)
228 sProfileName =
"GIF_LRG";
239 const QString &mimeType,
const QSize resolution,
240 double videoFrameRate,
const QString &container,
241 const QString &videoCodec,
const QString &audioCodec,
245 QStringList sAdditionalInfoList;
253 QString sProfileName =
DLNAProfileName(mimeType, resolution, videoFrameRate,
254 container, videoCodec, audioCodec);
255 if (!sProfileName.isEmpty())
256 sAdditionalInfoList << QString(
"DLNA.ORG_PN=%1").arg(sProfileName);
278 if (mimeType.startsWith(
"audio") || mimeType.startsWith(
"video"))
295 QString sAdditionalInfo =
"*";
308 if (!sAdditionalInfoList.isEmpty() &&
309 sAdditionalInfoList.first().startsWith(
"DLNA.ORG_PN"))
310 sAdditionalInfo = sAdditionalInfoList.join(
";");
312 return sAdditionalInfo;
318 const QString &mimeType,
const QSize resolution,
319 double videoFrameRate,
const QString &container,
320 const QString &videoCodec,
const QString &audioCodec,
323 QStringList protocolInfoFields;
330 protocolInfoFields <<
"http-get";
332 protocolInfoFields <<
"rtsp-rtp-udp";
339 protocolInfoFields <<
"*";
344 protocolInfoFields << mimeType;
350 videoFrameRate, container,
351 videoCodec, audioCodec,
354 if (protocolInfoFields.size() != 4)
355 LOG(VB_GENERAL, LOG_CRIT,
"DLNA::ProtocolInfoString() : Invalid number of fields in string");
357 QString str = protocolInfoFields.join(
":");
359 if (str.length() > 256)
361 LOG(VB_GENERAL, LOG_WARNING,
"DLNA::ProtocolInfoString() : ProtocolInfo string exceeds "
362 "256 byte limit for compatibility with older UPnP devices. "
363 "Consider omitting optional DLNA information such as ci-param");
379 LOG(VB_GENERAL, LOG_ERR,
"Programmer Error: 'Streaming' and 'Interactive' mode flags are mutally exclusive");
387 return QString(
"DLNA.ORG_FLAGS=%1")
388 .arg(flags,8,10,QChar(
'0')) +
"000000000000000000000000";
393 QString str =
"DLNA.ORG_OP=%1%2";
413 QString str =
"DLNA.ORG_CI=%1";
415 return str.arg(wasConverted ?
"1" :
"0");