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_H263
,
57
VIDEO_FORMAT_H264
,
58
VIDEO_FORMAT_H265
,
59
VIDEO_FORMAT_VP8
,
60
VIDEO_FORMAT_MPEG4
61
}
VideoFormat
;
62
63
/**
64
* Supported video file types
65
*/
66
typedef
enum
67
{
68
VIDEO_FILE_TYPE_MP4
,
69
VIDEO_FILE_TYPE_3GP
,
70
VIDEO_FILE_TYPE_AVI
,
71
VIDEO_FILE_TYPE_MKV
,
72
VIDEO_FILE_TYPE_H265
73
}
VideoFileType
;
74
75
/**
76
* Destroy the video pipeline
77
*/
78
bool
destroy
();
79
80
/**
81
* Setup the video pipeline for recording
82
*
83
* @param[in] videoStream EGL stream to record from
84
* @param[in] width Width of the recorded video
85
* @param[in] height Height of the recorded video
86
* @param[in] frameRate Frame rate
87
* @param[in] fileName File name
88
* @param[in] videoFormat Video format
89
* @param[in] videoFileType Video file type
90
* @param[in] bitRate Bitrate, if 0 the bitrate will be selected depending on the
91
* resolution
92
*/
93
bool
setupForRecording
(EGLStreamKHR videoStream, uint32_t width, uint32_t height,
94
float
frameRate,
const
char
*fileName,
95
VideoFormat
videoFormat =
VIDEO_FORMAT_H264
,
96
VideoFileType
videoFileType =
VIDEO_FILE_TYPE_MP4
, uint32_t bitRate = 0);
97
98
/**
99
* Setup the video pipeline for playback
100
*
101
* @param[out] videoStream EGL stream
102
* @param[in] fileName File name
103
*/
104
bool
setupForPlayback
(EGLStreamKHR *videoStream,
const
char
*fileName);
105
106
/**
107
* Start recording/playback
108
*/
109
bool
start
();
110
111
/**
112
* Pause recording/playback
113
*/
114
bool
pause
();
115
116
/**
117
* Toggle recording/playback
118
*/
119
bool
toggle
();
120
121
/**
122
* Rewind (playback only)
123
*/
124
bool
rewind
();
125
126
/**
127
* Stop recording/playback
128
*/
129
bool
stop
();
130
131
/**
132
* Get the file extension for a video file type.
133
*/
134
static
const
char
*
getFileExtension
(
VideoFileType
fileType);
135
136
/**
137
* Get the aspect ratio of the video. The video has to be in paused or playing state.
138
*
139
* @param aspectRatio [out]
140
*/
141
bool
getAspectRatio
(
float
*aspectRatio)
const
;
142
143
private
:
144
#ifdef GST_SUPPORTED
145
GstState m_state;
146
147
GstElement *m_pipeline;
148
#endif
149
};
150
151
};
// namespace ArgusSamples
152
153
#endif // VIDEO_PIPELINE_H
Generated on Thu Sep 22 2016 11:28:01 for Argus Camera Sample by
1.8.1