From c768420dbe391271b7be47f150ff9ec977c1927e Mon Sep 17 00:00:00 2001 From: Deepak Srivastava Date: Tue, 22 Sep 2015 14:45:07 +0530 Subject: [PATCH] Sync with 2.4 (Added demuxer support for 3gp(h263 and amr codec) file) Change-Id: I70d11cb3a693861de877b4e0b3ea048523de2d9d Signed-off-by: Deepak Srivastava --- src/port_gst/mediademuxer_port_gst.c | 46 +++++++++++++++++++++++++++++++++--- test/mediademuxer_test.c | 6 ++++- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/src/port_gst/mediademuxer_port_gst.c b/src/port_gst/mediademuxer_port_gst.c index c5c61fb..a2c235d 100755 --- a/src/port_gst/mediademuxer_port_gst.c +++ b/src/port_gst/mediademuxer_port_gst.c @@ -465,7 +465,7 @@ static void __gst_cb_typefind(GstElement *tf, guint probability, type = gst_caps_to_string(caps); if (type) { MD_I("Media type %s found, probability %d%%\n", type, probability); - if (strstr(type, "quicktime") || (strstr(type, "audio/x-m4a"))) { + if (strstr(type, "quicktime") || (strstr(type, "audio/x-m4a")) || strstr(type, "x-3gp")) { gst_handle->is_valid_container = true; gst_handle->demux = gst_element_factory_make("qtdemux", NULL); if (!gst_handle->demux) { @@ -761,6 +761,15 @@ int _set_mime_video(media_format_h format, track *head) if (media_format_set_video_height(format, src_height)) goto ERROR; } + } else if (gst_structure_has_name(struc, "video/x-h263")) { + gst_structure_get_int(struc, "width", &src_width); + gst_structure_get_int(struc, "height", &src_height); + if (media_format_set_video_mime(format, MEDIA_FORMAT_H263)) + goto ERROR; + if (media_format_set_video_width(format, src_width)) + goto ERROR; + if (media_format_set_video_height(format, src_height)) + goto ERROR; } else { MD_I("Video mime not supported so far\n"); goto ERROR; @@ -873,8 +882,39 @@ int _set_mime_audio(media_format_h format, track *head) goto ERROR; if (media_format_set_audio_bit(format, bit)) goto ERROR; - } - else { + } else if (gst_structure_has_name(struc, "audio/AMR")) { + gst_structure_get_int(struc, "channels", &channels); + gst_structure_get_int(struc, "rate", &rate); + gst_structure_get_int(struc, "bit", &bit); + if (media_format_set_audio_mime(format, MEDIA_FORMAT_AMR_NB)) + goto ERROR; + if(channels == 0) + channels = 1; /* default */ + if (media_format_set_audio_channel(format, channels)) + goto ERROR; + if (media_format_set_audio_samplerate(format, rate)) + goto ERROR; + if (bit == 0) + bit = 16; /* default */ + if (media_format_set_audio_bit(format, bit)) + goto ERROR; + } else if (gst_structure_has_name(struc, "audio/AMR-WB")) { + gst_structure_get_int(struc, "channels", &channels); + gst_structure_get_int(struc, "rate", &rate); + gst_structure_get_int(struc, "bit", &bit); + if (media_format_set_audio_mime(format, MEDIA_FORMAT_AMR_WB)) + goto ERROR; + if(channels == 0) + channels = 1; /* default */ + if (media_format_set_audio_channel(format, channels)) + goto ERROR; + if (media_format_set_audio_samplerate(format, rate)) + goto ERROR; + if (bit == 0) + bit = 16; /* default */ + if (media_format_set_audio_bit(format, bit)) + goto ERROR; + } else { MD_I("Audio mime not supported so far\n"); goto ERROR; } diff --git a/test/mediademuxer_test.c b/test/mediademuxer_test.c index 485056a..f460329 100755 --- a/test/mediademuxer_test.c +++ b/test/mediademuxer_test.c @@ -605,8 +605,12 @@ void *_fetch_video_data(void *ptr) if (v_mime == MEDIA_FORMAT_H264_SP || v_mime == MEDIA_FORMAT_H264_MP || v_mime == MEDIA_FORMAT_H264_HP) { flag = 10; - g_print("mediacodec_init_audio() for MEDIACODEC_H264\n"); + g_print("mediacodec_init_video() for MEDIACODEC_H264\n"); mediacodec_init_video(MEDIACODEC_H264, flag, w, h); + } else if (v_mime == MEDIA_FORMAT_H263) { + g_print("mediacodec_init_video() for MEDIACODEC_H263\n"); + flag = 10; + mediacodec_init_video(MEDIACODEC_H263, flag, w, h); } else { g_print("Not Supported YET- Need to add mime for validating with video codec\n"); return (void *)status; -- 2.7.4