inference.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #pragma once
  2. #include <iostream>
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include <gst/gst.h>
  6. #include <glib.h>
  7. #include <stdio.h>
  8. #include <math.h>
  9. #include <string.h>
  10. #include <sys/time.h>
  11. #include "gstnvdsmeta.h"
  12. #include "gst-nvmessage.h"
  13. #include "DataSource.h"
  14. // ZLMediaKit
  15. #include "Util/logger.h"
  16. #include "Util/NoticeCenter.h"
  17. #include "Poller/EventPoller.h"
  18. #include "Player/PlayerProxy.h"
  19. #include "Rtmp/RtmpPusher.h"
  20. #include "Common/config.h"
  21. #include "Pusher/MediaPusher.h"
  22. #include "Extension/Frame.h"
  23. #include "Util/SqlPool.h"
  24. #include "Network/TcpClient.h"
  25. #include "Poller/Timer.h"
  26. #include "TCPClient.h"
  27. #include <list>
  28. using namespace std;
  29. namespace MIVA{
  30. // 基于Deepstream
  31. class Inference
  32. {
  33. private:
  34. // Deepstream
  35. GMainLoop *loop = NULL;
  36. GstElement *pipeline = NULL,*streammux = NULL, *sink = NULL, *pgie = NULL,
  37. *queue1, *queue2, *queue3, *queue4, *queue5, *nvvidconv = NULL,
  38. *nvosd = NULL, *tiler = NULL;
  39. GstElement *transform = NULL;
  40. GstBus *bus = NULL;
  41. guint bus_watch_id;
  42. GstPad *tiler_src_pad = NULL;
  43. guint tiler_rows, tiler_columns;
  44. guint pgie_batch_size;
  45. public:
  46. static std::shared_ptr<Inference> CreateNew();
  47. Inference();
  48. ~Inference();
  49. public:
  50. int32_t Init(std::list<DataSource> DataList);
  51. void Destory();
  52. void StartTask();
  53. void PauseTask();
  54. private:
  55. // static
  56. static GstPadProbeReturn tiler_src_pad_buffer_probe(GstPad * pad, GstPadProbeInfo * info, gpointer u_data);
  57. static gboolean bus_call (GstBus * bus, GstMessage * msg, gpointer data);
  58. static void cb_newpad (GstElement * decodebin, GstPad * decoder_src_pad, gpointer data);
  59. static void decodebin_child_added (GstChildProxy * child_proxy, GObject * object,
  60. gchar * name, gpointer user_data);
  61. static GstElement* create_source_bin(guint index, gchar * uri);
  62. };
  63. }