DtvKit_ATSC3.0
Loading...
Searching...
No Matches
atsc_core_atsc3_route_parser.h
Go to the documentation of this file.
1/*******************************************************************************
2 * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3 *
4 * This file is part of a DTVKit Software Component
5 * You are permitted to copy, modify or distribute this file subject to the terms
6 * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
7 *
8 * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
9 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
10 * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
11 *
12 * If you or your organisation is not a member of DTVKit then you have access
13 * to this source code outside of the terms of the licence agreement
14 * and you are expected to delete this and any associated files immediately.
15 * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
16 *******************************************************************************/
17
18#pragma once
19#include <iostream>
20#include <string>
21#include <list>
22#include <cstdio>
23#include <sys/stat.h>
24#include <map>
25
28#include "atsc_types.h"
29
30// ESG (Eletronic Service Guide)
31// IBB (Integrated Broadcast Broadband)
32//
33// ESG - SGDD(Service Guide Delivery Descriptor)
34// L SGDU(Service Guide Delivery Unit)
35//
36// SGDU - Service Fragment
37// L Content Fragment
38// L Schedule Fragment
39//
40
48typedef struct{
49 int32_t iDataLen;
50 uint8_t *pData;
52 uint32_t iTsi;
53 uint32_t iToi;
54 uint32_t iOffset;
55 uint32_t iTotalSize;
57
61typedef struct{
62 uint32_t iType;
63 uint32_t iServiceId;
64 uint32_t iCategory;
65 uint32_t iMsg;
67
74
80typedef std::function<void(sDownloadFileInfo_t)> funcDownloadDone;
81
85typedef std::function<void(int32_t, void*, const char*)> funcAppSignal;
86
90class CRoute
91{
92public:
93
101 CRoute( const char* pHlsPath, const char* pDataPath, sSltService_t stService, int32_t iPhysicalCh );
102
110
117 sRouteParseResult_t Parse(uint8_t* pData, int32_t iDataLen);
118
126
135
142 void SetHandler(funcDownloadDone f1, funcAppSignal f2);
143
150 void SetAppContextId( char *pContextId, char *pPackageUrl );
151
159
166 std::list<sEfdtFile_t> GetProgress(void);
167
174 std::string GetBaseUrl( void );
175
182 int32_t GetMediaType( void );
183private:
184
193 void ProcessNRTData(sSessionFileProperties_t properties, sTransportSessionId_t session);
194
204 void ProcessAVData(sSessionFileProperties_t properties, sTransportSessionId_t session);
205
212 int32_t ParseSls(uint8_t *pData, int32_t iDataLen, uint32_t iTsi, uint32_t iToi);
213
220 int32_t WriteSLS(sRouteParamLite_t param);
221
228 int32_t WriteData(sRouteParamLite_t param);
229
236 int32_t UpdateDataSession( void );
237
244 bool IsReceived(uint32_t iTsi, uint32_t iToi);
245
252 bool SetReceived(uint32_t iTsi, uint32_t iToi);
253
260 void SaveMsg(uint8_t* pData,int32_t iDataLen, uint32_t iTsi, uint32_t iToi, char* pContentLocation);
261
262 funcDownloadDone mCbDownloadDone;
263 funcAppSignal mCbAppSignal;
267 sMetadataEnvelope_t mEnvelope;
268 sHeldElement_t mHeld;
269 CHLSMaker mHls;
271 std::map<uint32_t , CSessionBuf*> mSession;
272 std::map<std::string, int32_t> mContentTypeMap;
273 std::list<std::string> mContentTypeList;
274 std::map<std::string, uint32_t > mSignalingVersionMap;
275 std::map<std::string, std::string>mAppContextIdMap;
276 std::map<std::string, std::string> mSignalingMap;
278 std::map<uint32_t , std::map<uint32_t , bool>> mReceivedMap;
279 std::map<uint32_t , std::map<uint32_t ,sEfdtFile_t>> mNrtFiles;
281 char mHlsDirectory[256];
282 char mBaseUrl[256];
283 char mSlsFdtData[65535];
284 char mSlsData[65535];
285 uint32_t mServiceId;
286 uint32_t mDestinationPort;
287 uint32_t mServiceCategory;
288 uint32_t mSourceIp;
289 uint32_t mDestinationIp;
290 uint32_t mSlsToi;
291 timespec mFileCleanUpTime;
292};
293
eRouteSignallingMsg_t
Definition atsc_core_atsc3_route_parser.h:71
@ eRouteSignallingMsgEsgUpdate
Definition atsc_core_atsc3_route_parser.h:72
eSltServiceType_t
Definition atsc_core_atsc3_signaling_types.h:130
Definition atsc_core_streamer_hlsmaker.h:85
Definition atsc_core_atsc3_route_parser.h:91
bool ClearDownloadStatus(void)
Clear the Signaling map and Session Data.
sRouteParseResult_t Parse(uint8_t *pData, int32_t iDataLen)
Parses the received data for route information.
std::string GetBaseUrl(void)
Return BaseURL.
CRoute(const char *pHlsPath, const char *pDataPath, sSltService_t stService, int32_t iPhysicalCh)
This constructor initializes a CRoute object with the given HLS path, data path, service information ...
int32_t GetMediaType(void)
Get the Media Type as Video or Audio.
uint32_t GetServiceValue(eSltServiceType_t eSltType)
Mapping the SLT service Type.
~CRoute()
Deconstruct the Route class object.
void SetHandler(funcDownloadDone f1, funcAppSignal f2)
Set the handler for the Download and APP signaling once the operation is done.
void DownloadDone(sSessionFileProperties_t properties, sTransportSessionId_t session)
Invoked when a download operation is completed, providing information about the downloaded file prope...
std::list< sEfdtFile_t > GetProgress(void)
Retrieves the progress of non-real-time (NRT) files being processed by the route.
void SetAppContextId(char *pContextId, char *pPackageUrl)
Set the Context ID for the package URL data.
Definition atsc_core_atsc3_signaling_types.h:647
Definition atsc_core_atsc3_signaling_types.h:290
Definition atsc_core_atsc3_signaling_types.h:432
Definition atsc_core_atsc3_signaling_types.h:591
Definition atsc_core_atsc3_route_parser.h:48
uint32_t iTsi
Definition atsc_core_atsc3_route_parser.h:52
uint32_t iTotalSize
Definition atsc_core_atsc3_route_parser.h:55
uint32_t iToi
Definition atsc_core_atsc3_route_parser.h:53
uint8_t * pData
Definition atsc_core_atsc3_route_parser.h:50
int32_t iDataLen
Definition atsc_core_atsc3_route_parser.h:49
uint32_t iOffset
Definition atsc_core_atsc3_route_parser.h:54
Definition atsc_core_atsc3_signaling_types.h:655
Definition atsc_core_atsc3_route_parser.h:61
uint32_t iServiceId
Definition atsc_core_atsc3_route_parser.h:63
uint32_t iType
Definition atsc_core_atsc3_route_parser.h:62
uint32_t iCategory
Definition atsc_core_atsc3_route_parser.h:64
uint32_t iMsg
Definition atsc_core_atsc3_route_parser.h:65
Definition atsc_core_atsc3_signaling_types.h:725
Definition atsc_core_atsc3_route_dashbuflist.h:39
Definition atsc_types.h:622
Definition atsc_core_atsc3_signaling_types.h:614