int mediamuxer_create(mediamuxer_h *muxer)
{
- MX_I("mediamuxer_create\n");
+ MX_I("mediamuxer_create");
mediamuxer_error_e ret = MEDIAMUXER_ERROR_NONE;
MUXER_INSTANCE_CHECK(muxer);
memset(handle, 0, sizeof(mediamuxer_s));
handle->muxer_state = MEDIAMUXER_STATE_NONE;
} else {
- MX_E("[CoreAPI][%s] MUXER_ERROR_OUT_OF_MEMORY(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MUXER_ERROR_OUT_OF_MEMORY(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_OUT_OF_MEMORY);
return MEDIAMUXER_ERROR_OUT_OF_MEMORY;
}
ret = mx_create(&handle->mx_handle);
if (ret != MEDIAMUXER_ERROR_NONE) {
- MX_E("[CoreAPI][%s] MUXER_ERROR_INVALID_OPERATION(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MUXER_ERROR_INVALID_OPERATION(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_INVALID_OPERATION);
g_free(handle);
handle = NULL;
int mediamuxer_set_data_sink(mediamuxer_h muxer, char *path, mediamuxer_output_format_e format)
{
- MX_I("mediamuxer_set_data_sink\n");
+ MX_I("mediamuxer_set_data_sink");
int ret = MEDIAMUXER_ERROR_NONE;
mediamuxer_s *handle;
MUXER_INSTANCE_CHECK(muxer);
&& format != MEDIAMUXER_CONTAINER_FORMAT_AMR_NB
&& format != MEDIAMUXER_CONTAINER_FORMAT_AMR_WB
&& format != MEDIAMUXER_CONTAINER_FORMAT_AAC_ADTS) {
- MX_E("Unsupported Container format: %d \n", format);
+ MX_E("Unsupported Container format: %d", format);
handle->muxer_state = MEDIAMUXER_STATE_NONE;
return MEDIAMUXER_ERROR_INVALID_PARAMETER;
}
__FUNCTION__, handle);
}
} else {
- MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_INVALID_STATE);
handle->muxer_state = MEDIAMUXER_STATE_NONE;
ret = MEDIAMUXER_ERROR_INVALID_STATE;
int mediamuxer_add_track(mediamuxer_h muxer, media_format_h media_format, int *track_index)
{
- MX_I("mediamuxer_add_track\n");
+ MX_I("mediamuxer_add_track");
mediamuxer_error_e ret = MEDIAMUXER_ERROR_NONE;
MUXER_INSTANCE_CHECK(muxer);
mediamuxer_s *handle;
if (handle->muxer_state == MEDIAMUXER_STATE_IDLE) {
ret = mx_add_track(handle->mx_handle, media_format, track_index);
if (ret != MEDIAMUXER_ERROR_NONE) {
- MX_E("[CoreAPI][%s] MUXER_ERROR_INVALID_OPERATION(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MUXER_ERROR_INVALID_OPERATION(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_INVALID_OPERATION);
ret = MEDIAMUXER_ERROR_INVALID_OPERATION;
} else {
handle);
}
} else {
- MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_INVALID_STATE);
ret = MEDIAMUXER_ERROR_INVALID_STATE;
}
int mediamuxer_prepare(mediamuxer_h muxer)
{
- MX_I("mediamuxer_prepare\n");
+ MX_I("mediamuxer_prepare");
int ret = MEDIAMUXER_ERROR_NONE;
MUXER_INSTANCE_CHECK(muxer);
mediamuxer_s *handle = (mediamuxer_s *)(muxer);
if (handle->muxer_state == MEDIAMUXER_STATE_IDLE) {
ret = mx_prepare(handle->mx_handle);
if (ret != MEDIAMUXER_ERROR_NONE) {
- MX_E("[CoreAPI][%s] MUXER_ERROR_INVALID_OPERATION(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MUXER_ERROR_INVALID_OPERATION(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_INVALID_OPERATION);
ret = MEDIAMUXER_ERROR_INVALID_OPERATION;
} else {
__FUNCTION__, handle);
}
} else {
- MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_INVALID_STATE);
return MEDIAMUXER_ERROR_INVALID_STATE;
}
int mediamuxer_start(mediamuxer_h muxer)
{
- MX_I("mediamuxer_start\n");
+ MX_I("mediamuxer_start");
int ret = MEDIAMUXER_ERROR_NONE;
MUXER_INSTANCE_CHECK(muxer);
mediamuxer_s *handle = (mediamuxer_s *)(muxer);
if (handle->muxer_state == MEDIAMUXER_STATE_READY) {
ret = mx_start(handle->mx_handle);
if (ret != MEDIAMUXER_ERROR_NONE) {
- MX_E("[CoreAPI][%s] MUXER_ERROR_INVALID_OPERATION(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MUXER_ERROR_INVALID_OPERATION(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_INVALID_OPERATION);
ret = MEDIAMUXER_ERROR_INVALID_OPERATION;
} else {
__FUNCTION__, handle);
}
} else {
- MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_INVALID_STATE);
return MEDIAMUXER_ERROR_INVALID_STATE;
}
int mediamuxer_write_sample(mediamuxer_h muxer, int track_index, media_packet_h inbuf)
{
- MX_I("mediamuxer_write_sample\n");
+ MX_I("mediamuxer_write_sample");
int ret = MEDIAMUXER_ERROR_NONE;
MUXER_INSTANCE_CHECK(muxer);
mediamuxer_s *handle = (mediamuxer_s *)(muxer);
__FUNCTION__, handle);
}
} else {
- MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_INVALID_STATE);
return MEDIAMUXER_ERROR_INVALID_STATE;
}
int mediamuxer_close_track(mediamuxer_h muxer, int track_index)
{
- MX_I("mediamuxer_close_track\n");
+ MX_I("mediamuxer_close_track");
int ret = MEDIAMUXER_ERROR_NONE;
MUXER_INSTANCE_CHECK(muxer);
mediamuxer_s *handle = (mediamuxer_s *)(muxer);
__FUNCTION__, handle);
}
} else {
- MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_INVALID_STATE);
ret = MEDIAMUXER_ERROR_INVALID_STATE;
}
int mediamuxer_pause(mediamuxer_h muxer)
{
- MX_I("mediamuxer_pause\n");
+ MX_I("mediamuxer_pause");
int ret = MEDIAMUXER_ERROR_NONE;
MUXER_INSTANCE_CHECK(muxer);
mediamuxer_s *handle = (mediamuxer_s *)(muxer);
__FUNCTION__, handle);
}
} else {
- MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_INVALID_STATE);
return MEDIAMUXER_ERROR_INVALID_STATE;
}
int mediamuxer_resume(mediamuxer_h muxer)
{
- MX_I("mediamuxer_resume\n");
+ MX_I("mediamuxer_resume");
int ret = MEDIAMUXER_ERROR_NONE;
MUXER_INSTANCE_CHECK(muxer);
mediamuxer_s *handle = (mediamuxer_s *)(muxer);
__FUNCTION__, handle);
}
} else {
- MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_INVALID_STATE);
return MEDIAMUXER_ERROR_INVALID_STATE;
}
int mediamuxer_stop(mediamuxer_h muxer)
{
- MX_I("mediamuxer_stop\n");
+ MX_I("mediamuxer_stop");
int ret = MEDIAMUXER_ERROR_NONE;
MUXER_INSTANCE_CHECK(muxer);
mediamuxer_s *handle = (mediamuxer_s *)(muxer);
|| handle->muxer_state == MEDIAMUXER_STATE_PAUSED) {
ret = mx_stop(handle->mx_handle);
if (ret != MEDIAMUXER_ERROR_NONE) {
- MX_E("[CoreAPI][%s] MUXER_ERROR_INVALID_OPERATION(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MUXER_ERROR_INVALID_OPERATION(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_INVALID_OPERATION);
ret = MEDIAMUXER_ERROR_INVALID_OPERATION;
} else {
__FUNCTION__, handle);
}
} else {
- MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_INVALID_STATE);
return MEDIAMUXER_ERROR_INVALID_STATE;
}
int mediamuxer_unprepare(mediamuxer_h muxer)
{
- MX_I("mediamuxer_unprepare\n");
+ MX_I("mediamuxer_unprepare");
int ret = MEDIAMUXER_ERROR_NONE;
MUXER_INSTANCE_CHECK(muxer);
mediamuxer_s *handle = (mediamuxer_s *)(muxer);
__FUNCTION__, handle);
}
} else {
- MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_INVALID_STATE);
return MEDIAMUXER_ERROR_INVALID_STATE;
}
int mediamuxer_destroy(mediamuxer_h muxer)
{
- MX_I("mediamuxer_destroy\n");
+ MX_I("mediamuxer_destroy");
int ret = MEDIAMUXER_ERROR_NONE;
MUXER_INSTANCE_CHECK(muxer);
mediamuxer_s *handle;
if (handle->muxer_state == MEDIAMUXER_STATE_IDLE) {
ret = mx_destroy(handle->mx_handle);
if (ret != MEDIAMUXER_ERROR_NONE) {
- MX_E("[CoreAPI][%s] MUXER_ERROR_INVALID_OPERATION(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MUXER_ERROR_INVALID_OPERATION(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_INVALID_OPERATION);
ret = MEDIAMUXER_ERROR_INVALID_OPERATION;
} else {
handle);
}
} else {
- MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MEDIAMUXER_ERROR_INVALID_STATE(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_INVALID_STATE);
return MEDIAMUXER_ERROR_INVALID_STATE;
}
int mediamuxer_get_state(mediamuxer_h muxer, mediamuxer_state_e *state)
{
- MX_I("mediamuxer_get_state\n");
+ MX_I("mediamuxer_get_state");
int ret = MEDIAMUXER_ERROR_NONE;
MUXER_INSTANCE_CHECK(muxer);
mediamuxer_s *handle = (mediamuxer_s *)(muxer);
if (state != NULL) {
*state = handle->muxer_state;
} else {
- MX_E("[CoreAPI][%s] MUXER_ERROR_INVALID_OPERATION(0x%08x)\n",
+ MX_E("[CoreAPI][%s] MUXER_ERROR_INVALID_OPERATION(0x%08x)",
__FUNCTION__, MEDIAMUXER_ERROR_INVALID_OPERATION);
ret = MEDIAMUXER_ERROR_INVALID_OPERATION;
}
handle->error_cb = NULL;
handle->error_cb_userdata = NULL;
- MX_I("mediamuxer_unset_error_cb\n");
+ MX_I("mediamuxer_unset_error_cb");
return MEDIAMUXER_ERROR_NONE;
}
static gboolean _mediamuxer_error_cb(mediamuxer_error_e error, void *user_data)
{
if (user_data == NULL) {
- MX_I("_mediamuxer_error_cb: ERROR %d to report. But call back is not set\n", error);
+ MX_I("_mediamuxer_error_cb: ERROR %d to report. But call back is not set", error);
return 0;
}
mediamuxer_s * handle = (mediamuxer_s *) user_data;
if (handle->error_cb)
((mediamuxer_error_cb)handle->error_cb)(error, handle->error_cb_userdata);
else
- MX_I("_mediamuxer_error_cb: ERROR %d to report. But call back is not set\n", error);
+ MX_I("_mediamuxer_error_cb: ERROR %d to report. But call back is not set", error);
return 0;
}
mxgst_handle_t *new_mediamuxer = NULL;
new_mediamuxer = (mxgst_handle_t *) g_malloc(sizeof(mxgst_handle_t));
- MX_I("GST_Muxer_Init allocating memory for new_mediamuxer: %p\n", new_mediamuxer);
+ MX_I("GST_Muxer_Init allocating memory for new_mediamuxer: %p", new_mediamuxer);
if (!new_mediamuxer) {
- MX_E("Cannot allocate memory for muxer \n");
+ MX_E("Cannot allocate memory for muxer");
ret = MX_ERROR;
goto ERROR;
}
MEDIAMUXER_FLEAVE();
return ret;
ERROR:
- MX_E("%s: Not implemented\n", __func__);
+ MX_E("%s: Not implemented", __func__);
MEDIAMUXER_FLEAVE();
return ret;
}
return ret;
}
-static GstCaps * __gst_codec_specific_caps(media_format_mimetype_e mimetype)
+static GstCaps * __gst_codec_specific_caps(media_format_h format)
{
MEDIAMUXER_FENTER();
GstCaps *new_caps = NULL;
+ media_format_type_e formattype = MEDIA_FORMAT_NONE;
+ media_format_mimetype_e mimetype = MEDIA_FORMAT_MAX;
+ int fps = 25;
+
+ if (media_format_get_type(format, &formattype)) {
+ MX_E("media_format_get_type failed");
+ return NULL;
+ }
+
+ if (MEDIA_FORMAT_AUDIO == formattype) {
+ if (MEDIA_FORMAT_ERROR_NONE != media_format_get_audio_info(format, &mimetype, NULL, NULL, NULL, NULL)) {
+ MX_E("media_format_get_container_mime failed");
+ return NULL;
+ }
+ } else if (MEDIA_FORMAT_VIDEO == formattype) {
+ if (MEDIA_FORMAT_ERROR_NONE != media_format_get_video_info(format, &mimetype, NULL, NULL, NULL, NULL)) {
+ MX_E("media_format_get_container_mime failed");
+ return NULL;
+ }
+ if (MEDIA_FORMAT_ERROR_NONE != media_format_get_video_frame_rate(format, &fps))
+ MX_E("media_format_get_video_frame_rate failed");
+ }
+
switch (mimetype) {
/* video */
case MEDIA_FORMAT_H261:
case MEDIA_FORMAT_H263:
case MEDIA_FORMAT_H263P:
new_caps = gst_caps_new_simple("video/x-h263",
- "variant", G_TYPE_STRING, "itu", NULL);
+ "variant", G_TYPE_STRING, "itu",
+ NULL);
+
+ if (fps)
+ gst_caps_set_simple(new_caps, "framerate", GST_TYPE_FRACTION, fps, 1, NULL);
+
if (!new_caps) {
MX_E("Fail to make simple caps");
return NULL;
case MEDIA_FORMAT_H264_MP:
case MEDIA_FORMAT_H264_HP:
new_caps = gst_caps_new_empty_simple("video/x-h264");
+ if (fps)
+ gst_caps_set_simple(new_caps, "framerate", GST_TYPE_FRACTION, fps, 1, NULL);
if (!new_caps) {
MX_E("Fail to make simple caps");
return NULL;
"mpegversion", G_TYPE_INT, 4,
"systemstream", G_TYPE_BOOLEAN, FALSE,
NULL);
+ if (fps)
+ gst_caps_set_simple(new_caps, "framerate", GST_TYPE_FRACTION, fps, 1, NULL);
if (!new_caps) {
MX_E("Fail to make simple caps");
return NULL;
case MEDIA_FORMAT_PCMU:
break;
default:
- MX_E("Unknown media mimeype %d. Assuming H264\n", mimetype);
+ MX_E("Unknown media mimeype %d. Assuming H264", mimetype);
break;
}
MEDIAMUXER_FLEAVE();
{
MEDIAMUXER_FENTER();
gint ret = MX_ERROR_NONE;
- GstCaps *new_caps;
+ GstCaps *new_caps = NULL;
mxgst_handle_t *gst_handle = (mxgst_handle_t *) pHandle;
media_format_type_e formattype;
mx_gst_track *current = NULL;
- media_format_mimetype_e current_mime;
+ gchar *caps_string = NULL;
/* Reach that track index and set the codec data */
for (current = gst_handle->track_info.track_head; current; current = current->next)
}
if (media_format_get_type(format, &formattype)) {
- MX_E("media_format_get_type failed\n");
+ MX_E("media_format_get_type failed");
goto ERROR;
}
case MEDIA_FORMAT_AUDIO:
/* Following check is safe but not mandatory. */
if ((current->track_index)%NO_OF_TRACK_TYPES != 1) {
- MX_E("This is not an audio track_index. Track_index is not in 3*n+1 format\n");
+ MX_E("This is not an audio track_index. Track_index is not in 3*n+1 format");
goto ERROR;
}
- /* return if track_mime is different to current_mime */
- if (media_format_get_audio_info(format, ¤t_mime, NULL, NULL, NULL, NULL)
- != MEDIA_FORMAT_ERROR_NONE) {
- MX_E("cant read audio mime in packet. returning\n");
- return MX_ERROR_INVALID_ARGUMENT;
- }
-
if (current->caps == NULL) {
- new_caps = __gst_codec_specific_caps(current_mime);
+ new_caps = __gst_codec_specific_caps(format);
if (new_caps == NULL) {
- MX_E("Setting Audio caps failed\n");
- ret = MX_ERROR_UNKNOWN;
- break;
- }
- gchar *caps_string = NULL;
- caps_string = gst_caps_to_string(new_caps);
- if (caps_string) {
- MX_I("New caps is = %s", caps_string);
- g_free(caps_string);
+ MX_E("Setting Audio caps failed");
+ goto ERROR;
}
current->caps = new_caps;
}
case MEDIA_FORMAT_VIDEO:
/* Following check is safe but not mandatory. */
if ((current->track_index)%NO_OF_TRACK_TYPES != 0) {
- MX_E("This is not an video track_index. Video track_index is not in 3*n format\n");
+ MX_E("This is not an video track_index. Video track_index is not in 3*n format");
goto ERROR;
}
- /* return if track_mime is different to current_mime */
- if (media_format_get_video_info(format, ¤t_mime, NULL, NULL, NULL, NULL)
- != MEDIA_FORMAT_ERROR_NONE) {
- MX_E("cant read video mime. returning\n");
- return MX_ERROR_INVALID_ARGUMENT;
- }
-
if (current->caps == NULL) {
- new_caps = __gst_codec_specific_caps(current_mime);
+ new_caps = __gst_codec_specific_caps(format);
if (new_caps == NULL) {
- MX_E("Setting Audio caps failed\n");
- ret = MX_ERROR_UNKNOWN;
- break;
+ MX_E("Setting Audio caps failed");
+ goto ERROR;
}
- gchar *caps_string = NULL;
- caps_string = gst_caps_to_string(new_caps);
- if (caps_string) {
- MX_I("New caps is = %s", caps_string);
- g_free(caps_string);
- }
-
current->caps = new_caps;
}
break;
case MEDIA_FORMAT_CONTAINER:
case MEDIA_FORMAT_UNKNOWN:
default:
- MX_E("Unknown format type\n");
+ MX_E("Unknown format type");
break;
}
+
+ caps_string = gst_caps_to_string(new_caps);
+ if (caps_string) {
+ MX_I("New caps is = %s", caps_string);
+ g_free(caps_string);
+ }
+
MEDIAMUXER_FLEAVE();
return ret;
ERROR:
mx_gst_track *last = NULL;
if (!mx_handle_gst->output_uri) {
- MX_E("URI is null. Possibly, set_data_sink failed. returning. \n");
+ MX_E("URI is null. Possibly, set_data_sink failed. returning.");
return MX_ERROR_INVALID_ARGUMENT;
}
current = (mx_gst_track *)g_malloc(sizeof(mx_gst_track));
if (!current) {
- MX_E("Not able to allocate memory\n");
+ MX_E("Not able to allocate memory");
return MX_ERROR;
}
- MX_I("Memory allocated to track = %p\n", current);
+ MX_I("Memory allocated to track = %p", current);
memset(current, 0, sizeof(mx_gst_track));
current->media_format = (void *)media_format;
current->caps = NULL;
current->next = NULL;
if (mx_handle_gst->track_info.track_head == NULL) {
- MX_I("Adding first-ever track\n");
+ MX_I("Adding first-ever track");
mx_handle_gst->track_info.track_head = current;
} else {
- MX_I("Adding %d-track)\n", 1+mx_handle_gst->track_info.total_track_cnt);
+ MX_I("Adding %d-track)", 1+mx_handle_gst->track_info.total_track_cnt);
last = mx_handle_gst->track_info.track_head;
while (last->next != NULL)
last = last->next;
&mimetype, NULL, NULL, NULL, NULL) == MEDIA_FORMAT_ERROR_NONE) {
if ((mx_handle_gst->muxed_format == MEDIAMUXER_CONTAINER_FORMAT_MP4
&& (mimetype == MEDIA_FORMAT_H264_SP || mimetype == MEDIA_FORMAT_H264_MP || mimetype == MEDIA_FORMAT_H264_HP
- || mimetype == MEDIA_FORMAT_H263
|| mimetype == MEDIA_FORMAT_MPEG4_SP))
|| (mx_handle_gst->muxed_format == MEDIAMUXER_CONTAINER_FORMAT_3GP
&& (mimetype == MEDIA_FORMAT_H264_SP || mimetype == MEDIA_FORMAT_H264_MP || mimetype == MEDIA_FORMAT_H264_HP
- || mimetype == MEDIA_FORMAT_H263))) {
+ || mimetype == MEDIA_FORMAT_H263
+ || mimetype == MEDIA_FORMAT_MPEG4_SP))) {
current->track_index = NO_OF_TRACK_TYPES*(mx_handle_gst->track_info.video_track_cnt);
(mx_handle_gst->track_info.video_track_cnt)++;
(mx_handle_gst->track_info.total_track_cnt)++;
*track_index = current->track_index;
- MX_I("Video track added successfully: %p, with head: %p \n",
+ MX_I("Video track added successfully: %p, with head: %p",
current->media_format, mx_handle_gst->track_info.track_head->media_format);
} else {
- MX_E("Unsupported/Mismatched video MIME Type: %x\n", mimetype);
+ MX_E("Unsupported/Mismatched video MIME Type: %x", mimetype);
}
} else if (media_format_get_audio_info((media_format_h)current->media_format,
&mimetype, NULL, NULL, NULL, NULL) == MEDIA_FORMAT_ERROR_NONE) {
(mx_handle_gst->track_info.total_track_cnt)++;
*track_index = current->track_index;
- MX_I("Audio track added successfully: %p, with head: %p \n",
+ MX_I("Audio track added successfully: %p, with head: %p",
current->media_format, mx_handle_gst->track_info.track_head->media_format);
} else {
- MX_E("Unsupported/Mismatched audio MIME Type: %x\n", mimetype);
+ MX_E("Unsupported/Mismatched audio MIME Type: %x", mimetype);
}
} else if (media_format_get_text_info((media_format_h)current->media_format,
&mimetype, &text_type_e) == MEDIA_FORMAT_ERROR_NONE) {
(mx_handle_gst->track_info.total_track_cnt)++;
*track_index = current->track_index;
- MX_I("Subtitle track added successfully: %p, with head: %p \n",
+ MX_I("Subtitle track added successfully: %p, with head: %p",
current->media_format, mx_handle_gst->track_info.track_head->media_format);
} else {
- MX_E("Unsupported/Mismatched subtitle MIME Type: %x\n", mimetype);
+ MX_E("Unsupported/Mismatched subtitle MIME Type: %x", mimetype);
}
} else {
- MX_E("Unsupported A/V/Subs MIME Type: %x\n", mimetype);
+ MX_E("Unsupported A/V/Subs MIME Type: %x", mimetype);
}
ret = _gst_set_caps(mx_handle_gst, (media_format_h)current->media_format, *track_index);
if (ret != MX_ERROR_NONE) {
mxgst_handle_t *gst_handle = (mxgst_handle_t*)data;
switch (GST_MESSAGE_TYPE(msg)) {
case GST_MESSAGE_EOS:
- MX_I("End of stream\n");
+ MX_I("End of stream");
break;
case GST_MESSAGE_ERROR: {
gchar *debug;
GError *error;
gst_message_parse_error(msg, &error, &debug);
if (!error) {
- MX_E("GStreamer callback error message parsing failed\n");
+ MX_E("GStreamer callback error message parsing failed");
ret = FALSE;
break;
}
- MX_I("GStreamer callback Error: %s\n", error->message);
+ MX_I("GStreamer callback Error: %s", error->message);
if (error) {
if (error->domain == GST_RESOURCE_ERROR)
error_val = __gst_handle_resource_error(gst_handle, error->code);
else if (error->domain == GST_CORE_ERROR)
error_val = __gst_handle_core_error(gst_handle, error->code);
else
- MX_I("Unknown GStreamer callback error\n");
+ MX_I("Unknown GStreamer callback error");
/* Update the user callback with ret value */
((gst_muxer_error_cb)gst_handle->user_cb[_GST_EVENT_TYPE_ERROR])
(error_val, gst_handle->user_data[_GST_EVENT_TYPE_ERROR]);
return ret;
}
g_free(debug);
- MX_E("Error: %s\n", error->message);
+ MX_E("Error: %s", error->message);
g_error_free(error);
}
break;
default:
- MX_I("unhandled gst callback message: 0x%x\n", GST_MESSAGE_TYPE(msg));
+ MX_I("unhandled gst callback message: 0x%x", GST_MESSAGE_TYPE(msg));
break;
}
MEDIAMUXER_FLEAVE();
static void _audio_start_feed(GstElement *source, guint size, mx_gst_track *current)
{
if (current) {
- MX_I("\nAudio Start feeding..., current->track_index = %d\n", current->track_index);
+ MX_I("\nAudio Start feeding..., current->track_index = %d", current->track_index);
current->stop_feed = 0;
current->start_feed = 1;
} else
- MX_I("Audio start feed called, however current handle is null\n");
+ MX_I("Audio start feed called, however current handle is null");
}
static void _video_start_feed(GstElement *source, guint size, mx_gst_track *current)
{
if (current) {
- MX_I("\nVideo Start feeding cb... current->track_index = %d\n", current->track_index);
+ MX_I("\nVideo Start feeding cb... current->track_index = %d", current->track_index);
current->stop_feed = 0;
current->start_feed = 1;
} else
- MX_I("Video start feed called, however, current is null\n");
+ MX_I("Video start feed called, however, current is null");
}
static void _subtitle_start_feed(GstElement *source, guint size, mx_gst_track *current)
{
if (current) {
- MX_I("Subtitle Start feeding cb... current->track_index = %d\n", current->track_index);
+ MX_I("Subtitle Start feeding cb... current->track_index = %d", current->track_index);
current->stop_feed = 0;
current->start_feed = 1;
} else
- MX_I("Subtitle start feed called, however, current is null\n");
+ MX_I("Subtitle start feed called, however, current is null");
}
static void _audio_stop_feed(GstElement *source, mx_gst_track *current)
{
if (current) {
- MX_I("\nAudio Stop feeding cb... current->track_index = %d\n", current->track_index);
+ MX_I("\nAudio Stop feeding cb... current->track_index = %d", current->track_index);
current->stop_feed = 1;
current->start_feed = 0;
} else
- MX_I("Audio stop feed called, however, current is null\n");
+ MX_I("Audio stop feed called, however, current is null");
}
static void _video_stop_feed(GstElement *source, mx_gst_track *current)
{
if (current) {
- MX_I("\nVideo Stop feeding... current->track_index = %d\n", current->track_index);
+ MX_I("Video Stop feeding... current->track_index = %d", current->track_index);
current->stop_feed = 1;
current->start_feed = 0;
} else
- MX_I("Video stop feed called, however, current is null\n");
+ MX_I("Video stop feed called, however, current is null");
}
static void _subtitle_stop_feed(GstElement *source, mx_gst_track *current)
{
if (current) {
- MX_I("\nSubtitle Stop feeding... current->track_index = %d\n", current->track_index);
+ MX_I("Subtitle Stop feeding... current->track_index = %d", current->track_index);
current->stop_feed = 1;
current->start_feed = 0;
} else
- MX_I("Subtitle stop feed called, however, current is null\n");
+ MX_I("Subtitle stop feed called, however, current is null");
}
&& gst_handle->muxed_format != MEDIAMUXER_CONTAINER_FORMAT_AAC_ADTS
&& gst_handle->muxed_format != MEDIAMUXER_CONTAINER_FORMAT_AMR_NB
&& gst_handle->muxed_format != MEDIAMUXER_CONTAINER_FORMAT_AMR_WB) {
- MX_E("Unsupported container-format. Currently suports only MP4, 3GP, WAV & AMR\n");
+ MX_E("Unsupported container-format. Currently suports only MP4, 3GP, WAV & AMR");
ret = MEDIAMUXER_ERROR_INVALID_PATH;
goto ERROR;
}
}
if ((!gst_handle->pipeline) || (!gst_handle->muxer) || (!gst_handle->sink)) {
- MX_E("One element could not be created. Exiting.\n");
+ MX_E("One element could not be created. Exiting.");
ret = MEDIAMUXER_ERROR_RESOURCE_LIMIT;
goto ERROR;
}
if (gst_handle->muxed_format == MEDIAMUXER_CONTAINER_FORMAT_AAC_ADTS) {
GstCaps *outcaps = gst_caps_new_simple("audio/mpeg", "stream-format", G_TYPE_STRING, "adts", NULL);
if (!gst_element_link_filtered(gst_handle->muxer, gst_handle->sink, outcaps))
- MX_E("muxer-sink link failed\n");
+ MX_E("muxer-sink link failed");
gst_caps_unref(outcaps);
} else {
if (!gst_element_link(gst_handle->muxer, gst_handle->sink))
- MX_E("muxer-sink link failed\n");
+ MX_E("muxer-sink link failed");
}
if (gst_handle->track_info.video_track_cnt) { /* Video track(s) exist */
MX_I("make mpeg4videoparse element");
}
} else {
- MX_E("Can't retrive mimetype for the current track. Unsupported MIME Type\n");
+ MX_E("Can't retrive mimetype for the current track. Unsupported MIME Type");
ret = MEDIAMUXER_ERROR_INVALID_PARAMETER;
goto ERROR;
}
if ((!current->appsrc) || (!current->parser)) {
- MX_E("One element (video_appsrc/vparse) could not be created. Exiting.\n");
+ MX_E("One element (video_appsrc/vparse) could not be created. Exiting.");
ret = MEDIAMUXER_ERROR_RESOURCE_LIMIT;
goto ERROR;
}
#ifdef ASYCHRONOUS_WRITE
/* ToDo: Use a function pointer, and create independent fucntions to each track */
- MX_I("\nRegistering video callback for cur->tr_ind = %d\n", current->track_index);
+ MX_I("\nRegistering video callback for cur->tr_ind = %d", current->track_index);
g_signal_connect(current->appsrc, "need-data",
G_CALLBACK(_video_start_feed), current);
g_signal_connect(current->appsrc, "enough-data",
g_object_set(current->appsrc, "max-bytes", (guint64)3 * 1024 * 1024, NULL);
if (!gst_element_link(current->appsrc, current->parser))
- MX_E("appsrc-parse failed\n");
+ MX_E("appsrc-parse failed");
/* Link videoparse to muxer_video_pad. Request for muxer A/V pads. */
snprintf(track_no, MAX_STRING_LENGTH - 1, "video_%.2d", vid_track_cnt++); /* sprintf(track_no,"video_00"); */
MX_E("parser get src pad");
if (gst_pad_link(vid_src, video_pad) != GST_PAD_LINK_OK)
- MX_E("video parser to muxer link failed\n");
+ MX_E("video parser to muxer link failed");
gst_object_unref(GST_OBJECT(vid_src));
gst_object_unref(GST_OBJECT(video_pad));
current->parser = gst_element_factory_make("amrparse", str_parser);
MX_I("make amrparse element");
} else if (mimetype == MEDIA_FORMAT_PCM) {
- MX_I("Do Nothing, as there is no need of parser for wav\n");
+ MX_I("Do Nothing, as there is no need of parser for wav");
} else {
MX_I("Do Nothing");
}
} else {
- MX_E("Can't retrive mimetype for the current track. Unsupported MIME Type. Proceeding to the next track\n");
+ MX_E("Can't retrive mimetype for the current track. Unsupported MIME Type. Proceeding to the next track");
}
if (!current->appsrc) {
- MX_E("One element (audio_appsrc) could not be created. Exiting.\n");
+ MX_E("One element (audio_appsrc) could not be created. Exiting.");
ret = MEDIAMUXER_ERROR_RESOURCE_LIMIT;
goto ERROR;
}
gst_bin_add_many(GST_BIN(gst_handle->pipeline), current->appsrc, NULL);
if (gst_handle->muxed_format == MEDIAMUXER_CONTAINER_FORMAT_AAC_ADTS
|| mimetype == MEDIA_FORMAT_PCM) {
- MX_I("Do Nothing, as there is no need of parser for wav and AAC_ADTS\n");
+ MX_I("Do Nothing, as there is no need of parser for wav and AAC_ADTS");
} else {
if (!current->parser) {
- MX_E("One element (audio-parser) could not be created. Exiting.\n");
+ MX_E("One element (audio-parser) could not be created. Exiting.");
ret = MEDIAMUXER_ERROR_RESOURCE_LIMIT;
goto ERROR;
}
#ifdef ASYCHRONOUS_WRITE
/* ToDo: Use a function pointer, and create independent fucntions to each track */
- MX_I("\nRegistering audio callback for cur->tr_ind = %d\n", current->track_index);
+ MX_I("\nRegistering audio callback for cur->tr_ind = %d", current->track_index);
g_signal_connect(current->appsrc, "need-data",
G_CALLBACK(_audio_start_feed), current);
g_signal_connect(current->appsrc, "enough-data",
aud_src = gst_element_get_static_pad(current->parser, "src");
if (gst_pad_link(aud_src, audio_pad) != GST_PAD_LINK_OK)
- MX_E("audio parser to muxer link failed\n");
+ MX_E("audio parser to muxer link failed");
gst_object_unref(GST_OBJECT(aud_src));
gst_object_unref(GST_OBJECT(audio_pad));
if (!current->appsrc) {
- MX_E("One element (text_appsrc) could not be created. Exiting.\n");
+ MX_E("One element (text_appsrc) could not be created. Exiting.");
ret = MEDIAMUXER_ERROR_RESOURCE_LIMIT;
goto ERROR;
}
#ifdef ASYCHRONOUS_WRITE
/* ToDo: Use a function pointer, and create independent functions to each track */
- MX_I("\nRegistering subtitle callback for cur->tr_ind = %d\n", current->track_index);
+ MX_I("\nRegistering subtitle callback for cur->tr_ind = %d", current->track_index);
g_signal_connect(current->appsrc, "need-data", G_CALLBACK(_subtitle_start_feed), current);
g_signal_connect(current->appsrc, "enough-data", G_CALLBACK(_subtitle_stop_feed), current);
#else
snprintf(track_no, MAX_STRING_LENGTH, "subtitle_%.2d", text_track_cnt++); /* snprintf(track_no,"subtitle_00"); */
subtitle_pad = gst_element_get_request_pad(gst_handle->muxer, track_no);
subtitle_src = gst_element_get_static_pad(current->appsrc, "src");
- MX_I("Linking subtitle-appsrc to muxersubtitle static-pad\n");
+ MX_I("Linking subtitle-appsrc to muxersubtitle static-pad");
if (gst_pad_link(subtitle_src, subtitle_pad) != GST_PAD_LINK_OK)
MX_E("subtitle_src and subtitle_pad link failed");
}
}
- MX_I("Output_uri= %s\n", gst_handle->output_uri);
+ MX_I("Output_uri= %s", gst_handle->output_uri);
g_object_set(GST_OBJECT(gst_handle->sink), "location",
gst_handle->output_uri, NULL);
MEDIAMUXER_CHECK_NULL(pHandle);
mxgst_handle_t *new_mediamuxer = (mxgst_handle_t *) pHandle;
- MX_I("__gst_muxer_prepare adding elements to the pipeline:%p\n", new_mediamuxer);
+ MX_I("__gst_muxer_prepare adding elements to the pipeline:%p", new_mediamuxer);
ret = _gst_create_pipeline(new_mediamuxer);
MEDIAMUXER_FLEAVE();
return ret;
MEDIAMUXER_CHECK_NULL(pHandle);
mxgst_handle_t *gst_handle = (mxgst_handle_t *) pHandle;
- MX_I("__gst_muxer_start making pipeline to playing:%p\n", gst_handle);
+ MX_I("__gst_muxer_start making pipeline to playing:%p", gst_handle);
/* set pipeline state to PLAYING */
MEDIAMUXER_ELEMENT_SET_STATE(GST_ELEMENT_CAST(gst_handle->pipeline),
return ret;
STATE_CHANGE_FAILED:
- MX_E("muxer state change failed, returning \n");
+ MX_E("muxer state change failed, returning");
ret = MX_ERROR_INVALID_ARGUMENT;
MEDIAMUXER_FLEAVE();
return ret;
char *pkt_codec_data;
unsigned int codec_data_size;
- if (media_packet_get_codec_data(out_pkt, (void **)&pkt_codec_data, &codec_data_size) == 0) {
+ if (media_packet_get_buffer_size(out_pkt, &size) != MEDIA_PACKET_ERROR_NONE) {
+ MX_E("media_packet_get_buffer_size failed");
+ return MX_ERROR_UNKNOWN;
+ }
+
+ if (!size) {
+ MX_E("media packet size is zero");
+ return MX_ERROR_UNKNOWN;
+ }
+
+ MX_I("Media packet Buffer capacity: %llu", size);
+
+ if (media_packet_get_codec_data(out_pkt, (void **)&pkt_codec_data, &codec_data_size)
+ == MEDIA_PACKET_ERROR_NONE) {
GstCaps *appsrc_caps = NULL;
GstCaps *new_appsrc_caps = NULL;
GstBuffer *codec_data_buffer = NULL;
}
- media_packet_get_buffer_size(out_pkt, &size);
- MX_I("Media packet Buffer capacity: %llu\n", size);
-
/* copy data */
data_ptr = (unsigned char *)g_malloc(size);
if (!data_ptr) {
- MX_E("Memory allocation failed in %s \n", __FUNCTION__);
+ MX_E("Memory allocation failed in %s", __FUNCTION__);
ret = MX_MEMORY_ERROR;
goto ERROR;
}
if (media_packet_get_buffer_data_ptr(out_pkt, &pkt_data)) {
MX_E("unable to get the buffer pointer \
- from media_packet_get_buffer_data_ptr\n");
+ from media_packet_get_buffer_data_ptr");
ret = MX_ERROR_UNKNOWN;
goto ERROR;
}
size, data_ptr, g_free));
if (media_packet_get_pts(out_pkt, &info)) {
- MX_E("unable to get the pts\n");
+ MX_E("unable to get the pts");
ret = MX_ERROR_UNKNOWN;
goto ERROR;
}
buffer->pts = info;
if (media_packet_get_dts(out_pkt, &info)) {
- MX_E("unable to get the dts\n");
+ MX_E("unable to get the dts");
ret = MX_ERROR_UNKNOWN;
goto ERROR;
}
buffer->dts = info;
if (media_packet_get_duration(out_pkt, &info)) {
- MX_E("unable to get the duration\n");
+ MX_E("unable to get the duration");
ret = MX_ERROR_UNKNOWN;
goto ERROR;
}
media_buffer_flags_e flags;
if (media_packet_get_flags(out_pkt, &flags)) {
- MX_E("unable to get the buffer size\n");
+ MX_E("unable to get the buffer size");
ret = MX_ERROR_UNKNOWN;
goto ERROR;
}
mxgst_handle_t *gst_handle = (mxgst_handle_t *) pHandle;
mx_gst_track *current = NULL;
bool eos = FALSE;
+ GstBuffer *gst_inbuf2 = NULL;
+ uint64_t inbuf_size = 0;
+
for (current = gst_handle->track_info.track_head; current; current = current->next)
if (current->track_index == track_index)
break;
if ((!current) || (current->track_index != track_index)) {
- MX_E("No tracks or mismatched track_index = %d\n", track_index);
+ MX_E("No tracks or mismatched track_index = %d", track_index);
if (current)
- MX_E("\ncurrent->track_index=%d\n", current->track_index);
+ MX_E("\ncurrent->track_index=%d", current->track_index);
else if (gst_handle->track_info.track_head) {
- MX_E("\n\ngst_handle->track_info.track_head->track_index=%d\n", gst_handle->track_info.track_head->track_index);
+ MX_E("\n\ngst_handle->track_info.track_head->track_index=%d", gst_handle->track_info.track_head->track_index);
if (gst_handle->track_info.track_head->next)
- MX_E("ext=%p\tnext->track_index=%d\n", gst_handle->track_info.track_head->next, gst_handle->track_info.track_head->next->track_index);
+ MX_E("ext=%p\tnext->track_index=%d", gst_handle->track_info.track_head->next, gst_handle->track_info.track_head->next->track_index);
} else
- MX_E("\n\n****Head is NULL****\n");
+ MX_E("****Head is NULL****");
ret = MX_ERROR_INVALID_ARGUMENT;
goto ERROR;
}
- MX_I("Track_index passed = %d, working-with_track_index = %d\n", track_index, current->track_index);
+ MX_I("Track_index passed = %d, working-with_track_index = %d", track_index, current->track_index);
- GstBuffer *gst_inbuf2 = NULL;
- gst_inbuf2 = gst_buffer_new();
/* ToDo: Add functionality to the following function */
/* MX_I("\nBefore buff=%x\n", gst_inbuf2); */
if (media_packet_is_end_of_stream(inbuf, &eos) != MEDIA_PACKET_ERROR_NONE) {
goto ERROR;
}
+ if (media_packet_get_buffer_size(inbuf, &inbuf_size) != MEDIA_PACKET_ERROR_NONE)
+ MX_E("media_packet_get_buffer_size failed");
+
+ if (eos && (inbuf_size == 0)) {
+ MX_I("end of stream");
+ gst_app_src_end_of_stream((GstAppSrc *)current->appsrc);
+ goto LEAVE;
+ }
+
+ gst_inbuf2 = gst_buffer_new();
ret = _gst_copy_media_packet_to_buf(current, inbuf, gst_inbuf2);
if (ret != MX_ERROR_NONE) {
MX_E("media packet copy to gstbuffer error");
}
if (track_index%NO_OF_TRACK_TYPES == 0) { /* NO_OF_TRACK_TYPES*n for video */
- MX_I("Waiting till start_feed of current video track, index=%d is active\n", current->track_index);
+ MX_I("Waiting till start_feed of current video track, index=%d is active", current->track_index);
#ifdef ASYCHRONOUS_WRITE
/* poll now to make it synchronous */
while (current->start_feed == 0)
g_usleep(WRITE_POLL_PERIOD);
- MX_I("pushing video\n");
+ MX_I("pushing video");
g_signal_emit_by_name(current->appsrc, "push-buffer", gst_inbuf2, &ret);
#else
ret = gst_app_src_push_buffer((GstAppSrc *)current->appsrc, gst_inbuf2);
#endif
- MX_I("attempted a vid-buf push\n");
+ MX_I("attempted a vid-buf push");
if (ret != GST_FLOW_OK) {
/* We got some error, stop sending data */
- MX_E("--video appsrc push failed--\n");
+ MX_E("--video appsrc push failed--");
ret = MX_ERROR_INVALID_ARGUMENT;
}
-
if (eos) {
MX_I("end of stream");
gst_app_src_end_of_stream((GstAppSrc *)current->appsrc);
}
} else if (track_index%NO_OF_TRACK_TYPES == 1) { /* NO_OF_TRACK_TYPES*n+1 for audio */
- MX_I(" Waiting till start_feed of current audio track, index=%d is active\n", current->track_index);
+ MX_I(" Waiting till start_feed of current audio track, index=%d is active", current->track_index);
#ifdef ASYCHRONOUS_WRITE
while (current->start_feed == 0)
g_usleep(WRITE_POLL_PERIOD);
- MX_I("End of sleep, pushing audio\n");
+ MX_I("End of sleep, pushing audio");
g_signal_emit_by_name(current->appsrc, "push-buffer", gst_inbuf2, &ret);
#else
ret = gst_app_src_push_buffer((GstAppSrc *)current->appsrc, gst_inbuf2);
#endif
- MX_I("Attempted a aud-buf push\n");
+ MX_I("Attempted a aud-buf push");
if (ret != GST_FLOW_OK) {
/* We got some error, stop sending data */
- MX_E("--audio appsrc push failed--\n");
+ MX_E("--audio appsrc push failed--");
}
-
if (eos) {
MX_I("end of stream");
gst_app_src_end_of_stream((GstAppSrc *)current->appsrc);
}
} else if (track_index%NO_OF_TRACK_TYPES == 2) { /* NO_OF_TRACK_TYPES*n+2 for subtitle */
- MX_I(" Waiting till start_feed of current subtitle, index=%d is active\n", current->track_index);
+ MX_I(" Waiting till start_feed of current subtitle, index=%d is active", current->track_index);
#ifdef ASYCHRONOUS_WRITE
while (current->start_feed == 0)
g_usleep(WRITE_POLL_PERIOD);
- MX_I("End of sleep, pushing subtitle data\n");
+ MX_I("End of sleep, pushing subtitle data");
g_signal_emit_by_name(current->appsrc, "push-buffer", gst_inbuf2, &ret);
#else
ret = gst_app_src_push_buffer((GstAppSrc *)current->appsrc, gst_inbuf2);
#endif
- MX_I("Attempted subtitle-buf push\n");
+ MX_I("Attempted subtitle-buf push");
if (ret != GST_FLOW_OK) {
/* We got some error, stop sending data */
- MX_E("--subtitle appsrc push failed--\n");
+ MX_E("--subtitle appsrc push failed--");
}
if (eos) {
MX_I("end of stream");
gst_app_src_end_of_stream((GstAppSrc *)current->appsrc);
}
} else {
- MX_E("Unsupported track index=%d. track_index-mod3= %d. Only 0/1/2 track index is vaild\n", track_index, track_index%NO_OF_TRACK_TYPES);
+ MX_E("Unsupported track index=%d. track_index-mod3= %d. Only 0/1/2 track index is vaild", track_index, track_index%NO_OF_TRACK_TYPES);
ret = MX_ERROR_INVALID_ARGUMENT;
}
+
+LEAVE:
/* Unref the buffer, as it is pushed into the appsrc already */
- gst_buffer_unref(gst_inbuf2);
+ if (gst_inbuf2)
+ gst_buffer_unref(gst_inbuf2);
+
MEDIAMUXER_FLEAVE();
return ret;
ERROR:
+ if (gst_inbuf2)
+ gst_buffer_unref(gst_inbuf2);
ret = MX_ERROR_INVALID_ARGUMENT;
MEDIAMUXER_FLEAVE();
return ret;
break;
if (!current || current->track_index != track_index) {
- (!current) ? MX_E("Current is Null") : MX_E("Mismatched between track index[%d]\n", track_index);
+ (!current) ? MX_E("Current is Null") : MX_E("Mismatched between track index[%d]", track_index);
goto ERROR;
}
- MX_I("__gst_muxer_stop setting eos to sources:%p\n", gst_handle);
+ MX_I("__gst_muxer_stop setting eos to sources:%p", gst_handle);
if (gst_handle->pipeline != NULL) {
if (track_index%NO_OF_TRACK_TYPES == 0) {
- MX_I("\n-----EOS for video-appsrc-----\n");
+ MX_I("-----EOS for video-appsrc-----");
gst_app_src_end_of_stream((GstAppSrc *)(current->appsrc));
} else if (track_index%NO_OF_TRACK_TYPES == 1) {
- MX_I("\n-----EOS for audio-appsrc-----\n");
+ MX_I("-----EOS for audio-appsrc-----");
gst_app_src_end_of_stream((GstAppSrc *)(current->appsrc));
} else if (track_index%NO_OF_TRACK_TYPES == 2) {
- MX_I("\n-----EOS for subtitle-appsrc-----\n");
+ MX_I("-----EOS for subtitle-appsrc-----");
gst_app_src_end_of_stream((GstAppSrc *)(current->appsrc));
} else {
- MX_E("Invalid track Index[%d].\n", track_index);
+ MX_E("Invalid track Index[%d].", track_index);
goto ERROR;
}
}
MEDIAMUXER_CHECK_NULL(pHandle);
mxgst_handle_t *gst_handle = (mxgst_handle_t *) pHandle;
- MX_I("gst_muxer_stop making pipeline to ready:%p\n", gst_handle);
+ MX_I("gst_muxer_stop making pipeline to ready:%p", gst_handle);
/* set pipeline state to READY */
MEDIAMUXER_ELEMENT_SET_STATE(GST_ELEMENT_CAST(gst_handle->pipeline),
GST_STATE_READY);
MEDIAMUXER_FLEAVE();
return ret;
STATE_CHANGE_FAILED:
- MX_E("muxer state change failed, returning \n");
+ MX_E("muxer state change failed, returning");
ret = MX_ERROR_INVALID_ARGUMENT;
MEDIAMUXER_FLEAVE();
return ret;
MEDIAMUXER_CHECK_NULL(pHandle);
mxgst_handle_t *gst_handle = (mxgst_handle_t *) pHandle;
- MX_I("gst_muxer_unprepare setting eos to sources:%p\n", gst_handle);
+ MX_I("gst_muxer_unprepare setting eos to sources:%p", gst_handle);
ret = _gst_destroy_pipeline(gst_handle);
MEDIAMUXER_FLEAVE();
return ret;
MEDIAMUXER_CHECK_NULL(pHandle);
mxgst_handle_t *new_mediamuxer = (mxgst_handle_t *) pHandle;
- MX_I("__gst_muxer_destroy deallocating new_mediamuxer:%p\n", new_mediamuxer);
+ MX_I("__gst_muxer_destroy deallocating new_mediamuxer:%p", new_mediamuxer);
MEDIAMUXER_FREEIF(new_mediamuxer->output_uri);
g_free(new_mediamuxer);
MEDIAMUXER_FLEAVE();
mxgst_handle_t *gst_handle = (mxgst_handle_t *) pHandle;
if (gst_handle->user_cb[_GST_EVENT_TYPE_ERROR]) {
- MX_E("Already set mediamuxer_error_cb\n");
+ MX_E("Already set mediamuxer_error_cb");
ret = MX_ERROR_INVALID_ARGUMENT;
goto ERROR;
} else {
}
}
- MX_I("Set event handler callback(cb = %p, data = %p)\n", callback, user_data);
+ MX_I("Set event handler callback(cb = %p, data = %p)", callback, user_data);
gst_handle->user_cb[_GST_EVENT_TYPE_ERROR] = (gst_muxer_error_cb) callback;
gst_handle->user_data[_GST_EVENT_TYPE_ERROR] = user_data;
MEDIAMUXER_FLEAVE();