From: Mahesh Kondiparthi Date: Thu, 14 Jan 2016 03:52:40 +0000 (+0530) Subject: Enhance muxer functionality to facilitate testing of FHD video muxing. X-Git-Tag: accepted/tizen/mobile/20160115.111247^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c974cb5201e4f2c52ad33c9737e011c14e4a055d;p=platform%2Fcore%2Fapi%2Fmediamuxer.git Enhance muxer functionality to facilitate testing of FHD video muxing. Also, Fixed bug in calling media_format_get_audio_info for video case. Change-Id: I5126d7d9f11d4a9d4131b95ac8ab335435b474f2 Signed-off-by: Joungkook Seo --- diff --git a/src/port_gst/mediamuxer_port_gst.c b/src/port_gst/mediamuxer_port_gst.c index fd712a0..3439ce5 100644 --- a/src/port_gst/mediamuxer_port_gst.c +++ b/src/port_gst/mediamuxer_port_gst.c @@ -827,7 +827,7 @@ int _gst_set_caps(MMHandleType pHandle, media_packet_h packet, int track_index) if (media_format_get_audio_info((media_format_h)(format), ¤t_mime, NULL, NULL, NULL, NULL) == MEDIA_FORMAT_ERROR_NONE) { if (track_mime != current_mime) { - MX_E("audio track_mime is not matching with packet mime. returning"); + MX_E("audio track_mime is not matching with packet mime. returning\n"); return MX_ERROR_INVALID_ARGUMENT; } } else { @@ -922,10 +922,10 @@ int _gst_set_caps(MMHandleType pHandle, media_packet_h packet, int track_index) /* return if track_mime is different to current_mime */ if (media_format_get_video_info((media_format_h)(current->media_format), &track_mime, NULL, NULL, NULL, NULL) == MEDIA_FORMAT_ERROR_NONE) { - if (media_format_get_audio_info((media_format_h)(format), ¤t_mime, NULL, NULL, NULL, NULL) + if (media_format_get_video_info((media_format_h)(format), ¤t_mime, NULL, NULL, NULL, NULL) == MEDIA_FORMAT_ERROR_NONE) { if (track_mime != current_mime) { - MX_E("video track_mime is not matching with packet mime. returning"); + MX_E("video track_mime is not matching with packet mime. returning\n"); return MX_ERROR_INVALID_ARGUMENT; } } else { diff --git a/test/mediamuxer_test.c b/test/mediamuxer_test.c index 747c34b..f265492 100644 --- a/test/mediamuxer_test.c +++ b/test/mediamuxer_test.c @@ -99,9 +99,9 @@ char data_sink[MAX_INPUT_SIZE]; bool have_mp4 = false; bool have_vid_track = false; bool have_aud_track = false; -int track_index_vid; -int track_index_aud; -int track_index_aud2; +int track_index_vid = -1; +int track_index_aud = -1; +int track_index_aud2 = -1; int g_menu_state = CURRENT_STATUS_MAINMENU; int demux_mp4(); @@ -276,13 +276,12 @@ int test_mediamuxer_add_track_audio() /* To add audio track */ mediamuxer_add_track(myMuxer, media_format_a, &track_index_aud); + g_print("Audio Track index returned is: %d\n", track_index_aud); if (validate_multitrack) { mediamuxer_add_track(myMuxer, media_format_a, &track_index_aud2); - g_print("Audio Track index is returned : %d\n", track_index_aud2); + g_print("Audio Multi-Track index returned is: %d\n", track_index_aud2); } - - g_print("Audio Track index is returned : %d\n", track_index_aud); return 0; } diff --git a/test/mediamuxer_test_gst.c b/test/mediamuxer_test_gst.c index c342c33..a43d12b 100644 --- a/test/mediamuxer_test_gst.c +++ b/test/mediamuxer_test_gst.c @@ -85,8 +85,12 @@ static void __audio_app_sink_callback(GstElement *sink, CustomData *data) int key; GstMapInfo map; - if (count == 0) - g_print("Called __audio_app_sink_callback\n"); + if (count == 0) { + g_print("Called __audio_app_sink_callback, track_index_aud = %d\n", track_index_aud); + if (validate_multitrack) + g_print("track_index_aud2 = %d\n", track_index_aud2); + g_print("audio data_sink = %s\n", data_sink); + } g_signal_emit_by_name(sink, "pull-sample", &sample); buffer = gst_sample_get_buffer(sample); @@ -228,14 +232,20 @@ static void __video_app_sink_callback(GstElement *sink, CustomData *data) media_packet_h vid_pkt; uint64_t ns; static int count = 0; - unsigned int vsize; int key; guint8 *dptr; GstMapInfo map; GstSample *sample; - - if (count == 0) - g_print("Called __video_app_sink_callback\n"); + GstStructure *caps_struc = NULL; + GstCaps *vid_caps_gst = NULL; + gint video_width; + gint video_height; + gboolean ret = false; + + if (count == 0) { + g_print("Called __video_app_sink_callback. track_index_vid = %d\n", track_index_vid); + g_print("video data_sink = %s\n", data_sink); + } g_signal_emit_by_name(sink, "pull-sample", &sample); buffer = gst_sample_get_buffer(sample); @@ -280,9 +290,20 @@ static void __video_app_sink_callback(GstElement *sink, CustomData *data) key = 0; } - vsize = map.size; - media_format_set_video_width(vidfmt, vsize/2+1); - media_format_set_video_height(vidfmt, vsize/2+1); + vid_caps_gst = gst_caps_from_string(vid_caps); + caps_struc = gst_caps_get_structure(vid_caps_gst, 0); + + ret = gst_structure_get_int(caps_struc, "width", &video_width); + ret = ret && gst_structure_get_int(caps_struc, "height", &video_height); + if (!ret) { + g_print("Failed to retrive video width/height. returning. \n"); + return; + } + + if (count == 0) + g_print("Extracted width=%d, height=%d\n", video_width, video_height); + media_format_set_video_width(vidfmt, video_width); + media_format_set_video_height(vidfmt, video_height); /* frame rate is came from the caps filter of demuxer */ if (media_format_set_video_frame_rate(vidfmt, 30)) { g_print("media_format_set_video_frame_rate failed\n");