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
01b8230d
Project 'adan.salazar/GeoSentinel' was moved to 'mario.chirinos/GeoSentinel'. Please update any links and bookmarks that may still have the old path.
Commit
01b8230d
authored
Oct 01, 2017
by
d.basulto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reconnect functionality added
parent
c9ad4f92
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
500 additions
and
328 deletions
+500
-328
StreamRecorder.cpp
StreamRecorder.cpp
+442
-291
StreamRecorder.h
StreamRecorder.h
+58
-37
No files found.
StreamRecorder.cpp
View file @
01b8230d
This diff is collapsed.
Click to expand it.
StreamRecorder.h
View file @
01b8230d
...
@@ -11,61 +11,82 @@
...
@@ -11,61 +11,82 @@
#ifndef STREAMRECORDER_H
#ifndef STREAMRECORDER_H
#define STREAMRECORDER_H
#define STREAMRECORDER_H
// your public header include
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/** Your public header include */
#include <gst/gst.h>
#include <gst/gst.h>
#include <jmorecfg.h>
#include <jmorecfg.h>
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define STREAMRECORDER_SAMPLERATE 44100
#define STREAMRECORDER_SAMPLERATE 44100
#define READSIZE 1152 //For MPEG1, frame_size = 1152 samples/frame
#define READSIZE 1152 //For MPEG1, frame_size = 1152 samples/frame
#define STREAMRECORDER_BYTESPERSAMPLE 2
#define STREAMRECORDER_BYTESPERSAMPLE 2
// the declaration of your class...
#define ERROR_MSG_SIZE 50
#define DST_URI_SIZE 80
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/** Class declaration */
class
StreamRecorder
class
StreamRecorder
{
{
private
:
private
:
unsigned
int
nBytes
;
unsigned
int
bufferSize
;
unsigned
char
*
audioBuffer
;
unsigned
char
*
audioBuffer
;
unsigned
char
*
audioBufferPosition
;
unsigned
char
*
audioBufferPosition
;
char
errorMessage
[
ERROR_MSG_SIZE
];
char
pluginUri
[
DST_URI_SIZE
];
unsigned
int
nBytes
;
unsigned
int
bufferSize
;
int
recordTime
;
int
recordTime
;
int
audioFileDuration
;
/** Audio filename */
long
int
timestamp
=
0
;
bool
isConnectionLost
;
bool
isConnectionLost
;
char
*
pluginUri
;
//char* sourceName;
//char* sourceName;
//GstElement* audioResample;
//GstElement* tempBin;
//GstElement* audioSink;
GstElement
*
streamSrc
;
GstElement
*
streamSrc
;
GstElement
*
audioConvert
;
GstElement
*
audioConvert
;
//GstElement* audioResample;
GstElement
*
filterCaps
;
GstElement
*
filterCaps
;
GstElement
*
queue0
;
GstElement
*
queue0
;
GstElement
*
queue1
;
GstElement
*
queue1
;
GstElement
*
filter
;
GstElement
*
filter
;
GstElement
*
fakeSink
;
GstElement
*
fakeSink
;
//GstElement* audioSink;
GstElement
*
mainPipeline
;
GstElement
*
mainPipeline
;
//GstElement* tempBin;
int
createMainPipeline
();
int
createMainPipeline
();
int
connect
(
const
char
*
uri
);
int
connect
(
);
int
disconnect
();
int
disconnect
();
// callbacks
/** add data to buffer */
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
);
// add data to buffer
int
addToBuffer
(
unsigned
char
*
data
,
int
length
);
int
addToBuffer
(
unsigned
char
*
data
,
int
length
);
int
compressBuffer
();
int
compressBuffer
();
// Save information when connection fails
/** plugin's callbacks */
static
void
savePartialBuffer
(
void
*
user_data
);
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
);
/
/ Restart the pipeline
/
** Restart the pipeline */
static
gboolean
reconnectURIStream
(
void
*
data
);
static
gboolean
reconnectURIStream
(
void
*
data
);
public
:
public
:
StreamRecorder
(
const
char
*
source
,
int
time
);
StreamRecorder
(
const
char
*
source
,
int
time
);
};
};
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
...
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