Introduced OnAtsc3FileDelivery.
Some checks failed
🚀 Pack skyscraper8 / make-zip (push) Failing after 29s
Some checks failed
🚀 Pack skyscraper8 / make-zip (push) Failing after 29s
This commit is contained in:
parent
4fe40e082a
commit
595ed5cd4f
@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using skyscraper8.Atsc.A331.Schema;
|
||||
using skyscraper8.Ietf.FLUTE;
|
||||
|
||||
namespace skyscraper8.Atsc.A331
|
||||
{
|
||||
@ -11,5 +13,6 @@ namespace skyscraper8.Atsc.A331
|
||||
{
|
||||
void OnAtsc3Detected();
|
||||
void OnAtsc3ServiceList(sltType slt);
|
||||
void OnAtsc3FileDelivery(IPEndPoint destination, ulong tsi, ulong toi, FluteListener targetListener, GuessedFluteDataType guessedFluteDataType, string outFileName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,5 +19,23 @@ namespace skyscraper8.Atsc.A331
|
||||
staticFilenames.Add(new Tuple<IPEndPoint, ulong, string>(endpoint, file.TOI, file.ContentLocation));
|
||||
}
|
||||
}
|
||||
|
||||
public string GuessFilename(IPEndPoint destination, ulong tsi, ulong toi)
|
||||
{
|
||||
if (staticFilenames != null)
|
||||
{
|
||||
foreach (Tuple<IPEndPoint, ulong, string> staticFilename in staticFilenames)
|
||||
{
|
||||
if (!staticFilename.Item1.Equals(destination))
|
||||
continue;
|
||||
if (staticFilename.Item2 != toi)
|
||||
continue;
|
||||
|
||||
return staticFilename.Item3;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,6 +131,12 @@ namespace skyscraper8.Atsc.A331
|
||||
{
|
||||
GuessedFluteDataType guessedFluteDataType = FluteUtilities.GuessDataType(targetListener);
|
||||
ProcessMetafile(guessedFluteDataType, targetListener, destination);
|
||||
|
||||
string outFileName = filenames.GuessFilename(destination, tsi, toi);
|
||||
if (!string.IsNullOrEmpty(outFileName))
|
||||
{
|
||||
eventHandler.OnAtsc3FileDelivery(destination, tsi, toi, targetListener, guessedFluteDataType, outFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,6 +153,8 @@ namespace skyscraper8.Atsc.A331
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
case GuessedFluteDataType.MultimediaContent:
|
||||
return false;
|
||||
default:
|
||||
throw new NotImplementedException(guessedFluteDataType.ToString());
|
||||
|
||||
@ -85,6 +85,8 @@ namespace skyscraper8.Ietf.FLUTE
|
||||
byte[] firstBlock = targetListener.GetFirstBlock();
|
||||
if (firstBlock[0] == 0x3c && firstBlock[1] == 0x3f && firstBlock[2] == 0x78 && firstBlock[3] == 0x6d && firstBlock[4] == 0x6c)
|
||||
return GuessedFluteDataType.Xml;
|
||||
if (firstBlock[0] == 0x00 && firstBlock[1] == 0x00 && firstBlock[2] == 0x00)
|
||||
return GuessedFluteDataType.MultimediaContent;
|
||||
return GuessedFluteDataType.Unknown;
|
||||
}
|
||||
}
|
||||
@ -92,6 +94,7 @@ namespace skyscraper8.Ietf.FLUTE
|
||||
public enum GuessedFluteDataType
|
||||
{
|
||||
Unknown,
|
||||
Xml
|
||||
Xml,
|
||||
MultimediaContent
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user