Jetson Inference
DNN Vision Library
gstDecoder.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef __GSTREAMER_DECODER_H__
24 #define __GSTREAMER_DECODER_H__
25 
26 #include "gstUtility.h"
27 
28 
29 struct _GstAppSink;
30 
31 
37 {
38 public:
42  gstDecoder* Create( gstCodec codec, const char* filename );
43 
47  gstDecoder* Create( gstCodec codec, uint16_t port );
48 
52  gstDecoder* Create( gstCodec codec, const char* multicastIP, uint16_t port );
53 
57  ~gstDecoder();
58 
59 
60 protected:
61  gstDecoder();
62 
63  void checkMsgBus();
64  void checkBuffer();
65  bool buildLaunchStr();
66 
67  bool init( gstCodec codec, const char* filename, const char* multicastIP, uint16_t port );
68 
69  static void onEOS(_GstAppSink* sink, void* user_data);
70  static GstFlowReturn onPreroll(_GstAppSink* sink, void* user_data);
71  static GstFlowReturn onBuffer(_GstAppSink* sink, void* user_data);
72 
73  _GstBus* mBus;
74  _GstAppSink* mAppSink;
75  _GstElement* mPipeline;
77 
78  std::string mLaunchStr;
79  std::string mInputPath;
80  std::string mMulticastIP;
81  uint16_t mPort;
82 };
83 
84 #endif
gstCodec mCodec
Definition: gstDecoder.h:76
static void onEOS(_GstAppSink *sink, void *user_data)
void checkMsgBus()
Hardware-accelerated H.264/H.265 video decoder for Jetson using GStreamer.
Definition: gstDecoder.h:36
bool buildLaunchStr()
_GstElement * mPipeline
Definition: gstDecoder.h:75
_GstBus * mBus
Definition: gstDecoder.h:73
gstDecoder * Create(gstCodec codec, const char *filename)
Create an decoder instance that reads from a video file on disk.
void checkBuffer()
uint16_t mPort
Definition: gstDecoder.h:81
std::string mMulticastIP
Definition: gstDecoder.h:80
gstCodec
Video codec (H.264/H.265) enumeration.
Definition: gstUtility.h:34
_GstAppSink * mAppSink
Definition: gstDecoder.h:74
std::string mLaunchStr
Definition: gstDecoder.h:78
~gstDecoder()
Destructor.
static GstFlowReturn onPreroll(_GstAppSink *sink, void *user_data)
bool init(gstCodec codec, const char *filename, const char *multicastIP, uint16_t port)
static GstFlowReturn onBuffer(_GstAppSink *sink, void *user_data)
std::string mInputPath
Definition: gstDecoder.h:79