Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GStreamer_audioRecorder
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
m3
GStreamer_audioRecorder
Commits
a187cafe
Commit
a187cafe
authored
Oct 09, 2017
by
d.basulto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change the way that the bytes to add is calculated
parent
262b856b
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
142 additions
and
185 deletions
+142
-185
StreamRecorder.cpp
StreamRecorder.cpp
+92
-142
StreamRecorder.h
StreamRecorder.h
+50
-43
No files found.
StreamRecorder.cpp
View file @
a187cafe
This diff is collapsed.
Click to expand it.
StreamRecorder.h
View file @
a187cafe
...
...
@@ -28,6 +28,8 @@
#define DST_URI_SIZE 80
#define RECONNECTION_DELAY 1
#define STREAM_ENOUGH_DATA_ERROR 4
//------------------------------------------------------------------------------
/** Class declaration */
...
...
@@ -36,60 +38,65 @@ class StreamRecorder
{
private
:
unsigned
char
*
audioBuffer
;
unsigned
char
*
audioBufferPosition
;
unsigned
char
*
audioBuffer
;
unsigned
char
*
audioBufferPosition
;
char
errorMessage
[
ERROR_MSG_SIZE
];
char
pluginUri
[
DST_URI_SIZE
];
char
errorMessage
[
ERROR_MSG_SIZE
];
char
pluginUri
[
DST_URI_SIZE
];
unsigned
int
nBytes
;
unsigned
int
bufferSize
;
unsigned
int
nBytes
;
unsigned
int
bufferSize
;
int
recordTime
;
int
audioFileDuration
;
/** Audio filename */
long
int
timestamp
=
0
;
long
int
oldTmpTimestamp
=
0
;
long
int
newTmpTimestamp
=
0
;
int
recordTime
;
int
audioFileDuration
;
bool
isConnectionLost
;
//char* sourceName;
//GstElement* audioResample;
//GstElement* tempBin;
//GstElement* audioSink;
GstElement
*
streamSrc
;
GstElement
*
audioConvert
;
GstElement
*
filterCaps
;
GstElement
*
queue0
;
GstElement
*
queue1
;
GstElement
*
filter
;
GstElement
*
fakeSink
;
GstElement
*
mainPipeline
;
/** Audio filename */
long
int
timestamp
=
0
;
long
int
oldTmpTimestamp
=
0
;
long
int
newTmpTimestamp
=
0
;
long
int
bytesPerSecond
=
0
;
bool
isDisconnected
=
false
;
bool
isValidDisconnectedEvent
=
false
;
int
createMainPipeline
();
int
connect
();
int
disconnect
();
//char* sourceName;
//GstElement* audioResample;
//GstElement* tempBin;
//GstElement* audioSink;
GstElement
*
streamSrc
;
GstElement
*
audioConvert
;
GstElement
*
filterCaps
;
GstElement
*
queue0
;
GstElement
*
queue1
;
GstElement
*
filter
;
GstElement
*
fakeSink
;
GstElement
*
mainPipeline
;
int
createMainPipeline
();
int
connect
();
int
disconnect
();
/** add data to buffer */
int
addToBuffer
(
unsigned
char
*
data
,
int
length
);
int
compressBuffer
();
/** add data to buffer */
int
addToBuffer
(
unsigned
char
*
data
,
int
length
);
int
compressBuffer
();
/** plugin's callbacks */
static
void
srcNewPad_callback
(
GstElement
*
element
,
GstPad
*
pad
,
void
*
data
);
static
int
bus_callback
(
GstBus
*
bus
,
GstMessage
*
message
,
void
*
data
);
static
int
filter_handoff_callback
(
GstElement
*
filter
,
GstBuffer
*
buffer
,
void
*
user_data
);
/** plugin's callbacks */
static
void
srcNewPad_callback
(
GstElement
*
element
,
GstPad
*
pad
,
void
*
data
);
static
int
bus_callback
(
GstBus
*
bus
,
GstMessage
*
message
,
void
*
data
);
static
int
filter_handoff_callback
(
GstElement
*
filter
,
GstBuffer
*
buffer
,
void
*
user_data
);
/** Save audio*/
static
void
saveBuffer
(
void
*
user_data
);
/** Save audio*/
void
saveBuffer
(
);
/** Restart the pipeline */
static
gboolean
reconnectURIStream
(
void
*
data
);
/** Restart the pipeline */
static
gboolean
reconnectURIStream
(
void
*
data
);
public
:
public
:
StreamRecorder
(
const
char
*
source
,
int
time
);
StreamRecorder
(
const
char
*
source
,
int
time
);
};
//------------------------------------------------------------------------------
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment