Commit a187cafe authored by d.basulto's avatar d.basulto

change the way that the bytes to add is calculated

parent 262b856b
This diff is collapsed.
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#define DST_URI_SIZE 80 #define DST_URI_SIZE 80
#define RECONNECTION_DELAY 1 #define RECONNECTION_DELAY 1
#define STREAM_ENOUGH_DATA_ERROR 4
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** Class declaration */ /** Class declaration */
...@@ -36,60 +38,65 @@ class StreamRecorder ...@@ -36,60 +38,65 @@ class StreamRecorder
{ {
private: private:
unsigned char* audioBuffer; unsigned char* audioBuffer;
unsigned char* audioBufferPosition; unsigned char* audioBufferPosition;
char errorMessage[ERROR_MSG_SIZE]; char errorMessage[ERROR_MSG_SIZE];
char pluginUri[DST_URI_SIZE]; char pluginUri[DST_URI_SIZE];
unsigned int nBytes; unsigned int nBytes;
unsigned int bufferSize; unsigned int bufferSize;
int recordTime; int recordTime;
int audioFileDuration; int audioFileDuration;
/** Audio filename */
long int timestamp = 0;
long int oldTmpTimestamp = 0;
long int newTmpTimestamp = 0;
bool isConnectionLost; /** Audio filename */
long int timestamp = 0;
//char* sourceName; long int oldTmpTimestamp = 0;
//GstElement* audioResample; long int newTmpTimestamp = 0;
//GstElement* tempBin; long int bytesPerSecond = 0;
//GstElement* audioSink;
GstElement* streamSrc;
GstElement* audioConvert; bool isDisconnected = false;
GstElement* filterCaps; bool isValidDisconnectedEvent = false;
GstElement* queue0;
GstElement* queue1;
GstElement* filter;
GstElement* fakeSink;
GstElement* mainPipeline;
int createMainPipeline(); //char* sourceName;
int connect(); //GstElement* audioResample;
int disconnect(); //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 */ /** add data to buffer */
int addToBuffer(unsigned char* data, int length); int addToBuffer(unsigned char* data, int length);
int compressBuffer(); int compressBuffer();
/** plugin's callbacks */ /** plugin's callbacks */
static void srcNewPad_callback(GstElement *element, GstPad *pad, void *data); static void srcNewPad_callback(GstElement *element, GstPad *pad, void *data);
static int bus_callback(GstBus *bus, GstMessage *message, void *data); static int bus_callback(GstBus *bus, GstMessage *message, void *data);
static int filter_handoff_callback(GstElement *filter, GstBuffer* buffer, void* user_data); static int filter_handoff_callback(GstElement *filter, GstBuffer* buffer, void* user_data);
/** Save audio*/ /** Save audio*/
static void saveBuffer(void *user_data); void saveBuffer();
/** 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);
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment