add adaptive-streaming info in video caps for media stream 63/69963/3 accepted/tizen/common/20160519.191332 accepted/tizen/ivi/20160519.085128 accepted/tizen/mobile/20160519.085100 accepted/tizen/tv/20160519.085042 accepted/tizen/wearable/20160519.085023 submit/tizen/20160519.011519
authorEunhae Choi <eunhae1.choi@samsung.com>
Tue, 17 May 2016 11:43:57 +0000 (20:43 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Tue, 17 May 2016 13:17:14 +0000 (22:17 +0900)
Change-Id: If96bd3763cc56176ae925d15edfb6caacfe9cdaf

packaging/libmm-player.spec
src/include/mm_player.h
src/include/mm_player_es.h
src/mm_player.c
src/mm_player_attrs.c
src/mm_player_es.c
src/mm_player_priv.c

index 5b50f974ec3241a782506eca3000b497f4a103db..ccef186ddeb899d55e01baf5fb856e7aa04e8396 100644 (file)
@@ -3,7 +3,7 @@
 
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.5.77
+Version:    0.5.78
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 821375d46a5c2a3551e31a312b1d2b254057e430..e94e6c8d53d20f2bb433f91612f41839859c6463 100644 (file)
  */
 #define MM_PLAYER_PD_MODE                                              "pd_mode"
 
+/**
+ * MM_PLAYER_DRC_MODE
+ *
+ * dynamic resolution change mode (int)
+ */
+#define MM_PLAYER_DRC_MODE                                             "drc_mode"
+
 #define BUFFER_MAX_PLANE_NUM (4)
 
 typedef struct {
@@ -2245,7 +2252,7 @@ int mm_player_set_audio_stream_changed_callback(MMHandleType player, mm_player_s
 int mm_player_set_video_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param);
 
 /**
- * This function is to get timeout value according to the content type for muse.
+ * This function is to get timeout value according to the content type for muse. \n
  * It's only supported when video stream is included in file. \n
  *
  * @param      player  [in] Handle of player.
@@ -2258,7 +2265,7 @@ int mm_player_set_video_stream_changed_callback(MMHandleType player, mm_player_s
 int mm_player_get_timeout(MMHandleType player, int *timeout);
 
 /**
- * This function is to get the number of video output buffers.
+ * This function is to get the number of video output buffers. \n
  * It's only supported when video stream is included in file. \n
  *
  * @param      player  [in] Handle of player.
@@ -2271,6 +2278,19 @@ int mm_player_get_timeout(MMHandleType player, int *timeout);
  */
 int mm_player_get_num_of_video_out_buffers(MMHandleType player, int *num, int *extra_num);
 
+/**
+ * This function is to set the dynamic resolution information. \n
+ * It's only supported when video stream is included in file. \n
+ *
+ * @param      player  [in] Handle of player.
+ * @param      drc     [in] dynamic resolution info of media stream data
+ *
+ * @return     This function returns zero on success, or negative value with error
+ *                     code.
+ * @since 3.0
+ */
+int mm_player_set_media_stream_dynamic_resolution(MMHandleType player, bool drc);
+
 /**
        @}
  */
index 7eb808457ec62abc4588050b509d1a7f6170f678..ede0059cc2d545ebf0d12e0541fb5cdc224757e0 100644 (file)
@@ -70,6 +70,7 @@ int _mmplayer_set_media_stream_min_percent(MMHandleType hplayer,
 int _mmplayer_get_media_stream_min_percent(MMHandleType hplayer,
                                            MMPlayerStreamType type,
                                            guint *min_percent);
+int _mmplayer_set_media_stream_dynamic_resolution(MMHandleType hplayer, bool drc);
 
 #ifdef __cplusplus
 }
index 33119b2b8937beacc34cad6606ed7bc9f59fcc1a..c75605d766e670083e338c8d40f126a0216818de 100644 (file)
@@ -1283,3 +1283,18 @@ int mm_player_get_num_of_video_out_buffers(MMHandleType player, int *num, int *e
        return result;
 }
 
+int mm_player_set_media_stream_dynamic_resolution(MMHandleType player, bool drc)
+{
+       int result = MM_ERROR_NONE;
+
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+
+       MMPLAYER_CMD_LOCK( player );
+
+       result = _mmplayer_set_media_stream_dynamic_resolution(player, drc);
+
+       MMPLAYER_CMD_UNLOCK( player );
+
+       return result;
+}
+
index aa598eef7d954df8afde3bebca984e466f2e803d..c5c94fc07299b22715f29f3335c5f1d89ea0d597 100644 (file)
@@ -1087,6 +1087,15 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        MM_PLAYER_PIPELINE_LEGACY,
                        MM_PLAYER_PIPELINE_MAX - 1
+               },
+               {
+                       "drc_mode",
+                       MM_ATTRS_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       (void *) FALSE,
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       FALSE,
+                       TRUE
                }
        };
 
