DtvKit_ATSC3.0
Loading...
Searching...
No Matches
atsc_core_atsc3_mmt_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 <stdio.h>
20#include <cstdio>
21#include <thread>
22#include <queue>
23#include <sys/time.h>
24#include <functional>
25#include <iostream>
26#include <string>
27#include <list>
28#include <sys/stat.h>
29#include <map>
30#include <math.h>
31
32#include "atsc_types.h"
33#include "atsc_core_utils_network.h"
37
51
55class CMmt
56{
57public:
64 CMmt(const char* pHlsPath, const char* pDataPath, sSltService_t stService, int32_t iPhysicalCh);
65
72 int32_t Parse(uint8_t* pData, uint32_t iDataLen);
73
77 typedef std::function<void(sDownloadFileInfo_t)> funcDownloadDone;
82 typedef std::function<void(int32_t, void*, const char*)> funcAppSignal;
87 typedef std::function<void(int32_t, sRouteComponent_t*)> funcRouteComponent;
96
103 bool Compare(uint32_t iServiceId, uint32_t iDestinationIp, uint32_t iDestinationPort);
104
112
119 static void CallbackCompleteMp4(char* pPath,char *pFilename, uint32_t iPacketId, uint32_t iSeq,int32_t iSize, FLOAT_64 dDuration, void *pCtx)
120 {
121 CMmt* my_this = (CMmt*)pCtx;
122 my_this->CallbackMp4(pPath, pFilename, iPacketId, iSeq, iSize, dDuration);
123 }
124
131 int32_t GetMediaType( void );
132
133private:
134
141 int32_t ParseHeader(uint8_t* pData, int32_t iLen, int32_t iVer, sMpegMediaTransportHeader_t *stHeader);
142
149 int32_t ParseMpu(uint8_t* pData, int32_t iLen, sMediaProcessingUnit_t*pMpu, sDataUnit_t *pDu);
150
157 int32_t ParseHinttrack(uint8_t* pData, int32_t iLen, int32_t iIsTimed, sHintTrack_t* stHinttrack);
158
165 int32_t ParseSignaling(uint8_t* pData, int32_t iLen, sMpegMediaTransportMsg_t* stMsg);
166
173 int32_t CallbackMp4(char* pPath, char *pFilename, uint32_t iTsi, uint32_t iToi, int32_t iSize, FLOAT_64 dDuration);
174
181 int32_t ParseMsg(uint8_t* pData, int32_t iDataLen, int32_t iMmtPacketId);
182
183 std::list<sAssetProperties_t>m_asset_list;
184 std::map<uint32_t, CMpuBuf> mMpuFileMap;
187 sHeldElement_t mHeld;
188 sUserServiceBundleDesc_t mUsbdDesc;
189 char mHlsDirectory[256];
190 char mBaseUrl[256];
192 std::map<int32_t , sMpuTimeStampProperties_t> mTimestampCheckMap;
193 std::map<uint32_t,uint32_t>mMsgVersionMap;
194 std::map<std::string, int32_t >mCodecType;
196 CHLSMaker mHls;
198 std::list<sMpuTimeStampProperties_t> mTimestampList;
199 std::list<sGfdtDescriptor_t> mGfdtDescList;
201 funcDownloadDone mCbDownloadDone;
202 funcAppSignal mCbAppSignal;
203 funcRouteComponent mCbRouteComponent;
205 int32_t gfd_recv_cnt;
206 uint32_t mServiceId;
207 uint32_t mDestinationPort;
208 uint32_t mServiceCategory;
209 uint32_t mSourceIp;
210 uint32_t mDestinationIp;
211 int32_t mVideoPacketId;
212 FLOAT_64 mVideoDuration;
213 uint32_t mDebugSeq;
214 sMpegMediaTransportHeader_t mMMTHeader;
215};
216
eSltServiceType_t
Definition atsc_core_atsc3_signaling_types.h:130
Definition atsc_core_streamer_hlsmaker.h:85
Definition atsc_core_atsc3_mmt_parser.h:56
CMmt(const char *pHlsPath, const char *pDataPath, sSltService_t stService, int32_t iPhysicalCh)
Asigned the Codec type and create the directory details.
uint32_t GetServiceValue(eSltServiceType_t eSLTType)
Return Service value based on eSltServiceType_t.
std::function< void(int32_t, sRouteComponent_t *) funcRouteComponent)
Definition atsc_core_atsc3_mmt_parser.h:87
static void CallbackCompleteMp4(char *pPath, char *pFilename, uint32_t iPacketId, uint32_t iSeq, int32_t iSize, FLOAT_64 dDuration, void *pCtx)
CallBack for the listing of MP4 file based on data.
Definition atsc_core_atsc3_mmt_parser.h:119
std::function< void(int32_t, void *, const char *) funcAppSignal)
Definition atsc_core_atsc3_mmt_parser.h:82
void SetHandler(funcDownloadDone f1, funcAppSignal f2, funcRouteComponent f3)
Assign the corresponding callback for Route,Signaling,Downloading.
int32_t Parse(uint8_t *pData, uint32_t iDataLen)
Parses MMT (MPEG Media Transport) data and handles different types of MMT packets.
bool Compare(uint32_t iServiceId, uint32_t iDestinationIp, uint32_t iDestinationPort)
Return T/F by comparing Service ID,Dest Port and IP.
int32_t GetMediaType(void)
Get the Media Type as Audio or Video.
std::function< void(sDownloadFileInfo_t)> funcDownloadDone
Definition atsc_core_atsc3_mmt_parser.h:77
Definition atsc_core_atsc3_mmt_mpubuflist.h:67
Definition atsc_core_atsc3_signaling_types.h:377
Definition atsc_core_atsc3_signaling_types.h:290
Definition atsc_core_atsc3_signaling_types.h:432
Definition atsc_core_atsc3_signaling_types.h:264
Definition atsc_core_atsc3_signaling_types.h:361
Definition atsc_core_atsc3_signaling_types.h:326
Definition atsc_core_atsc3_signaling_types.h:390
Definition atsc_core_atsc3_mmt_parser.h:46
CMpuBuf mfu
Definition atsc_core_atsc3_mmt_parser.h:48
CMpuBuf mpu
Definition atsc_core_atsc3_mmt_parser.h:47
CMpuBuf fragment
Definition atsc_core_atsc3_mmt_parser.h:49
Definition atsc_core_atsc3_signaling_types.h:312
Definition atsc_types.h:622
Definition atsc_core_atsc3_signaling_types.h:502