123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 |
- #pragma once
- #include <iostream>
- #include <stdio.h>
- #include <string.h>
- #include <gst/gst.h>
- #include <glib.h>
- #include <stdio.h>
- #include <math.h>
- #include <string.h>
- #include <sys/time.h>
- #include "nvdsmeta.h"
- #include "gstnvdsmeta.h"
- #include "gst-nvmessage.h"
- #include "nvbufsurface.h"
- #include "DataSource.h"
- #include "InferRange.h"
- #include "Util/logger.h"
- #include "Util/NoticeCenter.h"
- #include "Poller/EventPoller.h"
- #include "Player/PlayerProxy.h"
- #include "Rtmp/RtmpPusher.h"
- #include "Common/config.h"
- #include "Pusher/MediaPusher.h"
- #include "Extension/Frame.h"
- #include "Util/SqlPool.h"
- #include "Network/TcpClient.h"
- #include "Poller/Timer.h"
- #include "TCPClient.h"
- #include "recorder.h"
- #include <mutex>
- #include <cuda_runtime.h>
- #include <opencv2/core.hpp>
- #include <opencv2/videoio.hpp>
- #include <opencv2/highgui.hpp>
- #include <opencv2/imgproc.hpp>
- #include <opencv2/imgproc/types_c.h>
- #include <list>
- using namespace std;
- namespace MIVA{
-
- class Inference
- {
- private:
-
- GMainLoop *loop = NULL;
- GstElement *pipeline = NULL,*streammux =NULL, *sink = NULL, *pgie = NULL,
- *queue1, *queue2, *queue3, *queue4, *queue5, *nvvidconv = NULL,
- *nvosd = NULL, *tiler = NULL;
- GstElement *transform = NULL;
- GstBus *bus = NULL;
- guint bus_watch_id;
- GstPad *pgie_src_pad = NULL;
- GstPad *tiler_sink_pad = NULL;
- guint tiler_rows, tiler_columns;
- guint pgie_batch_size;
- public:
- std::shared_ptr<std::vector<DataSource>> m_DataList = NULL;
- std::shared_ptr<InferInfo> m_InferInfo = nullptr;
- std::shared_ptr<recorder> m_recorder = nullptr;
-
-
- static std::shared_ptr<Inference> CreateNew();
- Inference();
- ~Inference();
- public:
-
-
- int32_t Init(std::shared_ptr<InferInfo> InferInfo);
-
-
- void Destory();
-
-
- void ReadyTask();
-
-
- int32_t StartTask();
-
-
- void PauseTask();
-
-
- void StopTask();
-
-
- int32_t RestartTask();
-
- public:
-
-
- static GstPadProbeReturn pgie_src_pad_buffer_probe(GstPad * pad, GstPadProbeInfo * info, gpointer u_data);
-
-
- static GstPadProbeReturn tiler_sink_pad_buffer_probe (GstPad * pad, GstPadProbeInfo * probe_info, gpointer u_data);
-
-
- static gboolean bus_call (GstBus * bus, GstMessage * msg, gpointer data);
-
-
- static void decodebin_child_added (GstChildProxy * child_proxy, GObject * object,
- gchar * name, gpointer user_data);
-
-
- static GstElement * create_uridecode_bin (guint index, gchar * filename);
-
-
- static void cb_newpad (GstElement * decodebin, GstPad * pad, gpointer data);
-
-
- static int PtInPolygon (Point p, vector<Point>& ptPolygon, int nCount);
-
-
- gboolean add_sources (int source_Id, std::string uri);
-
-
-
- void stop_release_source (gint source_id);
-
-
- void ModifyUri(GstElement *source_bin, std::string uri);
-
-
-
- void FreeElement(int source_Id,GstElement *source_bin);
-
-
- void AddSources(int sourceId);
- };
- }
|