| From 1ed6c923b718465236e473a1a00d2846bb67a576 Mon Sep 17 00:00:00 2001 |
| From: Yuan Fang <yuan.fang@mediatek.com> |
| Date: Wed, 14 Aug 2019 15:43:29 +0800 |
| Subject: [PATCH] upgrade-gst-base-to-1_14_4 |
| |
| --- |
| ext/ogg/gstoggdemux.c | 62 ++++++++++++++++++++++++++++--- |
| ext/ogg/gstoggstream.c | 18 ++++++++- |
| ext/ogg/gstoggstream.h | 2 + |
| gst-libs/gst/audio/gstaudiobasesink.c | 5 ++- |
| gst-libs/gst/audio/gstaudiodecoder.c | 14 +++++++ |
| gst-libs/gst/audio/gstaudiodecoder.h | 4 ++ |
| gst-libs/gst/riff/riff-media.c | 1 + |
| gst-libs/gst/video/gstvideoutilsprivate.c | 12 ++++++ |
| gst-libs/gst/video/video-format.c | 14 ++++++- |
| gst-libs/gst/video/video-format.h | 2 + |
| gst-libs/gst/video/video-info.c | 19 ++++++++-- |
| gst/playback/gstdecodebin2.c | 2 +- |
| gst/playback/gstplaybin2.c | 5 ++- |
| gst/playback/gstplaysink.c | 48 ++++++++++++++++++++++++ |
| 14 files changed, 193 insertions(+), 15 deletions(-) |
| |
| diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c |
| index e600b3d..a9c6b27 100644 |
| --- a/ext/ogg/gstoggdemux.c |
| +++ b/ext/ogg/gstoggdemux.c |
| @@ -51,6 +51,9 @@ |
| /* we hope we get a granpos within this many bytes off the end */ |
| #define DURATION_CHUNK_OFFSET (128*1024) |
| |
| +/*search max page count*/ |
| +#define SEARCH_MAX_PAGE 75 |
| + |
| /* An Ogg page can not be larger than 255 segments of 255 bytes, plus |
| 26 bytes of header */ |
| #define MAX_OGG_PAGE_SIZE (255 * 255 + 26) |
| @@ -192,7 +195,9 @@ gst_ogg_pad_init (GstOggPad * pad) |
| |
| pad->map.granulerate_n = 0; |
| pad->map.granulerate_d = 0; |
| - pad->map.granuleshift = -1; |
| + pad->map.granuleshift = 0; |
| + pad->map.channel = 0; |
| + pad->map.bitspersample = 0; |
| } |
| |
| static void |
| @@ -830,7 +835,8 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet, |
| if (!packet->b_o_s || push_headers) { |
| if (pad->last_ret == GST_FLOW_OK) { |
| GST_LOG_OBJECT (ogg, "Pushing buf %" GST_PTR_FORMAT, buf); |
| - ret = gst_pad_push (GST_PAD_CAST (pad), buf); |
| + if (gst_buffer_get_size (buf) > 0) |
| + ret = gst_pad_push (GST_PAD_CAST (pad), buf); |
| } else { |
| GST_DEBUG_OBJECT (ogg, "not pushing buffer on error pad"); |
| ret = pad->last_ret; |
| @@ -2748,6 +2754,7 @@ gst_ogg_demux_get_prev_page (GstOggDemux * ogg, ogg_page * og, gint64 * offset) |
| gint64 begin = ogg->offset; |
| gint64 end = begin; |
| gint64 cur_offset = -1; |
| + gint hit_limit_cnt = 0; |
| |
| GST_LOG_OBJECT (ogg, "getting page before %" G_GINT64_FORMAT, begin); |
| |
| @@ -2778,7 +2785,12 @@ gst_ogg_demux_get_prev_page (GstOggDemux * ogg, ogg_page * og, gint64 * offset) |
| ret = gst_ogg_demux_get_next_page (ogg, og, boundary, &new_offset); |
| /* we hit the upper limit, offset contains the last page start */ |
| if (ret == GST_FLOW_LIMIT) { |
| - GST_LOG_OBJECT (ogg, "hit limit"); |
| + hit_limit_cnt++; |
| + GST_INFO_OBJECT (ogg, "hit limit, cnt=%d", hit_limit_cnt); |
| + if (hit_limit_cnt >= 3){ |
| + ret = GST_FLOW_OK; |
| + goto beach; |
| + } |
| break; |
| } |
| /* something went wrong */ |
| @@ -2965,8 +2977,12 @@ gst_ogg_demux_activate_chain (GstOggDemux * ogg, GstOggChain * chain, |
| gst_ogg_pad_mark_discont (pad); |
| pad->last_ret = GST_FLOW_OK; |
| |
| + GST_DEBUG_OBJECT (ogg, |
| + "serialno %08x time %" GST_TIME_FORMAT, |
| + pad->map.serialno, GST_TIME_ARGS (pad->start_time)); |
| + |
| if (pad->map.is_skeleton || pad->map.is_cmml || pad->added |
| - || !pad->map.caps) |
| + || !pad->map.caps || (pad->start_time == GST_CLOCK_TIME_NONE)) |
| continue; |
| |
| GST_DEBUG_OBJECT (ogg, "adding pad %" GST_PTR_FORMAT, pad); |
| @@ -4078,6 +4094,7 @@ gst_ogg_demux_read_chain (GstOggDemux * ogg, GstOggChain ** res_chain) |
| gint64 offset = ogg->offset; |
| ogg_page og; |
| gboolean done; |
| + gint loop_page_cnt = 0; |
| gint i; |
| |
| GST_LOG_OBJECT (ogg, "reading chain at %" G_GINT64_FORMAT, offset); |
| @@ -4201,8 +4218,15 @@ gst_ogg_demux_read_chain (GstOggDemux * ogg, GstOggChain ** res_chain) |
| break; |
| } |
| |
| + if ((loop_page_cnt >= SEARCH_MAX_PAGE) && (done == FALSE)) { |
| + done = TRUE; |
| + GST_ERROR_OBJECT (ogg, "(loop_page_cnt >= SEARCH_MAX_PAGE) && (done == FALSE)"); |
| + break; |
| + } |
| + |
| if (!done) { |
| ret = gst_ogg_demux_get_next_page (ogg, &og, -1, NULL); |
| + loop_page_cnt++; |
| if (ret != GST_FLOW_OK) |
| break; |
| } |
| @@ -4229,6 +4253,7 @@ gst_ogg_demux_read_end_chain (GstOggDemux * ogg, GstOggChain * chain) |
| gboolean done = FALSE; |
| ogg_page og; |
| gint i; |
| + gint hit_limit_count = 0; |
| |
| while (!done) { |
| begin -= ogg->chunk_size; |
| @@ -4243,8 +4268,14 @@ gst_ogg_demux_read_end_chain (GstOggDemux * ogg, GstOggChain * chain) |
| while (ogg->offset < end) { |
| ret = gst_ogg_demux_get_next_page (ogg, &og, end - ogg->offset, NULL); |
| |
| - if (ret == GST_FLOW_LIMIT) |
| + if (ret == GST_FLOW_LIMIT) { |
| + hit_limit_count++; |
| + GST_INFO_OBJECT (ogg, "hit_limit_count=%d", hit_limit_count); |
| + if (hit_limit_count >= 3) { |
| + done = TRUE; |
| + } |
| break; |
| + } |
| if (ret != GST_FLOW_OK) |
| return ret; |
| |
| @@ -4389,6 +4420,12 @@ gst_ogg_demux_find_chains (GstOggDemux * ogg) |
| GstOggChain *chain; |
| GstFlowReturn ret; |
| |
| + /*init og header and body*/ |
| + og.header_len = 0; |
| + og.body_len = 0; |
| + og.header = NULL; |
| + og.body = NULL; |
| + |
| /* get peer to figure out length */ |
| if ((peer = gst_pad_get_peer (ogg->sinkpad)) == NULL) |
| goto no_peer; |
| @@ -4420,7 +4457,20 @@ gst_ogg_demux_find_chains (GstOggDemux * ogg) |
| if (ret != GST_FLOW_OK) |
| goto no_last_page; |
| |
| - serialno = ogg_page_serialno (&og); |
| + GST_DEBUG_OBJECT (ogg, "ogg_page_serialno,og.header_len=%d,og.body_len=%d",og.header_len,og.body_len); |
| + if ((og.header_len > 27) && (og.header_len <= (27 + 255))) { |
| + serialno = ogg_page_serialno (&og); |
| + } |
| + else { |
| + gint i; |
| + for (i = 0; i < chain->streams->len; i++) { |
| + GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i); |
| + if (pad != NULL) { |
| + serialno = pad->map.serialno; |
| + break; |
| + } |
| + } |
| + } |
| |
| if (!gst_ogg_chain_has_stream (chain, serialno)) { |
| /* the last page is not in the first stream, this means we should |
| diff --git a/ext/ogg/gstoggstream.c b/ext/ogg/gstoggstream.c |
| index cdb6fa6..d5ee126 100644 |
| --- a/ext/ogg/gstoggstream.c |
| +++ b/ext/ogg/gstoggstream.c |
| @@ -28,6 +28,7 @@ |
| |
| #include <gst/riff/riff-media.h> |
| #include <gst/pbutils/pbutils.h> |
| +#include <gst/audio/audio.h> |
| |
| #include <stdlib.h> |
| #include <string.h> |
| @@ -1649,12 +1650,27 @@ setup_ogmaudio_mapper (GstOggStream * pad, ogg_packet * packet) |
| GST_DEBUG ("fourcc: %s", fstr); |
| |
| /* FIXME: Need to do something with the reorder map */ |
| + gchar *pchar=NULL; |
| + guint16 n_fourcc=strtol((const char *)fstr,&pchar,16); |
| + |
| + pad->channel = GST_READ_UINT16_LE (data + 45); |
| + pad->bitspersample = GST_READ_UINT32_LE (data + 41); |
| + |
| pad->caps = |
| - gst_riff_create_audio_caps (fourcc, NULL, NULL, NULL, NULL, NULL, NULL); |
| + gst_riff_create_audio_caps (n_fourcc, NULL, NULL, NULL, NULL, NULL, NULL); |
| |
| if (pad->caps) { |
| gst_caps_set_simple (pad->caps, |
| "rate", G_TYPE_INT, pad->granulerate_n, NULL); |
| + gst_caps_set_simple (pad->caps, |
| + "channels", G_TYPE_INT, pad->channel, NULL); |
| + if (GST_RIFF_WAVE_FORMAT_PCM == n_fourcc) { |
| + GstAudioFormat format; |
| + gint wd = GST_ROUND_UP_8 (pad->bitspersample); |
| + format = gst_audio_format_build_integer (wd != 8, G_LITTLE_ENDIAN, wd, wd); |
| + gst_caps_set_simple (pad->caps, |
| + "format", G_TYPE_STRING, gst_audio_format_to_string (format), NULL); |
| + } |
| } else { |
| pad->caps = gst_caps_new_simple ("audio/x-ogm-unknown", |
| "fourcc", G_TYPE_STRING, fstr, |
| diff --git a/ext/ogg/gstoggstream.h b/ext/ogg/gstoggstream.h |
| index d49527f..2822a93 100644 |
| --- a/ext/ogg/gstoggstream.h |
| +++ b/ext/ogg/gstoggstream.h |
| @@ -111,6 +111,8 @@ struct _GstOggStream |
| GstOggIndex *index; |
| guint64 kp_denom; |
| guint64 idx_bitrate; |
| + guint16 channel; |
| + guint32 bitspersample; |
| }; |
| |
| |
| diff --git a/gst-libs/gst/audio/gstaudiobasesink.c b/gst-libs/gst/audio/gstaudiobasesink.c |
| index ff4e4e2..534f195 100644 |
| --- a/gst-libs/gst/audio/gstaudiobasesink.c |
| +++ b/gst-libs/gst/audio/gstaudiobasesink.c |
| @@ -1757,8 +1757,9 @@ gst_audio_base_sink_get_alignment (GstAudioBaseSink * sink, |
| /* discont candidate */ |
| sink->priv->discont_time = time; |
| } else if (time - sink->priv->discont_time >= sink->priv->discont_wait) { |
| - /* discont_wait expired, discontinuity detected */ |
| - discont = TRUE; |
| + /* discont_wait expired, discontinuity detected, not set discont avoid drop samples*/ |
| + /* discont = TRUE; */ |
| + |
| sink->priv->discont_time = -1; |
| } |
| } else { |
| diff --git a/gst-libs/gst/audio/gstaudiodecoder.c b/gst-libs/gst/audio/gstaudiodecoder.c |
| index dede766..564a4d5 100644 |
| --- a/gst-libs/gst/audio/gstaudiodecoder.c |
| +++ b/gst-libs/gst/audio/gstaudiodecoder.c |
| @@ -458,6 +458,10 @@ gst_audio_decoder_init (GstAudioDecoder * dec, GstAudioDecoderClass * klass) |
| /* init state */ |
| dec->priv->ctx.min_latency = 0; |
| dec->priv->ctx.max_latency = 0; |
| + |
| + dec->ts_none = FALSE; |
| + dec->sub_ts_none = FALSE; |
| + |
| gst_audio_decoder_reset (dec, TRUE); |
| GST_DEBUG_OBJECT (dec, "init ok"); |
| } |
| @@ -1272,6 +1276,10 @@ gst_audio_decoder_finish_frame (GstAudioDecoder * dec, GstBuffer * buf, |
| else |
| ts = GST_CLOCK_TIME_NONE; |
| |
| + if (dec->ts_none && !dec->sub_ts_none) { |
| + ts = GST_CLOCK_TIME_NONE; |
| + } |
| + |
| GST_DEBUG_OBJECT (dec, "leading frame ts %" GST_TIME_FORMAT, |
| GST_TIME_ARGS (ts)); |
| |
| @@ -1514,6 +1522,12 @@ gst_audio_decoder_push_buffers (GstAudioDecoder * dec, gboolean force) |
| } |
| /* track upstream ts, but do not get stuck if nothing new upstream */ |
| ts = gst_adapter_prev_pts (priv->adapter, &distance); |
| + |
| + if (ts <= priv->prev_ts) { |
| + dec->ts_none = TRUE; |
| + dec->sub_ts_none = TRUE; |
| + } |
| + |
| if (ts != priv->prev_ts || distance <= priv->prev_distance) { |
| priv->prev_ts = ts; |
| priv->prev_distance = distance; |
| diff --git a/gst-libs/gst/audio/gstaudiodecoder.h b/gst-libs/gst/audio/gstaudiodecoder.h |
| index f03d9ac..3c537a1 100644 |
| --- a/gst-libs/gst/audio/gstaudiodecoder.h |
| +++ b/gst-libs/gst/audio/gstaudiodecoder.h |
| @@ -172,6 +172,10 @@ struct _GstAudioDecoder |
| GstSegment input_segment; |
| GstSegment output_segment; |
| |
| + /*set ts to GST_CLOCK_TIME_NONE flag*/ |
| + gboolean ts_none; |
| + gboolean sub_ts_none; |
| + |
| /*< private >*/ |
| GstAudioDecoderPrivate *priv; |
| |
| diff --git a/gst-libs/gst/riff/riff-media.c b/gst-libs/gst/riff/riff-media.c |
| index 2d6aa55..5c06924 100644 |
| --- a/gst-libs/gst/riff/riff-media.c |
| +++ b/gst-libs/gst/riff/riff-media.c |
| @@ -261,6 +261,7 @@ gst_riff_create_video_caps (guint32 codec_fcc, |
| case GST_MAKE_FOURCC ('m', 'p', 'g', '2'): |
| case GST_MAKE_FOURCC ('P', 'I', 'M', '2'): |
| case GST_MAKE_FOURCC ('D', 'V', 'R', ' '): |
| + case GST_MAKE_FOURCC ('E', 'M', '2', 'V'): |
| case GST_MAKE_FOURCC (0x02, 0x00, 0x00, 0x10): |
| caps = gst_caps_new_simple ("video/mpeg", |
| "systemstream", G_TYPE_BOOLEAN, FALSE, |
| diff --git a/gst-libs/gst/video/gstvideoutilsprivate.c b/gst-libs/gst/video/gstvideoutilsprivate.c |
| index 68631c8..3d71cb3 100644 |
| --- a/gst-libs/gst/video/gstvideoutilsprivate.c |
| +++ b/gst-libs/gst/video/gstvideoutilsprivate.c |
| @@ -135,10 +135,22 @@ __gst_video_element_proxy_getcaps (GstElement * element, GstPad * sinkpad, |
| gst_caps_unref (templ_caps); |
| |
| if (filter) { |
| + GstStructure *filter_st = NULL; |
| GST_LOG_OBJECT (element, "intersecting with %" GST_PTR_FORMAT, filter); |
| filter_caps = gst_caps_intersect (fcaps, filter); |
| gst_caps_unref (fcaps); |
| fcaps = filter_caps; |
| + |
| + filter_st = gst_caps_get_structure (filter, 0); |
| + if (!gst_structure_has_field (filter_st, "framerate")) { |
| + GstStructure *fcaps_st = NULL; |
| + |
| + fcaps_st = gst_caps_get_structure (fcaps, 0); |
| + gst_structure_remove_field (fcaps_st, "framerate"); |
| + fcaps_st = NULL; |
| + } |
| + |
| + filter_st = NULL; |
| } |
| |
| done: |
| diff --git a/gst-libs/gst/video/video-format.c b/gst-libs/gst/video/video-format.c |
| index f2fa22b..ebe1ad5 100644 |
| --- a/gst-libs/gst/video/video-format.c |
| +++ b/gst-libs/gst/video/video-format.c |
| @@ -5240,6 +5240,12 @@ static const VideoFormat formats[] = { |
| PSTR222, PLANE012, OFFS0, SUB444, PACK_Y444_12BE), |
| MAKE_YUV_LE_FORMAT (Y444_12LE, "raw video", 0x00000000, DPTH12_12_12, |
| PSTR222, PLANE012, OFFS0, SUB444, PACK_Y444_12LE), |
| + |
| + MAKE_YUV_FORMAT (MT21, "raw video", GST_MAKE_FOURCC ('M', 'M', '2', '1'), |
| + DPTH888, PSTR122, PLANE011, OFFS001, SUB420, PACK_NV12), |
| + MAKE_YUV_FORMAT (I422, "raw video", GST_MAKE_FOURCC ('Y', 'M', '1', '6'), |
| + DPTH888, PSTR111, PLANE012, OFFS0, SUB422, PACK_420), |
| + |
| MAKE_GRAY_C_LE_FORMAT (GRAY10_LE32, "raw video", DPTH10, PSTR0, PLANE0, OFFS0, |
| SUB4, PACK_GRAY10_LE32), |
| MAKE_YUV_C_LE_FORMAT (NV12_10LE32, "raw video", |
| @@ -5480,6 +5486,10 @@ gst_video_format_from_fourcc (guint32 fourcc) |
| return GST_VIDEO_FORMAT_IYU1; |
| case GST_MAKE_FOURCC ('A', 'Y', '6', '4'): |
| return GST_VIDEO_FORMAT_AYUV64; |
| + case GST_MAKE_FOURCC ('M', 'M', '2', '1'): |
| + return GST_VIDEO_FORMAT_MT21; |
| + case GST_MAKE_FOURCC ('Y', 'M', '1', '6'): |
| + return GST_VIDEO_FORMAT_I422; |
| case GST_MAKE_FOURCC ('X', 'V', '1', '0'): |
| return GST_VIDEO_FORMAT_GRAY10_LE32; |
| case GST_MAKE_FOURCC ('X', 'V', '1', '5'): |
| @@ -5504,9 +5514,11 @@ GstVideoFormat |
| gst_video_format_from_string (const gchar * format) |
| { |
| guint i; |
| - |
| g_return_val_if_fail (format != NULL, GST_VIDEO_FORMAT_UNKNOWN); |
| |
| + if (strcmp ("MT21", format) == 0) |
| + return GST_VIDEO_FORMAT_MT21; |
| + |
| for (i = 0; i < G_N_ELEMENTS (formats); i++) { |
| if (strcmp (GST_VIDEO_FORMAT_INFO_NAME (&formats[i].info), format) == 0) |
| return GST_VIDEO_FORMAT_INFO_FORMAT (&formats[i].info); |
| diff --git a/gst-libs/gst/video/video-format.h b/gst-libs/gst/video/video-format.h |
| index dbf514d..325e0c8 100644 |
| --- a/gst-libs/gst/video/video-format.h |
| +++ b/gst-libs/gst/video/video-format.h |
| @@ -195,6 +195,8 @@ typedef enum { |
| GST_VIDEO_FORMAT_I422_12LE, |
| GST_VIDEO_FORMAT_Y444_12BE, |
| GST_VIDEO_FORMAT_Y444_12LE, |
| + GST_VIDEO_FORMAT_MT21, |
| + GST_VIDEO_FORMAT_I422, |
| GST_VIDEO_FORMAT_GRAY10_LE32, |
| GST_VIDEO_FORMAT_NV12_10LE32, |
| GST_VIDEO_FORMAT_NV16_10LE32, |
| diff --git a/gst-libs/gst/video/video-info.c b/gst-libs/gst/video/video-info.c |
| index 25f7027..1ffabee 100644 |
| --- a/gst-libs/gst/video/video-info.c |
| +++ b/gst-libs/gst/video/video-info.c |
| @@ -785,12 +785,24 @@ fill_planes (GstVideoInfo * info) |
| info->stride[1] = GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2); |
| info->stride[2] = info->stride[1]; |
| info->offset[0] = 0; |
| - info->offset[1] = info->stride[0] * GST_ROUND_UP_2 (height); |
| + info->offset[1] = GST_ROUND_UP_128 (info->stride[0] * GST_ROUND_UP_2 (height)); |
| cr_h = GST_ROUND_UP_2 (height) / 2; |
| if (GST_VIDEO_INFO_IS_INTERLACED (info)) |
| cr_h = GST_ROUND_UP_2 (cr_h); |
| - info->offset[2] = info->offset[1] + info->stride[1] * cr_h; |
| - info->size = info->offset[2] + info->stride[2] * cr_h; |
| + info->offset[2] = info->offset[1] + GST_ROUND_UP_128 (info->stride[1] * cr_h); |
| + info->size = info->offset[2] + GST_ROUND_UP_128 (info->stride[2] * cr_h); |
| + break; |
| + |
| + case GST_VIDEO_FORMAT_I422: |
| + info->stride[0] = GST_ROUND_UP_4 (width); |
| + info->stride[1] = GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2); |
| + info->stride[2] = info->stride[1]; |
| + |
| + info->offset[0] = 0; |
| + info->offset[1] = GST_ROUND_UP_128 (info->stride[0] * GST_ROUND_UP_2 (height)); |
| + info->offset[2] = info->offset[1] + GST_ROUND_UP_128 (info->stride[1] * GST_ROUND_UP_2 (height)); |
| + |
| + info->size = info->stride[0] * GST_ROUND_UP_2 (height) * 2; |
| break; |
| case GST_VIDEO_FORMAT_Y41B: |
| info->stride[0] = GST_ROUND_UP_4 (width); |
| @@ -835,6 +847,7 @@ fill_planes (GstVideoInfo * info) |
| break; |
| case GST_VIDEO_FORMAT_NV12: |
| case GST_VIDEO_FORMAT_NV21: |
| + case GST_VIDEO_FORMAT_MT21: |
| info->stride[0] = GST_ROUND_UP_4 (width); |
| info->stride[1] = info->stride[0]; |
| info->offset[0] = 0; |
| diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c |
| index c6e8131..06c8853 100644 |
| --- a/gst/playback/gstdecodebin2.c |
| +++ b/gst/playback/gstdecodebin2.c |
| @@ -246,7 +246,7 @@ enum |
| |
| /* when playing, keep a max of 2MB of data but try to keep the number of buffers |
| * as low as possible (try to aim for 5 buffers) */ |
| -#define AUTO_PLAY_SIZE_BYTES 2 * 1024 * 1024 |
| +#define AUTO_PLAY_SIZE_BYTES 10 * 1024 * 1024 |
| #define AUTO_PLAY_SIZE_BUFFERS 5 |
| #define AUTO_PLAY_SIZE_TIME 0 |
| |
| diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c |
| index a2e9ed4..58cd6e6 100644 |
| --- a/gst/playback/gstplaybin2.c |
| +++ b/gst/playback/gstplaybin2.c |
| @@ -4707,7 +4707,10 @@ autoplug_select_cb (GstElement * decodebin, GstPad * pad, |
| gst_element_factory_can_src_any_caps (factory, raw_caps) |
| || gst_element_factory_can_src_any_caps (factory, caps); |
| } else { |
| - compatible = gst_element_factory_can_src_any_caps (factory, caps); |
| + if (flags & GST_PLAY_FLAG_NATIVE_VIDEO) |
| + compatible = gst_element_factory_can_src_any_caps (factory, raw_caps); |
| + else |
| + compatible = gst_element_factory_can_src_any_caps (factory, caps); |
| } |
| |
| gst_object_unref (sinkpad); |
| diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c |
| index 89cd225..13f991c 100644 |
| --- a/gst/playback/gstplaysink.c |
| +++ b/gst/playback/gstplaysink.c |
| @@ -1949,6 +1949,54 @@ gen_video_chain (GstPlaySink * playsink, gboolean raw, gboolean async) |
| } |
| prev = chain->conv; |
| } |
| + else if (playsink->flags & GST_PLAY_FLAG_NATIVE_VIDEO) { |
| + GstElement *elem = NULL; |
| + GstIterator *iter = NULL; |
| + GValue value = { 0 }; |
| + gboolean done = FALSE; |
| + gboolean found_mdp = FALSE; |
| + |
| + iter = gst_bin_iterate_elements (playsink->video_sink); |
| + if (iter != NULL) { |
| + while (!done) { |
| + switch (gst_iterator_next (iter, &value)) { |
| + case GST_ITERATOR_OK: |
| + elem = (GstElement *) g_value_get_object (&value); |
| + GST_DEBUG_OBJECT (playsink, "element->name=%s", GST_ELEMENT_NAME (elem)); |
| + if (strstr (GST_ELEMENT_NAME (elem), "mtkmdp")) { |
| + done = TRUE; |
| + found_mdp = TRUE; |
| + } |
| + /* Iterator increased the element refcount, so unref */ |
| + g_value_unset (&value); |
| + break; |
| + default: |
| + done = TRUE; |
| + break; |
| + } |
| + } |
| + gst_iterator_free (iter); |
| + } |
| + |
| + if (found_mdp == FALSE) { |
| + GST_DEBUG_OBJECT (playsink, "mdp_plugin == NULL"); |
| + chain->conv = gst_element_factory_make ("mtkmdp", "mtkmdp"); |
| + if (chain->conv == NULL) { |
| + GST_WARNING_OBJECT (playsink, "no mtkmdp plugin"); |
| + } |
| + else { |
| + gst_bin_add (bin, chain->conv); |
| + if (prev) { |
| + if (!gst_element_link_pads_full (prev, "src", chain->conv, "sink", |
| + GST_PAD_LINK_CHECK_TEMPLATE_CAPS)) |
| + goto link_failed; |
| + } else { |
| + head = chain->conv; |
| + } |
| + prev = chain->conv; |
| + } |
| + } |
| + } |
| |
| update_colorbalance (playsink); |
| |
| -- |
| 1.9.1 |
| |