goto ERROR;
}
buffer->duration = info;
- /* TBD: set falgs is not available now in media_packet */
+
media_buffer_flags_e flags;
if (media_packet_get_flags(out_pkt, &flags)) {
MX_E("unable to get the buffer size\n");
ret = MX_ERROR_UNKNOWN;
goto ERROR;
}
- GST_BUFFER_FLAG_SET(buffer, flags);
+
+ if (flags & MEDIA_PACKET_SYNC_FRAME)
+ GST_BUFFER_FLAG_UNSET(buffer, GST_BUFFER_FLAG_DELTA_UNIT);
+
ERROR:
MEDIAMUXER_FLEAVE();
return ret;
MEDIAMUXER_CHECK_NULL(pHandle);
mxgst_handle_t *gst_handle = (mxgst_handle_t *) pHandle;
mx_gst_track *current = NULL;
+ bool eos = FALSE;
for (current = gst_handle->track_info.track_head; current; current = current->next)
if (current->track_index == track_index)
break;
gst_inbuf2 = gst_buffer_new();
/* ToDo: Add functionality to the following function */
/* MX_I("\nBefore buff=%x\n", gst_inbuf2); */
- _gst_copy_media_packet_to_buf(current, inbuf, gst_inbuf2);
+ if (media_packet_is_end_of_stream(inbuf, &eos) != MEDIA_PACKET_ERROR_NONE) {
+ MX_E("media_packet_is_end_of_stream failed");
+ goto ERROR;
+ }
+
+ ret = _gst_copy_media_packet_to_buf(current, inbuf, gst_inbuf2);
+ if (ret != MX_ERROR_NONE) {
+ MX_E("media packet copy to gstbuffer error");
+ goto 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);
if (ret != GST_FLOW_OK) {
/* We got some error, stop sending data */
MX_E("--video appsrc push failed--\n");
+ 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);
#ifdef ASYCHRONOUS_WRITE
/* We got some error, stop sending data */
MX_E("--audio appsrc push failed--\n");
}
+
+ 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);
#ifdef ASYCHRONOUS_WRITE
/* We got some error, stop sending data */
MX_E("--subtitle appsrc push failed--\n");
}
+ 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);
ret = MX_ERROR_INVALID_ARGUMENT;