Sync with 2.4 (Added demuxer support for FLAC). 99/51999/1
authorDeepak Srivastava <srivastava.d@samsung.com>
Wed, 18 Nov 2015 05:42:41 +0000 (11:12 +0530)
committerDeepak Srivastava <srivastava.d@samsung.com>
Wed, 18 Nov 2015 05:43:13 +0000 (11:13 +0530)
Change-Id: Ia372d84254b7b52d1d552fc6fcf483f6f7c27cf6
Signed-off-by: Deepak Srivastava <srivastava.d@samsung.com>
src/port_gst/mediademuxer_port_gst.c
test/mediademuxer_test.c

index 43cfbc5d088a3e0ea69f5b75eec11b02cc7f4e8b..147607a2912f26b510aad5a1e02141e55d047328 100755 (executable)
@@ -355,6 +355,8 @@ static int __gst_create_audio_only_pipeline(gpointer data,  GstCaps *caps)
                gst_handle->demux = gst_element_factory_make("amrparse", NULL);
        } else if (strstr(type, "audio/x-wav")) {
                gst_handle->demux = gst_element_factory_make("wavparse", NULL);
+       } else if (strstr(type, "audio/x-flac")) {
+               gst_handle->demux = gst_element_factory_make("flacparse", NULL);
        }
        g_free(type);
        if (!gst_handle->demux) {
@@ -507,6 +509,7 @@ static void __gst_cb_typefind(GstElement *tf, guint probability,
                } else if ((strstr(type, "adts"))
                           || (strstr(type, "audio/mpeg"))
                           || (strstr(type, "audio/x-wav"))
+                          || (strstr(type, "audio/x-flac"))
                           || (strstr(type, "application/x-id3"))
                           || (strstr(type, "audio/x-amr-nb-sh"))
                           || (strstr(type, "audio/x-amr-wb-sh"))) {
@@ -927,6 +930,24 @@ int _set_mime_audio(media_format_h format, track *head)
                        bit = 16;       /* default */
                if (media_format_set_audio_bit(format, bit))
                        goto ERROR;
+       } else if (gst_structure_has_name(struc, "audio/x-flac")) {
+               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_FLAC))
+                       goto ERROR;
+               if (channels == 0)
+                       channels = 2;   /* default */
+               if (media_format_set_audio_channel(format, channels))
+                       goto ERROR;
+               if (rate == 0)
+                       rate = 44100;   /* default */
+               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;
index 60119bc0bac509d24a2f3952192878ce4f7baf99..31a38e4bac61c09e40c1d357af860de1cfcdcba9 100755 (executable)
@@ -419,6 +419,10 @@ void *_fetch_audio_data(void *ptr)
                        flag = 10;
                        g_print("mediacodec_init_audio() for MEDIACODEC_AMR_WB\n");
                        mediacodec_init_audio(MEDIACODEC_AMR_WB, flag, samplerate, channel, bit);
+               } else if (a_mime == MEDIA_FORMAT_FLAC) {
+                       flag = 10;
+                       g_print("mediacodec_init_audio() for MEDIACODEC_FLAC\n");
+                       mediacodec_init_audio(MEDIACODEC_FLAC, flag, samplerate, channel, bit);
                } else {
                        g_print("Not Supported YET- Need to add mime for validating with audio codec\n");
                        return (void *)status;