From: Wim Taymans Date: Thu, 18 Aug 2011 17:36:50 +0000 (+0200) Subject: Merge branch 'master' into 0.11 X-Git-Tag: 1.19.3~511^2~7350 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ba41bb5ca78335dca05a320679ade19886a552fb;p=platform%2Fupstream%2Fgstreamer.git Merge branch 'master' into 0.11 Conflicts: ext/ogg/gstoggmux.c gst/playback/gstplaysink.c --- ba41bb5ca78335dca05a320679ade19886a552fb diff --cc ext/ogg/gstoggdemux.c index 72e1624,eddaa44..f101001 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@@ -114,8 -114,9 +114,8 @@@ static void gst_ogg_pad_finalize (GObje static const GstQueryType *gst_ogg_pad_query_types (GstPad * pad); static gboolean gst_ogg_pad_src_query (GstPad * pad, GstQuery * query); static gboolean gst_ogg_pad_event (GstPad * pad, GstEvent * event); -static GstCaps *gst_ogg_pad_getcaps (GstPad * pad); static GstOggPad *gst_ogg_chain_get_stream (GstOggChain * chain, - glong serialno); + guint32 serialno); static GstFlowReturn gst_ogg_demux_combine_flows (GstOggDemux * ogg, GstOggPad * pad, GstFlowReturn ret); @@@ -1183,10 -1183,10 +1185,11 @@@ gst_ogg_chain_new_stream (GstOggChain gst_tag_list_free (list); GST_DEBUG_OBJECT (chain->ogg, - "created new ogg src %p for stream with serial %08lx", ret, serialno); + "created new ogg src %p for stream with serial %08" G_GINT32_MODIFIER "x", + ret, serialno); g_array_append_val (chain->streams, ret); + gst_pad_set_active (GST_PAD_CAST (ret), TRUE); return ret; @@@ -2935,8 -2962,9 +2942,8 @@@ gst_ogg_demux_find_chains (GstOggDemux { ogg_page og; GstPad *peer; - GstFormat format; gboolean res; - gulong serialno; + guint32 serialno; GstOggChain *chain; GstFlowReturn ret; diff --cc ext/ogg/gstoggmux.c index a87e4fc,f039efc..2f043ec --- a/ext/ogg/gstoggmux.c +++ b/ext/ogg/gstoggmux.c @@@ -1070,6 -1120,19 +1074,21 @@@ gst_ogg_mux_set_header_on_caps (GstCap return caps; } + static void + create_header_packet (ogg_packet * packet, GstBuffer * buf, GstOggPadData * pad) + { - packet->packet = GST_BUFFER_DATA (buf); - packet->bytes = GST_BUFFER_SIZE (buf); ++ gsize size; ++ ++ packet->packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ); ++ packet->bytes = size; + packet->granulepos = 0; + /* mark BOS and packet number */ + packet->b_o_s = (pad->packetno == 0); + packet->packetno = pad->packetno++; + /* mark EOS */ + packet->e_o_s = 0; + } + /* * For each pad we need to write out one (small) header in one * page that allows decoders to identify the type of the stream. diff --cc gst/playback/gstplaysink.c index 23e9526,019dcc3..e0a540b --- a/gst/playback/gstplaysink.c +++ b/gst/playback/gstplaysink.c @@@ -171,8 -182,9 +184,10 @@@ struct _GstPlaySin gboolean text_pad_blocked; GstPad *text_srcpad_stream_synchronizer; GstPad *text_sinkpad_stream_synchronizer; + gulong text_block_id; + guint32 pending_blocked_pads; + /* properties */ GstElement *audio_sink; GstElement *video_sink; @@@ -2863,73 -2871,8 +2878,78 @@@ is_raw_pad (GstPad * pad return raw; } +static GstProbeReturn +sinkpad_blocked_cb (GstPad * blockedpad, GstProbeType type, gpointer type_data, + gpointer user_data); + static void -sinkpad_blocked_cb (GstPad * blockedpad, gboolean blocked, gpointer user_data) +video_set_blocked (GstPlaySink * playsink, gboolean blocked) +{ + if (playsink->video_pad) { + GstPad *opad = + GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD + (playsink->video_pad))); + if (blocked && playsink->video_block_id == 0) { + playsink->video_block_id = + gst_pad_add_probe (opad, GST_PROBE_TYPE_BLOCK, sinkpad_blocked_cb, + gst_object_ref (playsink), (GDestroyNotify) gst_object_unref); + } else if (!blocked && playsink->video_block_id) { + gst_pad_remove_probe (opad, playsink->video_block_id); ++ PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_VIDEO_RAW); ++ PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_VIDEO); + playsink->video_block_id = 0; + playsink->video_pad_blocked = FALSE; + } + gst_object_unref (opad); + } +} + +static void +audio_set_blocked (GstPlaySink * playsink, gboolean blocked) +{ + if (playsink->audio_pad) { + GstPad *opad = + GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD + (playsink->audio_pad))); + if (blocked && playsink->audio_block_id == 0) { + playsink->audio_block_id = + gst_pad_add_probe (opad, GST_PROBE_TYPE_BLOCK, sinkpad_blocked_cb, + gst_object_ref (playsink), (GDestroyNotify) gst_object_unref); + } else if (!blocked && playsink->audio_block_id) { + gst_pad_remove_probe (opad, playsink->audio_block_id); ++ PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_AUDIO_RAW); ++ PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_AUDIO); + playsink->audio_block_id = 0; + playsink->audio_pad_blocked = FALSE; + } + gst_object_unref (opad); + } +} + +static void +text_set_blocked (GstPlaySink * playsink, gboolean blocked) +{ + if (playsink->text_pad) { + GstPad *opad = + GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD + (playsink->text_pad))); + if (blocked && playsink->text_block_id == 0) { + playsink->text_block_id = + gst_pad_add_probe (opad, GST_PROBE_TYPE_BLOCK, sinkpad_blocked_cb, + gst_object_ref (playsink), (GDestroyNotify) gst_object_unref); + } else if (!blocked && playsink->text_block_id) { + gst_pad_remove_probe (opad, playsink->text_block_id); ++ PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_TEXT); + playsink->text_block_id = 0; + playsink->text_pad_blocked = FALSE; + } + gst_object_unref (opad); + } +} + +static GstProbeReturn +sinkpad_blocked_cb (GstPad * blockedpad, GstProbeType type, gpointer type_data, + gpointer user_data) { GstPlaySink *playsink = (GstPlaySink *) user_data; GstPad *pad; @@@ -2938,19 -2881,43 +2958,27 @@@ pad = GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (blockedpad))); if (pad == playsink->video_pad) { - playsink->video_pad_blocked = blocked; - GST_DEBUG_OBJECT (pad, "Video pad blocked: %d", blocked); - if (!blocked) { - PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_VIDEO_RAW); - PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_VIDEO); - } + playsink->video_pad_blocked = TRUE; + GST_DEBUG_OBJECT (pad, "Video pad blocked"); } else if (pad == playsink->audio_pad) { - playsink->audio_pad_blocked = blocked; - GST_DEBUG_OBJECT (pad, "Audio pad blocked: %d", blocked); - if (!blocked) { - PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_AUDIO_RAW); - PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_AUDIO); - } + playsink->audio_pad_blocked = TRUE; + GST_DEBUG_OBJECT (pad, "Audio pad blocked"); } else if (pad == playsink->text_pad) { - playsink->text_pad_blocked = blocked; - GST_DEBUG_OBJECT (pad, "Text pad blocked: %d", blocked); - if (!blocked) - PENDING_FLAG_UNSET (playsink, GST_PLAY_SINK_TYPE_TEXT); - } - - if (!blocked) { - gst_object_unref (pad); - GST_PLAY_SINK_UNLOCK (playsink); - return; + playsink->text_pad_blocked = TRUE; + GST_DEBUG_OBJECT (pad, "Text pad blocked"); } - if ((!playsink->video_pad || playsink->video_pad_blocked) && - (!playsink->audio_pad || playsink->audio_pad_blocked) && - (!playsink->text_pad || playsink->text_pad_blocked)) { + /* We reconfigure when for ALL streams: + * * there isn't a pad + * * OR the pad is blocked + * * OR there are no pending blocks on that pad + */ + + if ((!playsink->video_pad || playsink->video_pad_blocked + || !PENDING_VIDEO_BLOCK (playsink)) && (!playsink->audio_pad + || playsink->audio_pad_blocked || !PENDING_AUDIO_BLOCK (playsink)) + && (!playsink->text_pad || playsink->text_pad_blocked + || !PENDING_TEXT_BLOCK (playsink))) { GST_DEBUG_OBJECT (playsink, "All pads blocked -- reconfiguring"); if (playsink->video_pad) { @@@ -3128,9 -3135,9 +3156,10 @@@ gst_play_sink_request_pad (GstPlaySink GstPad *blockpad = GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (res))); - gst_pad_set_blocked_async_full (blockpad, TRUE, sinkpad_blocked_cb, + *block_id = + gst_pad_add_probe (blockpad, GST_PROBE_TYPE_BLOCK, sinkpad_blocked_cb, gst_object_ref (playsink), (GDestroyNotify) gst_object_unref); + PENDING_FLAG_SET (playsink, type); gst_object_unref (blockpad); } if (!activate)