Remove build dependecy for test 93/140093/3 accepted/tizen/4.0/unified/20170816.010853 accepted/tizen/4.0/unified/20170816.014506 accepted/tizen/4.0/unified/20170828.224021 accepted/tizen/unified/20170728.195512 submit/tizen/20170727.075608 submit/tizen_4.0/20170811.094300 submit/tizen_4.0/20170814.115522 submit/tizen_4.0/20170828.100002 submit/tizen_4.0_unified/20170814.115522
authorGilbok Lee <gilbok.lee@samsung.com>
Mon, 24 Jul 2017 00:35:16 +0000 (09:35 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Thu, 27 Jul 2017 07:23:03 +0000 (07:23 +0000)
[Version] 0.1.12
[Profile] Mobile, Wearable, TV
[Issue Type] Remove build dependecy

Change-Id: I591cc8b7dd96afbe6ba0ac134f22de1353e83439

CMakeLists.txt
packaging/capi-mediamuxer.spec
test/CMakeLists.txt
test/mediamuxer_test.c
test/mediamuxer_test_gst.c
test/mediamuxer_test_with_demuxer.c

index 8342a53..427c0d8 100755 (executable)
@@ -13,7 +13,7 @@ SET(INC_PORT_CUSTOM_DIR include/port_custom)
 SET(INC_PORT_FFMPEG_DIR include/port_ffmpeg)
 INCLUDE_DIRECTORIES(${INC_DIR} ${INC_PORT_GST_DIR} ${INC_PORT_CUSTOM_DIR} ${INC_PORT_FFMPEG_DIR})
 
-SET(dependents "dlog glib-2.0 mm-common capi-media-tool iniparser gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-app-1.0 capi-media-codec capi-mediademuxer")
+SET(dependents "dlog glib-2.0 mm-common capi-media-tool iniparser gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-app-1.0")
 SET(pc_dependents "capi-base-common capi-media-tool")
 
 INCLUDE(FindPkgConfig)
index e4a9c15..e6972b4 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-mediamuxer
 Summary:    A Media Muxer library in Tizen Native API
-Version:    0.1.11
+Version:    0.1.12
 Release:    1
 Group:      Multimedia/API
 License:    Apache-2.0
@@ -11,14 +11,13 @@ BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(mm-common)
 BuildRequires:  pkgconfig(capi-base-common)
 BuildRequires:  pkgconfig(capi-media-tool)
-BuildRequires:  pkgconfig(libtbm)
 BuildRequires:  pkgconfig(gstreamer-1.0)
 BuildRequires:  pkgconfig(gstreamer-plugins-base-1.0)
 BuildRequires:  pkgconfig(gstreamer-video-1.0)
 BuildRequires:  pkgconfig(gstreamer-app-1.0)
 BuildRequires:  pkgconfig(iniparser)
-BuildRequires:  pkgconfig(capi-media-codec)
-BuildRequires:  pkgconfig(capi-mediademuxer)
+#BuildRequires:  pkgconfig(capi-media-codec)
+#BuildRequires:  pkgconfig(capi-mediademuxer)
 
 %description
 
index ba084fa..4568231 100644 (file)
@@ -7,14 +7,15 @@ INCLUDE_DIRECTORIES(../include/headers)
 link_directories(${CMAKE_SOURCE_DIR}/../)
 
 INCLUDE(FindPkgConfig)
+#pkg_check_modules(${fw_test} REQUIRED capi-media-codec capi-mediademuxer)
 FOREACH(flag ${${fw_test}_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -pie")
-
-aux_source_directory(. sources)
-
+SET(source_files mediamuxer_test.c mediamuxer_test_gst.c)
+#SET(source_files mediamuxer_test.c mediamuxer_test_gst.c mediamuxer_test_with_demuxer.c mediamuxer_test_with_mediacodec.c)
+#ADD_DEFINITIONS(-DUSE_MEDIA_CODEC -DUSE_MEDIA_DEMUX)
 FOREACH(src ${sources})
     GET_FILENAME_COMPONENT(src_name ${src} NAME_WE)
     LIST(APPEND source_files "${src_name}")
index 7b4aa73..064421e 100644 (file)
 #include <mediamuxer_private.h>
 #include <media_packet_internal.h>
 #include <media_format.h>
+#ifdef USE_MEDIA_CODEC
 #include <media_codec.h>
+#endif
+#ifdef USE_MEDIA_DEMUX
 #include <mediademuxer.h>
+#endif
 
 #define DUMP_OUTBUF 1
 /*-----------------------------------------------------------------------
@@ -94,7 +98,9 @@ int channel = DEFAULT_CHANNEL;
 int bit = DEFAULT_BIT;
 unsigned char buf_adts[ADTS_HEADER_SIZE];
 uint64_t pts = 0;
+#ifdef USE_MEDIA_CODEC
 static int bitrate = DEFAULT_BITRATE;
+#endif
 int iseos_codec = 0;
 bool validate_with_codec = false;
 bool validate_multitrack = false;
@@ -230,14 +236,17 @@ int test_mediamuxer_add_track_video()
                        g_print("Add video track is invalid for wav/amr\n");
                        return 1;
                }
-
+#ifdef USE_MEDIA_CODEC
                if (validate_with_codec) {
                        media_format_set_video_width(media_format, width);
                        media_format_set_video_height(media_format, height);
                } else {
+#endif
                        media_format_set_video_width(media_format, 640);
                        media_format_set_video_height(media_format, 480);
+#ifdef USE_MEDIA_CODEC
                }
+#endif
                media_format_set_video_avg_bps(media_format, 256000);
                media_format_set_video_max_bps(media_format, 256000);
 
@@ -250,11 +259,14 @@ int test_mediamuxer_add_track_video()
                /* To add video track */
                mediamuxer_add_track(myMuxer, media_format, &track_index_vid);
                g_print("Video Track index is returned : %d\n", track_index_vid);
-       } else {
+       }
+#ifdef USE_MEDIA_DEMUX
+       else {
                mediamuxer_add_track(myMuxer, media_format, &track_index_vid);
                g_print("Video Track index returned is: %d\n", track_index_vid);
                test_mediademuxer_select_track(demuxer_index_vid);
        }
+#endif
        return 0;
 }
 
@@ -292,6 +304,7 @@ int test_mediamuxer_add_track_audio()
                                g_print("Problem during media_format_set_audio_mime operation for aac-adts audio\n");
                }
 
