AXFramedSource.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**********************************************************************************
  2. *
  3. * Copyright (c) 2019-2020 Beijing AXera Technology Co., Ltd. All Rights Reserved.
  4. *
  5. * This source file is the property of Beijing AXera Technology Co., Ltd. and
  6. * may not be copied or distributed in any isomorphic form without the prior
  7. * written consent of Beijing AXera Technology Co., Ltd.
  8. *
  9. **********************************************************************************/
  10. #ifndef __AXFRAMEDSOURCE_H__
  11. #define __AXFRAMEDSOURCE_H__
  12. #include "FramedSource.hh"
  13. #include "AXRingBuffer.h"
  14. #define COMM_RTSP_PRT(fmt...) \
  15. do {\
  16. printf("[RTSP][%s]: ", __FUNCTION__);\
  17. printf(fmt);\
  18. printf("\n");\
  19. }while(0)
  20. class AXFramedSource: public FramedSource {
  21. public:
  22. static AXFramedSource* createNew(UsageEnvironment& env);
  23. public:
  24. static EventTriggerId eventTriggerId;
  25. // Note that this is defined here to be a static class variable, because this code is intended to illustrate how to
  26. // encapsulate a *single* device - not a set of devices.
  27. // You can, however, redefine this to be a non-static member variable.
  28. void AddFrameBuff(AX_U8 nChn, const AX_U8* pBuf, AX_U32 nLen, AX_U64 nPts=0, AX_BOOL bIFrame=AX_FALSE);
  29. virtual unsigned maxFrameSize() const;
  30. protected:
  31. AXFramedSource(UsageEnvironment& env);
  32. // called only by createNew(), or by subclass constructors
  33. virtual ~AXFramedSource();
  34. private:
  35. // redefined virtual functions:
  36. virtual void doGetNextFrame();
  37. //virtual void doStopGettingFrames(); // optional
  38. private:
  39. static void deliverFrame(void* clientData);
  40. void _deliverFrame();
  41. private:
  42. static unsigned referenceCount; // used to count how many instances of this class currently exist
  43. CAXRingBuffer* m_pRingBuf;
  44. u_int32_t m_nTriggerID;
  45. };
  46. #endif /*__AXFRAMEDSOURCE_H__*/