Merge branch 'develop' of https://github.com/Vocaluxe/Vocaluxe into release-0.3
This commit is contained in:
commit
ef3d7d2592
18 files changed
+810
-1029
No files matched your search
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.IO.Compression;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
@@ -91,6 +92,16 @@ namespace ClientServerLib
|
|||||||
}
|
}
|
||||||
|
|
||||||
public byte[] Encrypt(byte[] Data)
|
public byte[] Encrypt(byte[] Data)
|
||||||
|
{
|
||||||
|
return _Encrypt(_Compress(Data));
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] Decrypt(byte[] Data)
|
||||||
|
{
|
||||||
|
return _Decompress(_Decrypt(Data));
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte[] _Encrypt(byte[] Data)
|
||||||
{
|
{
|
||||||
if (Data == null || (!keySet && encryption))
|
if (Data == null || (!keySet && encryption))
|
||||||
return Data;
|
return Data;
|
||||||
@@ -142,7 +153,7 @@ namespace ClientServerLib
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] Decrypt(byte[] Data)
|
private byte[] _Decrypt(byte[] Data)
|
||||||
{
|
{
|
||||||
if (Data == null || (!keySet && encryption))
|
if (Data == null || (!keySet && encryption))
|
||||||
return Data;
|
return Data;
|
||||||
@@ -202,5 +213,64 @@ namespace ClientServerLib
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private byte[] _Compress(byte[] Data)
|
||||||
|
{
|
||||||
|
if (Data == null)
|
||||||
|
return Data;
|
||||||
|
|
||||||
|
using (var compressed = new MemoryStream())
|
||||||
|
{
|
||||||
|
using (var gz = new GZipStream(compressed, CompressionMode.Compress, true))
|
||||||
|
{
|
||||||
|
gz.Write(Data, 0, Data.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] result = null;
|
||||||
|
|
||||||
|
if (compressed.Length < Data.Length)
|
||||||
|
{
|
||||||
|
result = new byte[compressed.Length + 1];
|
||||||
|
result[0] = 1; //data stream is compressed
|
||||||
|
compressed.Position = 0;
|
||||||
|
compressed.Read(result, 1, (int)compressed.Length);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = new byte[Data.Length + 1];
|
||||||
|
result[0] = 0; //data stream is not compressed
|
||||||
|
Array.Copy(Data, 0, result, 1, Data.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte[] _Decompress(byte[] Data)
|
||||||
|
{
|
||||||
|
if (Data == null)
|
||||||
|
return Data;
|
||||||
|
|
||||||
|
if (Data[0] == 0) //not compressed
|
||||||
|
{
|
||||||
|
byte[] result = new byte[Data.Length - 1];
|
||||||
|
Array.Copy(Data, 1, result, 0, result.Length);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var inStream = new MemoryStream())
|
||||||
|
{
|
||||||
|
inStream.Write(Data, 1, Data.Length - 1);
|
||||||
|
inStream.Position = 0;
|
||||||
|
|
||||||
|
using (var outStream = new MemoryStream())
|
||||||
|
{
|
||||||
|
using (var gz = new GZipStream(inStream, CompressionMode.Decompress, true))
|
||||||
|
gz.CopyTo(outStream);
|
||||||
|
|
||||||
|
return outStream.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,6 +116,7 @@
|
|||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>gstreamer-1.0.lib;gstcontroller-1.0.lib;gobject-2.0.lib;glib-2.0.lib;gstapp-1.0.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>gstreamer-1.0.lib;gstcontroller-1.0.lib;gobject-2.0.lib;glib-2.0.lib;gstapp-1.0.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<Profile>true</Profile>
|
||||||
</Link>
|
</Link>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>xcopy "$(OutDir)*.dll" "$(SolutionDir)Output\x86\gstreamer\" /I /Y</Command>
|
<Command>xcopy "$(OutDir)*.dll" "$(SolutionDir)Output\x86\gstreamer\" /I /Y</Command>
|
||||||
@@ -136,6 +137,7 @@
|
|||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>gstreamer-1.0.lib;gstcontroller-1.0.lib;gobject-2.0.lib;glib-2.0.lib;gstapp-1.0.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>gstreamer-1.0.lib;gstcontroller-1.0.lib;gobject-2.0.lib;glib-2.0.lib;gstapp-1.0.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<Profile>true</Profile>
|
||||||
</Link>
|
</Link>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>xcopy "$(OutDir)*.dll" "$(SolutionDir)Output\x64\gstreamer\" /I /Y</Command>
|
<Command>xcopy "$(OutDir)*.dll" "$(SolutionDir)Output\x64\gstreamer\" /I /Y</Command>
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SpecifyACultureInStringConversionExplicitly/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SpecifyACultureInStringConversionExplicitly/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestUseVarKeywordEverywhere/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestUseVarKeywordEverywhere/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestUseVarKeywordEvident/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestUseVarKeywordEvident/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Cleanup/@EntryIndexedValue"><?xml version="1.0" encoding="utf-16"?><Profile name="Cleanup"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSRemoveCodeRedundancies>True</CSRemoveCodeRedundancies><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSUseVar><BehavourStyle>CAN_CHANGE_TO_EXPLICIT</BehavourStyle><LocalVariableStyle>ALWAYS_EXPLICIT</LocalVariableStyle><ForeachVariableStyle>ALWAYS_EXPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>False</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><CSharpFormatDocComments>True</CSharpFormatDocComments><CSShortenReferences>True</CSShortenReferences><StyleCop.Documentation><SA1600ElementsMustBeDocumented>False</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>False</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>False</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>False</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>False</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>False</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>False</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>False</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>False</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>False</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>Ignore</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>False</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>False</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>False</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>False</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><StyleCop.Layout><SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine>False</SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine><SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine>True</SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine><SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine>True</SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine><SA1511WhileDoFooterMustNotBePrecededByBlankLine>True</SA1511WhileDoFooterMustNotBePrecededByBlankLine><SA1512SingleLineCommentsMustNotBeFollowedByBlankLine>True</SA1512SingleLineCommentsMustNotBeFollowedByBlankLine><SA1513ClosingCurlyBracketMustBeFollowedByBlankLine>False</SA1513ClosingCurlyBracketMustBeFollowedByBlankLine><SA1514ElementDocumentationHeaderMustBePrecededByBlankLine>False</SA1514ElementDocumentationHeaderMustBePrecededByBlankLine><SA1515SingleLineCommentMustBeProceededByBlankLine>False</SA1515SingleLineCommentMustBeProceededByBlankLine></StyleCop.Layout><StyleCop.Readability><SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists>True</SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists><SA1106CodeMustNotContainEmptyStatements>True</SA1106CodeMustNotContainEmptyStatements><SA1108BlockStatementsMustNotContainEmbeddedComments>True</SA1108BlockStatementsMustNotContainEmbeddedComments><SA1109BlockStatementsMustNotContainEmbeddedRegions>True</SA1109BlockStatementsMustNotContainEmbeddedRegions><SA1120CommentsMustContainText>False</SA1120CommentsMustContainText><SA1121UseBuiltInTypeAlias>False</SA1121UseBuiltInTypeAlias><SA1122UseStringEmptyForEmptyStrings>False</SA1122UseStringEmptyForEmptyStrings><SA1123DoNotPlaceRegionsWithinElements>False</SA1123DoNotPlaceRegionsWithinElements><SA1124CodeMustNotContainEmptyRegions>True</SA1124CodeMustNotContainEmptyRegions></StyleCop.Readability><StyleCop.Spacing><SA1001CommasMustBeSpacedCorrectly>False</SA1001CommasMustBeSpacedCorrectly><SA1005SingleLineCommentsMustBeginWithSingleSpace>False</SA1005SingleLineCommentsMustBeginWithSingleSpace><SA1006PreprocessorKeywordsMustNotBePrecededBySpaLine truncated
|
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Cleanup/@EntryIndexedValue"><?xml version="1.0" encoding="utf-16"?><Profile name="Cleanup"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSRemoveCodeRedundancies>True</CSRemoveCodeRedundancies><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSUseVar><BehavourStyle>CAN_CHANGE_TO_IMPLICIT</BehavourStyle><LocalVariableStyle>IMPLICIT_WHEN_INITIALIZER_HAS_TYPE</LocalVariableStyle><ForeachVariableStyle>ALWAYS_EXPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>False</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><CSharpFormatDocComments>True</CSharpFormatDocComments><CSShortenReferences>True</CSShortenReferences><StyleCop.Documentation><SA1600ElementsMustBeDocumented>False</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>False</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>False</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>False</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>False</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>False</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>False</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>False</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>False</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>False</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>Ignore</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>False</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>False</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>False</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>False</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><StyleCop.Layout><SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine>False</SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine><SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine>True</SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine><SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine>True</SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine><SA1511WhileDoFooterMustNotBePrecededByBlankLine>True</SA1511WhileDoFooterMustNotBePrecededByBlankLine><SA1512SingleLineCommentsMustNotBeFollowedByBlankLine>True</SA1512SingleLineCommentsMustNotBeFollowedByBlankLine><SA1513ClosingCurlyBracketMustBeFollowedByBlankLine>False</SA1513ClosingCurlyBracketMustBeFollowedByBlankLine><SA1514ElementDocumentationHeaderMustBePrecededByBlankLine>False</SA1514ElementDocumentationHeaderMustBePrecededByBlankLine><SA1515SingleLineCommentMustBeProceededByBlankLine>False</SA1515SingleLineCommentMustBeProceededByBlankLine></StyleCop.Layout><StyleCop.Readability><SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists>True</SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists><SA1106CodeMustNotContainEmptyStatements>True</SA1106CodeMustNotContainEmptyStatements><SA1108BlockStatementsMustNotContainEmbeddedComments>True</SA1108BlockStatementsMustNotContainEmbeddedComments><SA1109BlockStatementsMustNotContainEmbeddedRegions>True</SA1109BlockStatementsMustNotContainEmbeddedRegions><SA1120CommentsMustContainText>False</SA1120CommentsMustContainText><SA1121UseBuiltInTypeAlias>False</SA1121UseBuiltInTypeAlias><SA1122UseStringEmptyForEmptyStrings>False</SA1122UseStringEmptyForEmptyStrings><SA1123DoNotPlaceRegionsWithinElements>False</SA1123DoNotPlaceRegionsWithinElements><SA1124CodeMustNotContainEmptyRegions>True</SA1124CodeMustNotContainEmptyRegions></StyleCop.Readability><StyleCop.Spacing><SA1001CommasMustBeSpacedCorrectly>False</SA1001CommasMustBeSpacedCorrectly><SA1005SingleLineCommentsMustBeginWithSingleSpace>False</SA1005SingleLineCommentsMustBeginWithSingleSpace><SA1006PreprocessorKeywordsMusLine truncated
|
||||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Simple_0020Reformat/@EntryIndexedValue"><?xml version="1.0" encoding="utf-16"?><Profile name="Simple Reformat"><CSOptimizeUsings><OptimizeUsings>False</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><StyleCop.Documentation><SA1600ElementsMustBeDocumented>False</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>False</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>False</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>False</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>False</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>False</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>False</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>False</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>False</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>False</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>Ignore</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>False</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>False</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>False</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>False</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><StyleCop.Spacing><SA1001CommasMustBeSpacedCorrectly>False</SA1001CommasMustBeSpacedCorrectly><SA1005SingleLineCommentsMustBeginWithSingleSpace>False</SA1005SingleLineCommentsMustBeginWithSingleSpace><SA1006PreprocessorKeywordsMustNotBePrecededBySpace>True</SA1006PreprocessorKeywordsMustNotBePrecededBySpace><SA1021NegativeSignsMustBeSpacedCorrectly>True</SA1021NegativeSignsMustBeSpacedCorrectly><SA1022PositiveSignsMustBeSpacedCorrectly>True</SA1022PositiveSignsMustBeSpacedCorrectly><SA1025CodeMustNotContainMultipleWhitespaceInARow>True</SA1025CodeMustNotContainMultipleWhitespaceInARow></StyleCop.Spacing><StyleCop.Readability><SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists>True</SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists><SA1106CodeMustNotContainEmptyStatements>True</SA1106CodeMustNotContainEmptyStatements><SA1108BlockStatementsMustNotContainEmbeddedComments>True</SA1108BlockStatementsMustNotContainEmbeddedComments><SA1109BlockStatementsMustNotContainEmbeddedRegions>True</SA1109BlockStatementsMustNotContainEmbeddedRegions><SA1120CommentsMustContainText>False</SA1120CommentsMustContainText><SA1121UseBuiltInTypeAlias>False</SA1121UseBuiltInTypeAlias><SA1122UseStringEmptyForEmptyStrings>False</SA1122UseStringEmptyForEmptyStrings><SA1123DoNotPlaceRegionsWithinElements>False</SA1123DoNotPlaceRegionsWithinElements><SA1124CodeMustNotContainEmptyRegions>True</SA1124CodeMustNotContainEmptyRegions></StyleCop.Readability><StyleCop.Layout><SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine>False</SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine><SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine>True</SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine><SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine>True</SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine><SA1511WhileDoFooterMustNotBePrecededByBlankLine>True</SA1511WhileDoFooterMustNotBePrecededByBlankLine><SA1512SingleLineCommentsMustNotBeFollowedByBlankLine>True</SA1512SingleLineCommentsMustNotBeFollowedByBlankLine><SA1513ClosingCurlyBracketMustBeFollowedByBlankLine>False</SA1513ClosingCurlyBracketMustBeFollowedByBlankLine><SA1514ElementDocumentationHeaderMustBePrecededByBlankLine>False</SA1514ElementDocumentationHeaderMustBePrecededByBlankLine><SA1515SingleLineCommentMustBeProceededByBlankLine>False</SA1515SingleLineCommentMustBeProceededByBlankLine></StyleCop.Layout><StyleCop.Ordering><AlphabeticalUsingDirectives>Ignore</AlphabeticalUsingDirectives><ExpandUsingDirectiLine truncated
|
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Simple_0020Reformat/@EntryIndexedValue"><?xml version="1.0" encoding="utf-16"?><Profile name="Simple Reformat"><CSOptimizeUsings><OptimizeUsings>False</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><StyleCop.Documentation><SA1600ElementsMustBeDocumented>False</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>False</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>False</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>False</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>False</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>False</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>False</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>False</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>False</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>False</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>Ignore</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>False</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>False</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>False</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>False</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><StyleCop.Spacing><SA1001CommasMustBeSpacedCorrectly>False</SA1001CommasMustBeSpacedCorrectly><SA1005SingleLineCommentsMustBeginWithSingleSpace>False</SA1005SingleLineCommentsMustBeginWithSingleSpace><SA1006PreprocessorKeywordsMustNotBePrecededBySpace>True</SA1006PreprocessorKeywordsMustNotBePrecededBySpace><SA1021NegativeSignsMustBeSpacedCorrectly>True</SA1021NegativeSignsMustBeSpacedCorrectly><SA1022PositiveSignsMustBeSpacedCorrectly>True</SA1022PositiveSignsMustBeSpacedCorrectly><SA1025CodeMustNotContainMultipleWhitespaceInARow>True</SA1025CodeMustNotContainMultipleWhitespaceInARow></StyleCop.Spacing><StyleCop.Readability><SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists>True</SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists><SA1106CodeMustNotContainEmptyStatements>True</SA1106CodeMustNotContainEmptyStatements><SA1108BlockStatementsMustNotContainEmbeddedComments>True</SA1108BlockStatementsMustNotContainEmbeddedComments><SA1109BlockStatementsMustNotContainEmbeddedRegions>True</SA1109BlockStatementsMustNotContainEmbeddedRegions><SA1120CommentsMustContainText>False</SA1120CommentsMustContainText><SA1121UseBuiltInTypeAlias>False</SA1121UseBuiltInTypeAlias><SA1122UseStringEmptyForEmptyStrings>False</SA1122UseStringEmptyForEmptyStrings><SA1123DoNotPlaceRegionsWithinElements>False</SA1123DoNotPlaceRegionsWithinElements><SA1124CodeMustNotContainEmptyRegions>True</SA1124CodeMustNotContainEmptyRegions></StyleCop.Readability><StyleCop.Layout><SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine>False</SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine><SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine>True</SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine><SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine>True</SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine><SA1511WhileDoFooterMustNotBePrecededByBlankLine>True</SA1511WhileDoFooterMustNotBePrecededByBlankLine><SA1512SingleLineCommentsMustNotBeFollowedByBlankLine>True</SA1512SingleLineCommentsMustNotBeFollowedByBlankLine><SA1513ClosingCurlyBracketMustBeFollowedByBlankLine>False</SA1513ClosingCurlyBracketMustBeFollowedByBlankLine><SA1514ElementDocumentationHeaderMustBePrecededByBlankLine>False</SA1514ElementDocumentationHeaderMustBePrecededByBlankLine><SA1515SingleLineCommentMustBeProceededByBlankLine>False</SA1515SingleLineCommentMustBeProceededByBlankLine></StyleCop.Layout><StyleCop.Ordering><AlphabeticalUsingDirectives>Ignore</AlphabeticalUsingDirectives><ExpandUsingDirectiLine truncated
|
||||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Cleanup</s:String>
|
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Cleanup</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/SilentCleanupProfile/@EntryValue">Simple Reformat</s:String>
|
<s:String x:Key="/Default/CodeStyle/CodeCleanup/SilentCleanupProfile/@EntryValue">Simple Reformat</s:String>
|
||||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_FIELD/@EntryValue">0</s:Int64>
|
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_FIELD/@EntryValue">0</s:Int64>
|
||||||
|
|||||||
@@ -55,14 +55,9 @@ namespace Vocaluxe.Base
|
|||||||
get { return _VideoEnabled; }
|
get { return _VideoEnabled; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_VideoEnabled && value)
|
if (_VideoEnabled == value)
|
||||||
return;
|
return;
|
||||||
if (!_VideoEnabled && !value)
|
ToggleVideo();
|
||||||
return;
|
|
||||||
if (_VideoEnabled && !value)
|
|
||||||
ToggleVideo();
|
|
||||||
if (!_VideoEnabled && value)
|
|
||||||
ToggleVideo();
|
|
||||||
_VideoEnabled = value;
|
_VideoEnabled = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,7 +121,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
List<string> templist = new List<string>();
|
var templist = new List<string>();
|
||||||
|
|
||||||
foreach (string ending in CSettings.MusicFileTypes)
|
foreach (string ending in CSettings.MusicFileTypes)
|
||||||
templist.AddRange(CHelper.ListFiles(CSettings.FolderBackgroundMusic, ending, true, true));
|
templist.AddRange(CHelper.ListFiles(CSettings.FolderBackgroundMusic, ending, true, true));
|
||||||
@@ -136,8 +131,8 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
if (CConfig.BackgroundMusicSource != EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC)
|
if (CConfig.BackgroundMusicSource != EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC)
|
||||||
AddBackgroundMusic();
|
AddBackgroundMusic();
|
||||||
if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON)
|
|
||||||
_VideoEnabled = true;
|
_VideoEnabled = (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON);
|
||||||
|
|
||||||
IsPlaying = false;
|
IsPlaying = false;
|
||||||
}
|
}
|
||||||
@@ -439,20 +434,9 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
if (_Video != -1)
|
if (_Video != -1)
|
||||||
{
|
{
|
||||||
if (_VideoEnabled)
|
CVideo.Close(_Video);
|
||||||
{
|
CDraw.RemoveTexture(ref _CurrentVideoTexture);
|
||||||
_VideoEnabled = false;
|
_Video = -1;
|
||||||
CVideo.Close(_Video);
|
|
||||||
_Video = -1;
|
|
||||||
CDraw.RemoveTexture(ref _CurrentVideoTexture);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (CVideo.Finished(_Video))
|
|
||||||
{
|
|
||||||
CVideo.Close(_Video);
|
|
||||||
CDraw.RemoveTexture(ref _CurrentVideoTexture);
|
|
||||||
_Video = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_LoadVideo();
|
_LoadVideo();
|
||||||
@@ -485,17 +469,15 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
private static void _LoadVideo()
|
private static void _LoadVideo()
|
||||||
{
|
{
|
||||||
if (_Video == -1)
|
if (_Video != -1 || String.IsNullOrEmpty(_CurrentPlaylistElement.VideoFilePath))
|
||||||
{
|
return;
|
||||||
_Video = CVideo.Load(_CurrentPlaylistElement.VideoFilePath);
|
_Video = CVideo.Load(_CurrentPlaylistElement.VideoFilePath);
|
||||||
if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON)
|
if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON)
|
||||||
CVideo.Skip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap);
|
CVideo.Skip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap);
|
||||||
else
|
else
|
||||||
CVideo.Skip(_Video, 0f, _CurrentPlaylistElement.VideoGap);
|
CVideo.Skip(_Video, 0f, _CurrentPlaylistElement.VideoGap);
|
||||||
_VideoEnabled = true;
|
_FadeTimer.Reset();
|
||||||
_FadeTimer.Reset();
|
_FadeTimer.Start();
|
||||||
_FadeTimer.Start();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -68,7 +68,7 @@ namespace Vocaluxe.Base
|
|||||||
_IDs.Enqueue(i);
|
_IDs.Enqueue(i);
|
||||||
|
|
||||||
//add dummy normal game mode and set it as default
|
//add dummy normal game mode and set it as default
|
||||||
SPartyMode pm = new SPartyMode {PartyMode = new CPartyModeNone(), ScreenFiles = new List<string>()};
|
var pm = new SPartyMode {PartyMode = new CPartyModeNone(), ScreenFiles = new List<string>()};
|
||||||
pm.PartyMode.Initialize();
|
pm.PartyMode.Initialize();
|
||||||
pm.PartyModeID = _IDs.Dequeue();
|
pm.PartyModeID = _IDs.Dequeue();
|
||||||
_NormalGameModeID = pm.PartyModeID;
|
_NormalGameModeID = pm.PartyModeID;
|
||||||
@@ -97,9 +97,9 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static List<SPartyModeInfos> GetPartyModeInfos()
|
public static List<SPartyModeInfos> GetPartyModeInfos()
|
||||||
{
|
{
|
||||||
List<SPartyModeInfos> infos = new List<SPartyModeInfos>();
|
var infos = new List<SPartyModeInfos>();
|
||||||
|
|
||||||
int[] pmIDs = new int[_PartyModes.Count];
|
var pmIDs = new int[_PartyModes.Count];
|
||||||
_PartyModes.Keys.CopyTo(pmIDs, 0);
|
_PartyModes.Keys.CopyTo(pmIDs, 0);
|
||||||
|
|
||||||
foreach (int pmID in pmIDs)
|
foreach (int pmID in pmIDs)
|
||||||
@@ -111,7 +111,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
if (mode.PartyMode != null)
|
if (mode.PartyMode != null)
|
||||||
{
|
{
|
||||||
SPartyModeInfos info = new SPartyModeInfos
|
var info = new SPartyModeInfos
|
||||||
{
|
{
|
||||||
Author = mode.Author,
|
Author = mode.Author,
|
||||||
Description = mode.Description,
|
Description = mode.Description,
|
||||||
@@ -219,7 +219,7 @@ namespace Vocaluxe.Base
|
|||||||
#region private stuff
|
#region private stuff
|
||||||
private static void _LoadPartyModes()
|
private static void _LoadPartyModes()
|
||||||
{
|
{
|
||||||
List<string> files = new List<string>();
|
var files = new List<string>();
|
||||||
files.AddRange(CHelper.ListFiles(CSettings.FolderPartyModes, "*.xml", false, true));
|
files.AddRange(CHelper.ListFiles(CSettings.FolderPartyModes, "*.xml", false, true));
|
||||||
|
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
@@ -231,7 +231,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
private static SPartyMode _LoadPartyMode(string file)
|
private static SPartyMode _LoadPartyMode(string file)
|
||||||
{
|
{
|
||||||
SPartyMode pm = new SPartyMode {PartyModeID = _IDs.Dequeue(), ScreenFiles = new List<string>(), NoErrors = false};
|
var pm = new SPartyMode {PartyModeID = _IDs.Dequeue(), ScreenFiles = new List<string>(), NoErrors = false};
|
||||||
|
|
||||||
CXMLReader xmlReader = CXMLReader.OpenFile(file);
|
CXMLReader xmlReader = CXMLReader.OpenFile(file);
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
string pathToCode = Path.Combine(Path.Combine(CSettings.FolderPartyModes, pm.Folder), CSettings.FolderPartyModeCode);
|
string pathToCode = Path.Combine(Path.Combine(CSettings.FolderPartyModes, pm.Folder), CSettings.FolderPartyModeCode);
|
||||||
|
|
||||||
List<string> filesToCompile = new List<string>();
|
var filesToCompile = new List<string>();
|
||||||
filesToCompile.AddRange(CHelper.ListFiles(pathToCode, "*.cs", false, true));
|
filesToCompile.AddRange(CHelper.ListFiles(pathToCode, "*.cs", false, true));
|
||||||
|
|
||||||
Assembly output = _CompileFiles(filesToCompile.ToArray());
|
Assembly output = _CompileFiles(filesToCompile.ToArray());
|
||||||
@@ -304,7 +304,7 @@ namespace Vocaluxe.Base
|
|||||||
pm.PartyMode.Initialize();
|
pm.PartyMode.Initialize();
|
||||||
pm.PartyMode.SetFolder(Path.Combine(Directory.GetCurrentDirectory(), Path.Combine(CSettings.FolderPartyModes, pm.Folder)));
|
pm.PartyMode.SetFolder(Path.Combine(Directory.GetCurrentDirectory(), Path.Combine(CSettings.FolderPartyModes, pm.Folder)));
|
||||||
|
|
||||||
if (!CTheme.AddTheme(Path.Combine(Directory.GetCurrentDirectory(), Path.Combine(Path.Combine(CSettings.FolderPartyModes, pm.Folder), "Theme.xml")), pm.PartyModeID))
|
if (!CTheme.AddTheme(Path.Combine(pm.PartyMode.GetFolder(), "Theme.xml"),pm.PartyModeID))
|
||||||
return pm;
|
return pm;
|
||||||
|
|
||||||
int themeIndex = CTheme.GetThemeIndex(pm.PartyModeID);
|
int themeIndex = CTheme.GetThemeIndex(pm.PartyModeID);
|
||||||
@@ -325,7 +325,7 @@ namespace Vocaluxe.Base
|
|||||||
if (screen != null)
|
if (screen != null)
|
||||||
{
|
{
|
||||||
screen.Init();
|
screen.Init();
|
||||||
screen.AssingPartyMode(pm.PartyMode);
|
screen.AssignPartyMode(pm.PartyMode);
|
||||||
screen.SetPartyModeID(pm.PartyModeID);
|
screen.SetPartyModeID(pm.PartyModeID);
|
||||||
screen.LoadTheme(xmlPath);
|
screen.LoadTheme(xmlPath);
|
||||||
pm.PartyMode.AddScreen(screen, screenfile);
|
pm.PartyMode.AddScreen(screen, screenfile);
|
||||||
@@ -343,7 +343,7 @@ namespace Vocaluxe.Base
|
|||||||
if (files == null || files.Length == 0)
|
if (files == null || files.Length == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
CompilerParameters compilerParams = new CompilerParameters();
|
var compilerParams = new CompilerParameters();
|
||||||
compilerParams.ReferencedAssemblies.Add("System.Windows.Forms.dll");
|
compilerParams.ReferencedAssemblies.Add("System.Windows.Forms.dll");
|
||||||
compilerParams.ReferencedAssemblies.Add("System.Core.dll");
|
compilerParams.ReferencedAssemblies.Add("System.Core.dll");
|
||||||
compilerParams.ReferencedAssemblies.Add("VocaluxeLib.dll");
|
compilerParams.ReferencedAssemblies.Add("VocaluxeLib.dll");
|
||||||
|
|||||||
+82
-142
@@ -44,13 +44,15 @@ namespace Vocaluxe.Base
|
|||||||
public int PartyModeID;
|
public int PartyModeID;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SSkinElement
|
class CSkinElement
|
||||||
{
|
{
|
||||||
public string Name;
|
|
||||||
public string Value;
|
public string Value;
|
||||||
|
|
||||||
public CTexture Texture;
|
public CTexture Texture;
|
||||||
public int VideoIndex;
|
}
|
||||||
|
|
||||||
|
class CVideoSkinElement : CSkinElement
|
||||||
|
{
|
||||||
|
public int VideoIndex = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SSkin
|
struct SSkin
|
||||||
@@ -64,8 +66,8 @@ namespace Vocaluxe.Base
|
|||||||
public string FileName;
|
public string FileName;
|
||||||
public int PartyModeID;
|
public int PartyModeID;
|
||||||
|
|
||||||
public Dictionary<string, SSkinElement> SkinList;
|
public Dictionary<string, CSkinElement> SkinList;
|
||||||
public List<SSkinElement> VideoList;
|
public Dictionary<string, CVideoSkinElement> VideoList;
|
||||||
|
|
||||||
public SColors ThemeColors;
|
public SColors ThemeColors;
|
||||||
}
|
}
|
||||||
@@ -111,9 +113,9 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
List<string> names = new List<string>();
|
var names = new List<string>();
|
||||||
// ReSharper disable LoopCanBeConvertedToQuery
|
// ReSharper disable LoopCanBeConvertedToQuery
|
||||||
foreach (STheme th in _Themes)
|
foreach (var th in _Themes)
|
||||||
// ReSharper restore LoopCanBeConvertedToQuery
|
// ReSharper restore LoopCanBeConvertedToQuery
|
||||||
{
|
{
|
||||||
if (th.PartyModeID == -1)
|
if (th.PartyModeID == -1)
|
||||||
@@ -128,9 +130,9 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
List<string> names = new List<string>();
|
var names = new List<string>();
|
||||||
// ReSharper disable LoopCanBeConvertedToQuery
|
// ReSharper disable LoopCanBeConvertedToQuery
|
||||||
foreach (SSkin sk in _Skins)
|
foreach (var sk in _Skins)
|
||||||
// ReSharper restore LoopCanBeConvertedToQuery
|
// ReSharper restore LoopCanBeConvertedToQuery
|
||||||
{
|
{
|
||||||
if (sk.PartyModeID == -1)
|
if (sk.PartyModeID == -1)
|
||||||
@@ -172,48 +174,34 @@ namespace Vocaluxe.Base
|
|||||||
if (xmlReader == null)
|
if (xmlReader == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
string value;
|
|
||||||
|
|
||||||
|
|
||||||
// load skins/textures
|
// load skins/textures
|
||||||
List<string> keys = new List<string>(_Skins[skinIndex].SkinList.Keys);
|
foreach (var valuePair in _Skins[skinIndex].SkinList)
|
||||||
|
|
||||||
foreach (string name in keys)
|
|
||||||
{
|
{
|
||||||
|
CSkinElement sk = valuePair.Value;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
xmlReader.GetValue("//root/Skins/" + name, out value, String.Empty);
|
xmlReader.GetValue("//root/Skins/" + valuePair.Key, out sk.Value, String.Empty);
|
||||||
SSkinElement sk = _Skins[skinIndex].SkinList[name];
|
|
||||||
sk.Value = value;
|
|
||||||
sk.VideoIndex = -1;
|
|
||||||
sk.Texture = CDraw.AddTexture(Path.Combine(_Skins[skinIndex].Path, sk.Value));
|
sk.Texture = CDraw.AddTexture(Path.Combine(_Skins[skinIndex].Path, sk.Value));
|
||||||
_Skins[skinIndex].SkinList[name] = sk;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Error on loading texture \"" + name + "\": " + e.Message + e.StackTrace);
|
MessageBox.Show("Error on loading texture \"" + valuePair.Key + "\": " + e.Message + e.StackTrace);
|
||||||
CLog.LogError("Error on loading texture \"" + name + "\": " + e.Message + e.StackTrace);
|
CLog.LogError("Error on loading texture \"" + valuePair.Key + "\": " + e.Message + e.StackTrace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// load videos
|
// load videos
|
||||||
for (int i = 0; i < _Skins[skinIndex].VideoList.Count; i++)
|
foreach (var valuePair in _Skins[skinIndex].VideoList)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
xmlReader.GetValue("//root/Videos/" + _Skins[skinIndex].VideoList[i].Name, out value, String.Empty);
|
xmlReader.GetValue("//root/Videos/" + valuePair.Key, out valuePair.Value.Value, String.Empty);
|
||||||
SSkinElement sk = new SSkinElement {Name = _Skins[skinIndex].VideoList[i].Name, Value = value};
|
|
||||||
sk.VideoIndex = CVideo.Load(Path.Combine(_Skins[skinIndex].Path, sk.Value));
|
|
||||||
CVideo.SetLoop(sk.VideoIndex, true);
|
|
||||||
CVideo.Pause(sk.VideoIndex);
|
|
||||||
sk.Texture = null;
|
|
||||||
_Skins[skinIndex].VideoList[i] = sk;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Error on loading video \"" + _Skins[skinIndex].VideoList[i].Name + "\": " + e.Message + e.StackTrace);
|
MessageBox.Show("Error on loading video \"" + valuePair.Key + "\": " + e.Message + e.StackTrace);
|
||||||
CLog.LogError("Error on loading video \"" + _Skins[skinIndex].VideoList[i].Name + "\": " + e.Message + e.StackTrace);
|
CLog.LogError("Error on loading video \"" + valuePair.Key + "\": " + e.Message + e.StackTrace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,37 +212,24 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static void UnloadSkins()
|
public static void UnloadSkins()
|
||||||
{
|
{
|
||||||
int numPartyModeSkins = 0;
|
|
||||||
for (int i = 0; i < _Skins.Count; i++)
|
for (int i = 0; i < _Skins.Count; i++)
|
||||||
{
|
{
|
||||||
foreach (SSkinElement sk in _Skins[i].SkinList.Values)
|
foreach (var sk in _Skins[i].SkinList.Values)
|
||||||
{
|
CDraw.RemoveTexture(ref sk.Texture);
|
||||||
CTexture texture = sk.Texture;
|
|
||||||
CDraw.RemoveTexture(ref texture);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int j = 0; j < _Skins[i].VideoList.Count; j++)
|
foreach (var vsk in _Skins[i].VideoList.Values)
|
||||||
{
|
{
|
||||||
CVideo.Close(_Skins[i].VideoList[j].VideoIndex);
|
CVideo.Close(vsk.VideoIndex);
|
||||||
CTexture videoTexture = _Skins[i].VideoList[j].Texture;
|
CDraw.RemoveTexture(ref vsk.Texture);
|
||||||
CDraw.RemoveTexture(ref videoTexture);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_Skins[i].PartyModeID != -1)
|
|
||||||
numPartyModeSkins++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (_Skins.Count > numPartyModeSkins)
|
for (int i = 0; i < _Skins.Count; i++)
|
||||||
{
|
{
|
||||||
int num = _Skins.Count;
|
if (_Skins[i].PartyModeID != -1)
|
||||||
for (int i = 0; i < num; i++)
|
continue;
|
||||||
{
|
_Skins.RemoveAt(i);
|
||||||
if (_Skins[i].PartyModeID == -1)
|
i--;
|
||||||
{
|
|
||||||
_Skins.RemoveAt(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,16 +358,16 @@ namespace Vocaluxe.Base
|
|||||||
#region Skins
|
#region Skins
|
||||||
writer.WriteStartElement("Skins");
|
writer.WriteStartElement("Skins");
|
||||||
|
|
||||||
foreach (SSkinElement element in _Skins[skinIndex].SkinList.Values)
|
foreach (var element in _Skins[skinIndex].SkinList)
|
||||||
writer.WriteElementString(element.Name, element.Value);
|
writer.WriteElementString(element.Key, element.Value.Value);
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
#endregion Skins
|
#endregion Skins
|
||||||
|
|
||||||
#region Videos
|
#region Videos
|
||||||
writer.WriteStartElement("Videos");
|
writer.WriteStartElement("Videos");
|
||||||
|
|
||||||
foreach (SSkinElement element in _Skins[skinIndex].VideoList)
|
foreach (var element in _Skins[skinIndex].VideoList)
|
||||||
writer.WriteElementString(element.Name, element.Value);
|
writer.WriteElementString(element.Key, element.Value.Value);
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
#endregion Videos
|
#endregion Videos
|
||||||
|
|
||||||
@@ -422,7 +397,7 @@ namespace Vocaluxe.Base
|
|||||||
if (xmlReader == null)
|
if (xmlReader == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
STheme theme = new STheme();
|
var theme = new STheme();
|
||||||
|
|
||||||
int version = 0;
|
int version = 0;
|
||||||
xmlReader.TryGetIntValue("//root/ThemeSystemVersion", ref version);
|
xmlReader.TryGetIntValue("//root/ThemeSystemVersion", ref version);
|
||||||
@@ -489,7 +464,7 @@ namespace Vocaluxe.Base
|
|||||||
if (xmlReader == null)
|
if (xmlReader == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SSkin skin = new SSkin();
|
var skin = new SSkin();
|
||||||
|
|
||||||
int version = 0;
|
int version = 0;
|
||||||
xmlReader.TryGetIntValue("//root/SkinSystemVersion", ref version);
|
xmlReader.TryGetIntValue("//root/SkinSystemVersion", ref version);
|
||||||
@@ -508,21 +483,15 @@ namespace Vocaluxe.Base
|
|||||||
skin.FileName = file;
|
skin.FileName = file;
|
||||||
skin.PartyModeID = theme.PartyModeID;
|
skin.PartyModeID = theme.PartyModeID;
|
||||||
|
|
||||||
skin.SkinList = new Dictionary<string, SSkinElement>();
|
skin.SkinList = new Dictionary<string, CSkinElement>();
|
||||||
List<string> names = xmlReader.GetValues("Skins");
|
List<string> names = xmlReader.GetValues("Skins");
|
||||||
foreach (string str in names)
|
foreach (string str in names)
|
||||||
{
|
skin.SkinList[str] = new CSkinElement();
|
||||||
SSkinElement sk = new SSkinElement {Name = str, Value = String.Empty};
|
|
||||||
skin.SkinList[str] = sk;
|
|
||||||
}
|
|
||||||
|
|
||||||
skin.VideoList = new List<SSkinElement>();
|
skin.VideoList = new Dictionary<string, CVideoSkinElement>();
|
||||||
names = xmlReader.GetValues("Videos");
|
names = xmlReader.GetValues("Videos");
|
||||||
foreach (string str in names)
|
foreach (string str in names)
|
||||||
{
|
skin.VideoList[str] = new CVideoSkinElement();
|
||||||
SSkinElement sk = new SSkinElement {Name = str, Value = String.Empty};
|
|
||||||
skin.VideoList.Add(sk);
|
|
||||||
}
|
|
||||||
_Skins.Add(skin);
|
_Skins.Add(skin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -587,8 +556,9 @@ namespace Vocaluxe.Base
|
|||||||
public static CTexture GetSkinTexture(string textureName, int partyModeID)
|
public static CTexture GetSkinTexture(string textureName, int partyModeID)
|
||||||
{
|
{
|
||||||
int skinIndex = GetSkinIndex(partyModeID);
|
int skinIndex = GetSkinIndex(partyModeID);
|
||||||
if (skinIndex != -1 && textureName != null && _Skins[skinIndex].SkinList.ContainsKey(textureName))
|
CSkinElement sk;
|
||||||
return _Skins[skinIndex].SkinList[textureName].Texture;
|
if (skinIndex != -1 && textureName != null && _Skins[skinIndex].SkinList.TryGetValue(textureName, out sk))
|
||||||
|
return sk.Texture;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -599,85 +569,57 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
private static string _GetSkinFileName(string skinName, int skinIndex, bool returnPath = false)
|
private static string _GetSkinFileName(string skinName, int skinIndex, bool returnPath = false)
|
||||||
{
|
{
|
||||||
foreach (SSkinElement sk in _Skins[skinIndex].SkinList.Values)
|
CSkinElement sk;
|
||||||
{
|
if (_Skins[skinIndex].SkinList.TryGetValue(skinName, out sk))
|
||||||
if (sk.Name == skinName)
|
return !returnPath ? sk.Value : Path.Combine(_Skins[skinIndex].Path, sk.Value);
|
||||||
return !returnPath ? sk.Value : Path.Combine(_Skins[skinIndex].Path, sk.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
CLog.LogError("Can't find Skin Element \"" + skinName);
|
CLog.LogError("Can't find Skin Element \"" + skinName);
|
||||||
return skinName;
|
return skinName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CTexture GetSkinVideoTexture(string videoName, int partyModeID)
|
public static CVideoSkinElement GetSkinVideo(string videoName, int partyModeID, bool load = true)
|
||||||
{
|
{
|
||||||
int skinIndex = GetSkinIndex(partyModeID);
|
int skinIndex = GetSkinIndex(partyModeID);
|
||||||
if (skinIndex != -1)
|
if (skinIndex != -1)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _Skins[skinIndex].VideoList.Count; i++)
|
CVideoSkinElement sk;
|
||||||
|
if (_Skins[skinIndex].VideoList.TryGetValue(videoName, out sk))
|
||||||
{
|
{
|
||||||
SSkinElement sk = _Skins[skinIndex].VideoList[i];
|
if (sk.VideoIndex == -1 && load)
|
||||||
if (sk.Name == videoName)
|
|
||||||
{
|
{
|
||||||
float time = 0f;
|
sk.VideoIndex = CVideo.Load(GetVideoFilePath(videoName, partyModeID));
|
||||||
if (sk.VideoIndex == -1)
|
CVideo.SetLoop(sk.VideoIndex, true);
|
||||||
{
|
|
||||||
sk.VideoIndex = CVideo.Load(GetVideoFilePath(sk.Name, partyModeID));
|
|
||||||
CVideo.SetLoop(sk.VideoIndex, true);
|
|
||||||
}
|
|
||||||
CVideo.GetFrame(sk.VideoIndex, ref sk.Texture, time, out time);
|
|
||||||
_Skins[skinIndex].VideoList[i] = sk;
|
|
||||||
return sk.Texture;
|
|
||||||
}
|
}
|
||||||
|
return sk;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CTexture GetSkinVideoTexture(string videoName, int partyModeID)
|
||||||
|
{
|
||||||
|
CVideoSkinElement sk = GetSkinVideo(videoName, partyModeID);
|
||||||
|
if (sk == null)
|
||||||
|
return null;
|
||||||
|
float time = 0f;
|
||||||
|
CVideo.GetFrame(sk.VideoIndex, ref sk.Texture, time, out time);
|
||||||
|
return sk.Texture;
|
||||||
|
}
|
||||||
|
|
||||||
public static void SkinVideoPause(string videoName, int partyModeID)
|
public static void SkinVideoPause(string videoName, int partyModeID)
|
||||||
{
|
{
|
||||||
int skinIndex = GetSkinIndex(partyModeID);
|
CVideoSkinElement sk = GetSkinVideo(videoName, partyModeID, false);
|
||||||
if (skinIndex != -1)
|
if (sk == null)
|
||||||
{
|
return;
|
||||||
for (int i = 0; i < _Skins[skinIndex].VideoList.Count; i++)
|
CVideo.Pause(sk.VideoIndex);
|
||||||
{
|
|
||||||
SSkinElement sk = _Skins[skinIndex].VideoList[i];
|
|
||||||
if (sk.Name == videoName)
|
|
||||||
{
|
|
||||||
if (sk.VideoIndex == -1)
|
|
||||||
{
|
|
||||||
sk.VideoIndex = CVideo.Load(GetVideoFilePath(sk.Name, partyModeID));
|
|
||||||
CVideo.SetLoop(sk.VideoIndex, true);
|
|
||||||
}
|
|
||||||
CVideo.Pause(sk.VideoIndex);
|
|
||||||
_Skins[skinIndex].VideoList[i] = sk;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SkinVideoResume(string videoName, int partyModeID)
|
public static void SkinVideoResume(string videoName, int partyModeID)
|
||||||
{
|
{
|
||||||
int skinIndex = GetSkinIndex(partyModeID);
|
CVideoSkinElement sk = GetSkinVideo(videoName, partyModeID);
|
||||||
if (skinIndex != -1)
|
if (sk == null)
|
||||||
{
|
return;
|
||||||
for (int i = 0; i < _Skins[skinIndex].VideoList.Count; i++)
|
CVideo.Resume(sk.VideoIndex);
|
||||||
{
|
|
||||||
SSkinElement sk = _Skins[skinIndex].VideoList[i];
|
|
||||||
if (sk.Name == videoName)
|
|
||||||
{
|
|
||||||
if (sk.VideoIndex == -1)
|
|
||||||
{
|
|
||||||
sk.VideoIndex = CVideo.Load(GetVideoFilePath(sk.Name, partyModeID));
|
|
||||||
CVideo.SetLoop(sk.VideoIndex, true);
|
|
||||||
}
|
|
||||||
CVideo.Resume(sk.VideoIndex);
|
|
||||||
_Skins[skinIndex].VideoList[i] = sk;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetVideoFilePath(string videoName, int partyModeID)
|
public static string GetVideoFilePath(string videoName, int partyModeID)
|
||||||
@@ -687,11 +629,9 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
private static string _GetVideoFileName(string videoName, int skinIndex, bool returnPath = false)
|
private static string _GetVideoFileName(string videoName, int skinIndex, bool returnPath = false)
|
||||||
{
|
{
|
||||||
foreach (SSkinElement sk in _Skins[skinIndex].VideoList)
|
CVideoSkinElement sk;
|
||||||
{
|
if (_Skins[skinIndex].VideoList.TryGetValue(videoName, out sk))
|
||||||
if (sk.Name == videoName)
|
return !returnPath ? sk.Value : Path.Combine(_Skins[skinIndex].Path, sk.Value);
|
||||||
return !returnPath ? sk.Value : Path.Combine(_Skins[skinIndex].Path, sk.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
CLog.LogError("Can't find Video Element \"" + videoName);
|
CLog.LogError("Can't find Video Element \"" + videoName);
|
||||||
return videoName;
|
return videoName;
|
||||||
@@ -705,13 +645,13 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
if (_Skins[skinIndex].PartyModeID == -1)
|
if (_Skins[skinIndex].PartyModeID == -1)
|
||||||
{
|
{
|
||||||
List<SColorF> playerColors = new List<SColorF>();
|
var playerColors = new List<SColorF>();
|
||||||
float value = 0f;
|
float value = 0f;
|
||||||
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
while (xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/R", ref value))
|
while (xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/R", ref value))
|
||||||
{
|
{
|
||||||
SColorF color = new SColorF {R = value};
|
var color = new SColorF {R = value};
|
||||||
|
|
||||||
xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/G", ref color.G);
|
xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/G", ref color.G);
|
||||||
xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/B", ref color.B);
|
xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/B", ref color.B);
|
||||||
@@ -723,11 +663,11 @@ namespace Vocaluxe.Base
|
|||||||
skin.ThemeColors.Player = playerColors.ToArray();
|
skin.ThemeColors.Player = playerColors.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SColorScheme> colorScheme = new List<SColorScheme>();
|
var colorScheme = new List<SColorScheme>();
|
||||||
List<string> names = xmlReader.GetValues("ColorSchemes");
|
List<string> names = xmlReader.GetValues("ColorSchemes");
|
||||||
foreach (string str in names)
|
foreach (string str in names)
|
||||||
{
|
{
|
||||||
SColorScheme scheme = new SColorScheme {Name = str};
|
var scheme = new SColorScheme {Name = str};
|
||||||
|
|
||||||
xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/R", ref scheme.Color.R);
|
xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/R", ref scheme.Color.R);
|
||||||
xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/G", ref scheme.Color.G);
|
xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/G", ref scheme.Color.G);
|
||||||
@@ -790,7 +730,7 @@ namespace Vocaluxe.Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
writer.WriteStartElement("ColorSchemes");
|
writer.WriteStartElement("ColorSchemes");
|
||||||
foreach (SColorScheme scheme in _Skins[skinIndex].ThemeColors.ColorSchemes)
|
foreach (var scheme in _Skins[skinIndex].ThemeColors.ColorSchemes)
|
||||||
{
|
{
|
||||||
writer.WriteStartElement(scheme.Name);
|
writer.WriteStartElement(scheme.Name);
|
||||||
|
|
||||||
@@ -840,7 +780,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static bool GetColor(string colorName, int skinIndex, out SColorF color)
|
public static bool GetColor(string colorName, int skinIndex, out SColorF color)
|
||||||
{
|
{
|
||||||
foreach (SColorScheme scheme in _Skins[skinIndex].ThemeColors.ColorSchemes)
|
foreach (var scheme in _Skins[skinIndex].ThemeColors.ColorSchemes)
|
||||||
{
|
{
|
||||||
if (scheme.Name == colorName)
|
if (scheme.Name == colorName)
|
||||||
{
|
{
|
||||||
@@ -856,7 +796,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static SColorF GetPlayerColor(int playerNr)
|
public static SColorF GetPlayerColor(int playerNr)
|
||||||
{
|
{
|
||||||
SColorF color = new SColorF(1f, 1f, 1f, 1f);
|
var color = new SColorF(1f, 1f, 1f, 1f);
|
||||||
|
|
||||||
int skinIndex = GetSkinIndex(-1);
|
int skinIndex = GetSkinIndex(-1);
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace Vocaluxe.Lib.Sound.Decoder
|
|||||||
|
|
||||||
if (!_Instance.Opened)
|
if (!_Instance.Opened)
|
||||||
{
|
{
|
||||||
//Free();
|
Close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,12 +72,13 @@ namespace Vocaluxe.Lib.Sound.Decoder
|
|||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
CLog.LogError("Error opening audio file (can't find decoder): " + _FileName);
|
CLog.LogError("Error opening audio file (can't find decoder): " + _FileName);
|
||||||
|
Close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (audioStreamIndex < 0)
|
if (audioStreamIndex < 0)
|
||||||
{
|
{
|
||||||
//Free();
|
Close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,6 +94,7 @@ namespace Vocaluxe.Lib.Sound.Decoder
|
|||||||
if (_FormatInfo.BitDepth != 16)
|
if (_FormatInfo.BitDepth != 16)
|
||||||
{
|
{
|
||||||
CLog.LogError("Unsupported BitDepth in file " + fileName);
|
CLog.LogError("Unsupported BitDepth in file " + fileName);
|
||||||
|
Close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_FileOpened = true;
|
_FileOpened = true;
|
||||||
@@ -100,35 +102,29 @@ namespace Vocaluxe.Lib.Sound.Decoder
|
|||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
if (!_FileOpened)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_Audiodecoder != IntPtr.Zero)
|
if (_Audiodecoder != IntPtr.Zero)
|
||||||
|
{
|
||||||
CAcinerella.AcFreeDecoder(_Audiodecoder);
|
CAcinerella.AcFreeDecoder(_Audiodecoder);
|
||||||
|
_Audiodecoder = IntPtr.Zero;
|
||||||
|
}
|
||||||
if (_InstancePtr != IntPtr.Zero)
|
if (_InstancePtr != IntPtr.Zero)
|
||||||
|
{
|
||||||
CAcinerella.AcClose(_InstancePtr);
|
CAcinerella.AcClose(_InstancePtr);
|
||||||
|
|
||||||
if (_InstancePtr != IntPtr.Zero)
|
|
||||||
CAcinerella.AcFree(_InstancePtr);
|
CAcinerella.AcFree(_InstancePtr);
|
||||||
|
_InstancePtr = IntPtr.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
_FileOpened = false;
|
_FileOpened = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SFormatInfo GetFormatInfo()
|
public SFormatInfo GetFormatInfo()
|
||||||
{
|
{
|
||||||
if (!_FileOpened)
|
return _FileOpened ? _FormatInfo : new SFormatInfo();
|
||||||
return new SFormatInfo();
|
|
||||||
|
|
||||||
return _FormatInfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetLength()
|
public float GetLength()
|
||||||
{
|
{
|
||||||
if (!_FileOpened)
|
return _FileOpened ? _Instance.Info.Duration / 1000f:0;
|
||||||
return 0f;
|
|
||||||
|
|
||||||
return _Instance.Info.Duration / 1000f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetPosition(float time)
|
public void SetPosition(float time)
|
||||||
@@ -138,7 +134,7 @@ namespace Vocaluxe.Lib.Sound.Decoder
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CAcinerella.AcSeek(_Audiodecoder, 0, (Int64)(time * 1000f));
|
CAcinerella.AcSeek(_Audiodecoder, (time>_CurrentTime)?0:-1, (Int64)(time * 1000f));
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@@ -149,7 +145,7 @@ namespace Vocaluxe.Lib.Sound.Decoder
|
|||||||
|
|
||||||
public float GetPosition()
|
public float GetPosition()
|
||||||
{
|
{
|
||||||
return !_FileOpened ? 0f : _CurrentTime;
|
return _FileOpened ? _CurrentTime : 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Decode(out byte[] buffer, out float timeStamp)
|
public void Decode(out byte[] buffer, out float timeStamp)
|
||||||
@@ -161,17 +157,9 @@ namespace Vocaluxe.Lib.Sound.Decoder
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int frameFinished;
|
bool frameFinished = CAcinerella.AcGetAudioFrame(_InstancePtr, _Audiodecoder);
|
||||||
try
|
|
||||||
{
|
|
||||||
frameFinished = CAcinerella.AcGetAudioFrame(_InstancePtr, _Audiodecoder);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
frameFinished = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frameFinished == 1)
|
if (frameFinished)
|
||||||
{
|
{
|
||||||
SACDecoder decoder = (SACDecoder)Marshal.PtrToStructure(_Audiodecoder, typeof(SACDecoder));
|
SACDecoder decoder = (SACDecoder)Marshal.PtrToStructure(_Audiodecoder, typeof(SACDecoder));
|
||||||
|
|
||||||
|
|||||||
@@ -156,11 +156,7 @@ namespace Vocaluxe.Lib.Video.Acinerella
|
|||||||
// the number of bytes read or an value smaller than zero if an error occured.
|
// the number of bytes read or an value smaller than zero if an error occured.
|
||||||
//TAc_read_callback = function(sender: Pointer; byte[] buf, int size): integer; cdecl;
|
//TAc_read_callback = function(sender: Pointer; byte[] buf, int size): integer; cdecl;
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
public delegate Int32 ACReadCallback(
|
public delegate Int32 ACReadCallback(IntPtr sender, IntPtr buf, Int32 size);
|
||||||
IntPtr sender,
|
|
||||||
IntPtr buf,
|
|
||||||
Int32 size
|
|
||||||
);
|
|
||||||
|
|
||||||
// Callback function used to ask the application to seek. return 0 if succeed , -1 on failure.
|
// Callback function used to ask the application to seek. return 0 if succeed , -1 on failure.
|
||||||
//TAc_seek_callback = function(sender: Pointer; pos: int64; whence: integer): int64; cdecl;
|
//TAc_seek_callback = function(sender: Pointer; pos: int64; whence: integer): int64; cdecl;
|
||||||
@@ -274,17 +270,11 @@ namespace Vocaluxe.Lib.Video.Acinerella
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
[DllImport(_AcDll, EntryPoint = "ac_open", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
[DllImport(_AcDll, EntryPoint = "ac_open", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||||
private static extern Int32 _ac_open2(
|
private static extern Int32 _ac_open2(IntPtr pAcInstance, string filename);
|
||||||
IntPtr pAcInstance,
|
|
||||||
string filename
|
|
||||||
);
|
|
||||||
|
|
||||||
// ReSharper disable UnusedMethodReturnValue.Global
|
// ReSharper disable UnusedMethodReturnValue.Global
|
||||||
public static Int32 AcOpen2(
|
public static Int32 AcOpen2(IntPtr pAcInstance, string filename)
|
||||||
// ReSharper restore UnusedMethodReturnValue.Global
|
// ReSharper restore UnusedMethodReturnValue.Global
|
||||||
IntPtr pAcInstance,
|
|
||||||
string filename
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
lock (_Lock)
|
lock (_Lock)
|
||||||
{
|
{
|
||||||
@@ -306,28 +296,15 @@ namespace Vocaluxe.Lib.Video.Acinerella
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Stores information in "pInfo" about stream number "nb".
|
// Stores information in "pInfo" about stream number "nb".
|
||||||
//procedure ac_get_stream_info(
|
//procedure ac_get_stream_info(inst: PAc_instance; nb: integer; pinfo: PAc_stream_info); cdecl; external ac_dll;
|
||||||
//inst: PAc_instance; nb: integer; pinfo: PAc_stream_info); cdecl; external ac_dll;
|
|
||||||
[DllImport(_AcDll, EntryPoint = "ac_get_stream_info", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
|
[DllImport(_AcDll, EntryPoint = "ac_get_stream_info", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
|
||||||
private static extern void _ac_get_stream_info(
|
private static extern void _ac_get_stream_info(IntPtr pAcInstance, Int32 nb, out SACStreamInfo info);
|
||||||
IntPtr pAcInstance,
|
|
||||||
Int32 nb,
|
|
||||||
out SACStreamInfo info
|
|
||||||
);
|
|
||||||
|
|
||||||
public static void AcGetStreamInfo(
|
public static void AcGetStreamInfo(IntPtr pAcInstance, Int32 nb, out SACStreamInfo info)
|
||||||
IntPtr pAcInstance,
|
|
||||||
Int32 nb,
|
|
||||||
out SACStreamInfo info
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
lock (_Lock)
|
lock (_Lock)
|
||||||
{
|
{
|
||||||
_ac_get_stream_info(
|
_ac_get_stream_info(pAcInstance, nb, out info);
|
||||||
pAcInstance,
|
|
||||||
nb,
|
|
||||||
out info
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,44 +359,44 @@ namespace Vocaluxe.Lib.Video.Acinerella
|
|||||||
[DllImport(_AcDll, EntryPoint = "ac_decode_package", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
|
[DllImport(_AcDll, EntryPoint = "ac_decode_package", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
|
||||||
private static extern Int32 _ac_decode_package(IntPtr pAcPackage, IntPtr pAcDecoder);
|
private static extern Int32 _ac_decode_package(IntPtr pAcPackage, IntPtr pAcDecoder);
|
||||||
|
|
||||||
public static Int32 AcDecodePackage(IntPtr pAcPackage, IntPtr pAcDecoder)
|
public static bool AcDecodePackage(IntPtr pAcPackage, IntPtr pAcDecoder)
|
||||||
{
|
{
|
||||||
lock (_Lock)
|
lock (_Lock)
|
||||||
{
|
{
|
||||||
return _ac_decode_package(pAcPackage, pAcDecoder);
|
return _ac_decode_package(pAcPackage, pAcDecoder)!=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport(_AcDll, EntryPoint = "ac_get_audio_frame", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
|
[DllImport(_AcDll, EntryPoint = "ac_get_audio_frame", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
|
||||||
private static extern Int32 _ac_get_audio_frame(IntPtr pAcInstance, IntPtr pAcDecoder);
|
private static extern Int32 _ac_get_audio_frame(IntPtr pAcInstance, IntPtr pAcDecoder);
|
||||||
|
|
||||||
public static Int32 AcGetAudioFrame(IntPtr pAcInstance, IntPtr pAcDecoder)
|
public static bool AcGetAudioFrame(IntPtr pAcInstance, IntPtr pAcDecoder)
|
||||||
{
|
{
|
||||||
lock (_Lock)
|
lock (_Lock)
|
||||||
{
|
{
|
||||||
return _ac_get_audio_frame(pAcInstance, pAcDecoder);
|
return _ac_get_audio_frame(pAcInstance, pAcDecoder)!=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport(_AcDll, EntryPoint = "ac_get_frame", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
|
[DllImport(_AcDll, EntryPoint = "ac_get_frame", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
|
||||||
private static extern Int32 _ac_get_frame(IntPtr pAcInstance, IntPtr pAcDecoder);
|
private static extern Int32 _ac_get_frame(IntPtr pAcInstance, IntPtr pAcDecoder);
|
||||||
|
|
||||||
public static Int32 AcGetFrame(IntPtr pAcInstance, IntPtr pAcDecoder)
|
public static bool AcGetFrame(IntPtr pAcInstance, IntPtr pAcDecoder)
|
||||||
{
|
{
|
||||||
lock (_Lock)
|
lock (_Lock)
|
||||||
{
|
{
|
||||||
return _ac_get_frame(pAcInstance, pAcDecoder);
|
return _ac_get_frame(pAcInstance, pAcDecoder)!=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport(_AcDll, EntryPoint = "ac_skip_frames", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
|
[DllImport(_AcDll, EntryPoint = "ac_skip_frames", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
|
||||||
private static extern Int32 _ac_skip_frames(IntPtr pAcInstance, IntPtr pAcDecoder, Int32 num);
|
private static extern Int32 _ac_skip_frames(IntPtr pAcInstance, IntPtr pAcDecoder, Int32 num);
|
||||||
|
|
||||||
public static Int32 AcSkipFrames(IntPtr pAcInstance, IntPtr pAcDecoder, Int32 num)
|
public static bool AcSkipFrames(IntPtr pAcInstance, IntPtr pAcDecoder, Int32 num)
|
||||||
{
|
{
|
||||||
lock (_Lock)
|
lock (_Lock)
|
||||||
{
|
{
|
||||||
return _ac_skip_frames(pAcInstance, pAcDecoder, num);
|
return _ac_skip_frames(pAcInstance, pAcDecoder, num)!=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,25 +408,18 @@ namespace Vocaluxe.Lib.Video.Acinerella
|
|||||||
[DllImport(_AcDll, EntryPoint = "ac_seek", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
|
[DllImport(_AcDll, EntryPoint = "ac_seek", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
|
||||||
private static extern Int32 _ac_seek(IntPtr pAcDecoder, Int32 dir, Int64 targetPos);
|
private static extern Int32 _ac_seek(IntPtr pAcDecoder, Int32 dir, Int64 targetPos);
|
||||||
|
|
||||||
// ReSharper disable UnusedMethodReturnValue.Global
|
public static bool AcSeek(IntPtr pAcDecoder, Int32 dir, Int64 targetPos)
|
||||||
public static Int32 AcSeek(IntPtr pAcDecoder, Int32 dir, Int64 targetPos)
|
|
||||||
// ReSharper restore UnusedMethodReturnValue.Global
|
|
||||||
{
|
{
|
||||||
lock (_Lock)
|
lock (_Lock)
|
||||||
{
|
{
|
||||||
return _ac_seek(pAcDecoder, dir, targetPos);
|
return _ac_seek(pAcDecoder, dir, targetPos)!=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//function ac_probe_input_buffer(buf: PChar; bufsize: Integer; filename: PChar;
|
//function ac_probe_input_buffer(buf: PChar; bufsize: Integer; filename: PChar;
|
||||||
//var score_max: Integer): PAc_proberesult; cdecl; external ac_dll;
|
//var score_max: Integer): PAc_proberesult; cdecl; external ac_dll;
|
||||||
[DllImport(_AcDll, EntryPoint = "ac_probe_input_buffer", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
|
[DllImport(_AcDll, EntryPoint = "ac_probe_input_buffer", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
|
||||||
public static extern IntPtr ac_probe_input_buffer(
|
public static extern IntPtr ac_probe_input_buffer(IntPtr buf, Int32 bufsize, IntPtr filename, out Int32 scoreMax);
|
||||||
IntPtr buf,
|
|
||||||
Int32 bufsize,
|
|
||||||
IntPtr filename,
|
|
||||||
out Int32 scoreMax
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReSharper restore UnusedMember.Global
|
// ReSharper restore UnusedMember.Global
|
||||||
|
|||||||
@@ -0,0 +1,441 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Threading;
|
||||||
|
using Vocaluxe.Base;
|
||||||
|
using VocaluxeLib.Draw;
|
||||||
|
|
||||||
|
namespace Vocaluxe.Lib.Video.Acinerella
|
||||||
|
{
|
||||||
|
class CDecoder
|
||||||
|
{
|
||||||
|
private IntPtr _Instance = IntPtr.Zero; // acinerella instance
|
||||||
|
private IntPtr _Videodecoder = IntPtr.Zero; // acinerella video decoder instance
|
||||||
|
|
||||||
|
private readonly Stopwatch _LoopTimer = new Stopwatch();
|
||||||
|
private readonly Thread _Thread;
|
||||||
|
private readonly Object _MutexFramebuffer = new Object();
|
||||||
|
private readonly CFramebuffer _Framebuffer;
|
||||||
|
private readonly Object _MutexSyncSignals = new Object();
|
||||||
|
|
||||||
|
private bool _FileOpened;
|
||||||
|
|
||||||
|
private float _FrameDuration; // frame time in s
|
||||||
|
private float _LastDecodedTime; // time of last decoded frame
|
||||||
|
private float _LastShownTime; // current video position
|
||||||
|
|
||||||
|
private float _Time;
|
||||||
|
private float _Gap;
|
||||||
|
private float _Start;
|
||||||
|
private bool _Loop;
|
||||||
|
|
||||||
|
private float _SetTime;
|
||||||
|
private float _SetGap;
|
||||||
|
private float _SetStart;
|
||||||
|
private bool _SetSkip;
|
||||||
|
|
||||||
|
private bool _Terminated;
|
||||||
|
private bool _FrameAvailable;
|
||||||
|
private bool _NoMoreFrames;
|
||||||
|
private readonly AutoResetEvent _EvWakeUp = new AutoResetEvent(false);
|
||||||
|
private bool _IsSleeping;
|
||||||
|
private int _WaitCount;
|
||||||
|
|
||||||
|
private float _SkipTime; // = Start + VideoGap
|
||||||
|
|
||||||
|
private string _FileName; // current video file name
|
||||||
|
private int _Width;
|
||||||
|
private int _Height;
|
||||||
|
private bool _Paused;
|
||||||
|
|
||||||
|
public CDecoder()
|
||||||
|
{
|
||||||
|
_Thread = new Thread(_Execute);
|
||||||
|
_Framebuffer = new CFramebuffer(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float Length { get; private set; }
|
||||||
|
|
||||||
|
public bool Paused
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
lock (_MutexSyncSignals)
|
||||||
|
{
|
||||||
|
_Paused = value;
|
||||||
|
if (_Paused)
|
||||||
|
_LoopTimer.Stop();
|
||||||
|
else
|
||||||
|
_LoopTimer.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Loop { private get; set; }
|
||||||
|
|
||||||
|
public bool Finished { get; private set; }
|
||||||
|
|
||||||
|
public bool Open(string fileName)
|
||||||
|
{
|
||||||
|
if (_FileOpened)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!File.Exists(fileName))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
_FileName = fileName;
|
||||||
|
|
||||||
|
//Do this here as one may want to get the length afterwards!
|
||||||
|
if (!_DoOpen())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
_FileOpened = true;
|
||||||
|
|
||||||
|
_Thread.Priority = ThreadPriority.Normal;
|
||||||
|
_Thread.Name = Path.GetFileName(fileName);
|
||||||
|
_Thread.Start();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
_Terminated = true;
|
||||||
|
Length = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool GetFrame(ref CTexture frame, float time, out float videoTime)
|
||||||
|
{
|
||||||
|
if (_Paused)
|
||||||
|
{
|
||||||
|
videoTime = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Loop)
|
||||||
|
{
|
||||||
|
lock (_MutexSyncSignals)
|
||||||
|
{
|
||||||
|
_SetTime += _LoopTimer.ElapsedMilliseconds / 1000f;
|
||||||
|
_LoopTimer.Restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Math.Abs(_SetTime - time) > float.Epsilon)
|
||||||
|
{
|
||||||
|
lock (_MutexSyncSignals)
|
||||||
|
{
|
||||||
|
_SetTime = time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
videoTime = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_UploadNewFrame(ref frame);
|
||||||
|
videoTime = _LastShownTime;
|
||||||
|
return frame != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Skip(float start, float gap)
|
||||||
|
{
|
||||||
|
lock (_MutexSyncSignals)
|
||||||
|
{
|
||||||
|
_SetStart = start;
|
||||||
|
_SetGap = gap;
|
||||||
|
_SetSkip = true;
|
||||||
|
_NoMoreFrames = false;
|
||||||
|
Finished = false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Threading
|
||||||
|
private void _Skip()
|
||||||
|
{
|
||||||
|
_SkipTime = _Start + _Gap;
|
||||||
|
|
||||||
|
if (_SkipTime < 0)
|
||||||
|
_SkipTime = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CAcinerella.AcSeek(_Videodecoder, (_LastDecodedTime > _SkipTime) ? -1 : 0, (Int64)(_SkipTime * 1000f));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error seeking video file \"" + _FileName + "\": " + e.Message);
|
||||||
|
}
|
||||||
|
_LastDecodedTime = _SkipTime;
|
||||||
|
|
||||||
|
lock (_MutexSyncSignals)
|
||||||
|
{
|
||||||
|
_LastShownTime = _LastDecodedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
lock (_MutexFramebuffer)
|
||||||
|
{
|
||||||
|
_Framebuffer.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
_FrameAvailable = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void _Execute()
|
||||||
|
{
|
||||||
|
while (!_Terminated)
|
||||||
|
{
|
||||||
|
bool skip;
|
||||||
|
lock (_MutexSyncSignals)
|
||||||
|
{
|
||||||
|
_Time = _SetTime;
|
||||||
|
skip = _SetSkip;
|
||||||
|
_SetSkip = false;
|
||||||
|
_Gap = _SetGap;
|
||||||
|
_Start = _SetStart;
|
||||||
|
_Loop = Loop;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (skip)
|
||||||
|
_Skip();
|
||||||
|
|
||||||
|
if (!_FrameAvailable)
|
||||||
|
_Decode();
|
||||||
|
|
||||||
|
if (_FrameAvailable)
|
||||||
|
{
|
||||||
|
if (!_Framebuffer.IsFull())
|
||||||
|
{
|
||||||
|
_Copy();
|
||||||
|
_WaitCount = 0;
|
||||||
|
Thread.Sleep(1);
|
||||||
|
}
|
||||||
|
else if (_WaitCount > 3)
|
||||||
|
{
|
||||||
|
_IsSleeping = true;
|
||||||
|
_EvWakeUp.WaitOne();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Thread.Sleep((int)((_Framebuffer.Size - 2) * _FrameDuration * 1000));
|
||||||
|
_WaitCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_Free();
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _DoOpen()
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_Instance = CAcinerella.AcInit();
|
||||||
|
CAcinerella.AcOpen2(_Instance, _FileName);
|
||||||
|
|
||||||
|
var instance = (SACInstance)Marshal.PtrToStructure(_Instance, typeof(SACInstance));
|
||||||
|
Length = instance.Info.Duration / 1000f;
|
||||||
|
ok = instance.Opened;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error opening video file: " + _FileName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int videoStreamIndex;
|
||||||
|
SACDecoder videodecoder;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_Videodecoder = CAcinerella.AcCreateVideoDecoder(_Instance);
|
||||||
|
videodecoder = (SACDecoder)Marshal.PtrToStructure(_Videodecoder, typeof(SACDecoder));
|
||||||
|
videoStreamIndex = videodecoder.StreamIndex;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error opening video file (can't find decoder): " + _FileName);
|
||||||
|
_Free();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (videoStreamIndex < 0)
|
||||||
|
{
|
||||||
|
_Free();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_Width = videodecoder.StreamInfo.VideoInfo.FrameWidth;
|
||||||
|
_Height = videodecoder.StreamInfo.VideoInfo.FrameHeight;
|
||||||
|
|
||||||
|
if (videodecoder.StreamInfo.VideoInfo.FramesPerSecond > 0)
|
||||||
|
_FrameDuration = 1f / (float)videodecoder.StreamInfo.VideoInfo.FramesPerSecond;
|
||||||
|
|
||||||
|
_LastDecodedTime = 0f;
|
||||||
|
_SetTime = 0f;
|
||||||
|
|
||||||
|
_Framebuffer.Init(_Width * _Height * 4);
|
||||||
|
_FrameAvailable = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void _Decode()
|
||||||
|
{
|
||||||
|
const int minFrameDropCount = 4;
|
||||||
|
|
||||||
|
if (_Paused || _NoMoreFrames)
|
||||||
|
return;
|
||||||
|
|
||||||
|
float videoTime = _Time + _Gap;
|
||||||
|
float timeDifference = videoTime - _LastDecodedTime;
|
||||||
|
|
||||||
|
bool dropFrame = timeDifference >= (minFrameDropCount - 1) * _FrameDuration;
|
||||||
|
|
||||||
|
if (_Terminated)
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool frameFinished = false;
|
||||||
|
if (dropFrame)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (videoTime >= Length)
|
||||||
|
{
|
||||||
|
if (_Loop)
|
||||||
|
{
|
||||||
|
lock (_MutexSyncSignals)
|
||||||
|
{
|
||||||
|
_Start = 0;
|
||||||
|
_Gap = 0f;
|
||||||
|
_SetTime = 0;
|
||||||
|
}
|
||||||
|
_Skip();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_NoMoreFrames = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var frameDropCount = (int)(timeDifference / _FrameDuration);
|
||||||
|
frameFinished = CAcinerella.AcSkipFrames(_Instance, _Videodecoder, frameDropCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error AcSkipFrame " + _FileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!frameFinished)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
frameFinished = CAcinerella.AcGetFrame(_Instance, _Videodecoder);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
CLog.LogError("Error AcGetFrame " + _FileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (frameFinished)
|
||||||
|
_FrameAvailable = true;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_Loop)
|
||||||
|
{
|
||||||
|
lock (_MutexSyncSignals)
|
||||||
|
{
|
||||||
|
_Start = 0f;
|
||||||
|
_Gap = 0f;
|
||||||
|
_SetTime = 0f;
|
||||||
|
}
|
||||||
|
_Skip();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_NoMoreFrames = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void _Copy()
|
||||||
|
{
|
||||||
|
var videodecoder = (SACDecoder)Marshal.PtrToStructure(_Videodecoder, typeof(SACDecoder));
|
||||||
|
if (videodecoder.Buffer == IntPtr.Zero)
|
||||||
|
return;
|
||||||
|
_LastDecodedTime = (float)videodecoder.Timecode;
|
||||||
|
_Framebuffer.Put(videodecoder.Buffer, _LastDecodedTime);
|
||||||
|
_FrameAvailable = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void _UploadNewFrame(ref CTexture frame)
|
||||||
|
{
|
||||||
|
lock (_MutexFramebuffer)
|
||||||
|
{
|
||||||
|
CFrame curFrame = _FindFrame();
|
||||||
|
|
||||||
|
if (curFrame != null)
|
||||||
|
{
|
||||||
|
CDraw.UpdateOrAddTexture(ref frame, _Width, _Height, curFrame.Data);
|
||||||
|
|
||||||
|
lock (_MutexSyncSignals)
|
||||||
|
{
|
||||||
|
_LastShownTime = curFrame.Time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_NoMoreFrames && _Framebuffer.IsEmpty())
|
||||||
|
Finished = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!Finished && _IsSleeping)
|
||||||
|
{
|
||||||
|
_IsSleeping = false;
|
||||||
|
_EvWakeUp.Set();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private CFrame _FindFrame()
|
||||||
|
{
|
||||||
|
CFrame result = null;
|
||||||
|
float now = _SetTime + _Gap;
|
||||||
|
float maxEnd = now - _FrameDuration * 2; //Get only frames younger than 2
|
||||||
|
CFrame frame;
|
||||||
|
while ((frame = _Framebuffer.Get()) != null)
|
||||||
|
{
|
||||||
|
float frameEnd = frame.Time + _FrameDuration;
|
||||||
|
//Don't show frames that are shown during or after now
|
||||||
|
if (frameEnd >= now)
|
||||||
|
break; //All following frames are after that one
|
||||||
|
|
||||||
|
_Framebuffer.SetRead();
|
||||||
|
//Get the last(newest) possible frame and skip the rest to force in-order showing
|
||||||
|
if (frameEnd <= maxEnd)
|
||||||
|
continue;
|
||||||
|
maxEnd = frameEnd;
|
||||||
|
result = frame;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void _Free()
|
||||||
|
{
|
||||||
|
if (_Videodecoder != IntPtr.Zero)
|
||||||
|
CAcinerella.AcFreeDecoder(_Videodecoder);
|
||||||
|
|
||||||
|
if (_Instance != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
CAcinerella.AcClose(_Instance);
|
||||||
|
CAcinerella.AcFree(_Instance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion Threading
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Vocaluxe.Lib.Video.Acinerella
|
||||||
|
{
|
||||||
|
class CFrame
|
||||||
|
{
|
||||||
|
public readonly byte[] Data;
|
||||||
|
public float Time = -1;
|
||||||
|
|
||||||
|
public CFrame(int dataSize)
|
||||||
|
{
|
||||||
|
Data = new byte[dataSize];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class CFramebuffer
|
||||||
|
{
|
||||||
|
private readonly CFrame[] _Frames;
|
||||||
|
private readonly int _Size;
|
||||||
|
private int _DataSize;
|
||||||
|
private int _Last;
|
||||||
|
private int _First;
|
||||||
|
private bool _Initialized;
|
||||||
|
|
||||||
|
public int Size
|
||||||
|
{
|
||||||
|
get { return _Size; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public CFramebuffer(int size)
|
||||||
|
{
|
||||||
|
_Size = size;
|
||||||
|
_Frames = new CFrame[size];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Init(int dataSize)
|
||||||
|
{
|
||||||
|
_DataSize = dataSize;
|
||||||
|
for (int i = 0; i < _Size; i++)
|
||||||
|
_Frames[i] = new CFrame(dataSize);
|
||||||
|
_Initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int _Next(int current)
|
||||||
|
{
|
||||||
|
current++;
|
||||||
|
return (current < _Size) ? current : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsFull()
|
||||||
|
{
|
||||||
|
return _Next(_Last) == _First;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsEmpty()
|
||||||
|
{
|
||||||
|
return _First == _Last;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Put(IntPtr data, float time)
|
||||||
|
{
|
||||||
|
if (!_Initialized || IsFull())
|
||||||
|
return false;
|
||||||
|
CFrame frame = _Frames[_Last];
|
||||||
|
Marshal.Copy(data, frame.Data, 0, _DataSize);
|
||||||
|
frame.Time = time;
|
||||||
|
_Last = _Next(_Last);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CFrame Get()
|
||||||
|
{
|
||||||
|
return IsEmpty() ? null : _Frames[_First];
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SetRead()
|
||||||
|
{
|
||||||
|
if (IsEmpty())
|
||||||
|
return false;
|
||||||
|
_First = _Next(_First);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Clear()
|
||||||
|
{
|
||||||
|
_First = 0;
|
||||||
|
_Last = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
#region license
|
|
||||||
// /*
|
|
||||||
// This file is part of Vocaluxe.
|
|
||||||
//
|
|
||||||
// Vocaluxe 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 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// Vocaluxe 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 Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
// */
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using VocaluxeLib.Draw;
|
|
||||||
|
|
||||||
namespace Vocaluxe.Lib.Video
|
|
||||||
{
|
|
||||||
abstract class CVideoDecoder : IVideoDecoder
|
|
||||||
{
|
|
||||||
protected List<SVideoStreams> _Streams = new List<SVideoStreams>();
|
|
||||||
protected bool _Initialized;
|
|
||||||
|
|
||||||
public virtual bool Init()
|
|
||||||
{
|
|
||||||
_Streams = new List<SVideoStreams>();
|
|
||||||
_Initialized = true;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void CloseAll();
|
|
||||||
|
|
||||||
public virtual int GetNumStreams()
|
|
||||||
{
|
|
||||||
return _Streams.Count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual int Load(string videoFileName)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool Close(int streamID)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual float GetLength(int streamID)
|
|
||||||
{
|
|
||||||
return 0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract bool GetFrame(int streamID, ref CTexture frame, float time, out float videoTime);
|
|
||||||
|
|
||||||
public virtual bool Skip(int streamID, float start, float gap)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void SetLoop(int streamID, bool loop) {}
|
|
||||||
|
|
||||||
public virtual void Pause(int streamID) {}
|
|
||||||
|
|
||||||
public virtual void Resume(int streamID) {}
|
|
||||||
|
|
||||||
public virtual bool Finished(int streamID)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void Update() {}
|
|
||||||
|
|
||||||
protected bool _AlreadyAdded(int streamID)
|
|
||||||
{
|
|
||||||
return _Streams.Any(st => st.Handle == streamID);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected int _GetStreamIndex(int streamID)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < _Streams.Count; i++)
|
|
||||||
{
|
|
||||||
if (_Streams[i].Handle == streamID)
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,709 +17,114 @@
|
|||||||
// */
|
// */
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Threading;
|
|
||||||
using Vocaluxe.Base;
|
|
||||||
using Vocaluxe.Lib.Video.Acinerella;
|
using Vocaluxe.Lib.Video.Acinerella;
|
||||||
using VocaluxeLib.Draw;
|
using VocaluxeLib.Draw;
|
||||||
|
|
||||||
namespace Vocaluxe.Lib.Video
|
namespace Vocaluxe.Lib.Video
|
||||||
{
|
{
|
||||||
delegate void Closeproc(int streamID);
|
class CVideoDecoderFFmpeg : IVideoDecoder
|
||||||
|
|
||||||
class CVideoDecoderFFmpeg : CVideoDecoder
|
|
||||||
{
|
{
|
||||||
private readonly List<CDecoder> _Decoder = new List<CDecoder>();
|
private readonly Dictionary<int, CDecoder> _Decoder = new Dictionary<int, CDecoder>();
|
||||||
private Closeproc _Closeproc;
|
private int _LastID;
|
||||||
private int _Count = 1;
|
|
||||||
|
|
||||||
private readonly Object _MutexDecoder = new Object();
|
public bool Init()
|
||||||
|
|
||||||
public override bool Init()
|
|
||||||
{
|
{
|
||||||
_Closeproc = _CloseProc;
|
|
||||||
CloseAll();
|
CloseAll();
|
||||||
|
return true;
|
||||||
return base.Init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void CloseAll()
|
public void CloseAll()
|
||||||
{
|
{
|
||||||
lock (_MutexDecoder)
|
foreach (var decoder in _Decoder.Values)
|
||||||
{
|
decoder.Close();
|
||||||
for (int i = 0; i < _Decoder.Count; i++)
|
_Decoder.Clear();
|
||||||
_Decoder[i].Free(_Closeproc, i + 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int Load(string videoFileName)
|
public int Load(string videoFileName)
|
||||||
{
|
{
|
||||||
SVideoStreams stream = new SVideoStreams(0);
|
var decoder = new CDecoder();
|
||||||
CDecoder decoder = new CDecoder();
|
|
||||||
|
|
||||||
if (decoder.Open(videoFileName))
|
if (decoder.Open(videoFileName))
|
||||||
{
|
{
|
||||||
lock (_MutexDecoder)
|
int id = _LastID++;
|
||||||
{
|
_Decoder.Add(id, decoder);
|
||||||
_Decoder.Add(decoder);
|
return id;
|
||||||
stream.Handle = _Count++;
|
|
||||||
_Streams.Add(stream);
|
|
||||||
return stream.Handle;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Close(int streamID)
|
public bool Close(int streamID)
|
||||||
{
|
{
|
||||||
if (_Initialized)
|
CDecoder decoder;
|
||||||
|
if (_Decoder.TryGetValue(streamID, out decoder))
|
||||||
{
|
{
|
||||||
lock (_MutexDecoder)
|
decoder.Close();
|
||||||
{
|
_Decoder.Remove(streamID);
|
||||||
if (_AlreadyAdded(streamID))
|
return true;
|
||||||
{
|
|
||||||
_Decoder[_GetStreamIndex(streamID)].Free(_Closeproc, streamID);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool GetFrame(int streamID, ref CTexture frame, float time, out float videoTime)
|
public int GetNumStreams()
|
||||||
{
|
{
|
||||||
|
return _Decoder.Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool GetFrame(int streamID, ref CTexture frame, float time, out float videoTime)
|
||||||
|
{
|
||||||
|
CDecoder decoder;
|
||||||
|
if (_Decoder.TryGetValue(streamID, out decoder))
|
||||||
|
return decoder.GetFrame(ref frame, time, out videoTime);
|
||||||
videoTime = 0;
|
videoTime = 0;
|
||||||
if (_Initialized)
|
|
||||||
{
|
|
||||||
lock (_MutexDecoder)
|
|
||||||
{
|
|
||||||
if (_AlreadyAdded(streamID))
|
|
||||||
return _Decoder[_GetStreamIndex(streamID)].GetFrame(ref frame, time, out videoTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override float GetLength(int streamID)
|
public float GetLength(int streamID)
|
||||||
{
|
{
|
||||||
if (_Initialized)
|
CDecoder decoder;
|
||||||
{
|
if (_Decoder.TryGetValue(streamID, out decoder))
|
||||||
lock (_MutexDecoder)
|
return decoder.Length;
|
||||||
{
|
|
||||||
if (_AlreadyAdded(streamID))
|
|
||||||
return _Decoder[_GetStreamIndex(streamID)].Length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0f;
|
return 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Skip(int streamID, float start, float gap)
|
public bool Skip(int streamID, float start, float gap)
|
||||||
{
|
{
|
||||||
if (_Initialized)
|
CDecoder decoder;
|
||||||
{
|
if (_Decoder.TryGetValue(streamID, out decoder))
|
||||||
lock (_MutexDecoder)
|
return decoder.Skip(start, gap);
|
||||||
{
|
|
||||||
if (_AlreadyAdded(streamID))
|
|
||||||
return _Decoder[_GetStreamIndex(streamID)].Skip(start, gap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetLoop(int streamID, bool loop)
|
public void SetLoop(int streamID, bool loop)
|
||||||
{
|
{
|
||||||
if (_Initialized)
|
CDecoder decoder;
|
||||||
{
|
if (_Decoder.TryGetValue(streamID, out decoder))
|
||||||
lock (_MutexDecoder)
|
decoder.Loop = loop;
|
||||||
{
|
|
||||||
if (_AlreadyAdded(streamID))
|
|
||||||
_Decoder[_GetStreamIndex(streamID)].Loop = loop;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Pause(int streamID)
|
public void Pause(int streamID)
|
||||||
{
|
{
|
||||||
if (_Initialized)
|
CDecoder decoder;
|
||||||
{
|
if (_Decoder.TryGetValue(streamID, out decoder))
|
||||||
lock (_MutexDecoder)
|
decoder.Paused = true;
|
||||||
{
|
|
||||||
if (_AlreadyAdded(streamID))
|
|
||||||
_Decoder[_GetStreamIndex(streamID)].Paused = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Resume(int streamID)
|
public void Resume(int streamID)
|
||||||
{
|
{
|
||||||
if (_Initialized)
|
CDecoder decoder;
|
||||||
{
|
if (_Decoder.TryGetValue(streamID, out decoder))
|
||||||
lock (_MutexDecoder)
|
decoder.Paused = false;
|
||||||
{
|
|
||||||
if (_AlreadyAdded(streamID))
|
|
||||||
_Decoder[_GetStreamIndex(streamID)].Paused = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Finished(int streamID)
|
public bool Finished(int streamID)
|
||||||
{
|
{
|
||||||
if (_Initialized)
|
CDecoder decoder;
|
||||||
{
|
if (_Decoder.TryGetValue(streamID, out decoder))
|
||||||
lock (_MutexDecoder)
|
return decoder.Finished;
|
||||||
{
|
|
||||||
if (_AlreadyAdded(streamID))
|
|
||||||
return _Decoder[_GetStreamIndex(streamID)].Finished;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _CloseProc(int streamID)
|
public void Update() {}
|
||||||
{
|
|
||||||
if (_Initialized)
|
|
||||||
{
|
|
||||||
lock (_MutexDecoder)
|
|
||||||
{
|
|
||||||
if (_AlreadyAdded(streamID))
|
|
||||||
{
|
|
||||||
int index = _GetStreamIndex(streamID);
|
|
||||||
_Decoder.RemoveAt(index);
|
|
||||||
_Streams.RemoveAt(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct SFrameBuffer
|
|
||||||
{
|
|
||||||
public byte[] Data;
|
|
||||||
public float Time;
|
|
||||||
public bool Displayed;
|
|
||||||
}
|
|
||||||
|
|
||||||
class CDecoder : IDisposable
|
|
||||||
{
|
|
||||||
private IntPtr _Instance = IntPtr.Zero; // acinerella instance
|
|
||||||
private IntPtr _Videodecoder = IntPtr.Zero; // acinerella video decoder instance
|
|
||||||
|
|
||||||
private readonly Stopwatch _LoopTimer = new Stopwatch();
|
|
||||||
private Closeproc _Closeproc; // delegate for stream closing
|
|
||||||
private int _StreamID; // stream ID for stream closing
|
|
||||||
private string _FileName; // current video file name
|
|
||||||
|
|
||||||
private bool _FileOpened;
|
|
||||||
|
|
||||||
private float _VideoTimeBase; // frame time
|
|
||||||
private float _VideoDecoderTime; // time of last decoded frame
|
|
||||||
private float _CurrentVideoTime; // current video position
|
|
||||||
private bool _BufferFull; // buffer is full, waiting for free frame slot
|
|
||||||
|
|
||||||
private bool _Skip; // do skip
|
|
||||||
private float _Time;
|
|
||||||
private float _Gap;
|
|
||||||
private float _Start;
|
|
||||||
private bool _Loop;
|
|
||||||
private float _Duration;
|
|
||||||
private float _VideoSkipTime; // = VideoGap
|
|
||||||
private float _SkipTime; // = Start + VideoGap
|
|
||||||
|
|
||||||
private bool _Paused;
|
|
||||||
private bool _NoMoreFrames;
|
|
||||||
private bool _BeforeLoop;
|
|
||||||
|
|
||||||
private int _Width;
|
|
||||||
private int _Height;
|
|
||||||
private float _SetTime;
|
|
||||||
private float _SetGap;
|
|
||||||
private float _SetStart;
|
|
||||||
private bool _SetSkip;
|
|
||||||
private bool _Terminated;
|
|
||||||
|
|
||||||
private readonly Thread _Thread;
|
|
||||||
//AutoResetEvent EventDecode = new AutoResetEvent(false);
|
|
||||||
private readonly SFrameBuffer[] _FrameBuffer = new SFrameBuffer[5];
|
|
||||||
private bool _NewFrame;
|
|
||||||
private readonly Object _MutexFramebuffer = new Object();
|
|
||||||
private readonly Object _MutexSyncSignals = new Object();
|
|
||||||
|
|
||||||
public CDecoder()
|
|
||||||
{
|
|
||||||
_Thread = new Thread(_Execute);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Free(Closeproc closeProc, int streamID)
|
|
||||||
{
|
|
||||||
_Closeproc = closeProc;
|
|
||||||
_StreamID = streamID;
|
|
||||||
_Terminated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float Length
|
|
||||||
{
|
|
||||||
get { return _FileOpened ? _Duration : 0f; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Paused
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
lock (_MutexSyncSignals)
|
|
||||||
{
|
|
||||||
_Paused = value;
|
|
||||||
if (_Paused)
|
|
||||||
_LoopTimer.Stop();
|
|
||||||
else
|
|
||||||
_LoopTimer.Start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Loop { private get; set; }
|
|
||||||
|
|
||||||
public bool Finished { get; private set; }
|
|
||||||
|
|
||||||
public bool Open(string fileName)
|
|
||||||
{
|
|
||||||
if (_FileOpened)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!File.Exists(fileName))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
_FileName = fileName;
|
|
||||||
_Thread.Priority = ThreadPriority.Normal;
|
|
||||||
_Thread.Name = Path.GetFileName(fileName);
|
|
||||||
_Thread.Start();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool GetFrame(ref CTexture frame, float time, out float videoTime)
|
|
||||||
{
|
|
||||||
videoTime = 0;
|
|
||||||
if (!_FileOpened)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (_Paused)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (Loop)
|
|
||||||
{
|
|
||||||
lock (_MutexSyncSignals)
|
|
||||||
{
|
|
||||||
_SetTime += _LoopTimer.ElapsedMilliseconds / 1000f;
|
|
||||||
videoTime = _SetTime;
|
|
||||||
|
|
||||||
_LoopTimer.Stop();
|
|
||||||
_LoopTimer.Reset();
|
|
||||||
_LoopTimer.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_UploadNewFrame(ref frame);
|
|
||||||
//EventDecode.Set();
|
|
||||||
return frame != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Math.Abs(_SetTime - time) > float.Epsilon)
|
|
||||||
{
|
|
||||||
lock (_MutexSyncSignals)
|
|
||||||
{
|
|
||||||
_SetTime = time;
|
|
||||||
}
|
|
||||||
_UploadNewFrame(ref frame);
|
|
||||||
videoTime = _CurrentVideoTime;
|
|
||||||
//EventDecode.Set();
|
|
||||||
return frame != null;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Skip(float start, float gap)
|
|
||||||
{
|
|
||||||
lock (_MutexSyncSignals)
|
|
||||||
{
|
|
||||||
_SetStart = start;
|
|
||||||
_SetGap = gap;
|
|
||||||
_SetSkip = true;
|
|
||||||
_NoMoreFrames = false;
|
|
||||||
Finished = false;
|
|
||||||
}
|
|
||||||
//EventDecode.Set();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Threading
|
|
||||||
private void _DoSkip()
|
|
||||||
{
|
|
||||||
if (!_FileOpened)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_VideoSkipTime = _Gap;
|
|
||||||
_SkipTime = _Start + _Gap;
|
|
||||||
_BeforeLoop = false;
|
|
||||||
|
|
||||||
if (_SkipTime > 0)
|
|
||||||
{
|
|
||||||
_VideoDecoderTime = _SkipTime;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
CAcinerella.AcSeek(_Videodecoder, -1, (Int64)(_SkipTime * 1000f));
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
CLog.LogError("Error seeking video file \"" + _FileName + "\": " + e.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_VideoDecoderTime = 0f;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
CAcinerella.AcSeek(_Videodecoder, -1, 0);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
CLog.LogError("Error seeking video file \"" + _FileName + "\": " + e.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lock (_MutexSyncSignals)
|
|
||||||
{
|
|
||||||
_CurrentVideoTime = _VideoDecoderTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
lock (_MutexFramebuffer)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < _FrameBuffer.Length; i++)
|
|
||||||
{
|
|
||||||
_FrameBuffer[i].Displayed = true;
|
|
||||||
_FrameBuffer[i].Time = -1f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_BufferFull = false;
|
|
||||||
_Skip = false;
|
|
||||||
_NewFrame = false;
|
|
||||||
//EventDecode.Set();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _Execute()
|
|
||||||
{
|
|
||||||
_DoOpen();
|
|
||||||
//EventDecode.Set();
|
|
||||||
while (!_Terminated)
|
|
||||||
{
|
|
||||||
{
|
|
||||||
//if (EventDecode.WaitOne(10))
|
|
||||||
lock (_MutexSyncSignals)
|
|
||||||
{
|
|
||||||
_Time = _SetTime;
|
|
||||||
if (_SetSkip)
|
|
||||||
_Skip = true;
|
|
||||||
|
|
||||||
_SetSkip = false;
|
|
||||||
_Gap = _SetGap;
|
|
||||||
_Start = _SetStart;
|
|
||||||
_Loop = Loop;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_Skip)
|
|
||||||
_DoSkip();
|
|
||||||
|
|
||||||
if (!_NewFrame)
|
|
||||||
_DoDecode();
|
|
||||||
|
|
||||||
if (_NewFrame)
|
|
||||||
_Copy();
|
|
||||||
Thread.Sleep(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_DoFree();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _DoOpen()
|
|
||||||
{
|
|
||||||
bool ok;
|
|
||||||
SACInstance instance = new SACInstance();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_Instance = CAcinerella.AcInit();
|
|
||||||
CAcinerella.AcOpen2(_Instance, _FileName);
|
|
||||||
|
|
||||||
instance = (SACInstance)Marshal.PtrToStructure(_Instance, typeof(SACInstance));
|
|
||||||
ok = instance.Opened;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
CLog.LogError("Error opening video file: " + _FileName);
|
|
||||||
ok = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!instance.Opened || !ok)
|
|
||||||
{
|
|
||||||
//Free();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_Duration = instance.Info.Duration / 1000f;
|
|
||||||
|
|
||||||
int videoStreamIndex;
|
|
||||||
SACDecoder videodecoder;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_Videodecoder = CAcinerella.AcCreateVideoDecoder(_Instance);
|
|
||||||
videodecoder = (SACDecoder)Marshal.PtrToStructure(_Videodecoder, typeof(SACDecoder));
|
|
||||||
videoStreamIndex = videodecoder.StreamIndex;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
CLog.LogError("Error opening video file (can't find decoder): " + _FileName);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (videoStreamIndex < 0)
|
|
||||||
{
|
|
||||||
//Free();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_Width = videodecoder.StreamInfo.VideoInfo.FrameWidth;
|
|
||||||
_Height = videodecoder.StreamInfo.VideoInfo.FrameHeight;
|
|
||||||
|
|
||||||
if (videodecoder.StreamInfo.VideoInfo.FramesPerSecond > 0)
|
|
||||||
_VideoTimeBase = 1f / (float)videodecoder.StreamInfo.VideoInfo.FramesPerSecond;
|
|
||||||
|
|
||||||
_VideoDecoderTime = 0f;
|
|
||||||
_Time = 0f;
|
|
||||||
|
|
||||||
for (int i = 0; i < _FrameBuffer.Length; i++)
|
|
||||||
{
|
|
||||||
_FrameBuffer[i].Time = -1f;
|
|
||||||
_FrameBuffer[i].Displayed = true;
|
|
||||||
_FrameBuffer[i].Data = new byte[_Width * _Height * 4];
|
|
||||||
}
|
|
||||||
_FileOpened = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _DoDecode()
|
|
||||||
{
|
|
||||||
const int framedropcount = 4;
|
|
||||||
|
|
||||||
if (!_FileOpened || _NewFrame)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_Paused || _NoMoreFrames || _BufferFull)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ((_SkipTime < 0f) && (_Time + _SkipTime >= 0f))
|
|
||||||
_SkipTime = 0f;
|
|
||||||
|
|
||||||
float myTime = _Time + _VideoSkipTime;
|
|
||||||
float timeDifference = myTime - _VideoDecoderTime;
|
|
||||||
|
|
||||||
bool dropFrame = timeDifference >= (framedropcount - 1) * _VideoTimeBase;
|
|
||||||
|
|
||||||
if (_Terminated)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int frameFinished = 0;
|
|
||||||
if (dropFrame && !_BeforeLoop)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
frameFinished = CAcinerella.AcSkipFrames(_Instance, _Videodecoder, framedropcount - 1);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
CLog.LogError("Error AcSkipFrame " + _FileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_BeforeLoop && (!dropFrame || frameFinished != 0))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
frameFinished = CAcinerella.AcGetFrame(_Instance, _Videodecoder);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
CLog.LogError("Error AcGetFrame " + _FileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frameFinished == 0)
|
|
||||||
{
|
|
||||||
if (_Loop)
|
|
||||||
{
|
|
||||||
_BeforeLoop = true;
|
|
||||||
bool doskip = true;
|
|
||||||
float tm = 0f;
|
|
||||||
int num = -1;
|
|
||||||
lock (_MutexFramebuffer)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < _FrameBuffer.Length; i++)
|
|
||||||
{
|
|
||||||
if (_FrameBuffer[i].Time > tm && !_FrameBuffer[i].Displayed)
|
|
||||||
{
|
|
||||||
tm = _FrameBuffer[i].Time;
|
|
||||||
num = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (num >= 0)
|
|
||||||
doskip = _FrameBuffer[num].Displayed;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!doskip)
|
|
||||||
return;
|
|
||||||
|
|
||||||
lock (_MutexSyncSignals)
|
|
||||||
{
|
|
||||||
_Start = 0f;
|
|
||||||
_Gap = 0f;
|
|
||||||
_SetTime = 0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
_DoSkip();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
_NoMoreFrames = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_NewFrame = true;
|
|
||||||
_Copy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _Copy()
|
|
||||||
{
|
|
||||||
if (!_NewFrame)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int num = -1;
|
|
||||||
|
|
||||||
lock (_MutexFramebuffer)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < _FrameBuffer.Length; i++)
|
|
||||||
{
|
|
||||||
if (_FrameBuffer[i].Displayed)
|
|
||||||
{
|
|
||||||
num = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (num == -1)
|
|
||||||
_BufferFull = true;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SACDecoder videodecoder = (SACDecoder)Marshal.PtrToStructure(_Videodecoder, typeof(SACDecoder));
|
|
||||||
|
|
||||||
_VideoDecoderTime = (float)videodecoder.Timecode;
|
|
||||||
_FrameBuffer[num].Time = _VideoDecoderTime;
|
|
||||||
|
|
||||||
if (videodecoder.Buffer != IntPtr.Zero)
|
|
||||||
{
|
|
||||||
Marshal.Copy(videodecoder.Buffer, _FrameBuffer[num].Data, 0, _Width * _Height * 4);
|
|
||||||
|
|
||||||
_FrameBuffer[num].Displayed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int numfull = 0;
|
|
||||||
for (int i = 0; i < _FrameBuffer.Length; i++)
|
|
||||||
{
|
|
||||||
if (!_FrameBuffer[i].Displayed)
|
|
||||||
numfull++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (numfull < _FrameBuffer.Length)
|
|
||||||
_BufferFull = false;
|
|
||||||
|
|
||||||
_NewFrame = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _UploadNewFrame(ref CTexture frame)
|
|
||||||
{
|
|
||||||
if (!_FileOpened)
|
|
||||||
return;
|
|
||||||
|
|
||||||
lock (_MutexFramebuffer)
|
|
||||||
{
|
|
||||||
int num = _FindFrame();
|
|
||||||
|
|
||||||
if (num >= 0)
|
|
||||||
{
|
|
||||||
CDraw.UpdateOrAddTexture(ref frame, _Width, _Height, _FrameBuffer[num].Data);
|
|
||||||
|
|
||||||
lock (_MutexSyncSignals)
|
|
||||||
{
|
|
||||||
_CurrentVideoTime = _FrameBuffer[num].Time;
|
|
||||||
}
|
|
||||||
Finished = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (_NoMoreFrames)
|
|
||||||
Finished = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int _FindFrame()
|
|
||||||
{
|
|
||||||
int result = -1;
|
|
||||||
float diff = 10000000f;
|
|
||||||
|
|
||||||
for (int i = 0; i < _FrameBuffer.Length; i++)
|
|
||||||
{
|
|
||||||
float td = _SetTime + _VideoSkipTime - _FrameBuffer[i].Time;
|
|
||||||
|
|
||||||
if (td > _VideoTimeBase * 2f)
|
|
||||||
_FrameBuffer[i].Displayed = true;
|
|
||||||
|
|
||||||
if (!_FrameBuffer[i].Displayed && (td < diff) && (td > _VideoTimeBase))
|
|
||||||
{
|
|
||||||
diff = Math.Abs(_FrameBuffer[i].Time - _SetTime - _VideoSkipTime);
|
|
||||||
result = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result != -1)
|
|
||||||
{
|
|
||||||
_FrameBuffer[result].Displayed = true;
|
|
||||||
_BufferFull = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _DoFree()
|
|
||||||
{
|
|
||||||
if (_Videodecoder != IntPtr.Zero)
|
|
||||||
CAcinerella.AcFreeDecoder(_Videodecoder);
|
|
||||||
|
|
||||||
if (_Instance != IntPtr.Zero)
|
|
||||||
CAcinerella.AcClose(_Instance);
|
|
||||||
|
|
||||||
if (_Instance != IntPtr.Zero)
|
|
||||||
CAcinerella.AcFree(_Instance);
|
|
||||||
|
|
||||||
_Closeproc(_StreamID);
|
|
||||||
}
|
|
||||||
#endregion Threading
|
|
||||||
|
|
||||||
public void Dispose() {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,16 +21,6 @@ using VocaluxeLib.Draw;
|
|||||||
|
|
||||||
namespace Vocaluxe.Lib.Video
|
namespace Vocaluxe.Lib.Video
|
||||||
{
|
{
|
||||||
struct SVideoStreams
|
|
||||||
{
|
|
||||||
public int Handle;
|
|
||||||
|
|
||||||
public SVideoStreams(int stream)
|
|
||||||
{
|
|
||||||
Handle = stream;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IVideoDecoder
|
interface IVideoDecoder
|
||||||
{
|
{
|
||||||
bool Init();
|
bool Init();
|
||||||
|
|||||||
@@ -54,10 +54,7 @@ namespace Vocaluxe.Screens
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_VideoPreviewInt = value;
|
_VideoPreviewInt = value;
|
||||||
if (!_VideoPreviewInt && !_VideoBackground)
|
CBackgroundMusic.VideoEnabled = _VideoPreviewInt || _VideoBackground;
|
||||||
CBackgroundMusic.VideoEnabled = false;
|
|
||||||
else
|
|
||||||
CBackgroundMusic.VideoEnabled = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ namespace Vocaluxe.Screens
|
|||||||
CConfig.VideosToBackground = (EOffOn)_SelectSlides[_SelectSlideVideosToBackground].Selection;
|
CConfig.VideosToBackground = (EOffOn)_SelectSlides[_SelectSlideVideosToBackground].Selection;
|
||||||
|
|
||||||
CConfig.WebcamConfig = _Config;
|
CConfig.WebcamConfig = _Config;
|
||||||
CBackgroundMusic.VideoEnabled = true;
|
CBackgroundMusic.VideoEnabled = CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON;
|
||||||
|
|
||||||
CConfig.SaveConfig();
|
CConfig.SaveConfig();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,6 +216,8 @@
|
|||||||
<Compile Include="GameModes\CGameMode.cs" />
|
<Compile Include="GameModes\CGameMode.cs" />
|
||||||
<Compile Include="GameModes\CGameModes.cs" />
|
<Compile Include="GameModes\CGameModes.cs" />
|
||||||
<Compile Include="Lib\Input\CControllerFramework.cs" />
|
<Compile Include="Lib\Input\CControllerFramework.cs" />
|
||||||
|
<Compile Include="Lib\Video\Acinerella\CDecoder.cs" />
|
||||||
|
<Compile Include="Lib\Video\Acinerella\CFramebuffer.cs" />
|
||||||
<Compile Include="SongQueue\CSongQueue.cs" />
|
<Compile Include="SongQueue\CSongQueue.cs" />
|
||||||
<Compile Include="GameModes\IGameMode.cs" />
|
<Compile Include="GameModes\IGameMode.cs" />
|
||||||
<Compile Include="SongQueue\ISongQueue.cs" />
|
<Compile Include="SongQueue\ISongQueue.cs" />
|
||||||
@@ -247,7 +249,6 @@
|
|||||||
<Compile Include="Lib\Sound\IPlayback.cs" />
|
<Compile Include="Lib\Sound\IPlayback.cs" />
|
||||||
<Compile Include="Lib\Sound\IRecord.cs" />
|
<Compile Include="Lib\Sound\IRecord.cs" />
|
||||||
<Compile Include="Lib\Video\Acinerella\CAcinerella.cs" />
|
<Compile Include="Lib\Video\Acinerella\CAcinerella.cs" />
|
||||||
<Compile Include="Lib\Video\CVideoDecoder.cs" />
|
|
||||||
<Compile Include="Lib\Video\CVideoDecoderFFmpeg.cs" />
|
<Compile Include="Lib\Video\CVideoDecoderFFmpeg.cs" />
|
||||||
<Compile Include="Lib\Video\CVideoDecoderGstreamer.cs" />
|
<Compile Include="Lib\Video\CVideoDecoderGstreamer.cs" />
|
||||||
<Compile Include="Lib\Video\Gstreamer\CGstreamerVideoWrapper.cs" />
|
<Compile Include="Lib\Video\Gstreamer\CGstreamerVideoWrapper.cs" />
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ namespace VocaluxeLib.Menu
|
|||||||
_ThemeScreenSettings = null;
|
_ThemeScreenSettings = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void _FadeTo(EScreens nextScreen)
|
protected static void _FadeTo(EScreens nextScreen)
|
||||||
{
|
{
|
||||||
CBase.Graphics.FadeTo(nextScreen);
|
CBase.Graphics.FadeTo(nextScreen);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace VocaluxeLib.Menu
|
|||||||
_PartyModeID = partyModeID;
|
_PartyModeID = partyModeID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AssingPartyMode(IPartyMode partyMode)
|
public void AssignPartyMode(IPartyMode partyMode)
|
||||||
{
|
{
|
||||||
_PartyMode = partyMode;
|
_PartyMode = partyMode;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user