+#ifdef USE_MEDIA_CODEC
                if (validate_with_codec) {
                        if (media_format_set_audio_channel(media_format_a, channel) != MEDIA_FORMAT_ERROR_NONE)
                                g_print("Problem during media_format_set_audio_channel operation\n");
@@ -299,13 +312,15 @@ int test_mediamuxer_add_track_audio()
                        media_format_set_audio_bit(media_format_a, bit);
                        media_format_set_audio_avg_bps(media_format_a, bitrate);
                } else {
+#endif
                        if (media_format_set_audio_channel(media_format_a, 2) != MEDIA_FORMAT_ERROR_NONE)
                                g_print("Problem during media_format_set_audio_channel operation\n");
                        media_format_set_audio_samplerate(media_format_a, 44100);
                        media_format_set_audio_bit(media_format_a, 16);
                        media_format_set_audio_avg_bps(media_format_a, 128000);
+#ifdef USE_MEDIA_CODEC
                }
-
+#endif
                media_format_set_audio_aac_type(media_format_a, true);
                media_format_get_audio_info(media_format_a, &mimetype, &channel, &samplerate, &bit, &avg_bps);
 
@@ -321,11 +336,14 @@ int test_mediamuxer_add_track_audio()
                        mediamuxer_add_track(myMuxer, media_format_a, &track_index_aud2);
                        g_print("Audio Multi-Track index returned is: %d\n", track_index_aud2);
                }
-       } else {
+       }
+#ifdef USE_MEDIA_DEMUX
+       else {
                mediamuxer_add_track(myMuxer, media_format_a, &track_index_aud);
                g_print("Audio Track index returned is: %d\n", track_index_aud);
                test_mediademuxer_select_track(demuxer_index_aud);
        }
+#endif
        return 0;
 }
 
