Argus Camera Sample
Argus Camera Sample
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
common
VideoPipeline.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3
*
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions
6
* are met:
7
* * Redistributions of source code must retain the above copyright
8
* notice, this list of conditions and the following disclaimer.
9
* * Redistributions in binary form must reproduce the above copyright
10
* notice, this list of conditions and the following disclaimer in the
11
* documentation and/or other materials provided with the distribution.
12
* * Neither the name of NVIDIA CORPORATION nor the names of its
13
* contributors may be used to endorse or promote products derived
14
* from this software without specific prior written permission.
15
*
16
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
17
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
*/
28
29
#ifndef VIDEO_PIPELINE_H
30
#define VIDEO_PIPELINE_H
31
32
#include <EGL/egl.h>
33
#include <EGL/eglext.h>
34
35
#ifdef GST_SUPPORTED
36
#include <gst/gst.h>
37
#endif
38
39
namespace
ArgusSamples
40
{
41
42
/**
43
* Record a video from a EGL stream
44
*/
45
class
VideoPipeline
46
{
47
public
:
48
VideoPipeline
();
49
~VideoPipeline
();
50
51
/**
52
* Supported video formats
53
*/
54
typedef
enum
55
{
56
VIDEO_FORMAT_H264
,
57
VIDEO_FORMAT_H265
,
58
VIDEO_FORMAT_VP8
,
59
}
VideoFormat
;
60
61
/**
62
* Supported video file types
63
*/
64
typedef
enum
65
{
66
VIDEO_FILE_TYPE_MP4
,
67
VIDEO_FILE_TYPE_3GP
,
68
VIDEO_FILE_TYPE_AVI
,
69
VIDEO_FILE_TYPE_MKV
,
70
VIDEO_FILE_TYPE_H265
71
}
VideoFileType
;
72
73
/**
74
* Destroy the video pipeline
75
*/
76
bool
destroy
();
77
78
/**
79
* Setup the video pipeline for recording
80
*
81
* @param[in] videoStream EGL stream to record from
82
* @param[in] width Width of the recorded video
83
* @param[in] height Height of the recorded video
84
* @param[in] frameRate Frame rate
85
* @param[in] fileName File name
86
* @param[in] videoFormat Video format
87
* @param[in] videoFileType Video file type
88
* @param[in] bitRate Bitrate, if 0 the bitrate will be selected depending on the
89
* resolution
90
*/
91
bool
setupForRecording
(EGLStreamKHR videoStream, uint32_t width, uint32_t height,
92
float
frameRate,
const
char
*fileName,
93
VideoFormat
videoFormat =
VIDEO_FORMAT_H264
,
94
VideoFileType
videoFileType =
VIDEO_FILE_TYPE_MP4
, uint32_t bitRate = 0);
95
96
/**
97
* Setup the video pipeline for playback
98
*
99
* @param[out] videoStream EGL stream
100
* @param[in] fileName File name
101
*/
102
bool
setupForPlayback
(EGLStreamKHR *videoStream,
const
char
*fileName);
103
104
/**
105
* Start recording/playback
106
*/
107
bool
start
();
108
109
/**
110
* Pause recording/playback
111
*/
112
bool
pause
();
113
114
/**
115
* Toggle recording/playback
116
*/
117
bool
toggle
();
118
119
/**
120
* Rewind (playback only)
121
*/
122
bool
rewind
();
123
124
/**
125
* Stop recording/playback
126
*/
127
bool
stop
();
128
129
/**
130
* Get the file extension for a video file type.
131
*/
132
static
const
char
*
getFileExtension
(
VideoFileType
fileType);
133
134
/**
135
* Get the aspect ratio of the video. The video has to be in paused or playing state.
136
*
137
* @param aspectRatio [out]
138
*/
139
bool
getAspectRatio
(
float
*aspectRatio)
const
;
140
141
private
:
142
#ifdef GST_SUPPORTED
143
GstState m_state;
144
145
GstElement *m_pipeline;
146
#endif
147
};
148
149
};
// namespace ArgusSamples
150
151
#endif // VIDEO_PIPELINE_H
Generated on Tue Jan 10 2017 11:35:27 for Argus Camera Sample by
1.8.1