Visual Studio Reformat: BDInfo

This commit is contained in:
Erwin de Haan 2019-01-13 20:15:15 +01:00
parent 9dcaafe700
commit 1077570ca8
5 changed files with 133 additions and 134 deletions

View File

@ -24,7 +24,7 @@ namespace BDInfo
{
public abstract class TSCodecAC3
{
private static byte[] eac3_blocks = new byte[] { 1, 2, 3, 6 };
private static byte[] eac3_blocks = new byte[] { 1, 2, 3, 6 };
public static void Scan(
TSAudioStream stream,

View File

@ -17,7 +17,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//=============================================================================
using System.IO;
using MediaBrowser.Model.IO;
// TODO: Do more interesting things here...

View File

@ -21,7 +21,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Text;
@ -446,7 +445,7 @@ namespace BDInfo
chapterIndex < chapterCount;
chapterIndex++)
{
int chapterType = data[pos+1];
int chapterType = data[pos + 1];
if (chapterType == 1)
{

View File

@ -21,7 +21,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Text;
@ -37,7 +36,7 @@ namespace BDInfo
public string Name = null;
public Dictionary<ushort, TSStream> Streams =
new Dictionary<ushort,TSStream>();
new Dictionary<ushort, TSStream>();
public TSStreamClipFile(
FileSystemMetadata fileInfo, IFileSystem fileSystem, ITextEncoding textEncoding)
@ -127,18 +126,18 @@ namespace BDInfo
case TSStreamType.MPEG1_VIDEO:
case TSStreamType.MPEG2_VIDEO:
case TSStreamType.VC1_VIDEO:
{
TSVideoFormat videoFormat = (TSVideoFormat)
(clipData[streamOffset + 2] >> 4);
TSFrameRate frameRate = (TSFrameRate)
(clipData[streamOffset + 2] & 0xF);
TSAspectRatio aspectRatio = (TSAspectRatio)
(clipData[streamOffset + 3] >> 4);
{
TSVideoFormat videoFormat = (TSVideoFormat)
(clipData[streamOffset + 2] >> 4);
TSFrameRate frameRate = (TSFrameRate)
(clipData[streamOffset + 2] & 0xF);
TSAspectRatio aspectRatio = (TSAspectRatio)
(clipData[streamOffset + 3] >> 4);
stream = new TSVideoStream();
((TSVideoStream)stream).VideoFormat = videoFormat;
((TSVideoStream)stream).AspectRatio = aspectRatio;
((TSVideoStream)stream).FrameRate = frameRate;
stream = new TSVideoStream();
((TSVideoStream)stream).VideoFormat = videoFormat;
((TSVideoStream)stream).AspectRatio = aspectRatio;
((TSVideoStream)stream).FrameRate = frameRate;
#if DEBUG
Debug.WriteLine(string.Format(
"\t{0} {1} {2} {3} {4}",
@ -148,8 +147,8 @@ namespace BDInfo
frameRate,
aspectRatio));
#endif
}
break;
}
break;
case TSStreamType.AC3_AUDIO:
case TSStreamType.AC3_PLUS_AUDIO:
@ -162,23 +161,23 @@ namespace BDInfo
case TSStreamType.LPCM_AUDIO:
case TSStreamType.MPEG1_AUDIO:
case TSStreamType.MPEG2_AUDIO:
{
byte[] languageBytes = new byte[3];
Array.Copy(clipData, streamOffset + 3,
languageBytes, 0, languageBytes.Length);
string languageCode =
_textEncoding.GetASCIIEncoding().GetString(languageBytes, 0, languageBytes.Length);
{
byte[] languageBytes = new byte[3];
Array.Copy(clipData, streamOffset + 3,
languageBytes, 0, languageBytes.Length);
string languageCode =
_textEncoding.GetASCIIEncoding().GetString(languageBytes, 0, languageBytes.Length);
TSChannelLayout channelLayout = (TSChannelLayout)
(clipData[streamOffset + 2] >> 4);
TSSampleRate sampleRate = (TSSampleRate)
(clipData[streamOffset + 2] & 0xF);
TSChannelLayout channelLayout = (TSChannelLayout)
(clipData[streamOffset + 2] >> 4);
TSSampleRate sampleRate = (TSSampleRate)
(clipData[streamOffset + 2] & 0xF);
stream = new TSAudioStream();
((TSAudioStream)stream).LanguageCode = languageCode;
((TSAudioStream)stream).ChannelLayout = channelLayout;
((TSAudioStream)stream).SampleRate = TSAudioStream.ConvertSampleRate(sampleRate);
((TSAudioStream)stream).LanguageCode = languageCode;
stream = new TSAudioStream();
((TSAudioStream)stream).LanguageCode = languageCode;
((TSAudioStream)stream).ChannelLayout = channelLayout;
((TSAudioStream)stream).SampleRate = TSAudioStream.ConvertSampleRate(sampleRate);
((TSAudioStream)stream).LanguageCode = languageCode;
#if DEBUG
Debug.WriteLine(string.Format(
"\t{0} {1} {2} {3} {4}",
@ -188,20 +187,20 @@ namespace BDInfo
channelLayout,
sampleRate));
#endif
}
break;
}
break;
case TSStreamType.INTERACTIVE_GRAPHICS:
case TSStreamType.PRESENTATION_GRAPHICS:
{
byte[] languageBytes = new byte[3];
Array.Copy(clipData, streamOffset + 2,
languageBytes, 0, languageBytes.Length);
string languageCode =
_textEncoding.GetASCIIEncoding().GetString(languageBytes, 0, languageBytes.Length);
{
byte[] languageBytes = new byte[3];
Array.Copy(clipData, streamOffset + 2,
languageBytes, 0, languageBytes.Length);
string languageCode =
_textEncoding.GetASCIIEncoding().GetString(languageBytes, 0, languageBytes.Length);
stream = new TSGraphicsStream();
stream.LanguageCode = languageCode;
stream.LanguageCode = languageCode;
#if DEBUG
Debug.WriteLine(string.Format(
"\t{0} {1} {2}",
@ -209,16 +208,16 @@ namespace BDInfo
streamType,
languageCode));
#endif
}
break;
}
break;
case TSStreamType.SUBTITLE:
{
byte[] languageBytes = new byte[3];
Array.Copy(clipData, streamOffset + 3,
languageBytes, 0, languageBytes.Length);
string languageCode =
_textEncoding.GetASCIIEncoding().GetString(languageBytes, 0, languageBytes.Length);
{
byte[] languageBytes = new byte[3];
Array.Copy(clipData, streamOffset + 3,
languageBytes, 0, languageBytes.Length);
string languageCode =
_textEncoding.GetASCIIEncoding().GetString(languageBytes, 0, languageBytes.Length);
#if DEBUG
Debug.WriteLine(string.Format(
"\t{0} {1} {2}",
@ -227,9 +226,9 @@ namespace BDInfo
languageCode));
#endif
stream = new TSTextStream();
stream.LanguageCode = languageCode;
}
break;
stream.LanguageCode = languageCode;
}
break;
}
if (stream != null)

View File

@ -536,80 +536,80 @@ namespace BDInfo
switch (parser.HeaderParse)
{
case 2:
{
parser.TransportErrorIndicator =
(byte)((buffer[i] >> 7) & 0x1);
parser.PayloadUnitStartIndicator =
(byte)((buffer[i] >> 6) & 0x1);
parser.TransportPriority =
(byte)((buffer[i] >> 5) & 0x1);
parser.PID =
(ushort)((buffer[i] & 0x1f) << 8);
}
break;
{
parser.TransportErrorIndicator =
(byte)((buffer[i] >> 7) & 0x1);
parser.PayloadUnitStartIndicator =
(byte)((buffer[i] >> 6) & 0x1);
parser.TransportPriority =
(byte)((buffer[i] >> 5) & 0x1);
parser.PID =
(ushort)((buffer[i] & 0x1f) << 8);
}
break;
case 1:
{
parser.PID |= (ushort)buffer[i];
if (Streams.ContainsKey(parser.PID))
{
parser.Stream = Streams[parser.PID];
parser.PID |= (ushort)buffer[i];
if (Streams.ContainsKey(parser.PID))
{
parser.Stream = Streams[parser.PID];
}
else
{
parser.Stream = null;
}
if (!StreamStates.ContainsKey(parser.PID))
{
StreamStates[parser.PID] = new TSStreamState();
}
parser.StreamState = StreamStates[parser.PID];
parser.StreamState.TotalPackets++;
parser.StreamState.WindowPackets++;
parser.TotalPackets++;
}
else
{
parser.Stream = null;
}
if (!StreamStates.ContainsKey(parser.PID))
{
StreamStates[parser.PID] = new TSStreamState();
}
parser.StreamState = StreamStates[parser.PID];
parser.StreamState.TotalPackets++;
parser.StreamState.WindowPackets++;
parser.TotalPackets++;
}
break;
break;
case 0:
{
parser.TransportScramblingControl =
(byte)((buffer[i] >> 6) & 0x3);
parser.AdaptionFieldControl =
(byte)((buffer[i] >> 4) & 0x3);
if ((parser.AdaptionFieldControl & 0x2) == 0x2)
{
parser.AdaptionFieldState = true;
}
if (parser.PayloadUnitStartIndicator == 1)
{
if (parser.PID == 0)
{
parser.PATSectionStart = true;
}
else if (parser.PID == parser.PMTPID)
{
parser.PMTSectionStart = true;
}
else if (parser.StreamState != null &&
parser.StreamState.TransferState)
{
parser.StreamState.TransferState = false;
parser.StreamState.TransferCount++;
parser.TransportScramblingControl =
(byte)((buffer[i] >> 6) & 0x3);
parser.AdaptionFieldControl =
(byte)((buffer[i] >> 4) & 0x3);
bool isFinished = ScanStream(
parser.Stream,
parser.StreamState,
parser.StreamState.StreamBuffer);
if (!isFullScan && isFinished)
if ((parser.AdaptionFieldControl & 0x2) == 0x2)
{
parser.AdaptionFieldState = true;
}
if (parser.PayloadUnitStartIndicator == 1)
{
if (parser.PID == 0)
{
return;
parser.PATSectionStart = true;
}
else if (parser.PID == parser.PMTPID)
{
parser.PMTSectionStart = true;
}
else if (parser.StreamState != null &&
parser.StreamState.TransferState)
{
parser.StreamState.TransferState = false;
parser.StreamState.TransferCount++;
bool isFinished = ScanStream(
parser.Stream,
parser.StreamState,
parser.StreamState.StreamBuffer);
if (!isFullScan && isFinished)
{
return;
}
}
}
}
}
break;
break;
}
}
else if (parser.AdaptionFieldState)
@ -670,7 +670,8 @@ namespace BDInfo
parser.PAT[parser.PATOffset++] = buffer[i++];
parser.PATSectionLength--;
parser.PacketLength--;
} --i;
}
--i;
if (parser.PATSectionLength == 0)
{
@ -801,7 +802,8 @@ namespace BDInfo
PMT[parser.PMTOffset++] = buffer[i++];
--parser.PMTSectionLength;
--parser.PacketLength;
} --i;
}
--i;
if (parser.PMTSectionLength == 0)
{
@ -1495,10 +1497,10 @@ namespace BDInfo
case TSStreamType.MPEG1_VIDEO:
case TSStreamType.MPEG2_VIDEO:
case TSStreamType.VC1_VIDEO:
{
stream = new TSVideoStream();
}
break;
{
stream = new TSVideoStream();
}
break;
case TSStreamType.AC3_AUDIO:
case TSStreamType.AC3_PLUS_AUDIO:
@ -1511,23 +1513,23 @@ namespace BDInfo
case TSStreamType.LPCM_AUDIO:
case TSStreamType.MPEG1_AUDIO:
case TSStreamType.MPEG2_AUDIO:
{
stream = new TSAudioStream();
}
break;
{
stream = new TSAudioStream();
}
break;
case TSStreamType.INTERACTIVE_GRAPHICS:
case TSStreamType.PRESENTATION_GRAPHICS:
{
stream = new TSGraphicsStream();
}
break;
{
stream = new TSGraphicsStream();
}
break;
case TSStreamType.SUBTITLE:
{
stream = new TSTextStream();
}
break;
{
stream = new TSTextStream();
}
break;
default:
break;