@@ -375,10 +393,15 @@ int test_mediamuxer_start()
 
 int test_mediamuxer_write_sample()
 {
+#ifdef USE_MEDIA_CODEC
        if (validate_with_codec) {
                /* Test muxer with codec */
                mediacodec_process_all();
-       } else if (validate_with_demux) {
+       } else
+#endif
+#ifdef USE_MEDIA_DEMUX
+       if (validate_with_demux) {
+
                bool sel_vid = false;
                bool sel_aud = false;
                test_mediademuxer_start();
@@ -388,7 +411,9 @@ int test_mediamuxer_write_sample()
                        sel_aud = true;
                g_print("is_video: %d, is_audio: %d\n", sel_vid, sel_aud);
                test_mediademuxer_process_all(sel_vid, sel_aud);
-       } else if (strncmp(data_sink, "31", 2) == 0 || strncmp(data_sink, "wav", 3) == 0
+       } else
+#endif
+       if (strncmp(data_sink, "31", 2) == 0 || strncmp(data_sink, "wav", 3) == 0
                || strncmp(data_sink, "41", 2) == 0
                || strncmp(data_sink, "42", 2) == 0 || strncmp(data_sink, "amr", 3) == 0) {
                demux_audio();
@@ -420,8 +445,10 @@ int test_mediamuxer_resume()
 int test_mediamuxer_stop()
 {
        g_print("test_mediamuxer_stop\n");
+#ifdef USE_MEDIA_DEMUX
        if (validate_with_demux)
                test_mediademuxer_stop();
+#endif
        mediamuxer_stop(myMuxer);
        return 0;
 }
@@ -472,6 +499,7 @@ int test_mediamuxer_set_eos_cb()
        return ret;
 }
 
+#ifdef USE_MEDIA_DEMUX
 int test_mediamuxer_with_demuxer_prepare()
 {
        int tracks_num = 0;
@@ -505,7 +533,7 @@ int test_mediamuxer_with_demuxer_prepare()
        return 0;
 
 }
-
+#endif
 /*-----------------------------------------------------------------------
 |    TEST  FUNCTION                                                                 |
 -----------------------------------------------------------------------*/
@@ -604,7 +632,9 @@ void _interpret_main_menu(char *cmd)
                        test_mediamuxer_set_error_cb();
                } else if (strncmp(cmd, "eo", 2) == 0) {
                        test_mediamuxer_set_eos_cb();
-               } else if (validate_with_codec) {
+               }
+#ifdef USE_MEDIA_CODEC
+               else if (validate_with_codec) {
                        if (strncmp(cmd, "cv", 2) == 0)
                            g_menu_state = CURRENT_STATUS_RAW_VIDEO_FILENAME;
                        else if (strncmp(cmd, "ve", 2) == 0)
@@ -613,12 +643,17 @@ void _interpret_main_menu(char *cmd)
                            g_menu_state = CURRENT_STATUS_RAW_AUDIO_FILENAME;
                        else if (strncmp(cmd, "ae", 2) == 0)
                            g_menu_state = CURRENT_STATUS_SET_AENC_INFO;
-               } else if (validate_with_demux) {
+               }
+#endif
+#ifdef USE_MEDIA_DEMUX
+               else if (validate_with_demux) {
                        if (strncmp(cmd, "mp", 2) == 0)
                                g_menu_state = CURRENT_STATUS_FILENAME;
                        else if (strncmp(cmd, "pr", 2) == 0)
                                test_mediamuxer_with_demuxer_prepare();
-               } else {
+               }
+#endif
+               else {
                        g_print("unknown menu command. Please try again\n");
                }
        } else {
@@ -686,6 +721,7 @@ static void interpret(char *cmd)
                g_menu_state = CURRENT_STATUS_MAINMENU;
                break;
        }
+#ifdef USE_MEDIA_CODEC
        case CURRENT_STATUS_RAW_VIDEO_FILENAME: {       /* "cv" */
                use_video = 1;
                static int codecid = 0;
@@ -767,6 +803,7 @@ static void interpret(char *cmd)
                }
        }
        break;
