DtvKit_ATSC3.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
atsc_core_streamer_demodsender.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#ifndef ATSC_CORE_STREAMER_DEMODSENDER_H_
18#define ATSC_CORE_STREAMER_DEMODSENDER_H_
19
20#pragma once
21#include <stdio.h>
22#include <time.h>
23#include <netinet/in.h>
24#include <net/if.h>
25#include <arpa/inet.h>
26#include <thread>
27#include <list>
28
29#include "debug.h"
31#include "atsc_core_common.h"
32
40typedef struct{
41 int32_t iCmd;
42 uint32_t iIp;
43 uint32_t iPort;
44 uint32_t iStreamIp;
45 uint32_t iStreamPort;
46 uint32_t iBitRate;
47 timespec stTimeContinue;
48 timespec stTimeStart;
50
54typedef struct{
55 int32_t iSock;
56 int32_t iDataLen;
57 uint8_t *pData;
58 sockaddr_in stAddr;
62
68public:
76
84
91 void Start(int32_t iMode);
92
99 void Stop();
100
107 void Put(uint8_t* pData, int32_t iDatalen) {
108 mMediaQueue->WriteRingQueue(pData, iDatalen);
109 }
110
117 void PutLLS(uint8_t* pData, int32_t iDatalen) {
118 mLlsQueue->WriteRingQueue(pData, iDatalen);
119 }
120
127 void PutSLS(uint8_t* pData, int32_t iDatalen) {
128 mSlsQueue->WriteRingQueue(pData, iDatalen);
129 }
130
137 int32_t PushMsg(sDemodClient_t* pClient);
138
145 int32_t GetClientCount();
146
147private:
148 std::thread *mThread;
149 CQueue *mMediaQueue;
150 std::list<sDemodClient_t>mClients;
151 CQueue *mLlsQueue;
152 CQueue *mSlsQueue;
153 int32_t mNumOfClient;
154 bool mRunning;
155 bool mUseMulticast;
163 void ThreadSender();
164
171 int32_t SendLLS(sDemodSend_t sParam);
172
179 int32_t SendMedia(sDemodSend_t sParam, bool multicast);
180
187 int32_t SendSLS(sDemodSend_t sParam);
188
195 int32_t GetSender(uint32_t iReqip, uint32_t iReqport, uint32_t *pClientsIp, uint32_t *pClientsPort);
196
203 int32_t RemoveOldClient();
204};
205
206#endif // ATSC_CORE_STREAMER_DEMODSENDER_H_
207
208
Definition atsc_core_streamer_demodsender.h:67
void Start(int32_t iMode)
Start functionality.
~CDemodSender()
Distructor of CDemodSender.
void Stop()
stop functionality
void PutLLS(uint8_t *pData, int32_t iDatalen)
Put LLS media into queue.
Definition atsc_core_streamer_demodsender.h:117
void Put(uint8_t *pData, int32_t iDatalen)
Put media into queue.
Definition atsc_core_streamer_demodsender.h:107
CDemodSender()
Constructor of CDemodSender.
void PutSLS(uint8_t *pData, int32_t iDatalen)
Put SLS media into queue.
Definition atsc_core_streamer_demodsender.h:127
int32_t PushMsg(sDemodClient_t *pClient)
push demod client into queue
int32_t GetClientCount()
read client count
Definition atsc_core_common_ring_queue.h:39
UINT_64 WriteRingQueue(uint8_t *pBuffer, uint32_t iSize)
Write ring queue buffer.
Definition atsc_core_streamer_demodsender.h:40
uint32_t iStreamIp
Definition atsc_core_streamer_demodsender.h:44
int32_t iCmd
Definition atsc_core_streamer_demodsender.h:41
timespec stTimeContinue
Definition atsc_core_streamer_demodsender.h:47
uint32_t iPort
Definition atsc_core_streamer_demodsender.h:43
uint32_t iIp
Definition atsc_core_streamer_demodsender.h:42
uint32_t iBitRate
Definition atsc_core_streamer_demodsender.h:46
timespec stTimeStart
Definition atsc_core_streamer_demodsender.h:48
uint32_t iStreamPort
Definition atsc_core_streamer_demodsender.h:45
Definition atsc_core_streamer_demodsender.h:54
int32_t iSock
Definition atsc_core_streamer_demodsender.h:55
int32_t iDataLen
Definition atsc_core_streamer_demodsender.h:56
sockaddr_in stAddr
Definition atsc_core_streamer_demodsender.h:58
sIpHeader_t stIp
Definition atsc_core_streamer_demodsender.h:59
uint8_t * pData
Definition atsc_core_streamer_demodsender.h:57
sUdpHeader_t stUdp
Definition atsc_core_streamer_demodsender.h:60
Definition atsc_core_common.h:41
Definition atsc_core_common.h:61