From 7cfc885def87e5c0a8cfdcc7b27326778a92f927 Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Tue, 28 Feb 2017 14:28:42 +0900 Subject: [PATCH 01/16] Fixed for correct framerate setting [Version] 0.1.17 [Profile] Mobile, Wearable, TV [Issue Type] Fix bugs Change-Id: I25bbcd2e6b12dc2c41099d79b914d57f16c0faaf --- packaging/capi-mediademuxer.spec | 2 +- src/port_gst/mediademuxer_port_gst.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packaging/capi-mediademuxer.spec b/packaging/capi-mediademuxer.spec index 4265b1d..4f0c60e 100755 --- a/packaging/capi-mediademuxer.spec +++ b/packaging/capi-mediademuxer.spec @@ -1,6 +1,6 @@ Name: capi-mediademuxer Summary: A Media Demuxer library in Tizen Native API -Version: 0.1.16 +Version: 0.1.17 Release: 1 Group: Multimedia/API License: Apache-2.0 diff --git a/src/port_gst/mediademuxer_port_gst.c b/src/port_gst/mediademuxer_port_gst.c index 54cc18a..b695807 100755 --- a/src/port_gst/mediademuxer_port_gst.c +++ b/src/port_gst/mediademuxer_port_gst.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -1161,6 +1162,7 @@ int _set_mime_video(media_format_h format, track *head) int src_height; int frame_rate_numerator = 0; int frame_rate_denominator = 0; + int frame_rate = 0; media_format_mimetype_e mime_type = MEDIA_FORMAT_MAX; struc = gst_caps_get_structure(head->caps, 0); if (!struc) { @@ -1192,7 +1194,13 @@ int _set_mime_video(media_format_h format, track *head) goto ERROR; } gst_structure_get_fraction(struc, "framerate", &frame_rate_numerator, &frame_rate_denominator); - if (media_format_set_video_frame_rate(format, frame_rate_numerator)) { + + /* Round off the framerate */ + if (frame_rate_denominator) + frame_rate = (int)floor((frame_rate_numerator / frame_rate_denominator) + 0.5); + + MD_I("set frame rate %d", frame_rate); + if (media_format_set_video_frame_rate(format, frame_rate)) { MD_E("Unable to set video frame rate\n"); goto ERROR; } -- 2.7.4 From ef1507ac86a5233ee18f106a3aa0b49f907395da Mon Sep 17 00:00:00 2001 From: "juan82.liu" Date: Fri, 3 Mar 2017 01:56:12 +0800 Subject: [PATCH 02/16] Fixed mediademuxer unprepare failed issue after eos [Version] 0.1.18 [Profile] Mobile, Wearable, TV [Issue Type] Fix bugs Change-Id: I7675199b5a63994280ab6d1a8eda617237f63de3 --- packaging/capi-mediademuxer.spec | 4 ++-- src/port_gst/mediademuxer_port_gst.c | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/packaging/capi-mediademuxer.spec b/packaging/capi-mediademuxer.spec index 4f0c60e..2ee5daf 100755 --- a/packaging/capi-mediademuxer.spec +++ b/packaging/capi-mediademuxer.spec @@ -1,6 +1,6 @@ Name: capi-mediademuxer Summary: A Media Demuxer library in Tizen Native API -Version: 0.1.17 +Version: 0.1.18 Release: 1 Group: Multimedia/API License: Apache-2.0 @@ -41,7 +41,7 @@ export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE" %ifarch %{arm} export CFLAGS="$CFLAGS -DENABLE_FFMPEG_CODEC" %endif -export CFLAGS="$CFLAGS -DSYSCONFDIR=\\\"%{_sysconfdir}\\\" " +export CFLAGS="$CFLAGS -DSYSCONFDIR=\\\"%{_sysconfdir}\\\" -DTIZEN_FEATURE_GST_UPSTREAM" MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` %cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} diff --git a/src/port_gst/mediademuxer_port_gst.c b/src/port_gst/mediademuxer_port_gst.c index b695807..2d0e2b7 100755 --- a/src/port_gst/mediademuxer_port_gst.c +++ b/src/port_gst/mediademuxer_port_gst.c @@ -459,6 +459,7 @@ int __gst_add_track_info(GstPad *pad, GstCaps *caps, track **head, MD_E("factory not able to make appsink"); goto ERROR; } + g_object_set(G_OBJECT(temp->appsink), "wait-on-eos", TRUE, NULL); if (!gst_bin_add(GST_BIN(pipeline), temp->appsink)) { gst_object_unref(temp->appsink); @@ -1020,6 +1021,7 @@ int _gst_set_appsink(track *temp, int index, int loop) } gst_app_sink_set_max_buffers((GstAppSink *)(temp->appsink), (guint) MAX_APP_BUFFER); gst_app_sink_set_drop((GstAppSink *)(temp->appsink), false); + gst_app_sink_set_wait_on_eos((GstAppSink *)(temp->appsink), true); MEDIADEMUXER_FLEAVE(); return ret; } @@ -1693,6 +1695,7 @@ int _gst_unset_appsink(track *temp, int index, int loop) } gst_app_sink_set_max_buffers((GstAppSink *)(temp->appsink), (guint)0); gst_app_sink_set_drop((GstAppSink *)(temp->appsink), true); + gst_app_sink_set_wait_on_eos((GstAppSink *)(temp->appsink), false); MEDIADEMUXER_FLEAVE(); return ret; } @@ -1778,6 +1781,25 @@ static int gst_demuxer_unprepare(MMHandleType pHandle) MEDIADEMUXER_CHECK_NULL(pHandle); mdgst_handle_t *gst_handle = (mdgst_handle_t *)pHandle; + /*Modification : Fix pipeline state change was block by appsink When EOS received and appsink also has many datas*/ + int indx = 0; + track *atrack = gst_handle->info.head; + while (atrack) { + if ((gst_handle->selected_tracks)[indx] == false) { + MD_I("Track [%d] Not selected\n", indx); + } else { + MD_I("Track [%d] to unset appsink...\n", indx); + gst_demuxer_unset_track(pHandle, indx); + } + if (atrack->next) { + track *next = atrack->next; + atrack = next; + } else { + break; + } + indx++; + } + _gst_clear_struct(gst_handle); if (gst_handle->bus_watch_id) { GSource *source = NULL; -- 2.7.4 From 82c9bf7ffd47ba3747f927f7c247283407526953 Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Wed, 22 Mar 2017 16:27:09 +0900 Subject: [PATCH 03/16] Use %license macro to copy license Change-Id: I2e554923002516bbf52ed7c007a60523f4e7f61d --- packaging/capi-mediademuxer.spec | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packaging/capi-mediademuxer.spec b/packaging/capi-mediademuxer.spec index 2ee5daf..5b420d8 100755 --- a/packaging/capi-mediademuxer.spec +++ b/packaging/capi-mediademuxer.spec @@ -51,10 +51,8 @@ make %{?jobs:-j%jobs} %install rm -rf %{buildroot} -mkdir -p %{buildroot}%{_datadir}/license -mkdir -p %{buildroot}/usr/bin -cp test/mediademuxer_test %{buildroot}/usr/bin -cp LICENSE.APLv2 %{buildroot}%{_datadir}/license/%{name} +mkdir -p %{buildroot}%{_bindir} +cp test/mediademuxer_test %{buildroot}%{_bindir} %make_install @@ -67,7 +65,7 @@ cp LICENSE.APLv2 %{buildroot}%{_datadir}/license/%{name} %files %manifest capi-mediademuxer.manifest %{_libdir}/libcapi-mediademuxer.so.* -%{_datadir}/license/%{name} +%license LICENSE.APLv2 %{_bindir}/* %files devel -- 2.7.4 From dbd653b6aaeee277ed3c6ffd6f940413c49a2489 Mon Sep 17 00:00:00 2001 From: "juan82.liu" Date: Tue, 28 Mar 2017 01:22:57 +0800 Subject: [PATCH 04/16] Patch to only send one seek event for the pipeline [Version] 0.1.19 [Profile] Mobile, Wearable, TV [Issue Type] Fix bugs Change-Id: I4fa0af2debcbeccc59cbb17e9a57c2e1e3ba08e8 --- packaging/capi-mediademuxer.spec | 2 +- src/port_gst/mediademuxer_port_gst.c | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/packaging/capi-mediademuxer.spec b/packaging/capi-mediademuxer.spec index 2ee5daf..b39adf5 100755 --- a/packaging/capi-mediademuxer.spec +++ b/packaging/capi-mediademuxer.spec @@ -1,6 +1,6 @@ Name: capi-mediademuxer Summary: A Media Demuxer library in Tizen Native API -Version: 0.1.18 +Version: 0.1.19 Release: 1 Group: Multimedia/API License: Apache-2.0 diff --git a/src/port_gst/mediademuxer_port_gst.c b/src/port_gst/mediademuxer_port_gst.c index 2d0e2b7..61be3e3 100755 --- a/src/port_gst/mediademuxer_port_gst.c +++ b/src/port_gst/mediademuxer_port_gst.c @@ -1627,6 +1627,7 @@ static int gst_demuxer_seek(MMHandleType pHandle, gint64 pos1) track *temp = head_track->head; track *temp_track = head_track->head; int indx = 0; + bool is_seek = FALSE; /* Setting each appsink to paused state before seek */ while (temp_track) { @@ -1652,20 +1653,23 @@ static int gst_demuxer_seek(MMHandleType pHandle, gint64 pos1) indx = 0; while (temp) { - MD_I("Got one element %p\n", temp->appsink); + MD_I("Got one element %p {%s}\n", temp->appsink, GST_ELEMENT_NAME(temp->appsink)); if (gst_handle->selected_tracks[indx] == true) { temp->need_codec_data = TRUE; - if (!gst_element_seek(temp->appsink, rate, GST_FORMAT_TIME, - GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT | GST_SEEK_FLAG_SNAP_BEFORE, - GST_SEEK_TYPE_SET, pos, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE)) { - MD_E("Seek failed!\n"); - goto ERROR; - } else { - MD_I("Seek success...setting appsink to playing state\n"); - if (gst_element_set_state(temp->appsink, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { - MD_E("Failed to set into PLAYING state"); + + if (!is_seek) { + if (!gst_element_seek(temp->appsink, rate, GST_FORMAT_TIME, + GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT | GST_SEEK_FLAG_SNAP_BEFORE, + GST_SEEK_TYPE_SET, pos, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE)) { + MD_E("Seek failed!\n"); goto ERROR; } + is_seek = TRUE; + } + MD_I("Seek success...setting appsink to playing state\n"); + if (gst_element_set_state(temp->appsink, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { + MD_E("Failed to set into PLAYING state"); + goto ERROR; } } indx++; @@ -1676,6 +1680,7 @@ static int gst_demuxer_seek(MMHandleType pHandle, gint64 pos1) temp = NULL; } } + MEDIADEMUXER_FLEAVE(); return MD_ERROR_NONE; ERROR: -- 2.7.4 From 0bcadd24f28fae22ef764a365b89f152ebef054c Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Thu, 29 Jun 2017 20:36:25 +0900 Subject: [PATCH 05/16] Change the way to check mediademuxer prepared [Version] 0.1.20 [Profile] Mobile, Wearable, TV [Issue Type] Fix bugs Change-Id: I8238a4d19cf4a9b6fa49660e405b617875ecfc92 --- packaging/capi-mediademuxer.spec | 2 +- src/port_gst/mediademuxer_port_gst.c | 27 +++++++++++++++++---------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/packaging/capi-mediademuxer.spec b/packaging/capi-mediademuxer.spec index 1bafe37..add2edf 100755 --- a/packaging/capi-mediademuxer.spec +++ b/packaging/capi-mediademuxer.spec @@ -1,6 +1,6 @@ Name: capi-mediademuxer Summary: A Media Demuxer library in Tizen Native API -Version: 0.1.19 +Version: 0.1.20 Release: 1 Group: Multimedia/API License: Apache-2.0 diff --git a/src/port_gst/mediademuxer_port_gst.c b/src/port_gst/mediademuxer_port_gst.c index 61be3e3..4538aa4 100755 --- a/src/port_gst/mediademuxer_port_gst.c +++ b/src/port_gst/mediademuxer_port_gst.c @@ -881,6 +881,9 @@ static int _gst_create_pipeline(mdgst_handle_t *gst_handle, char *uri) #ifdef TIZEN_FEATURE_STREAMING int remote_streaming = 0; #endif + GstState element_state = GST_STATE_VOID_PENDING; + GstState element_pending_state = GST_STATE_VOID_PENDING; + /* Initialize GStreamer */ /* Note: Replace the arguments of gst_init to pass the command line args to GStreamer. */ gst_init(NULL, NULL); @@ -955,16 +958,20 @@ static int _gst_create_pipeline(mdgst_handle_t *gst_handle, char *uri) /* set pipeline state to PAUSED */ MEDIADEMUXER_SET_STATE(gst_handle->pipeline, GST_STATE_PAUSED, ERROR); - int count = 0; - while (gst_handle->is_prepared != true) { - count++; - usleep(POLLING_INTERVAL); - MD_I("Inside while loop\n"); - if (count > POLLING_INTERVAL) { - MD_E("Error occure\n"); - ret = MD_ERROR; - break; - } + if (gst_element_get_state(gst_handle->pipeline, &element_state, &element_pending_state, 1 * GST_SECOND) + == GST_STATE_CHANGE_FAILURE) { + MD_E(" [%s] state : %s pending : %s \n", + GST_ELEMENT_NAME(gst_handle->pipeline), + gst_element_state_get_name(element_state), + gst_element_state_get_name(element_pending_state)); + ret = MD_ERROR; + goto ERROR; + } + + if (gst_handle->is_prepared != true) { + MD_E("Error occure"); + ret = MD_ERROR; + goto ERROR; } MEDIADEMUXER_FLEAVE(); -- 2.7.4 From c2434e2ec1d1721035f63fda24a32c52bbe712c7 Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Fri, 21 Jul 2017 15:26:25 +0900 Subject: [PATCH 06/16] Fix cyclic build dependency remove capi-media-codec depency for test [Version] 0.1.21 [Profile] Mobile, Wearable, TV [Issue Type] Fix cyclic dependency Change-Id: I5fae29310ba9a8d56098a485deb890f6288186fe --- CMakeLists.txt | 3 +- packaging/capi-mediademuxer.spec | 5 +- test/mediademuxer_test.c | 190 +++++++++++++++++++++------------------ 3 files changed, 107 insertions(+), 91 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c7acfa..fa91135 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,8 @@ 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") +#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") +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) diff --git a/packaging/capi-mediademuxer.spec b/packaging/capi-mediademuxer.spec index add2edf..4b07b67 100755 --- a/packaging/capi-mediademuxer.spec +++ b/packaging/capi-mediademuxer.spec @@ -1,6 +1,6 @@ Name: capi-mediademuxer Summary: A Media Demuxer library in Tizen Native API -Version: 0.1.20 +Version: 0.1.21 Release: 1 Group: Multimedia/API License: Apache-2.0 @@ -11,8 +11,7 @@ BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(mm-common) BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(capi-media-tool) -BuildRequires: pkgconfig(capi-media-codec) -BuildRequires: pkgconfig(libtbm) +#BuildRequires: pkgconfig(capi-media-codec) BuildRequires: pkgconfig(gstreamer-1.0) BuildRequires: pkgconfig(gstreamer-plugins-base-1.0) BuildRequires: pkgconfig(gstreamer-video-1.0) diff --git a/test/mediademuxer_test.c b/test/mediademuxer_test.c index b532d60..526c6b7 100755 --- a/test/mediademuxer_test.c +++ b/test/mediademuxer_test.c @@ -29,7 +29,9 @@ #include #include #include +#ifdef USE_MEDIA_CODEC #include +#endif /*----------------------------------------------------------------------- | GLOBAL CONSTANT DEFINITIONS: | @@ -131,10 +133,13 @@ int write_amrwb_header = 0; /* write magic number for AMR-WB Header at one time #endif bool validate_with_codec = false; -mediacodec_h g_media_codec = NULL; + FILE *fp_out_codec_audio = NULL; -mediacodec_h g_media_codec_1 = NULL; FILE *fp_out_codec_video = NULL; +#ifdef USE_MEDIA_CODEC +mediacodec_h g_media_codec = NULL; +mediacodec_h g_media_codec_1 = NULL; +#endif /*----------------------------------------------------------------------- | HELPER FUNCTION | @@ -305,6 +310,7 @@ int test_mediademuxer_get_track_info() return ret; } +#ifdef USE_MEDIA_CODEC static void mediacodec_finish(mediacodec_h handle, FILE *fp) { int err = 0; @@ -397,6 +403,86 @@ static void mediacodec_process_audio_pkt(media_packet_h in_buf) } } +static void _mediacodec_fill_video_buffer_cb(media_packet_h pkt, void *user_data) +{ + int err = 0; + uint64_t buf_size = 0; + void *data = NULL; + media_packet_h output_buf; + + if (pkt != NULL) { + err = mediacodec_get_output(g_media_codec_1, &output_buf, 0); + if (err == MEDIACODEC_ERROR_NONE) { + media_packet_get_buffer_size(output_buf, &buf_size); + /* g_print("%s - output_buf size = %lld\n", __func__, buf_size); */ + media_packet_get_buffer_data_ptr(output_buf, &data); + if (data != NULL) + fwrite(data, 1, buf_size, fp_out_codec_video); + else + g_print("Data is null inside _mediacodec_fill_video_buffer_cb\n"); + media_packet_destroy(output_buf); + } else { + g_print("mediacodec_get_output failed inside _mediacodec_fill_video_buffer_cb lerr = %d\n", err); + return; + } + } else { + g_print("video pkt from mediacodec is null\n"); + } + return; +} + +static void mediacodec_init_video(int codecid, int flag, int width, int height) +{ + /* This file will be used to dump the data */ + fp_out_codec_video = fopen("/opt/usr/codec_dump_video.out", "wb"); + g_print("Create dumped file as codec_dump_video.out\n"); + + if (g_media_codec_1 != NULL) { + mediacodec_unprepare(g_media_codec_1); + mediacodec_destroy(g_media_codec_1); + g_media_codec_1 = NULL; + } + if (mediacodec_create(&g_media_codec_1) != MEDIACODEC_ERROR_NONE) { + g_print("mediacodec_create is failed\n"); + return; + } + /* Now set the code info */ + if ((mediacodec_set_codec(g_media_codec_1, (mediacodec_codec_type_e)codecid, + (mediacodec_support_type_e)flag) != MEDIACODEC_ERROR_NONE)) { + g_print("mediacodec_set_codec is failed\n"); + return; + } + /* set the video dec info */ + if ((mediacodec_set_vdec_info(g_media_codec_1, width, height)) != MEDIACODEC_ERROR_NONE) { + g_print("mediacodec_set_vdec is failed\n"); + return; + } + /* Set the callback for output data, which will be used to write the data to file */ + mediacodec_set_output_buffer_available_cb(g_media_codec_1, + _mediacodec_fill_video_buffer_cb, + g_media_codec_1); + + if (MEDIACODEC_ERROR_NONE != mediacodec_prepare(g_media_codec_1)) { + g_print("mediacodec_prepare is failed\n"); + return; + } +} + +static void mediacodec_process_video_pkt(media_packet_h in_buf) +{ + if (g_media_codec_1 != NULL) { + /* process the media packet */ + if (MEDIACODEC_ERROR_NONE != mediacodec_process_input(g_media_codec_1, in_buf, 0)) { + g_print("mediacodec process input is failed inside mediacodec_process_video_pkt\n"); + return; + } + } else { + g_print("mediacodec handle is invalid inside mediacodec_process_video_pkt()\n"); + } +} + +#endif + void *_fetch_audio_data(void *ptr) { int ret = MEDIADEMUXER_ERROR_NONE; @@ -413,6 +499,7 @@ void *_fetch_audio_data(void *ptr) *status = -1; g_print("Audio Data function\n"); +#ifdef USE_MEDIA_CODEC if (validate_with_codec) { int flag = 0; if (a_mime == MEDIA_FORMAT_AAC_LC || a_mime == MEDIA_FORMAT_AAC_HE || @@ -445,7 +532,7 @@ void *_fetch_audio_data(void *ptr) return (void *)status; } } - +#endif while (1) { ret = mediademuxer_read_sample(demuxer, aud_track, &audbuf); if (ret != MEDIADEMUXER_ERROR_NONE) { @@ -484,97 +571,23 @@ void *_fetch_audio_data(void *ptr) } #endif +#ifdef USE_MEDIA_CODEC if (validate_with_codec) mediacodec_process_audio_pkt(audbuf); else +#endif media_packet_destroy(audbuf); } g_print("EOS return of mediademuxer_read_sample() for audio\n"); *status = 0; +#ifdef USE_MEDIA_CODEC if (validate_with_codec) mediacodec_finish(g_media_codec, fp_out_codec_audio); +#endif return (void *)status; } -static void _mediacodec_fill_video_buffer_cb(media_packet_h pkt, void *user_data) -{ - int err = 0; - uint64_t buf_size = 0; - void *data = NULL; - media_packet_h output_buf; - - if (pkt != NULL) { - err = mediacodec_get_output(g_media_codec_1, &output_buf, 0); - if (err == MEDIACODEC_ERROR_NONE) { - media_packet_get_buffer_size(output_buf, &buf_size); - /* g_print("%s - output_buf size = %lld\n", __func__, buf_size); */ - media_packet_get_buffer_data_ptr(output_buf, &data); - if (data != NULL) - fwrite(data, 1, buf_size, fp_out_codec_video); - else - g_print("Data is null inside _mediacodec_fill_video_buffer_cb\n"); - media_packet_destroy(output_buf); - } else { - g_print("mediacodec_get_output failed inside _mediacodec_fill_video_buffer_cb lerr = %d\n", err); - return; - } - } else { - g_print("video pkt from mediacodec is null\n"); - } - return; -} - -static void mediacodec_init_video(int codecid, int flag, int width, int height) -{ - /* This file will be used to dump the data */ - fp_out_codec_video = fopen("/opt/usr/codec_dump_video.out", "wb"); - g_print("Create dumped file as codec_dump_video.out\n"); - - if (g_media_codec_1 != NULL) { - mediacodec_unprepare(g_media_codec_1); - mediacodec_destroy(g_media_codec_1); - g_media_codec_1 = NULL; - } - if (mediacodec_create(&g_media_codec_1) != MEDIACODEC_ERROR_NONE) { - g_print("mediacodec_create is failed\n"); - return; - } - /* Now set the code info */ - if ((mediacodec_set_codec(g_media_codec_1, (mediacodec_codec_type_e)codecid, - (mediacodec_support_type_e)flag) != MEDIACODEC_ERROR_NONE)) { - g_print("mediacodec_set_codec is failed\n"); - return; - } - /* set the video dec info */ - if ((mediacodec_set_vdec_info(g_media_codec_1, width, height)) != MEDIACODEC_ERROR_NONE) { - g_print("mediacodec_set_vdec is failed\n"); - return; - } - /* Set the callback for output data, which will be used to write the data to file */ - mediacodec_set_output_buffer_available_cb(g_media_codec_1, - _mediacodec_fill_video_buffer_cb, - g_media_codec_1); - - if (MEDIACODEC_ERROR_NONE != mediacodec_prepare(g_media_codec_1)) { - g_print("mediacodec_prepare is failed\n"); - return; - } -} - -static void mediacodec_process_video_pkt(media_packet_h in_buf) -{ - if (g_media_codec_1 != NULL) { - /* process the media packet */ - if (MEDIACODEC_ERROR_NONE != mediacodec_process_input(g_media_codec_1, in_buf, 0)) { - g_print("mediacodec process input is failed inside mediacodec_process_video_pkt\n"); - return; - } - } else { - g_print("mediacodec handle is invalid inside mediacodec_process_video_pkt()\n"); - } -} - #if 0 static void _local_media_packet_get_codec_data(media_packet_h pkt) { @@ -610,6 +623,7 @@ void *_fetch_video_data(void *ptr) *status = -1; g_print("Video Data function\n"); +#ifdef USE_MEDIA_CODEC if (validate_with_codec) { int flag = 0; if (v_mime == MEDIA_FORMAT_H264_SP || v_mime == MEDIA_FORMAT_H264_MP || @@ -626,6 +640,7 @@ void *_fetch_video_data(void *ptr) return (void *)status; } } +#endif while (1) { ret = mediademuxer_read_sample(demuxer, vid_track, &vidbuf); if (ret != MEDIADEMUXER_ERROR_NONE) { @@ -651,16 +666,20 @@ void *_fetch_video_data(void *ptr) } #endif +#ifdef USE_MEDIA_CODEC if (validate_with_codec) mediacodec_process_video_pkt(vidbuf); else +#endif media_packet_destroy(vidbuf); } g_print("EOS return of mediademuxer_read_sample() for video\n"); *status = 0; + +#ifdef USE_MEDIA_CODEC if (validate_with_codec) mediacodec_finish(g_media_codec_1, fp_out_codec_video); - +#endif return (void *)status; } @@ -903,9 +922,11 @@ static void display_sub_basic() g_print("d. Destroy \t"); g_print("q. Quit \n"); g_print("---------------------------------------------------------------------------\n"); +#ifdef USE_MEDIA_CODEC if (validate_with_codec) g_print("[Validation with Media codec]\n"); else +#endif g_print("[validation as stand alone. To validate with media codec, run mediademuxertest with -c option]\n"); } @@ -1046,11 +1067,6 @@ static void interpret(char *cmd) test_mediademuxer_is_encrypted(); else g_print("UNKNOW COMMAND\n"); - } else if (len == 2) { - if (strncmp(cmd, "10", len) == 0) - g_print("UNKNOW COMMAND\n"); - else - g_print("UNKNOW COMMAND\n"); } else { g_print("UNKNOW COMMAND\n"); } -- 2.7.4 From 664b8e39ac81798d9033a0e300ea6181ac357016 Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Tue, 8 Aug 2017 15:11:27 +0900 Subject: [PATCH 07/16] Change fuction set_state to set_state_with_parent in have-type callback sometimes state hang during demux state shange [Version] 0.1.22 [Profile] Mobile, Wearable, TV [Issue Type] Fix bugs Change-Id: Ib5256c4d381dac72c34b1bba33ff02f7ced05941 --- include/port_gst/mediademuxer_port_gst.h | 9 +++++++++ packaging/capi-mediademuxer.spec | 2 +- src/port_gst/mediademuxer_port_gst.c | 26 +++++++++++++++++--------- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/include/port_gst/mediademuxer_port_gst.h b/include/port_gst/mediademuxer_port_gst.h index 9737be4..c784b81 100755 --- a/include/port_gst/mediademuxer_port_gst.h +++ b/include/port_gst/mediademuxer_port_gst.h @@ -42,6 +42,15 @@ extern "C" { } \ } while (0) +#define MEDIADEMUXER_SYNC_STATE_WITH_PARENT(x_element, error) \ + do { \ + MD_I("Sync state with parent [%s]\n", GST_ELEMENT_NAME(x_element)); \ + if (GST_STATE_CHANGE_FAILURE == gst_element_sync_state_with_parent(x_element)) { \ + MD_E("failed to sync %s state with parent\n", GST_ELEMENT_NAME(x_element)); \ + goto error; \ + } \ + } while (0) + #define MEDIADEMUXER_LINK_PAD(srcpad, sinkpad, error) \ do { \ if (GST_PAD_LINK_OK != gst_pad_link(srcpad, sinkpad)) { \ diff --git a/packaging/capi-mediademuxer.spec b/packaging/capi-mediademuxer.spec index 4b07b67..1d022c6 100755 --- a/packaging/capi-mediademuxer.spec +++ b/packaging/capi-mediademuxer.spec @@ -1,6 +1,6 @@ Name: capi-mediademuxer Summary: A Media Demuxer library in Tizen Native API -Version: 0.1.21 +Version: 0.1.22 Release: 1 Group: Multimedia/API License: Apache-2.0 diff --git a/src/port_gst/mediademuxer_port_gst.c b/src/port_gst/mediademuxer_port_gst.c index 4538aa4..3cc57aa 100755 --- a/src/port_gst/mediademuxer_port_gst.c +++ b/src/port_gst/mediademuxer_port_gst.c @@ -451,8 +451,8 @@ int __gst_add_track_info(GstPad *pad, GstCaps *caps, track **head, goto ERROR; } - MEDIADEMUXER_SET_STATE(temp->queue, GST_STATE_PAUSED, ERROR); MEDIADEMUXER_LINK_PAD(pad, queue_sink_pad, ERROR); + MEDIADEMUXER_SYNC_STATE_WITH_PARENT(temp->queue, ERROR); temp->appsink = gst_element_factory_make("appsink", NULL); if (!temp->appsink) { @@ -470,7 +470,6 @@ int __gst_add_track_info(GstPad *pad, GstCaps *caps, track **head, gst_app_sink_set_max_buffers((GstAppSink *) temp->appsink, (guint) 0); gst_app_sink_set_drop((GstAppSink *) temp->appsink, true); - MEDIADEMUXER_SET_STATE(temp->appsink, GST_STATE_PAUSED, ERROR); queue_src_pad = gst_element_get_static_pad(temp->queue, "src"); if (!queue_src_pad) { @@ -511,10 +510,11 @@ int __gst_add_track_info(GstPad *pad, GstCaps *caps, track **head, MD_E("sink pad of video parse(%s) not available", GST_ELEMENT_NAME(parse_element)); goto ERROR; } - MEDIADEMUXER_SET_STATE(parse_element, GST_STATE_PAUSED, ERROR); /* Link demuxer pad with sink pad of parse element */ MEDIADEMUXER_LINK_PAD(queue_src_pad, parse_sink_pad, ERROR); + MEDIADEMUXER_SYNC_STATE_WITH_PARENT(parse_element, ERROR); + if (strstr(temp->caps_string, "h264")) { outcaps = gst_caps_new_simple("video/x-h264", "stream-format", G_TYPE_STRING, "byte-stream", NULL); gst_element_link_filtered(parse_element, temp->appsink, outcaps); @@ -564,7 +564,7 @@ int __gst_add_track_info(GstPad *pad, GstCaps *caps, track **head, goto ERROR; } MEDIADEMUXER_LINK_PAD(queue_src_pad, id3_sinkpad, ERROR); - MEDIADEMUXER_SET_STATE(id3tag, GST_STATE_PAUSED, ERROR); + MEDIADEMUXER_SYNC_STATE_WITH_PARENT(id3tag, ERROR); id3_srcpad = gst_element_get_static_pad(id3tag, "src"); if (!id3_srcpad) { MD_E("fail to get id3demux src pad.\n"); @@ -608,7 +608,6 @@ int __gst_add_track_info(GstPad *pad, GstCaps *caps, track **head, MD_E("sink pad of audio parse(%s) not available", GST_ELEMENT_NAME(parse_element)); goto ERROR; } - MEDIADEMUXER_SET_STATE(parse_element, GST_STATE_PAUSED, ERROR); /* Link demuxer pad with sink pad of parse element */ if (id3tag) @@ -616,6 +615,8 @@ int __gst_add_track_info(GstPad *pad, GstCaps *caps, track **head, else MEDIADEMUXER_LINK_PAD(queue_src_pad, parse_sink_pad, ERROR); + MEDIADEMUXER_SYNC_STATE_WITH_PARENT(parse_element, ERROR); + /* Link src pad with appSink element */ gst_element_link(parse_element, temp->appsink); } else { @@ -624,6 +625,8 @@ int __gst_add_track_info(GstPad *pad, GstCaps *caps, track **head, } else { MEDIADEMUXER_LINK_PAD(queue_src_pad, apppad, ERROR); } + + MEDIADEMUXER_SYNC_STATE_WITH_PARENT(temp->appsink, ERROR); /* gst_pad_link(pad, fpad) */ if (*head == NULL) { *head = temp; @@ -797,8 +800,13 @@ static void __gst_cb_typefind(GstElement *tf, guint probability, G_CALLBACK(__gst_on_pad_added), gst_handle); g_signal_connect(gst_handle->demux, "no-more-pads", G_CALLBACK(__gst_no_more_pad), gst_handle); - gst_bin_add_many(GST_BIN(gst_handle->pipeline), - gst_handle->demux, NULL); + if (!gst_bin_add(GST_BIN(gst_handle->pipeline), gst_handle->demux)) { + gst_object_unref(gst_handle->demux); + MD_E("fail add demuxer(%s) in pipeline", + GST_ELEMENT_NAME(gst_handle->demux)); + goto ERROR; + } + pad = gst_element_get_static_pad(gst_handle->typefind, "src"); if (!pad) { MD_E("fail to get typefind src pad.\n"); @@ -816,8 +824,8 @@ static void __gst_cb_typefind(GstElement *tf, guint probability, } gst_pad_unlink(pad, fake_pad); MEDIADEMUXER_LINK_PAD(pad, demuxer_pad, ERROR); - MEDIADEMUXER_SET_STATE(gst_handle->demux, - GST_STATE_PAUSED, ERROR); + + MEDIADEMUXER_SYNC_STATE_WITH_PARENT(gst_handle->demux, ERROR); if (pad) gst_object_unref(pad); if (demuxer_pad) -- 2.7.4 From d3d5f40fbc8a5b1710e7e56a351c03d84ae3d93c Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Wed, 30 Aug 2017 16:14:30 +0900 Subject: [PATCH 08/16] Add element lock state for prevent deadlock Add handle NULL check [Version] 0.1.23 [Profile] Mobile, Wearable, TV [Issue Type] Fix bugs Change-Id: Id9ee77adba954eadee1d7a85633763403b8ff4f5 --- include/mediademuxer_util.h | 8 ++ packaging/capi-mediademuxer.spec | 2 +- src/port_gst/mediademuxer_port_gst.c | 185 +++++++++++++++++++---------------- 3 files changed, 110 insertions(+), 85 deletions(-) diff --git a/include/mediademuxer_util.h b/include/mediademuxer_util.h index 01c0670..93c7a58 100755 --- a/include/mediademuxer_util.h +++ b/include/mediademuxer_util.h @@ -84,6 +84,14 @@ extern "C" { } \ } while (0) +#define MEDIADEMUXER_CHECK_NULL_VOID(x_var) \ + do { \ + if (!x_var) { \ + MD_E("[%s] is NULL\n", #x_var); \ + return; \ + } \ + } while (0) + #define MEDIADEMUXER_CHECK_SET_AND_PRINT(x_var, x_cond, ret, ret_val, err_text) \ do { \ if (x_var != x_cond) { \ diff --git a/packaging/capi-mediademuxer.spec b/packaging/capi-mediademuxer.spec index 1d022c6..94b2671 100755 --- a/packaging/capi-mediademuxer.spec +++ b/packaging/capi-mediademuxer.spec @@ -1,6 +1,6 @@ Name: capi-mediademuxer Summary: A Media Demuxer library in Tizen Native API -Version: 0.1.22 +Version: 0.1.23 Release: 1 Group: Multimedia/API License: Apache-2.0 diff --git a/src/port_gst/mediademuxer_port_gst.c b/src/port_gst/mediademuxer_port_gst.c index 3cc57aa..4076551 100755 --- a/src/port_gst/mediademuxer_port_gst.c +++ b/src/port_gst/mediademuxer_port_gst.c @@ -333,6 +333,7 @@ static void __gst_no_more_pad(GstElement *element, gpointer data) int loop_track; track_info *head_track = &(gst_handle->info); track *head = head_track->head; + MEDIADEMUXER_CHECK_NULL_VOID(gst_handle); gst_handle->selected_tracks = (bool *) g_malloc(sizeof(bool) * (gst_handle->total_tracks)); MD_I("Allocating %p to core->selected_tracks \n", gst_handle->selected_tracks); @@ -677,7 +678,9 @@ static void __gst_on_pad_added(GstElement *element, GstPad *pad, gpointer data) track *tmp = NULL; mdgst_handle_t *gst_handle = (mdgst_handle_t *)data; track_info *head_track = &(gst_handle->info); - GstCaps *caps = gst_pad_get_current_caps(pad); + GstCaps *caps = NULL; + MEDIADEMUXER_CHECK_NULL_VOID(gst_handle); + caps = gst_pad_get_current_caps(pad); if (!caps) { MD_E("caps is NULL"); return; @@ -775,101 +778,114 @@ static void __gst_cb_typefind(GstElement *tf, guint probability, GstPad *pad = NULL; GstPad *demuxer_pad = NULL; GstPad *fake_pad = NULL; - gchar *type; + gchar *type = NULL; + MEDIADEMUXER_CHECK_NULL_VOID(gst_handle); 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")) || strstr(type, "x-3gp") - || strstr(type, "ogg") || strstr(type, "flv") || strstr(type, "x-msvideo")) { - gst_handle->is_valid_container = true; - if (strstr(type, "ogg")) - gst_handle->demux = gst_element_factory_make("oggdemux", NULL); - else if (strstr(type, "flv")) - gst_handle->demux = gst_element_factory_make("flvdemux", NULL); - else if (strstr(type, "x-msvideo")) - gst_handle->demux = gst_element_factory_make("avidemux", NULL); - else - gst_handle->demux = gst_element_factory_make("qtdemux", NULL); - if (!gst_handle->demux) { - gst_handle->is_valid_container = false; - MD_E("factory not able to create qtdemux\n"); - goto ERROR; - } else { - g_signal_connect(gst_handle->demux, "pad-added", - G_CALLBACK(__gst_on_pad_added), gst_handle); - g_signal_connect(gst_handle->demux, "no-more-pads", - G_CALLBACK(__gst_no_more_pad), gst_handle); - if (!gst_bin_add(GST_BIN(gst_handle->pipeline), gst_handle->demux)) { - gst_object_unref(gst_handle->demux); - MD_E("fail add demuxer(%s) in pipeline", - GST_ELEMENT_NAME(gst_handle->demux)); - goto ERROR; - } + if (!type) { + MD_E("Fail to get caps string"); + goto ERROR; + } - pad = gst_element_get_static_pad(gst_handle->typefind, "src"); - if (!pad) { - MD_E("fail to get typefind src pad.\n"); - goto ERROR; - } - demuxer_pad = gst_element_get_static_pad(gst_handle->demux, "sink"); - if (!demuxer_pad) { - MD_E("fail to get qtdemuc sink pad.\n"); - goto ERROR; - } - fake_pad = gst_element_get_static_pad(gst_handle->fakesink, "sink"); - if (!fake_pad) { - MD_E("fail to get fakesink sink pad.\n"); - goto ERROR; - } - gst_pad_unlink(pad, fake_pad); - MEDIADEMUXER_LINK_PAD(pad, demuxer_pad, ERROR); - - MEDIADEMUXER_SYNC_STATE_WITH_PARENT(gst_handle->demux, ERROR); - if (pad) - gst_object_unref(pad); - if (demuxer_pad) - gst_object_unref(demuxer_pad); - if (fake_pad) - gst_object_unref(fake_pad); - } - } 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"))) { - MD_I("Audio only format is found\n"); - pad = gst_element_get_static_pad(gst_handle->typefind, "src"); - if (!pad) { - MD_E("fail to get typefind src pad.\n"); - goto ERROR; - } - fake_pad = gst_element_get_static_pad(gst_handle->fakesink, "sink"); - if (!fake_pad) { - MD_E("fail to get fakesink sink pad.\n"); - goto ERROR; - } - gst_pad_unlink(pad, fake_pad); - if (pad) - gst_object_unref(pad); - if (fake_pad) - gst_object_unref(fake_pad); + MD_I("Media type %s found, probability %d%%\n", type, probability); + if (strstr(type, "quicktime") || strstr(type, "audio/x-m4a") || + strstr(type, "x-3gp") || strstr(type, "ogg") || + strstr(type, "flv") || strstr(type, "x-msvideo")) { + gst_handle->is_valid_container = true; + if (strstr(type, "ogg")) + gst_handle->demux = gst_element_factory_make("oggdemux", NULL); + else if (strstr(type, "flv")) + gst_handle->demux = gst_element_factory_make("flvdemux", NULL); + else if (strstr(type, "x-msvideo")) + gst_handle->demux = gst_element_factory_make("avidemux", NULL); + else + gst_handle->demux = gst_element_factory_make("qtdemux", NULL); - __gst_create_audio_only_pipeline(data, caps); - } else { + if (!gst_handle->demux) { gst_handle->is_valid_container = false; - MD_E("Not supported container %s\n", type); + MD_E("factory not able to create qtdemux\n"); + goto ERROR; } - g_free(type); + g_signal_connect(gst_handle->demux, "pad-added", + G_CALLBACK(__gst_on_pad_added), gst_handle); + g_signal_connect(gst_handle->demux, "no-more-pads", + G_CALLBACK(__gst_no_more_pad), gst_handle); + gst_element_set_locked_state(gst_handle->demux, TRUE); + if (!gst_bin_add(GST_BIN(gst_handle->pipeline), gst_handle->demux)) { + MD_E("fail add demuxer(%s) in pipeline", + GST_ELEMENT_NAME(gst_handle->demux)); + gst_object_unref(gst_handle->demux); + gst_handle->demux = NULL; + goto ERROR; + } + + pad = gst_element_get_static_pad(gst_handle->typefind, "src"); + if (!pad) { + MD_E("fail to get typefind src pad.\n"); + goto ERROR; + } + demuxer_pad = gst_element_get_static_pad(gst_handle->demux, "sink"); + if (!demuxer_pad) { + MD_E("fail to get qtdemuc sink pad.\n"); + goto ERROR; + } + fake_pad = gst_element_get_static_pad(gst_handle->fakesink, "sink"); + if (!fake_pad) { + MD_E("fail to get fakesink sink pad.\n"); + goto ERROR; + } + gst_pad_unlink(pad, fake_pad); + MEDIADEMUXER_LINK_PAD(pad, demuxer_pad, ERROR); + + MEDIADEMUXER_SYNC_STATE_WITH_PARENT(gst_handle->demux, ERROR); + gst_element_set_locked_state(gst_handle->demux, FALSE); + if (pad) + gst_object_unref(pad); + if (demuxer_pad) + gst_object_unref(demuxer_pad); + if (fake_pad) + gst_object_unref(fake_pad); + + } 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"))) { + MD_I("Audio only format is found\n"); + pad = gst_element_get_static_pad(gst_handle->typefind, "src"); + if (!pad) { + MD_E("fail to get typefind src pad.\n"); + goto ERROR; + } + fake_pad = gst_element_get_static_pad(gst_handle->fakesink, "sink"); + if (!fake_pad) { + MD_E("fail to get fakesink sink pad.\n"); + goto ERROR; + } + gst_pad_unlink(pad, fake_pad); + if (pad) + gst_object_unref(pad); + if (fake_pad) + gst_object_unref(fake_pad); + + __gst_create_audio_only_pipeline(data, caps); + } else { + gst_handle->is_valid_container = false; + MD_E("Not supported container %s\n", type); } + + g_free(type); MEDIADEMUXER_FLEAVE(); return; + ERROR: gst_handle->is_valid_container = false; if (type) g_free(type); + if (gst_handle->demux) + gst_element_set_locked_state(gst_handle->demux, FALSE); if (pad) gst_object_unref(pad); if (demuxer_pad) @@ -1214,7 +1230,7 @@ int _set_mime_video(media_format_h format, track *head) /* Round off the framerate */ if (frame_rate_denominator) - frame_rate = (int)floor((frame_rate_numerator / frame_rate_denominator) + 0.5); + frame_rate = (int)floor(((gdouble)frame_rate_numerator / frame_rate_denominator) + 0.5); MD_I("set frame rate %d", frame_rate); if (media_format_set_video_frame_rate(format, frame_rate)) { @@ -1766,6 +1782,7 @@ ERROR: void _gst_clear_struct(mdgst_handle_t *gst_handle) { MEDIADEMUXER_FENTER(); + MEDIADEMUXER_CHECK_NULL_VOID(gst_handle); if (gst_handle->selected_tracks) { MD_I("Deallocating gst_handle->selected_tracks %p\n", gst_handle->selected_tracks); -- 2.7.4 From 31903fd0e2de14a8a07a4c2894ad2d0c459e8a9e Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Fri, 29 Sep 2017 10:18:48 +0900 Subject: [PATCH 09/16] Fix coverity issues [Version] 0.1.24 [Profile] Mobile, Wearable, TV [Issue Type] Fix coverity issues Change-Id: I67cfb39f8904474b741e3a646274f71fb5fc8364 --- packaging/capi-mediademuxer.spec | 2 +- src/port_gst/mediademuxer_port_gst.c | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/packaging/capi-mediademuxer.spec b/packaging/capi-mediademuxer.spec index 94b2671..cdd1708 100755 --- a/packaging/capi-mediademuxer.spec +++ b/packaging/capi-mediademuxer.spec @@ -1,6 +1,6 @@ Name: capi-mediademuxer Summary: A Media Demuxer library in Tizen Native API -Version: 0.1.23 +Version: 0.1.24 Release: 1 Group: Multimedia/API License: Apache-2.0 diff --git a/src/port_gst/mediademuxer_port_gst.c b/src/port_gst/mediademuxer_port_gst.c index 4076551..ae1adb7 100755 --- a/src/port_gst/mediademuxer_port_gst.c +++ b/src/port_gst/mediademuxer_port_gst.c @@ -699,6 +699,13 @@ static void __gst_on_pad_added(GstElement *element, GstPad *pad, gpointer data) } gst_caps_unref(caps); tmp = head_track->head; + + if (!tmp) { + MD_I("trak is NULL\n"); + MEDIADEMUXER_FLEAVE(); + return; + } + while (tmp->next) tmp = tmp->next; if (!tmp || !tmp->caps_string) { @@ -1253,7 +1260,7 @@ int _set_mime_audio(media_format_h format, track *head) int bit = 0; int channels = 0; int id3_flag = 0; - const gchar *stream_format; + const gchar *stream_format = NULL; media_format_mimetype_e mime_type = MEDIA_FORMAT_MAX; struc = gst_caps_get_structure(head->caps, 0); @@ -1274,10 +1281,12 @@ int _set_mime_audio(media_format_h format, track *head) goto ERROR; stream_format = gst_structure_get_string(struc, "stream-format"); - if (strncmp(stream_format, "adts", 4) == 0) - media_format_set_audio_aac_type(format, 1); - else - media_format_set_audio_aac_type(format, 0); + if (stream_format) { + if (strncmp(stream_format, "adts", 4) == 0) + media_format_set_audio_aac_type(format, 1); + else + media_format_set_audio_aac_type(format, 0); + } } else if (mpegversion == 1 || id3_flag) { gst_structure_get_int(struc, "layer", &layer); -- 2.7.4 From 1703d65a71d369a16f3d699de8d89d2d52de8617 Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Mon, 16 Oct 2017 16:57:46 +0900 Subject: [PATCH 10/16] Fix coverity issues [Version] 0.1.25 [Profile] Mobile, Wearable, TV [Issue Type] Fix coverity issues Change-Id: I8f45adbfd1e966f01aed84b25c109c3c6579681a --- packaging/capi-mediademuxer.spec | 2 +- src/port_gst/mediademuxer_port_gst.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packaging/capi-mediademuxer.spec b/packaging/capi-mediademuxer.spec index cdd1708..d9fbcf1 100755 --- a/packaging/capi-mediademuxer.spec +++ b/packaging/capi-mediademuxer.spec @@ -1,6 +1,6 @@ Name: capi-mediademuxer Summary: A Media Demuxer library in Tizen Native API -Version: 0.1.24 +Version: 0.1.25 Release: 1 Group: Multimedia/API License: Apache-2.0 diff --git a/src/port_gst/mediademuxer_port_gst.c b/src/port_gst/mediademuxer_port_gst.c index ae1adb7..c0f1a3e 100755 --- a/src/port_gst/mediademuxer_port_gst.c +++ b/src/port_gst/mediademuxer_port_gst.c @@ -708,11 +708,19 @@ static void __gst_on_pad_added(GstElement *element, GstPad *pad, gpointer data) while (tmp->next) tmp = tmp->next; - if (!tmp || !tmp->caps_string) { - MD_I("trak or trak caps_string is NULL\n"); + + if (!tmp) { + MD_I("trak is NULL\n"); + MEDIADEMUXER_FLEAVE(); + return; + } + + if (!tmp->caps_string) { + MD_I("trak caps_string is NULL\n"); MEDIADEMUXER_FLEAVE(); return; } + if (tmp->caps_string[0] == 'v') { MD_I("found Video Pad\n"); (head_track->num_video_track)++; -- 2.7.4 From 41497313433fa2f928c4a1e5de13817e1408b261 Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Thu, 19 Oct 2017 17:18:56 +0900 Subject: [PATCH 11/16] Fix coverity issues [Version] 0.1.25 [Profile] Mobile, Wearable, TV [Issue Type] Fix coverity issues Change-Id: I732f1610e3c9a906d1c952770606d61686f11cef --- src/port_gst/mediademuxer_port_gst.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/port_gst/mediademuxer_port_gst.c b/src/port_gst/mediademuxer_port_gst.c index c0f1a3e..fb745d1 100755 --- a/src/port_gst/mediademuxer_port_gst.c +++ b/src/port_gst/mediademuxer_port_gst.c @@ -706,13 +706,13 @@ static void __gst_on_pad_added(GstElement *element, GstPad *pad, gpointer data) return; } - while (tmp->next) + while (tmp->next) { tmp = tmp->next; - - if (!tmp) { - MD_I("trak is NULL\n"); - MEDIADEMUXER_FLEAVE(); - return; + if (!tmp) { + MD_I("trak is NULL\n"); + MEDIADEMUXER_FLEAVE(); + return; + } } if (!tmp->caps_string) { -- 2.7.4 From cce7760d690414c9fd29a028203896ceb8e75fa7 Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Tue, 30 Jan 2018 10:56:54 +0900 Subject: [PATCH 12/16] Fix mistakes in header description [Version] 0.1.26 [Profile] Mobile, Wearable, TV [Issue Type] Fix description bugs Change-Id: Iee9d5d42d4a6059785a3606b9c4b51e7c32313bb --- include/mediademuxer.h | 103 ++++++++++++++++++++------------------- packaging/capi-mediademuxer.spec | 2 +- 2 files changed, 53 insertions(+), 52 deletions(-) diff --git a/include/mediademuxer.h b/include/mediademuxer.h index be38977..2cbe965 100755 --- a/include/mediademuxer.h +++ b/include/mediademuxer.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __TIZEN_MEDIADEMUXER_H__ -#define __TIZEN_MEDIADEMUXER_H__ +#ifndef __TIZEN_MULTIMEDIA_MEDIADEMUXER_H__ +#define __TIZEN_MULTIMEDIA_MEDIADEMUXER_H__ #include #include @@ -43,7 +43,7 @@ extern "C" { typedef struct mediademuxer_s *mediademuxer_h; /** - * @brief Enumeration for media demuxer state + * @brief Enumeration for media demuxer state. * @since_tizen 3.0 */ typedef enum { @@ -81,10 +81,10 @@ typedef enum { * #MEDIADEMUXER_ERROR_SEEK_FAILED, * #MEDIADEMUXER_ERROR_DRM_NOT_PERMITTED * @since_tizen 3.0 - * @param[in] error The error that occurred in media demuxer - * @param[in] user_data The user data passed from the code where - * mediademuxer_set_error_cb() was invoked - * This data will be accessible from mediademuxer_error_cb() + * @param[in] error The error that occurred in media demuxer + * @param[in] user_data The user data passed from the code where + * mediademuxer_set_error_cb() was invoked + * This data will be accessible from mediademuxer_error_cb() * @pre Create media demuxer handle by calling mediademuxer_create() function. * @see mediademuxer_set_error_cb() * @see mediademuxer_unset_error_cb() @@ -94,10 +94,10 @@ typedef void (*mediademuxer_error_cb) (mediademuxer_error_e error, void *user_da /** * @brief Called when end of stream occurs in media demuxer. * @since_tizen 3.0 - * @param[in] track_num The track_num which indicate eos for which track number occured - * @param[in] user_data The user data passed from the code where - * mediademuxer_set_eos_cb() was invoked - * This data will be accessible from mediademuxer_eos_cb() + * @param[in] track_num The track_num which indicate eos for which track number occured + * @param[in] user_data The user data passed from the code where + * mediademuxer_set_eos_cb() was invoked + * This data will be accessible from mediademuxer_eos_cb() * @pre Create media demuxer handle by calling mediademuxer_create() function. * @see mediademuxer_set_eos_cb() * @see mediademuxer_unset_eos_cb() @@ -108,7 +108,7 @@ typedef void (*mediademuxer_eos_cb) (int track_num, void *user_data); * @brief Creates a media demuxer handle for demuxing. * @since_tizen 3.0 * @remarks You must release @a demuxer using mediademuxer_destroy() function. - * @param[out] demuxer A new handle to media demuxer + * @param[out] demuxer A new handle to media demuxer * @return @c 0 on success, otherwise a negative error value * @retval #MEDIADEMUXER_ERROR_NONE Successful * @retval #MEDIADEMUXER_ERROR_INVALID_OPERATION Invalid Operation @@ -125,7 +125,7 @@ int mediademuxer_create(mediademuxer_h *demuxer); * @remarks The mediastorage privilege(http://tizen.org/privilege/mediastorage) should be added if any video/audio files are used to play located in the internal storage. * @remarks The externalstorage privilege(http://tizen.org/privilege/externalstorage) should be added if any video/audio files are used to play located in the external storage. * @remarks You must release @a demuxer using mediademuxer_destroy() function. - * @param[in] demuxer The media demuxer handle + * @param[in] demuxer The media demuxer handle * @param[in] path The content location, such as the file path * @return @c 0 on success, otherwise a negative error value * @retval #MEDIADEMUXER_ERROR_NONE Successful @@ -140,8 +140,8 @@ int mediademuxer_set_data_source(mediademuxer_h demuxer, const char *path); /** * @brief Prepares the media demuxer for demuxing. * @since_tizen 3.0 - * @remark User should call this before mediademuxer_start() function. - * @param[in] demuxer The media demuxer handle + * @remarks User should call this before mediademuxer_start() function. + * @param[in] demuxer The media demuxer handle * @return @c 0 on success, otherwise a negative error value * @retval #MEDIADEMUXER_ERROR_NONE Successful * @retval #MEDIADEMUXER_ERROR_INVALID_PARAMETER Invalid parameter @@ -158,8 +158,9 @@ int mediademuxer_prepare(mediademuxer_h demuxer); /** * @brief Gets the total track count present in the container stream. * @since_tizen 3.0 - * @param[in] demuxer The media demuxer handle - * @param[out] count The number of tracks present + * @param[in] demuxer The media demuxer handle + * @param[out] count The number of tracks present + * @return @c 0 on success, otherwise a negative error value * @retval #MEDIADEMUXER_ERROR_NONE Successful * @retval #MEDIADEMUXER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #MEDIADEMUXER_ERROR_INVALID_STATE Invalid state @@ -173,8 +174,8 @@ int mediademuxer_get_track_count(mediademuxer_h demuxer, int *count); /** * @brief Selects the track to be performed. * @since_tizen 3.0 - * @param[in] demuxer The media demuxer handle - * @param[in] track_index The track index on which is selected for read + * @param[in] demuxer The media demuxer handle + * @param[in] track_index The track index on which is selected for read * @return @c 0 on success, otherwise a negative error value * @retval #MEDIADEMUXER_ERROR_NONE Successful * @retval #MEDIADEMUXER_ERROR_INVALID_PARAMETER Invalid parameter @@ -189,8 +190,8 @@ int mediademuxer_select_track(mediademuxer_h demuxer, int track_index); /** * @brief Starts the media demuxer. * @since_tizen 3.0 - * @remark User should call this before mediademuxer_read_sample() function. - * @param[in] demuxer The media demuxer handle + * @remarks User should call this before mediademuxer_read_sample() function. + * @param[in] demuxer The media demuxer handle * @return @c 0 on success, otherwise a negative error value * @retval #MEDIADEMUXER_ERROR_NONE Successful * @retval #MEDIADEMUXER_ERROR_INVALID_PARAMETER Invalid parameter @@ -209,9 +210,9 @@ int mediademuxer_start(mediademuxer_h demuxer); * @brief Retrieves the track format of the read sample. * @since_tizen 3.0 * @remarks The @a format should be released using media_format_unref() function. - * @param[in] demuxer The media demuxer handle - * @param[in] track_index The index of the track - * @param[out] format The media format handle + * @param[in] demuxer The media demuxer handle + * @param[in] track_index The index of the track + * @param[out] format The media format handle * @return @c 0 on success, otherwise a negative error value * @retval #MEDIADEMUXER_ERROR_NONE Successful * @retval #MEDIADEMUXER_ERROR_INVALID_PARAMETER Invalid parameter @@ -229,11 +230,11 @@ int mediademuxer_get_track_info(mediademuxer_h demuxer, int track_index, media_f /** * @brief Reads a frame(sample) of one single track. * @since_tizen 3.0 - * @remark The @a outbuf should be released using media_packet_destroy() function. - * @remark Once this API is called, user app can call the mediatool APIs to extract + * @remarks The @a outbuf should be released using media_packet_destroy() function. + * @remarks Once this function is called, user app can call the mediatool APIs to extract * side information such as pts, size, duration, flags etc. - * @param[in] demuxer The media demuxer handle - * @param[in] track_index The index of track of which data is needed + * @param[in] demuxer The media demuxer handle + * @param[in] track_index The index of track of which data is needed * @param[out] outbuf The media packet handle * @return @c 0 on success, otherwise a negative error value * @retval #MEDIADEMUXER_ERROR_NONE Successful @@ -254,9 +255,9 @@ int mediademuxer_read_sample(mediademuxer_h demuxer, int track_index, media_pack /** * @brief Seeks to a particular instance of time (in milli seconds). * @since_tizen 3.0 - * @remark If mediademuxer_seek() is followed by mediademuxer_read_sample(), outbuf will be the key frame right before the seek position. - * @param[in] demuxer The media demuxer handle - * @param[in] pos The value of the new start position + * @remarks If mediademuxer_seek() is followed by mediademuxer_read_sample(), outbuf will be the key frame right before the seek position. + * @param[in] demuxer The media demuxer handle + * @param[in] pos The value of the new start position * @return @c 0 on success, otherwise a negative error value * @retval #MEDIADEMUXER_ERROR_NONE Successful * @retval #MEDIADEMUXER_ERROR_INVALID_PARAMETER Invalid parameter @@ -271,8 +272,8 @@ int mediademuxer_seek(mediademuxer_h demuxer, int64_t pos); /** * @brief Unselects the selected track. * @since_tizen 3.0 - * @param[in] demuxer The media demuxer handle - * @param[in] track_index The track index to be unselected + * @param[in] demuxer The media demuxer handle + * @param[in] track_index The track index to be unselected * @return @c 0 on success, otherwise a negative error value * @retval #MEDIADEMUXER_ERROR_NONE Successful * @retval #MEDIADEMUXER_ERROR_INVALID_PARAMETER Invalid parameter @@ -288,8 +289,8 @@ int mediademuxer_unselect_track(mediademuxer_h demuxer, int track_index); /** * @brief Stops the media demuxer. * @since_tizen 3.0 - * @remark User can call this if need to stop demuxing if needed. - * @param[in] demuxer The media demuxer handle + * @remarks User can call this if need to stop demuxing if needed. + * @param[in] demuxer The media demuxer handle * @return @c 0 on success, otherwise a negative error value * @retval #MEDIADEMUXER_ERROR_NONE Successful * @retval #MEDIADEMUXER_ERROR_INVALID_PARAMETER Invalid parameter @@ -306,7 +307,7 @@ int mediademuxer_stop(mediademuxer_h demuxer); * @brief Resets the media demuxer. * @since_tizen 3.0 * @remarks User should call this before mediademuxer_destroy() function. - * @param[in] demuxer The media demuxer handle + * @param[in] demuxer The media demuxer handle * @return @c 0 on success, otherwise a negative error value * @retval #MEDIADEMUXER_ERROR_NONE Successful * @retval #MEDIADEMUXER_ERROR_INVALID_PARAMETER Invalid parameter @@ -321,7 +322,7 @@ int mediademuxer_unprepare(mediademuxer_h demuxer); /** * @brief Removes the instance of media demuxer and clear all its context memory. * @since_tizen 3.0 - * @param[in] demuxer The media demuxer handle + * @param[in] demuxer The media demuxer handle * @return @c 0 on success, otherwise a negative error value * @retval #MEDIADEMUXER_ERROR_NONE Successful * @retval #MEDIADEMUXER_ERROR_INVALID_PARAMETER Invalid parameter @@ -336,7 +337,7 @@ int mediademuxer_destroy(mediademuxer_h demuxer); /** * @brief Gets media demuxer state. * @since_tizen 3.0 - * @param[in] demuxer The media demuxer handle + * @param[in] demuxer The media demuxer handle * @param[out] state The media demuxer sate * @return @c 0 on success, otherwise a negative error value * @retval #MEDIADEMUXER_ERROR_NONE Successful @@ -348,13 +349,13 @@ int mediademuxer_destroy(mediademuxer_h demuxer); int mediademuxer_get_state(mediademuxer_h demuxer, mediademuxer_state *state); /** - * @brief Registers an error callback function to be invoked when an error occurs. + * @brief Sets an error callback function to be invoked when an error occurs. * @since_tizen 3.0 * @param[in] demuxer The media demuxer handle * @param[in] callback Callback function pointer - * @param[in] user_data The user data passed from the code where - * mediademuxer_set_error_cb() was invoked - * This data will be accessible from mediademuxer_error_cb() + * @param[in] user_data The user data passed from the code where + * mediademuxer_set_error_cb() was invoked + * This data will be accessible from mediademuxer_error_cb() * @return @c 0 on success, otherwise a negative error value * @retval #MEDIADEMUXER_ERROR_NONE Successful * @retval #MEDIADEMUXER_ERROR_INVALID_PARAMETER Invalid parameter @@ -367,9 +368,9 @@ int mediademuxer_get_state(mediademuxer_h demuxer, mediademuxer_state *state); int mediademuxer_set_error_cb(mediademuxer_h demuxer, mediademuxer_error_cb callback, void *user_data); /** - * @brief Unregisters the error callback function. + * @brief Unsets the error callback function. * @since_tizen 3.0 - * @param[in] demuxer The media demuxer handle + * @param[in] demuxer The media demuxer handle * @return @c 0 on success, otherwise a negative error value * @retval #MEDIADEMUXER_ERROR_NONE Successful * @retval #MEDIADEMUXER_ERROR_INVALID_PARAMETER Invalid parameter @@ -379,13 +380,13 @@ int mediademuxer_set_error_cb(mediademuxer_h demuxer, mediademuxer_error_cb call int mediademuxer_unset_error_cb(mediademuxer_h demuxer); /** - * @brief Registers an eos callback function to be invoked when an eos occurs. + * @brief Sets an eos callback function to be invoked when an eos occurs. * @since_tizen 3.0 * @param[in] demuxer The media demuxer handle * @param[in] callback Callback function pointer - * @param[in] user_data The user data passed from the code where - * mediademuxer_set_eos_cb() was invoked - * This data will be accessible from mediademuxer_eos_cb() + * @param[in] user_data The user data passed from the code where + * mediademuxer_set_eos_cb() was invoked + * This data will be accessible from mediademuxer_eos_cb() * @return @c 0 on success, otherwise a negative error value * @retval #MEDIADEMUXER_ERROR_NONE Successful * @retval #MEDIADEMUXER_ERROR_INVALID_PARAMETER Invalid parameter @@ -398,9 +399,9 @@ int mediademuxer_unset_error_cb(mediademuxer_h demuxer); int mediademuxer_set_eos_cb(mediademuxer_h demuxer, mediademuxer_eos_cb callback, void *user_data); /** - * @brief Unregisters the eos callback function. + * @brief Unsets the eos callback function. * @since_tizen 3.0 - * @param[in] demuxer The media demuxer handle + * @param[in] demuxer The media demuxer handle * @return @c 0 on success, otherwise a negative error value * @retval #MEDIADEMUXER_ERROR_NONE Successful * @retval #MEDIADEMUXER_ERROR_INVALID_PARAMETER Invalid parameter @@ -416,4 +417,4 @@ int mediademuxer_unset_eos_cb(mediademuxer_h demuxer); #ifdef __cplusplus } #endif -#endif /* __TIZEN_MEDIADEMUXER_H__ */ +#endif /* __TIZEN_MULTIMEDIA_MEDIADEMUXER_H__ */ diff --git a/packaging/capi-mediademuxer.spec b/packaging/capi-mediademuxer.spec index d9fbcf1..f15f084 100755 --- a/packaging/capi-mediademuxer.spec +++ b/packaging/capi-mediademuxer.spec @@ -1,6 +1,6 @@ Name: capi-mediademuxer Summary: A Media Demuxer library in Tizen Native API -Version: 0.1.25 +Version: 0.1.26 Release: 1 Group: Multimedia/API License: Apache-2.0 -- 2.7.4 From 5d67e341c3eb02717167c18b9184d30df21054ea Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Wed, 7 Mar 2018 15:32:43 +0900 Subject: [PATCH 13/16] Fix typo error in mediademuxer doc [Version] 0.1.27 [Profile] Mobile, Wearable, TV [Issue Type] Fix type error Change-Id: Id311178ff61ea73323f1b72dc6cbb8fc55297d87 --- doc/mediademuxer_doc.h | 4 ++-- packaging/capi-mediademuxer.spec | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/mediademuxer_doc.h b/doc/mediademuxer_doc.h index 6f2f63f..52feea3 100644 --- a/doc/mediademuxer_doc.h +++ b/doc/mediademuxer_doc.h @@ -40,8 +40,8 @@ * 4) To create single or multiple instances of media demuxer. One instance can demux only one
* input stream
* 5) To demux all the popular media formats such as MP4, AAC-NB, AAC-WB, MP3 etc.
- * 6) To extract elementarty media sample information, such as timestamp, sample size, key-frame(I-frame) etc.
- * 7) To identify encripted format
+ * 6) To extract elementary media sample information, such as timestamp, sample size, key-frame(I-frame) etc.
+ * 7) To identify encrypted format
* 8) To seek to a different position-forward or backward- while extracting
*
* Typical Call Flow of mediamuxer APIs is:
diff --git a/packaging/capi-mediademuxer.spec b/packaging/capi-mediademuxer.spec index f15f084..21ed98b 100755 --- a/packaging/capi-mediademuxer.spec +++ b/packaging/capi-mediademuxer.spec @@ -1,6 +1,6 @@ Name: capi-mediademuxer Summary: A Media Demuxer library in Tizen Native API -Version: 0.1.26 +Version: 0.1.27 Release: 1 Group: Multimedia/API License: Apache-2.0 -- 2.7.4 From 161e0c7e4526d8c55fd602af2a507abdd21ab5c5 Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Mon, 26 Mar 2018 11:38:47 +0900 Subject: [PATCH 14/16] Fix Svace issue (MEMORY_LEAK) [Version] 0.1.28 [Profile] Mobile, Wearable [Issue Type] Fix bugs Change-Id: I5a885c900ba1fd9b313932c724cf4e87f3e6f36e --- packaging/capi-mediademuxer.spec | 2 +- src/mediademuxer_ini.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packaging/capi-mediademuxer.spec b/packaging/capi-mediademuxer.spec index 21ed98b..783b06b 100755 --- a/packaging/capi-mediademuxer.spec +++ b/packaging/capi-mediademuxer.spec @@ -1,6 +1,6 @@ Name: capi-mediademuxer Summary: A Media Demuxer library in Tizen Native API -Version: 0.1.27 +Version: 0.1.28 Release: 1 Group: Multimedia/API License: Apache-2.0 diff --git a/src/mediademuxer_ini.c b/src/mediademuxer_ini.c index e0178fe..4892be7 100755 --- a/src/mediademuxer_ini.c +++ b/src/mediademuxer_ini.c @@ -157,7 +157,8 @@ int md_ini_load(md_ini_t *ini) else { MD_E("Invalid port is set to [%s] [%d]\n", ini->port_name, ini->port_type); - goto ERROR; + iniparser_freedict(dict); + return MD_COURRPTED_INI;; } MD_L("The port is set to [%s] [%d]\n", ini->port_name, ini->port_type); @@ -172,9 +173,6 @@ int md_ini_load(md_ini_t *ini) MD_L("port_type : %d\n", ini->port_type); return MD_ERROR_NONE; -ERROR: - return MD_COURRPTED_INI; - } static void _md_ini_check_ini_status(void) -- 2.7.4 From db548a9303231d52c4769c63a2e74e3a4a85a4ec Mon Sep 17 00:00:00 2001 From: SeokHoon Lee Date: Mon, 17 Sep 2018 16:00:20 +0900 Subject: [PATCH 15/16] Add gcov environment Signed-off-by: SeokHoon Lee Change-Id: I4ffa27fc3e42b90e640ae721781a49254fee74bf --- packaging/capi-mediademuxer.spec | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packaging/capi-mediademuxer.spec b/packaging/capi-mediademuxer.spec index 783b06b..a700115 100755 --- a/packaging/capi-mediademuxer.spec +++ b/packaging/capi-mediademuxer.spec @@ -42,6 +42,13 @@ export CFLAGS="$CFLAGS -DENABLE_FFMPEG_CODEC" %endif export CFLAGS="$CFLAGS -DSYSCONFDIR=\\\"%{_sysconfdir}\\\" -DTIZEN_FEATURE_GST_UPSTREAM" +%if 0%{?gcov:1} +export CFLAGS+=" -fprofile-arcs -ftest-coverage" +export CXXFLAGS+=" -fprofile-arcs -ftest-coverage" +export FFLAGS+=" -fprofile-arcs -ftest-coverage" +export LDFLAGS+=" -lgcov" +%endif + MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` %cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -- 2.7.4 From 4e3695033c6f62f0659344662f423a46b980234d Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Fri, 7 Dec 2018 16:34:36 +0900 Subject: [PATCH 16/16] Fix dlog format error [Version] 0.1.29 [Profile] Common [Issue Type] Fix bugs Change-Id: I855b3268fb8476e93e76d7899d506b0f1bed5b80 --- packaging/capi-mediademuxer.spec | 2 +- src/port_gst/mediademuxer_port_gst.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packaging/capi-mediademuxer.spec b/packaging/capi-mediademuxer.spec index a700115..aa54962 100755 --- a/packaging/capi-mediademuxer.spec +++ b/packaging/capi-mediademuxer.spec @@ -1,6 +1,6 @@ Name: capi-mediademuxer Summary: A Media Demuxer library in Tizen Native API -Version: 0.1.28 +Version: 0.1.29 Release: 1 Group: Multimedia/API License: Apache-2.0 diff --git a/src/port_gst/mediademuxer_port_gst.c b/src/port_gst/mediademuxer_port_gst.c index fb745d1..24747e0 100755 --- a/src/port_gst/mediademuxer_port_gst.c +++ b/src/port_gst/mediademuxer_port_gst.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -1459,13 +1460,13 @@ static int _gst_copy_buf_to_media_packet(media_packet_h out_pkt, } /* copy data */ media_packet_get_buffer_size(out_pkt, &size); - MD_I("Media packet Buffer capacity: %llu GST Buffer size = %d\n", size, map.size); + MD_I("Media packet Buffer capacity: %"PRIu64" GST Buffer size = %"G_GSIZE_FORMAT"\n", size, map.size); if (size < (uint64_t)map.size) { - MD_W("Media packet Buffer capacity[%llu] is \ - less than the GST Buffer size[%d]. Resizing...\n", size, map.size); + MD_W("Media packet Buffer capacity[%"PRIu64"] is \ + less than the GST Buffer size[%"G_GSIZE_FORMAT"]. Resizing...\n", size, map.size); ret = media_packet_set_buffer_size(out_pkt, (uint64_t)map.size); media_packet_get_buffer_size(out_pkt, &size); - MD_I("Media packet Buffer NEW capacity: %llu \n", size); + MD_I("Media packet Buffer NEW capacity: %"PRIu64"\n", size); } if (media_packet_get_buffer_data_ptr(out_pkt, &pkt_data)) { MD_E("unable to get the buffer pointer from media_packet_get_buffer_data_ptr\n"); -- 2.7.4