index 449e67538f830f84192fe95a758aaf1efe33948a..17b20507512081d510ba8768f8037d8c36dd249c 100644 (file)
@@ -39,9 +39,9 @@
 /*---------------------------------------------------------------------------
 |    LOCAL FUNCTION PROTOTYPES:                                                                                                |
 ---------------------------------------------------------------------------*/
-static int _parse_media_format (MMPlayerVideoStreamInfo * video, MMPlayerAudioStreamInfo * audio, media_format_h format);
-static int _convert_media_format_video_mime_to_str (MMPlayerVideoStreamInfo * video, media_format_mimetype_e mime);
-static int _convert_media_format_audio_mime_to_str (MMPlayerAudioStreamInfo * audio, media_format_mimetype_e mime);
+static int __parse_media_format (MMPlayerVideoStreamInfo * video, MMPlayerAudioStreamInfo * audio, media_format_h format);
+static int __convert_media_format_video_mime_to_str (MMPlayerVideoStreamInfo * video, media_format_mimetype_e mime);
+static int __convert_media_format_audio_mime_to_str (MMPlayerAudioStreamInfo * audio, media_format_mimetype_e mime);
 
 /*===========================================================================================
 |                                                                                                                                                                                      |
@@ -50,7 +50,7 @@ static int _convert_media_format_audio_mime_to_str (MMPlayerAudioStreamInfo * au
 ========================================================================================== */
 
 static int
