You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
2.8 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __BASIC_MEDIA_DESTINATION_H_INCL__
  2. #define __BASIC_MEDIA_DESTINATION_H_INCL__
  3. #ifndef LRF_PROXY_ONLY
  4. #include "basicFunctionality.h"
  5. #include "basicLIBAV.h"
  6. #include "basicLogCollection.h"
  7. /**
  8. * TODO: Add class description
  9. *
  10. * @author Gagua
  11. */
  12. class basicMediaDestination
  13. {
  14. //private:
  15. //basicLogCollection * m_pLog;
  16. public:
  17. basicMediaDestination();
  18. virtual ~basicMediaDestination();
  19. virtual bool pushFrame(AVFrame * Frame, void * src = NULL)
  20. {
  21. if ( Frame || src ) return false;
  22. return false;
  23. }
  24. virtual bool pushFrame(cv::Mat * Frame, void * src = NULL)
  25. {
  26. if ( Frame || src ) return false;
  27. return false;
  28. }
  29. virtual bool pushFrame(cv::Mat & Frame, void * src = NULL)
  30. {
  31. if ( Frame.empty() || src ) return false;
  32. return false;
  33. }
  34. virtual void setError(bool A, CSTR BOBO = NULL) {
  35. if ( A || BOBO ) A=false;
  36. }
  37. virtual int startRecord(uint32_t FramesToRecord)
  38. {
  39. if ( FramesToRecord ) return -1;
  40. return -1;
  41. }
  42. virtual void startRecord(CSTR FileName) {
  43. if ( FileName ) FileName = FileName;
  44. }
  45. virtual int stopRecord(void)
  46. {
  47. return -1;
  48. }
  49. virtual bool isRecorder(void)
  50. {
  51. return false;
  52. }
  53. /*
  54. Compressed H264 of the source, before it is decoded (live view / recording without re-encoding,
  55. see streamHandler). A destination that does not need it ignores these calls.
  56. */
  57. // Parameter sets: SPS / PPS NAL units (sprop-parameter-sets of the SDP) or libav extradata
  58. // (Annex-B or avcC). Called when the source (re)connects, before the first packet.
  59. virtual void pushEncodedParams(const uint8_t * data, size_t size, bool extradata, void * src = NULL)
  60. {
  61. if (data || size || extradata || src) return;
  62. }
  63. // One NAL unit without start code (RTP depacketizer, live555). marker: last NAL unit of the
  64. // picture; synced: the presentation times are RTCP synchronised
  65. virtual void pushEncodedNalu(const uint8_t * data, size_t size, int64_t ptUs, bool marker, bool synced, void * src = NULL)
  66. {
  67. if (data || size || ptUs || marker || synced || src) return;
  68. }
  69. // One access unit (libav packet): Annex-B, or length prefixed when the extradata was avcC.
  70. // ptsUs < 0: not known
  71. virtual void pushEncodedPacket(const uint8_t * data, size_t size, int64_t ptsUs, void * src = NULL)
  72. {
  73. if (data || size || ptsUs || src) return;
  74. }
  75. // The source lost its stream (it reconnects): the next data starts again with the parameters
  76. virtual void encodedSourceStopped(void * src = NULL)
  77. {
  78. if (src) return;
  79. }
  80. };
  81. inline basicMediaDestination::basicMediaDestination()
  82. {
  83. //m_pLog = basicLogCollection::getInstance();
  84. }
  85. inline basicMediaDestination::~basicMediaDestination() {}
  86. typedef vector<basicMediaDestination *> mediaDestinationsCollection;
  87. #endif // ! LRF_PROXY_ONLY
  88. #endif // __BASICMEDIADESTINATION_H_INCL__