+#endif
        case CURRENT_STATUS_FILENAME: { /* mp */
                input_filepath(cmd);
                strncpy(media_file, cmd, MAX_INPUT_SIZE - 1);
index 67143d3..808ebdf 100644 (file)
@@ -32,7 +32,6 @@
 #include <mediamuxer.h>
 #include <mediamuxer_private.h>
 #include <media_packet_internal.h>
-#include <media_codec.h>
 
 /* ---------------------------------------------------------------------
 |    GLOBAL VARIABLE DEFINITIONS:                                       |
@@ -42,6 +41,8 @@ char *sub_caps;
 bool aud_eos = 0;
 bool vid_eos = 0;
 bool text_eos = 0;
+bool aud_codec_data = false;
+bool vid_codec_data = false;
 extern int track_index_vid, track_index_aud, track_index_aud2;
 extern int track_index_text;
 extern mediamuxer_h myMuxer;
@@ -216,9 +217,46 @@ static void __audio_app_sink_callback(GstElement *sink, CustomData *data)
                        }
 
 SET_CAPS:
-                       if (media_packet_set_extra(aud_pkt, aud_caps)) {
-                               g_print("unable to set the audio codec data \n");
-                               goto ERROR2;
+                       if (!aud_codec_data) {
+                               aud_codec_data = true;
+                               /* Create the codec data and pass to _gst_copy_buf_to_media_packet() to add into the media packet */
+                               GstStructure *structure = NULL;
+                               const GValue *value = NULL;
+                               GstPad *sink_pad;
+                               GstCaps *aud_caps;
+                               GstBuffer *codec_data_buffer = NULL;
+                               sink_pad = gst_element_get_static_pad(sink, "sink");
+                               if (!sink_pad) {
+                                       g_print("fail to get audio appsink pad\n");
+                                       goto ERROR2;
+                               }
+
+                               aud_caps = gst_pad_get_current_caps(sink_pad);
+                               structure = gst_caps_get_structure(aud_caps, 0);
+                               /* get codec data from caps*/
+                               value = gst_structure_get_value(structure, "codec_data");
+                               if (value)
+                                       codec_data_buffer = gst_value_get_buffer(value);
+
+                               if (codec_data_buffer) {
+                                       GstMapInfo codec_data_map;
+                                       if (!gst_buffer_map(codec_data_buffer, &codec_data_map, GST_MAP_READ)) {
+                                               g_print("codec data buffer map failed\n");
+                                               goto ERROR2;
+                                       }
+                                       if (media_packet_set_codec_data(aud_pkt, (void *)codec_data_map.data,
+                                               (unsigned int)codec_data_map.size)) {
+                                               g_print("unable to set the codec data\n");
+                                               gst_buffer_unmap(codec_data_buffer, &codec_data_map);
+                                               goto ERROR2;
+                                       }
+                                       gst_buffer_unmap(codec_data_buffer, &codec_data_map);
+
+                                       media_buffer_flags_e flags;
+                                       media_packet_get_flags(aud_pkt, &flags);
+                                       media_packet_set_flags(aud_pkt, flags | MEDIA_PACKET_CODEC_CONFIG);
+                               }
+                               gst_caps_unref(aud_caps);
                        }
 
                        /* Print count and size to indicate a received buffer */
@@ -374,6 +412,48 @@ static void __video_app_sink_callback(GstElement *sink, CustomData *data)
                                goto ERROR3;
                        }
 
+                       if (!vid_codec_data) {
+                               vid_codec_data = true;
+                               /* Create the codec data and pass to _gst_copy_buf_to_media_packet() to add into the media packet */
+                               GstStructure *structure = NULL;
+                               const GValue *value = NULL;
+                               GstPad *sink_pad;
+                               GstCaps *vid_caps;
+                               GstBuffer *codec_data_buffer = NULL;
+                               sink_pad = gst_element_get_static_pad(sink, "sink");
+                               if (!sink_pad) {
+                                       g_print("fail to get audio appsink pad\n");
+                                       goto ERROR2;
+                               }
+
+                               vid_caps = gst_pad_get_current_caps(sink_pad);
+                               structure = gst_caps_get_structure(vid_caps, 0);
+                               /* get codec data from caps*/
+                               value = gst_structure_get_value(structure, "codec_data");
+                               if (value)
+                                       codec_data_buffer = gst_value_get_buffer(value);
+
+                               if (codec_data_buffer) {
+                                       GstMapInfo codec_data_map;
+                                       if (!gst_buffer_map(codec_data_buffer, &codec_data_map, GST_MAP_READ)) {
+                                               g_print("codec data buffer map failed\n");
+                                               goto ERROR2;
+                                       }
+                                       if (media_packet_set_codec_data(vid_pkt, (void *)codec_data_map.data,
+                                               (unsigned int)codec_data_map.size)) {
+                                               g_print("unable to set the codec data\n");
+                                               gst_buffer_unmap(codec_data_buffer, &codec_data_map);
+                                               goto ERROR2;
+                                       }
+                                       gst_buffer_unmap(codec_data_buffer, &codec_data_map);
+
+                                       media_buffer_flags_e flags;
+                                       media_packet_get_flags(vid_pkt, &flags);
+                                       media_packet_set_flags(vid_pkt, flags | MEDIA_PACKET_CODEC_CONFIG);
+                               }
+                               gst_caps_unref(vid_caps);
+                       }
+
                        /* Print count and size to indicate a received buffer */
                        g_print("Received video buffer count : %4d (size : %5"PRIu64", pts : %12"PRIu64")\n",
                                        ++count, ns, buffer->pts);
index 5ac1c0f..a591f77 100644 (file)
@@ -270,5 +270,3 @@ void test_mediademuxer_process_all(bool is_video, bool is_audio)
 
        return;
 }
-
-