-_convert_media_format_video_mime_to_str (MMPlayerVideoStreamInfo * video,
+__convert_media_format_video_mime_to_str (MMPlayerVideoStreamInfo * video,
     media_format_mimetype_e mime)
 {
   MMPLAYER_RETURN_VAL_IF_FAIL (video, MM_ERROR_INVALID_ARGUMENT);
@@ -74,7 +74,7 @@ _convert_media_format_video_mime_to_str (MMPlayerVideoStreamInfo * video,
 }
 
 static int
-_convert_media_format_audio_mime_to_str (MMPlayerAudioStreamInfo * audio,
+__convert_media_format_audio_mime_to_str (MMPlayerAudioStreamInfo * audio,
     media_format_mimetype_e mime)
 {
   MMPLAYER_RETURN_VAL_IF_FAIL (audio, MM_ERROR_INVALID_ARGUMENT);
@@ -93,7 +93,7 @@ _convert_media_format_audio_mime_to_str (MMPlayerAudioStreamInfo * audio,
 }
 
 static int
-_parse_media_format (MMPlayerVideoStreamInfo * video,
+__parse_media_format (MMPlayerVideoStreamInfo * video,
     MMPlayerAudioStreamInfo * audio, media_format_h format)
 {
   if (audio) {
@@ -108,7 +108,7 @@ _parse_media_format (MMPlayerVideoStreamInfo * video,
          return MM_ERROR_PLAYER_INTERNAL;
     }
 
-    _convert_media_format_audio_mime_to_str (audio, mime);
+    __convert_media_format_audio_mime_to_str (audio, mime);
     audio->sample_rate = samplerate;
     audio->channels = channel;
 //video->user_info = ;
@@ -134,7 +134,7 @@ _parse_media_format (MMPlayerVideoStreamInfo * video,
     }
     LOGD ("frame_rate %d", frame_rate);
 
-    _convert_media_format_video_mime_to_str (video, mime);
+    __convert_media_format_video_mime_to_str (video, mime);
 
     video->width = width;
     video->height = height;
@@ -146,7 +146,7 @@ _parse_media_format (MMPlayerVideoStreamInfo * video,
 }
 
 static gboolean
-_mmplayer_update_video_info(MMHandleType hplayer, media_format_h fmt)
+__mmplayer_update_video_info(MMHandleType hplayer, media_format_h fmt)
 {
   mm_player_t *player = (mm_player_t *) hplayer;
   gboolean ret = FALSE;
@@ -264,7 +264,7 @@ _mmplayer_set_media_stream_seek_data_cb(MMHandleType hplayer,
        return MM_ERROR_NONE;
 }
 
-GstElement*
+static GstElement*
 __mmplayer_get_source_element (mm_player_t *player, MMPlayerStreamType type)
 {
        enum MainElementID elemId = MMPLAYER_M_NUM;
@@ -522,7 +522,7 @@ _mmplayer_submit_packet (MMHandleType hplayer, media_packet_h packet)
       /* get format to check video format */
       media_packet_get_format (packet, &fmt);
       if (fmt) {
-        if (_mmplayer_update_video_info(hplayer, fmt)) {
+        if (__mmplayer_update_video_info(hplayer, fmt)) {
           LOGD("update video caps");
           g_object_set(G_OBJECT(player->pipeline->mainbin[MMPLAYER_M_SRC].gst),
                                     "caps", player->v_stream_caps, NULL);
@@ -557,8 +557,8 @@ ERROR:
   return ret;
 }
 
-int
-_mmplayer_video_caps_new (MMHandleType hplayer, MMPlayerVideoStreamInfo * video,
+static int
+__mmplayer_video_caps_new (MMHandleType hplayer, MMPlayerVideoStreamInfo * video,
     const char *fieldname, ...)
 {
   int cap_size;
@@ -620,7 +620,7 @@ _mmplayer_video_caps_new (MMHandleType hplayer, MMPlayerVideoStreamInfo * video,
 }
 
 static void
-_mmplayer_set_uri_type(mm_player_t *player)
+__mmplayer_set_uri_type(mm_player_t *player)
 {
        MMPLAYER_FENTER ();
 
@@ -637,53 +637,58 @@ _mmplayer_set_video_info (MMHandleType hplayer, media_format_h format)
   mm_player_t *player = MM_PLAYER_CAST (hplayer);
   MMPlayerVideoStreamInfo video = { 0, };
   int ret = MM_ERROR_NONE;
+  gboolean drc = FALSE;
 
   MMPLAYER_FENTER ();
 
   MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-  _mmplayer_set_uri_type(player);
+  __mmplayer_set_uri_type(player);
 
-  ret = _parse_media_format (&video, NULL, format);
+  ret = __parse_media_format (&video, NULL, format);
   if(ret != MM_ERROR_NONE)
     return ret;
 
+  mm_attrs_get_int_by_name(player->attrs, MM_PLAYER_DRC_MODE, &drc);
+
   if (strstr (video.mime, "video/mpeg")) {
-    _mmplayer_video_caps_new (hplayer, &video,
+    __mmplayer_video_caps_new (hplayer, &video,
         "mpegversion", G_TYPE_INT, video.version,
-        "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
+        "systemstream", G_TYPE_BOOLEAN, FALSE,
+        "adaptive-streaming", G_TYPE_BOOLEAN, drc, NULL);
   } else if (strstr (video.mime, "video/x-h264")) {
     //if (info.colordepth)
     {
-      //      _mmplayer_video_caps_new(hplayer, &info,
+      //      __mmplayer_video_caps_new(hplayer, &info,
       //              "colordepth", G_TYPE_INT, info.colordepth, NULL);
     }
     //else
     {
-      _mmplayer_video_caps_new (hplayer, &video,
+      __mmplayer_video_caps_new (hplayer, &video,
           "stream-format", G_TYPE_STRING, "byte-stream",
-          "alignment", G_TYPE_STRING, "au", NULL);
+          "alignment", G_TYPE_STRING, "au",
+          "adaptive-streaming", G_TYPE_BOOLEAN, drc, NULL);
     }
   }
 #if 0
   else if (strstr (info->mime, "video/x-wmv")) {
-    _mmplayer_video_caps_new (hplayer, &info,
+    __mmplayer_video_caps_new (hplayer, &info,
         "wmvversion", G_TYPE_INT, info.version, NULL);
   } else if (strstr (info.mime, "video/x-pn-realvideo")) {
-    _mmplayer_video_caps_new (hplayer, &info,
+    __mmplayer_video_caps_new (hplayer, &info,
         "rmversion", G_TYPE_INT, info.version, NULL);
   } else if (strstr (info.mime, "video/x-msmpeg")) {
-    _mmplayer_video_caps_new (hplayer, &info,
+    __mmplayer_video_caps_new (hplayer, &info,
         "msmpegversion", G_TYPE_INT, info.version, NULL);
   } else if (strstr (info.mime, "video/x-h265")) {
     if (info.colordepth) {
-      _mmplayer_video_caps_new (hplayer, &info,
+      __mmplayer_video_caps_new (hplayer, &info,
           "colordepth", G_TYPE_INT, info.colordepth, NULL);
     } else {
-      _mmplayer_video_caps_new (hplayer, &info, NULL);
+      __mmplayer_video_caps_new (hplayer, &info, NULL);
     }
   } else {
-    _mmplayer_video_caps_new (hplayer, &info, NULL);
+    __mmplayer_video_caps_new (hplayer, &info, NULL);
   }
 #endif
   g_free ((char *) video.mime);
@@ -705,9 +710,9 @@ _mmplayer_set_audio_info (MMHandleType hplayer, media_format_h format)
 
   MMPLAYER_RETURN_VAL_IF_FAIL (hplayer, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-  _mmplayer_set_uri_type(player);
+  __mmplayer_set_uri_type(player);
 
-  ret = _parse_media_format (NULL, &audio, format);
+  ret = __parse_media_format (NULL, &audio, format);
   if(ret != MM_ERROR_NONE)
     return ret;
 
@@ -823,3 +828,27 @@ _mmplayer_set_subtitle_info (MMHandleType hplayer,
 
   return MM_ERROR_NONE;
 }
+
+int
+_mmplayer_set_media_stream_dynamic_resolution(MMHandleType hplayer, bool drc)
+{
+       mm_player_t *player = MM_PLAYER_CAST (hplayer);
+       int ret = MM_ERROR_NONE;
+
+       MMPLAYER_FENTER ();
+
+       MMPLAYER_RETURN_VAL_IF_FAIL (player, FALSE);
+
+       mm_attrs_set_int_by_name (player->attrs, MM_PLAYER_DRC_MODE, (int)drc);
+       if (player->v_stream_caps)
+       {
+               LOGD("update video caps with drc information.");
+               gst_caps_set_simple (player->v_stream_caps,
+                       "adaptive-streaming", G_TYPE_BOOLEAN, drc, NULL);
+       }
+
+       MMPLAYER_FLEAVE ();
+       return ret;
+
+
+}
index c41917f8e9998206b58b5de6bff8a42590c2c8e2..89bbe2e052319db223593c23002339a605dff6a2 100644 (file)
@@ -9109,7 +9109,7 @@ _mmplayer_create_player(MMHandleType handle) // @
        player->video_share_clock_delta = 0;
        player->has_closed_caption = FALSE;
        player->video_num_buffers = DEFAULT_NUM_OF_V_OUT_BUFFER;
-       player->video_extra_num_buffers = 0;
+       player->video_extra_num_buffers = DEFAULT_NUM_OF_V_OUT_BUFFER;
        if (player->ini.dump_element_keyword[0][0] == '\0')
        {
                player->ini.set_dump_element_flag= FALSE;