Replace unicode char with its integer value

pull/2220/head
Bond_009 5 years ago
parent d756233f62
commit 09d1f976d9

@ -1334,24 +1334,25 @@ namespace MediaBrowser.MediaEncoding.Probing
{ {
video.Timestamp = GetMpegTimestamp(video.Path); video.Timestamp = GetMpegTimestamp(video.Path);
_logger.LogDebug("Video has {timestamp} timestamp", video.Timestamp); _logger.LogDebug("Video has {Timestamp} timestamp", video.Timestamp);
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Error extracting timestamp info from {path}", video.Path); _logger.LogError(ex, "Error extracting timestamp info from {Path}", video.Path);
video.Timestamp = null; video.Timestamp = null;
} }
} }
} }
} }
// REVIEW:
private TransportStreamTimestamp GetMpegTimestamp(string path) private TransportStreamTimestamp GetMpegTimestamp(string path)
{ {
var packetBuffer = new byte['Å']; var packetBuffer = new byte[197];
using (var fs = _fileSystem.GetFileStream(path, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read)) using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
{ {
fs.Read(packetBuffer, 0, packetBuffer.Length); fs.Read(packetBuffer);
} }
if (packetBuffer[0] == 71) if (packetBuffer[0] == 71)
@ -1359,7 +1360,7 @@ namespace MediaBrowser.MediaEncoding.Probing
return TransportStreamTimestamp.None; return TransportStreamTimestamp.None;
} }
if ((packetBuffer[4] == 71) && (packetBuffer['Ä'] == 71)) if ((packetBuffer[4] == 71) && (packetBuffer[196] == 71))
{ {
if ((packetBuffer[0] == 0) && (packetBuffer[1] == 0) && (packetBuffer[2] == 0) && (packetBuffer[3] == 0)) if ((packetBuffer[0] == 0) && (packetBuffer[1] == 0) && (packetBuffer[2] == 0) && (packetBuffer[3] == 0))
{ {

Loading…
Cancel
Save