Name: libmm-streamrecorder
Summary: Media Stream Recorder library
-Version: 0.0.14
+Version: 0.0.15
Release: 0
Group: Multimedia/Other
License: Apache-2.0
* An enumeration for attribute values types.
*/
typedef enum {
- MM_STR_REC_ATTRS_TYPE_INVALID = -1, /**< Type is invalid */
- MM_STR_REC_ATTRS_TYPE_INT, /**< Integer type attribute */
- MM_STR_REC_ATTRS_TYPE_DOUBLE, /**< Double type attribute */
- MM_STR_REC_ATTRS_TYPE_STRING, /**< UTF-8 String type attribute */
- MM_STR_REC_ATTRS_TYPE_DATA, /**< Pointer type attribute */
+ MM_STR_REC_ATTRS_TYPE_INVALID = -1, /**< Type is invalid */
+ MM_STR_REC_ATTRS_TYPE_INT, /**< Integer type attribute */
+ MM_STR_REC_ATTRS_TYPE_DOUBLE, /**< Double type attribute */
+ MM_STR_REC_ATTRS_TYPE_STRING, /**< UTF-8 String type attribute */
+ MM_STR_REC_ATTRS_TYPE_DATA, /**< Pointer type attribute */
} MMStreamRecorderAttrsType;
/**
* An enumeration for attribute validation type.
*/
typedef enum {
- MM_STR_REC_ATTRS_VALID_TYPE_INVALID = -1, /**< Invalid validation type */
- MM_STR_REC_ATTRS_VALID_TYPE_NONE, /**< Do not check validity */
- MM_STR_REC_ATTRS_VALID_TYPE_INT_ARRAY, /**< validity checking type of integer array */
- MM_STR_REC_ATTRS_VALID_TYPE_INT_RANGE, /**< validity checking type of integer range */
- MM_STR_REC_ATTRS_VALID_TYPE_DOUBLE_ARRAY, /**< validity checking type of double array */
- MM_STR_REC_ATTRS_VALID_TYPE_DOUBLE_RANGE, /**< validity checking type of double range */
+ MM_STR_REC_ATTRS_VALID_TYPE_INVALID = -1, /**< Invalid validation type */
+ MM_STR_REC_ATTRS_VALID_TYPE_NONE, /**< Do not check validity */
+ MM_STR_REC_ATTRS_VALID_TYPE_INT_ARRAY, /**< validity checking type of integer array */
+ MM_STR_REC_ATTRS_VALID_TYPE_INT_RANGE, /**< validity checking type of integer range */
+ MM_STR_REC_ATTRS_VALID_TYPE_DOUBLE_ARRAY, /**< validity checking type of double array */
+ MM_STR_REC_ATTRS_VALID_TYPE_DOUBLE_RANGE, /**< validity checking type of double range */
} MMStreamRecorderAttrsValidType;
/**
* An enumeration for attribute access flag.
*/
typedef enum {
- MM_STR_REC_ATTRS_FLAG_DISABLED = 0, /**< None flag is set. This means the attribute is not allowed to use. */
- MM_STR_REC_ATTRS_FLAG_READABLE = 1 << 0,/**< Readable */
- MM_STR_REC_ATTRS_FLAG_WRITABLE = 1 << 1,/**< Writable */
- MM_STR_REC_ATTRS_FLAG_MODIFIED = 1 << 2,/**< Modified */
- MM_STR_REC_ATTRS_FLAG_RW = MM_STR_REC_ATTRS_FLAG_READABLE | MM_STR_REC_ATTRS_FLAG_WRITABLE,
- /**< Readable and Writable */
+ MM_STR_REC_ATTRS_FLAG_DISABLED = 0, /**< None flag is set. This means the attribute is not allowed to use. */
+ MM_STR_REC_ATTRS_FLAG_READABLE = 1 << 0,/**< Readable */
+ MM_STR_REC_ATTRS_FLAG_WRITABLE = 1 << 1,/**< Writable */
+ MM_STR_REC_ATTRS_FLAG_MODIFIED = 1 << 2,/**< Modified */
+ MM_STR_REC_ATTRS_FLAG_RW = MM_STR_REC_ATTRS_FLAG_READABLE | MM_STR_REC_ATTRS_FLAG_WRITABLE,
+ /**< Readable and Writable */
} MMStreamRecorderAttrsFlag;
/**
* A structure for attribute information
*/
typedef struct {
- MMStreamRecorderAttrsType type;
- MMStreamRecorderAttrsFlag flag;
- MMStreamRecorderAttrsValidType validity_type;
+ MMStreamRecorderAttrsType type;
+ MMStreamRecorderAttrsFlag flag;
+ MMStreamRecorderAttrsValidType validity_type;
/**
* A union that describes validity of the attribute.
*/
- union {
+ union {
/**
* Validity structure for integer array.
*/
double max; /**< maximum range */
double def; /**< default value */
} double_range;
- };
+ };
} MMStreamRecorderAttrsInfo;
| MACRO DEFINITIONS |
========================================================================================*/
-#define MMSTREAMRECORDER_FOURCC(a,b,c,d) (guint32)((a)|(b)<<8|(c)<<16|(d)<<24)
+#define MMSTREAMRECORDER_FOURCC(a, b, c, d) (guint32)((a)|(b)<<8|(c)<<16|(d)<<24)
#define MMSTREAMRECORDER_FOURCC_ARGS(fourcc) \
- ((gchar)((fourcc)&0xff)), \
- ((gchar)(((fourcc)>>8)&0xff)), \
- ((gchar)(((fourcc)>>16)&0xff)), \
- ((gchar)(((fourcc)>>24)&0xff))
+ ((gchar)((fourcc)&0xff)), \
+ ((gchar)(((fourcc)>>8)&0xff)), \
+ ((gchar)(((fourcc)>>16)&0xff)), \
+ ((gchar)(((fourcc)>>24)&0xff))
/*=======================================================================================
| ENUM DEFINITIONS |
/**
*
*/
-#define MMFILE_FOURCC(a,b,c,d) (guint32)((a)|(b)<<8|(c)<<16|(d)<<24)
+#define MMFILE_FOURCC(a, b, c, d) (guint32)((a)|(b)<<8|(c)<<16|(d)<<24)
#define MMFILE_FOURCC_ARGS(fourcc) \
((gchar)((fourcc)&0xff)), \
((gchar)(((fourcc)>>8)&0xff)), \
/* GStreamer element remove macro */
#define _MMSTREAMRECORDER_ELEMENT_REMOVE(element, eid) \
- if (element[eid].gst != NULL) { \
- gst_object_unref(element[eid].gst); \
- }
+ do { \
+ if (element[eid].gst != NULL) { \
+ gst_object_unref(element[eid].gst); \
+ } \
+ } while (0)
#define _MM_GST_ELEMENT_LINK_MANY gst_element_link_many
#define _MM_GST_ELEMENT_LINK gst_element_link
gst_object_unref(sink_parent); sink_parent = NULL;\
if (src_name) {\
free(src_name); src_name = NULL;\
- }\
+ } \
if (sink_name) {\
free(sink_name); sink_name = NULL;\
- }\
+ } \
gst_object_unref(srcpad); srcpad = NULL;\
gst_object_unref(sinkpad); sinkpad = NULL;\
err = MM_ERROR_STREAMRECORDER_GST_LINK;\
goto if_fail_goto;\
- }\
+ } \
gst_object_unref(srcpad); srcpad = NULL;\
gst_object_unref(sinkpad); sinkpad = NULL;\
}
-#define _MM_GST_PAD_UNLINK_UNREF( srcpad, sinkpad) \
+#define _MM_GST_PAD_UNLINK_UNREF(srcpad, sinkpad) \
if (srcpad && sinkpad) { \
gst_pad_unlink(srcpad, sinkpad); \
} else { \
} else { \
item->object = G_OBJECT(x_pad); \
item->category = x_category; \
- item->handler_id = gst_pad_add_probe(x_pad,GST_PAD_PROBE_TYPE_BUFFER,x_callback, x_hstreamrecorder,NULL); \
+ item->handler_id = gst_pad_add_probe(x_pad, GST_PAD_PROBE_TYPE_BUFFER, x_callback, x_hstreamrecorder, NULL); \
x_hstreamrecorder->buffer_probes = g_list_append(x_hstreamrecorder->buffer_probes, item); \
_mmstreamrec_dbg_log("Adding buffer probe on [%s:%s] - [ID : %lu], [Category : %x] ", GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category); \
} \
-} while (0);
+} while (0)
#define MMSTREAMRECORDER_ADD_EVENT_PROBE(x_pad, x_category, x_callback, x_hstreamrecorder) \
do { \
else if (x_category == 0 || !(x_category & _MMSTREAMRECORDER_HANDLER_CATEGORY_ALL)) { \
_mmstreamrec_dbg_err("Invalid handler category : %x \n", x_category); \
} else { \
- item->object =G_OBJECT(x_pad); \
+ item->object = G_OBJECT(x_pad); \
item->category = x_category; \
- item->handler_id = gst_pad_add_probe(x_pad,GST_PAD_PROBE_TYPE_EVENT_BOTH,x_callback, x_hstreamrecorder,NULL); \
+ item->handler_id = gst_pad_add_probe(x_pad, GST_PAD_PROBE_TYPE_EVENT_BOTH, x_callback, x_hstreamrecorder, NULL); \
x_hstreamrecorder->event_probes = g_list_append(x_hstreamrecorder->event_probes, item); \
_mmstreamrec_dbg_log("Adding event probe on [%s:%s] - [ID : %lu], [Category : %x] ", GST_DEBUG_PAD_NAME(item->object), item->handler_id, item->category); \
} \
} else if (x_category == 0 || !(x_category & _MMSTREAMRECORDER_HANDLER_CATEGORY_ALL)) { \
_mmstreamrec_dbg_err("Invalid handler category : %x \n", x_category); \
} else { \
- item->object =G_OBJECT(x_pad); \
+ item->object = G_OBJECT(x_pad); \
item->category = x_category; \
item->handler_id = gst_pad_add_data_probe(x_pad, G_CALLBACK(x_callback), x_hstreamrecorder); \
x_hstreamrecorder->data_probes = g_list_append(x_hstreamrecorder->data_probes, item); \
} \
} while (0);
-#define MMSTREAMRECORDER_SIGNAL_CONNECT( x_object, x_category, x_signal, x_callback, x_hstreamrecorder) \
+#define MMSTREAMRECORDER_SIGNAL_CONNECT(x_object, x_category, x_signal, x_callback, x_hstreamrecorder) \
do { \
MMStreamRecorderHandlerItem* item = NULL; \
item = (MMStreamRecorderHandlerItem *) g_malloc(sizeof(MMStreamRecorderHandlerItem)); \
if (!item) { \
- _mmstreamrec_dbg_err("Cannot connect signal [%s]\n", x_signal ); \
+ _mmstreamrec_dbg_err("Cannot connect signal [%s]\n", x_signal); \
} else if (x_category == 0 || !(x_category & _MMSTREAMRECORDER_HANDLER_CATEGORY_ALL)) { \
_mmstreamrec_dbg_err("Invalid handler category : %x \n", x_category); \
} else { \
item->object = G_OBJECT(x_object); \
item->category = x_category; \
item->handler_id = g_signal_connect(G_OBJECT(x_object), x_signal,\
- G_CALLBACK(x_callback), x_hstreamrecorder ); \
+ G_CALLBACK(x_callback), x_hstreamrecorder); \
x_hstreamrecorder->signals = g_list_append(x_hstreamrecorder->signals, item); \
_mmstreamrec_dbg_log("Connecting signal on [%s] - [ID : %lu], [Category : %x] ", GST_OBJECT_NAME(item->object), item->handler_id, item->category); \
} \
#define MMSTREAMRECORDER_G_OBJECT_GET(obj, name, value) \
do { \
if (obj) { \
- if(g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(obj)), name)) { \
+ if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(obj)), name)) { \
g_object_get(G_OBJECT(obj), name, value, NULL); \
} else { \
- _mmstreamrec_dbg_warn ("The object doesn't have a property named(%s)", name); \
+ _mmstreamrec_dbg_warn("The object doesn't have a property named(%s)", name); \
} \
} else { \
_mmstreamrec_dbg_err("Null object"); \
} \
-} while(0);
+} while (0)
#define MMSTREAMRECORDER_G_OBJECT_SET(obj, name, value) \
do { \
if (obj) { \
- if(g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(obj)), name)) { \
+ if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(obj)), name)) { \
g_object_set(G_OBJECT(obj), name, value, NULL); \
} else { \
- _mmstreamrec_dbg_warn ("The object doesn't have a property named(%s)", name); \
+ _mmstreamrec_dbg_warn("The object doesn't have a property named(%s)", name); \
} \
} else { \
_mmstreamrec_dbg_err("Null object"); \
} \
-} while(0);
+} while (0)
#define MMSTREAMRECORDER_SEND_MESSAGE(handle, msg_id, msg_code) \
{\
#define DEFAULT_SUPPORTED_VIDEO_ENCODERS ""
#define DEFAULT_SUPPORTED_FILE_FORMATS ""
-int
- _mm_streamrecorder_ini_load(mm_streamrecorder_ini_t * ini);
-
-int
- _mm_streamrecorder_ini_unload(mm_streamrecorder_ini_t * ini);
+int _mm_streamrecorder_ini_load(mm_streamrecorder_ini_t * ini);
+int _mm_streamrecorder_ini_unload(mm_streamrecorder_ini_t * ini);
#ifdef __cplusplus
}
#define _MMSTREAMRECORDER_GET_COND(handle) (_MMSTREAMRECORDER_CAST_MTSAFE(handle).cond)
#define _MMSTREAMRECORDER_WAIT(handle) pthread_cond_wait(&_MMSTREAMRECORDER_GET_COND(handle), _MMSTREAMRECORDER_GET_LOCK(handle))
-#define _MMSTREAMRECORDER_TIMED_WAIT(handle, timeout) pthread_cond_timedwait(&_MMSTREAMRECORDER_GET_COND(handle), _MMSTREAMRECORDER_GET_LOCK(handle),&timeout)
+#define _MMSTREAMRECORDER_TIMED_WAIT(handle, timeout) pthread_cond_timedwait(&_MMSTREAMRECORDER_GET_COND(handle), _MMSTREAMRECORDER_GET_LOCK(handle), &timeout)
/* for command */
#define _MMSTREAMRECORDER_GET_CMD_LOCK(handle) (_MMSTREAMRECORDER_CAST_MTSAFE(handle).cmd_lock)
* @return This function returns zero on success, or negative value with error code.
* @remarks typedef bool (*mm_message_callback) (int msg, mm_messageType *param, void *user_param);@n
* @n
- * typedef union @n
+ * typedef union @n
* { @n
* int code; @n
- * struct @n
+ * struct @n
* { @n
* int total; @n
* int elapsed; @n
* } time; @n
- * struct @n
+ * struct @n
* { @n
* int previous; @n
* int current; @n
* @param[in] type Allocation type of streamrecorder context.
* @return This function returns zero on success, or negative value with error code.
* @remarks
- * @see _mmstreamrecorder_destroy_pipeline()
+ * @see _mmstreamrecorder_destroy_pipeline()
*
*/
int _mmstreamrecorder_create_pipeline(MMHandleType handle);
| MACRO DEFINITIONS |
========================================================================================*/
#ifndef CLEAR
-#define CLEAR(x) memset (&(x), 0, sizeof (x))
+#define CLEAR(x) memset(&(x), 0, sizeof(x))
#endif
#define SAFE_FREE(x) \
/**
* Macro for checking validity and debugging
*/
-#define mmf_return_if_fail( expr ) \
- if( expr ){} \
- else \
- { \
- _mmstreamrec_dbg_err( "failed [%s]", #expr); \
+#define mmf_return_if_fail(expr) \
+ if (!(expr)) { \
+ _mmstreamrec_dbg_err("failed [%s]", #expr); \
return; \
};
/**
* Macro for checking validity and debugging
*/
-#define mmf_return_val_if_fail( expr, val ) \
- if( expr ){} \
- else \
- { \
- _mmstreamrec_dbg_err("failed [%s]", #expr); \
- return( val ); \
- };
+#define mmf_return_val_if_fail(expr, val) \
+ do { \
+ if (!(expr)) { \
+ _mmstreamrec_dbg_err("failed [%s]", #expr); \
+ return (val); \
+ } \
+ } while (0)
/**
* Minimum integer value
#define FPUTC_CHECK(x_char, x_file)\
{\
- if (fputc(x_char, x_file) == EOF) \
- {\
+ if (fputc(x_char, x_file) == EOF) {\
_mmstreamrec_dbg_err("[Critical] fputc() returns fail.\n"); \
return FALSE;\
- }\
+ } \
}
#define FPUTS_CHECK(x_str, x_file)\
{\
- if (fputs(x_str, x_file) == EOF) \
- {\
+ if (fputs(x_str, x_file) == EOF) {\
_mmstreamrec_dbg_err("[Critical] fputs() returns fail.\n");\
SAFE_FREE(str); \
return FALSE;\
- }\
+ } \
}
/*=======================================================================================
mmf_return_val_if_fail(item, FALSE);
hstreamrecorder = MMF_STREAMRECORDER(item->handle);
- if(hstreamrecorder == NULL) {
+ if (hstreamrecorder == NULL) {
_mmstreamrec_dbg_warn("msg id:0x%x, item:%p, handle is NULL", item->id, item);
goto MSG_CALLBACK_DONE;
}
mmf_return_val_if_fail(sc, TRUE);
mmf_return_val_if_fail(sc->info_video, TRUE);
- if (sc->info_video->b_commiting) {
+ if (sc->info_video->b_commiting)
_mmstreamrecorder_video_handle_eos((MMHandleType) hstreamrecorder);
- }
sc->bget_eos = TRUE;
}
/* get trailer size */
- if (finfo->fileformat == MM_FILE_FORMAT_3GP || finfo->fileformat == MM_FILE_FORMAT_MP4) {
+ if (finfo->fileformat == MM_FILE_FORMAT_3GP || finfo->fileformat == MM_FILE_FORMAT_MP4)
MMSTREAMRECORDER_G_OBJECT_GET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
- } else {
+ else
trailer_size = 0;
- }
/* to minimizing free space check overhead */
count = count % _MMSTREAMRECORDER_FREE_SPACE_CHECK_INTERVAL;
if (sc->ferror_count == 2 && sc->ferror_send == FALSE) {
sc->ferror_send = TRUE;
msg.id = MM_MESSAGE_STREAMRECORDER_ERROR;
- if (ret == -2) {
+ if (ret == -2)
msg.param.code = MM_ERROR_FILE_NOT_FOUND;
- } else {
+ else
msg.param.code = MM_ERROR_FILE_READ;
- }
+
_mmstreamrecorder_send_message((MMHandleType) hstreamrecorder, &msg);
} else {
sc->ferror_count++;
default: /* succeeded to get free space */
/* check free space for recording */
/* get queued buffer size */
- if (sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC_QUE].gst) {
+ if (sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC_QUE].gst)
MMSTREAMRECORDER_G_OBJECT_GET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC_QUE].gst, "current-level-bytes", &aq_size);
- }
- if (sc->encode_element[_MMSTREAMRECORDER_ENCSINK_VENC_QUE].gst) {
+
+ if (sc->encode_element[_MMSTREAMRECORDER_ENCSINK_VENC_QUE].gst)
MMSTREAMRECORDER_G_OBJECT_GET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_VENC_QUE].gst, "current-level-bytes", &vq_size);
- }
queued_buffer = aq_size + vq_size;
rec_pipe_time = GST_TIME_AS_MSECONDS(b_time);
- if (finfo->fileformat == MM_FILE_FORMAT_3GP || finfo->fileformat == MM_FILE_FORMAT_MP4) {
+ if (finfo->fileformat == MM_FILE_FORMAT_3GP || finfo->fileformat == MM_FILE_FORMAT_MP4)
MMSTREAMRECORDER_G_OBJECT_GET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
- } else {
+ else
trailer_size = 0;
- }
/* check max time */
if (videoinfo->max_time > 0 && rec_pipe_time > videoinfo->max_time) {
rec_pipe_time = GST_TIME_AS_MSECONDS(GST_BUFFER_TIMESTAMP(buffer));
- if (finfo->fileformat == MM_FILE_FORMAT_3GP || finfo->fileformat == MM_FILE_FORMAT_MP4) {
+ if (finfo->fileformat == MM_FILE_FORMAT_3GP || finfo->fileformat == MM_FILE_FORMAT_MP4)
MMSTREAMRECORDER_G_OBJECT_GET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size);
- } else {
+ else
trailer_size = 0;
- }
if (videoinfo->max_time > 0 && videoinfo->max_time < (remained_time + rec_pipe_time))
remained_time = videoinfo->max_time - rec_pipe_time;
_mmstreamrec_dbg_log("ENTER(%s)", GST_PAD_NAME(pad));
/* FIXME : the name of audio sink pad of wavparse, oggmux doesn't have 'audio'. How could I handle the name? */
- if ((strstr(GST_PAD_NAME(pad), "audio")) || (strstr(GST_PAD_NAME(pad), "sink"))) {
+ if ((strstr(GST_PAD_NAME(pad), "audio")) || (strstr(GST_PAD_NAME(pad), "sink")))
MMSTREAMRECORDER_ADD_BUFFER_PROBE(pad, _MMSTREAMRECORDER_HANDLER_AUDIOREC, __mmstreamrecorder_audio_dataprobe_record, hstreamrecorder);
- } else {
+ else
_mmstreamrec_dbg_warn("Unknow pad is added, check it : [%s]", GST_PAD_NAME(pad));
- }
return;
}
buffer_size = gst_buffer_get_size(buffer);
if (audioinfo->filesize == 0) {
- if (finfo->fileformat == MM_FILE_FORMAT_WAV) {
+ if (finfo->fileformat == MM_FILE_FORMAT_WAV)
audioinfo->filesize += 44; /* wave header size */
- } else if (finfo->fileformat == MM_FILE_FORMAT_AMR) {
+ else if (finfo->fileformat == MM_FILE_FORMAT_AMR)
audioinfo->filesize += 6; /* amr header size */
- }
audioinfo->filesize += buffer_size;
return GST_PAD_PROBE_OK;
if (sc->ferror_count == 2 && sc->ferror_send == FALSE) {
sc->ferror_send = TRUE;
msg.id = MM_MESSAGE_STREAMRECORDER_ERROR;
- if (free_space_ret == -2) {
+ if (free_space_ret == -2)
msg.param.code = MM_ERROR_FILE_NOT_FOUND;
- } else {
+ else
msg.param.code = MM_ERROR_FILE_READ;
- }
+
_mmstreamrecorder_send_message((MMHandleType) hstreamrecorder, &msg);
} else {
sc->ferror_count++;
_mmstreamrec_dbg_warn("No more space for recording!!!");
_mmstreamrec_dbg_warn("Free Space : [%" G_GUINT64_FORMAT "], file size : [%" G_GUINT64_FORMAT "]", free_space, audioinfo->filesize);
- if (audioinfo->bMuxing) {
+ if (audioinfo->bMuxing)
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
- } else {
+ else
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AQUE].gst, "empty-buffers", TRUE);
- }
sc->isMaxsizePausing = TRUE;
msg.id = MM_MESSAGE_STREAMRECORDER_NO_FREE_SPACE;
if (audioinfo->max_time > 0 && rec_pipe_time > audioinfo->max_time) {
_mmstreamrec_dbg_warn("Current time : [%" G_GUINT64_FORMAT "], Maximum time : [%" G_GUINT64_FORMAT "]", rec_pipe_time, audioinfo->max_time);
- if (audioinfo->bMuxing) {
+ if (audioinfo->bMuxing)
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_ENCBIN].gst, "block", TRUE);
- } else {
+ else
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AQUE].gst, "empty-buffers", TRUE);
- }
sc->isMaxtimePausing = TRUE;
msg.id = MM_MESSAGE_STREAMRECORDER_TIME_LIMIT;
}
/* free dict as we got our own structure */
- if(dict)
+ if (dict)
iniparser_freedict(dict);
/* dump structure */
if (err != MM_ERROR_NONE)
return err;
- if (sc->audio_enable == TRUE) {
+ if (sc->audio_enable == TRUE)
gst_bin_add(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst), sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_BIN].gst);
- }
/* add element and encodesink bin to encode main pipeline */
gst_bin_add_many(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst), sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_FILT].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_BIN].gst, NULL);
return MM_ERROR_NONE;
pipeline_creation_error:
- for (i = _MMSTREAMRECORDER_AUDIOSRC_BIN; i <= _MMSTREAMRECORDER_ENCSINK_SINK; i++) {
+ for (i = _MMSTREAMRECORDER_AUDIOSRC_BIN; i <= _MMSTREAMRECORDER_ENCSINK_SINK; i++)
_MMSTREAMRECORDER_ELEMENT_REMOVE(sc->encode_element, i);
- }
+
_MMSTREAMRECORDER_ELEMENT_REMOVE(sc->encode_element, _MMSTREAMRECORDER_ENCODE_MAIN_PIPE);
return err;
}
/* TODO : check the last value ( set ) */
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_ENCBIN].gst, "profile", hstreamrecorder->ini.encsink_bin_profile);
- if (rec_mode == MM_STREAMRECORDER_MODE_MEDIABUFFER) {
+ if (rec_mode == MM_STREAMRECORDER_MODE_MEDIABUFFER)
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_ENCBIN].gst, "auto-audio-convert", hstreamrecorder->ini.encsink_bin_auto_audio_convert);
- }
+
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_ENCBIN].gst, "auto-audio-resample", hstreamrecorder->ini.encsink_bin_auto_audio_resample);
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_ENCBIN].gst, "auto-colorspace", hstreamrecorder->ini.encsink_bin_auto_colorspace);
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_ENCBIN].gst, "use-video-toggle", hstreamrecorder->ini.encsink_bin_use_video_toggle);
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_ENCBIN].gst, "auto-colorspace", hstreamrecorder->ini.encsink_bin_auto_colorspace);
- if (video_src_format == MM_STREAMRECORDER_INPUT_FORMAT_NV12) {
+ if (video_src_format == MM_STREAMRECORDER_INPUT_FORMAT_NV12)
video_src_format = MM_STREAMRECORDER_INPUT_FORMAT_I420;
- }
+
caps = gst_set_videosrcpad_caps(video_src_format, video_width, video_height, video_fps, 1);
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_ENCBIN].gst, "vcaps", caps);
- if (video_src_format != MM_STREAMRECORDER_INPUT_FORMAT_NV12) {
+ if (video_src_format != MM_STREAMRECORDER_INPUT_FORMAT_NV12)
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_VCONV].gst, "dst-buffer-num", hstreamrecorder->ini.convert_output_buffer_num);
- }
+
/* state tuning */
err = gst_pad_set_caps(gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_VENC].gst, "sink"), caps);
err = MM_ERROR_NONE;
if (profile == MM_STREAMRECORDER_ENCBIN_PROFILE_VIDEO) {
/* video encoder attribute setting */
- if (v_bitrate > 0) {
+ if (v_bitrate > 0)
MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_VENC].gst, "bitrate", v_bitrate);
- } else {
+ else
_mmstreamrec_dbg_warn("video bitrate is too small[%d], so skip setting. Use DEFAULT value.", v_bitrate);
- }
}
if (sc->audio_enable == TRUE) {
}
if (caps) {
- if (rec_mode == MM_STREAMRECORDER_MODE_MEDIABUFFER) {
+ if (rec_mode == MM_STREAMRECORDER_MODE_MEDIABUFFER)
MMSTREAMRECORDER_G_OBJECT_SET((sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_SRC].gst), "caps", caps);
- }
+
MMSTREAMRECORDER_G_OBJECT_SET((sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_FILT].gst), "caps", caps);
{
gchar *type = gst_caps_to_string(caps);
mmf_return_val_if_fail(sc && sc->encode_element, MM_ERROR_STREAMRECORDER_NOT_INITIALIZED);
mmf_return_val_if_fail(sc->info_video, MM_ERROR_STREAMRECORDER_NOT_INITIALIZED);
- if (sc->audio_enable == TRUE) {
+ if (sc->audio_enable == TRUE)
mmf_return_val_if_fail(sc->info_audio, MM_ERROR_STREAMRECORDER_NOT_INITIALIZED);
- }
+
mmf_return_val_if_fail(sc->info_file, MM_ERROR_STREAMRECORDER_NOT_INITIALIZED);
info = sc->info_video;
sc = MMF_STREAMRECORDER_SUBCONTEXT(handle);
mmf_return_val_if_fail(sc, FALSE);
mmf_return_val_if_fail(sc->info_video, FALSE);
- if (sc->audio_enable == TRUE) {
+ if (sc->audio_enable == TRUE)
mmf_return_val_if_fail(sc->info_audio, FALSE);
- }
mmf_return_val_if_fail(sc->info_file, FALSE);