ATSC3  24.10.0
atsc_mw_av_control.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 
20 #include <stdio.h>
21 #include <thread>
22 #include <pthread.h>
23 #include <mutex>
24 #include <unistd.h>
25 #include <queue>
26 #include <sys/time.h>
27 #include <functional>
28 
33 #include "atsc_basetype.h"
34 
38 typedef struct {
39  int32_t iMediaType;
40  uint32_t iSize;
41  int32_t iSvcId;
42  int32_t iMajCh;
43  int32_t iMinCh;
44  int32_t iPhyCh;
45  uint8_t *pData;
47 
51 typedef struct{
52  int32_t iMediaType;
53  int32_t iServiceId;
54  int32_t iMajorCh;
55  int32_t iMinorCh;
56  int32_t iPhyCh;
57  uint8_t *pAvData;
58  uint32_t iAvSize;
59 }sAvData_t;
60 
61 typedef std::function<void(sAvData_t*)> AvDataCbFunc;
63 class CAvCtrl
64 {
65 public:
72  CAvCtrl();
73 
80  ~CAvCtrl();
81 
82  std::thread *mAvDataThread;
90  void AvCtrl_CbDataEvent(sAvData_t *pAvData);
91 
98  void AvDataHandlerThread( void );
99 
106  int32_t GetAvData( sAvBuffer_t *pAvData );
107 
114  void SetHandler( AvDataCbFunc fData );
115 
122  void RegisterAvEventNotify(AvDataCbFunc fParamsPtr);
123 
125 private:
126  bool mAvRunning;
127  std::recursive_mutex mMut;
128  std::queue<sAvBuffer_t> mAvQueue;
129 };
std::function< void(sAvData_t *)> AvDataCbFunc
Definition: atsc_mw_av_control.h:61
Definition: atsc_mw_av_control.h:64
std::thread * mAvDataThread
Definition: atsc_mw_av_control.h:82
~CAvCtrl()
Clear and Delete the Data.
Definition: atsc_mw_av_control.cpp:40
int32_t GetAvData(sAvBuffer_t *pAvData)
Get the Audio and Video data based on Media Type after parsing from ALP.
Definition: atsc_mw_av_control.cpp:140
void SetHandler(AvDataCbFunc fData)
Set the AV data to the callback for receiving the data.
Definition: atsc_mw_av_control.cpp:72
void AvDataHandlerThread(void)
Thread to control audio and video data.
Definition: atsc_mw_av_control.cpp:107
AvDataCbFunc mAvDataCb
Definition: atsc_mw_av_control.h:124
void AvCtrl_CbDataEvent(sAvData_t *pAvData)
To push the data to the queue.
Definition: atsc_mw_av_control.cpp:85
void RegisterAvEventNotify(AvDataCbFunc fParamsPtr)
Registed the Call back for receiving the data.
Definition: atsc_mw_av_control.cpp:58
CAvCtrl()
Create and Register the data for controlling the Audio and Video data flow to decoder.
Definition: atsc_mw_av_control.cpp:26
Definition: atsc_mw_av_control.h:38
int32_t iSvcId
Definition: atsc_mw_av_control.h:41
uint8_t * pData
Definition: atsc_mw_av_control.h:45
uint32_t iSize
Definition: atsc_mw_av_control.h:40
int32_t iPhyCh
Definition: atsc_mw_av_control.h:44
int32_t iMajCh
Definition: atsc_mw_av_control.h:42
int32_t iMediaType
Definition: atsc_mw_av_control.h:39
int32_t iMinCh
Definition: atsc_mw_av_control.h:43
Definition: atsc_mw_av_control.h:51
int32_t iMinorCh
Definition: atsc_mw_av_control.h:55
uint8_t * pAvData
Definition: atsc_mw_av_control.h:57
int32_t iServiceId
Definition: atsc_mw_av_control.h:53
int32_t iMediaType
Definition: atsc_mw_av_control.h:52
int32_t iMajorCh
Definition: atsc_mw_av_control.h:54
uint32_t iAvSize
Definition: atsc_mw_av_control.h:58
int32_t iPhyCh
Definition: atsc_mw_av_control.h:56