[0.6.265] Set videoparse to send SPS/PPS with every IDR frame 82/265382/9
authorGilbok Lee <gilbok.lee@samsung.com>
Sun, 17 Oct 2021 23:56:02 +0000 (08:56 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Mon, 18 Oct 2021 06:03:05 +0000 (15:03 +0900)
- Set property when stream-format of videoparser is byte-stream
- Remove unused code

Change-Id: I126aa248bba878d252415eeaed3ecaf474567384

packaging/libmm-player.spec
src/mm_player_priv.c

index 9df3d35..31abe7c 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.264
+Version:    0.6.265
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 6f88332..73e60b4 100644 (file)
@@ -7741,77 +7741,75 @@ _mmplayer_gst_element_added(GstElement *bin, GstElement *element, gpointer data)
        if (__mmplayer_add_dump_buffer_probe(player, element))
                LOGD("add buffer probe");
 
-       if (g_strrstr(klass, "Codec/Decoder/Audio")) {
-               gchar *selected = NULL;
-               selected = g_strdup(GST_ELEMENT_NAME(element));
-               player->audio_decoders = g_list_append(player->audio_decoders, selected);
+       if (g_strrstr(klass, "Decoder")) {
+               if (g_strrstr(klass, "Audio")) {
+                       player->audio_decoders = g_list_append(player->audio_decoders,
+                                                                                                                                       g_strdup(GST_ELEMENT_NAME(element)));
 
-               /* update codec info */
-               player->not_supported_codec &= MISSING_PLUGIN_VIDEO;
-               player->can_support_codec |= FOUND_PLUGIN_AUDIO;
-               player->audiodec_linked = 1;
-       } else if (g_strrstr(klass, "Codec/Decoder/Video")) {
-               /* update codec info */
-               player->not_supported_codec &= MISSING_PLUGIN_AUDIO;
-               player->can_support_codec |= FOUND_PLUGIN_VIDEO;
-               player->videodec_linked = 1;
-       }
-
-       if (g_strrstr(klass, "Demuxer/Adaptive")) {
-               player->pipeline->mainbin[MMPLAYER_M_ADAPTIVE_DEMUX].id = MMPLAYER_M_ADAPTIVE_DEMUX;
-               player->pipeline->mainbin[MMPLAYER_M_ADAPTIVE_DEMUX].gst = element;
-
-               LOGD("set max variant limit: %d, %d %d", player->adaptive_info.limit.bandwidth,
-                                               player->adaptive_info.limit.width, player->adaptive_info.limit.height);
+                       /* update codec info */
+                       player->not_supported_codec &= MISSING_PLUGIN_VIDEO;
+                       player->can_support_codec |= FOUND_PLUGIN_AUDIO;
+                       player->audiodec_linked = 1;
+               } else if (g_strrstr(klass, "Video")) {
+                       GstElement *video_parse = player->pipeline->mainbin[MMPLAYER_M_V_PARSE].gst;
+                       /* update codec info */
+                       player->not_supported_codec &= MISSING_PLUGIN_AUDIO;
+                       player->can_support_codec |= FOUND_PLUGIN_VIDEO;
+                       player->videodec_linked = 1;
+
+                       if (video_parse) {
+                               GstPad *srcpad = gst_element_get_static_pad (video_parse, "src");
+                               if (srcpad) {
+                                       GstCaps *caps = NULL;
+                                       GstStructure *str = NULL;
+                                       const gchar *name = NULL;
+                                       gboolean caps_ret = TRUE;
+
+                                       MMPLAYER_GST_GET_CAPS_INFO_FROM_PAD (srcpad, caps, str, name, caps_ret);
+                                       if (caps_ret && str) {
+                                               const gchar *stream_format = gst_structure_get_string (str, "stream-format");
+                                               if (stream_format && g_strrstr(stream_format, "byte-stream")) {
+                                                       if ((g_object_class_find_property(G_OBJECT_GET_CLASS(video_parse), "config-interval"))) {
+                                                               g_object_set(G_OBJECT(video_parse), "config-interval", -1, NULL);
+                                                               LOGD("Send SPS and PPS Insertion every IDR frame");
+                                                       }
+                                               }
+                                       }
+                                       gst_object_unref(GST_OBJECT(srcpad));
+                               }
+                       }
+               }
+       } else if (g_strrstr(klass, "Demuxer")) {
+               if (g_strrstr(klass, "Adaptive")) {
+                       player->pipeline->mainbin[MMPLAYER_M_ADAPTIVE_DEMUX].id = MMPLAYER_M_ADAPTIVE_DEMUX;
+                       player->pipeline->mainbin[MMPLAYER_M_ADAPTIVE_DEMUX].gst = element;
 
-               g_object_set(player->pipeline->mainbin[MMPLAYER_M_ADAPTIVE_DEMUX].gst,
-                                               "max-bandwidth", player->adaptive_info.limit.bandwidth,
-                                               "max-video-width", player->adaptive_info.limit.width,
-                                               "max-video-height", player->adaptive_info.limit.height, NULL);
+                       LOGD("set max variant limit: %d, %d %d", player->adaptive_info.limit.bandwidth,
+                                                       player->adaptive_info.limit.width, player->adaptive_info.limit.height);
 
-       } else if (g_strrstr(klass, "Demuxer")) {
+                       g_object_set(player->pipeline->mainbin[MMPLAYER_M_ADAPTIVE_DEMUX].gst,
+                                                       "max-bandwidth", player->adaptive_info.limit.bandwidth,
+                                                       "max-video-width", player->adaptive_info.limit.width,
+                                                       "max-video-height", player->adaptive_info.limit.height, NULL);
+               } else {
 #ifdef __DEBUG__
-               LOGD("plugged element is demuxer. take it");
+                       LOGD("plugged element is demuxer. take it");
 #endif
-               player->pipeline->mainbin[MMPLAYER_M_DEMUX].id = MMPLAYER_M_DEMUX;
-               player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst = element;
+                       player->pipeline->mainbin[MMPLAYER_M_DEMUX].id = MMPLAYER_M_DEMUX;
+                       player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst = element;
+               }
        } else if (g_strrstr(klass, "Parser") && (g_strrstr(klass, "Video"))) {
                player->pipeline->mainbin[MMPLAYER_M_V_PARSE].id = MMPLAYER_M_V_PARSE;
                player->pipeline->mainbin[MMPLAYER_M_V_PARSE].gst = element;
        }
 
-       if (g_strrstr(factory_name, "asfdemux") || g_strrstr(factory_name, "qtdemux") || g_strrstr(factory_name, "avidemux")) {
-               int surface_type = 0;
-
-               mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &surface_type);
-       }
-
-       // to support trust-zone only
-       if (g_strrstr(factory_name, "asfdemux")) {
-               LOGD("set file-location %s", player->profile.uri);
-               g_object_set(G_OBJECT(element), "file-location", player->profile.uri, NULL);
-       } else if (g_strrstr(factory_name, "legacyh264parse")) {
-               LOGD("[%s] output-format to legacyh264parse", "mssdemux");
-               g_object_set(G_OBJECT(element), "output-format", 1, NULL); /* NALU/Byte Stream format */
-       } else if (g_strrstr(factory_name, "mpegaudioparse")) {
+       if (g_strrstr(factory_name, "mpegaudioparse")) {
                if ((MMPLAYER_IS_HTTP_STREAMING(player)) &&
                        (__mmplayer_is_only_mp3_type(player->type))) {
                        LOGD("[mpegaudioparse] set streaming pull mode.");
                        g_object_set(G_OBJECT(element), "http-pull-mp3dec", TRUE, NULL);
                }
-       } else if (g_strrstr(factory_name, player->ini.videocodec_element_hw)) {
-               player->pipeline->mainbin[MMPLAYER_M_DEC1].gst = element;
-       }
-
-       if (g_strrstr(factory_name, "omxdec_h264") || g_strrstr(factory_name, "v4l2h264dec")) {
-               GstElement *video_parse = player->pipeline->mainbin[MMPLAYER_M_V_PARSE].gst;
-               if (video_parse && (g_object_class_find_property(G_OBJECT_GET_CLASS(video_parse), "config-interval"))) {
-                       g_object_set(G_OBJECT(video_parse), "config-interval", -1, NULL);
-                       LOGD("Send SPS and PPS Insertion every IDR frame");
-               }
-       }
-
-       if ((player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst) &&
+       } else if ((player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst) &&
                (g_strrstr(GST_ELEMENT_NAME(element), "multiqueue"))) {
                LOGD("plugged element is multiqueue. take it %s", GST_ELEMENT_NAME(element));
 
@@ -7825,7 +7823,6 @@ _mmplayer_gst_element_added(GstElement *bin, GstElement *element, gpointer data)
                        _mm_player_streaming_set_multiqueue(player->streamer, element);
                        _mm_player_streaming_sync_property(player->streamer, player->pipeline->mainbin[MMPLAYER_M_AUTOPLUG].gst);
                }
-
        }
 
        return;