• Home
  • Raw
  • Download

Lines Matching refs:basesink

404 static void gst_base_sink_default_get_times (GstBaseSink * basesink,
406 static gboolean gst_base_sink_set_flushing (GstBaseSink * basesink,
408 static gboolean gst_base_sink_default_activate_pull (GstBaseSink * basesink,
429 static gboolean gst_base_sink_default_event (GstBaseSink * basesink,
431 static GstFlowReturn gst_base_sink_default_wait_event (GstBaseSink * basesink,
439 static gboolean gst_base_sink_negotiate_pull (GstBaseSink * basesink);
445 static gboolean gst_base_sink_is_too_late (GstBaseSink * basesink,
711 gst_base_sink_init (GstBaseSink * basesink, gpointer g_class) in gst_base_sink_init() argument
716 basesink->priv = priv = gst_base_sink_get_instance_private (basesink); in gst_base_sink_init()
722 basesink->sinkpad = gst_pad_new_from_template (pad_template, "sink"); in gst_base_sink_init()
724 gst_pad_set_activate_function (basesink->sinkpad, gst_base_sink_pad_activate); in gst_base_sink_init()
725 gst_pad_set_activatemode_function (basesink->sinkpad, in gst_base_sink_init()
727 gst_pad_set_query_function (basesink->sinkpad, gst_base_sink_sink_query); in gst_base_sink_init()
728 gst_pad_set_event_function (basesink->sinkpad, gst_base_sink_event); in gst_base_sink_init()
729 gst_pad_set_chain_function (basesink->sinkpad, gst_base_sink_chain); in gst_base_sink_init()
730 gst_pad_set_chain_list_function (basesink->sinkpad, gst_base_sink_chain_list); in gst_base_sink_init()
731 gst_element_add_pad (GST_ELEMENT_CAST (basesink), basesink->sinkpad); in gst_base_sink_init()
733 basesink->pad_mode = GST_PAD_MODE_NONE; in gst_base_sink_init()
734 g_mutex_init (&basesink->preroll_lock); in gst_base_sink_init()
735 g_cond_init (&basesink->preroll_cond); in gst_base_sink_init()
738 basesink->can_activate_push = DEFAULT_CAN_ACTIVATE_PUSH; in gst_base_sink_init()
739 basesink->can_activate_pull = DEFAULT_CAN_ACTIVATE_PULL; in gst_base_sink_init()
741 basesink->sync = DEFAULT_SYNC; in gst_base_sink_init()
742 basesink->max_lateness = DEFAULT_MAX_LATENESS; in gst_base_sink_init()
764 GST_OBJECT_FLAG_SET (basesink, GST_ELEMENT_FLAG_SINK); in gst_base_sink_init()
770 GstBaseSink *basesink; in gst_base_sink_finalize() local
772 basesink = GST_BASE_SINK (object); in gst_base_sink_finalize()
774 g_mutex_clear (&basesink->preroll_lock); in gst_base_sink_finalize()
775 g_cond_clear (&basesink->preroll_cond); in gst_base_sink_finalize()
1719 gst_base_sink_commit_state (GstBaseSink * basesink) in gst_base_sink_commit_state() argument
1728 basesink->playing_async = FALSE; in gst_base_sink_commit_state()
1730 GST_OBJECT_LOCK (basesink); in gst_base_sink_commit_state()
1731 current = GST_STATE (basesink); in gst_base_sink_commit_state()
1732 next = GST_STATE_NEXT (basesink); in gst_base_sink_commit_state()
1733 pending = GST_STATE_PENDING (basesink); in gst_base_sink_commit_state()
1739 GST_DEBUG_OBJECT (basesink, "committing state to PLAYING"); in gst_base_sink_commit_state()
1741 basesink->need_preroll = FALSE; in gst_base_sink_commit_state()
1743 basesink->priv->committed = TRUE; in gst_base_sink_commit_state()
1752 GST_DEBUG_OBJECT (basesink, "committing state to PAUSED"); in gst_base_sink_commit_state()
1755 basesink->priv->committed = TRUE; in gst_base_sink_commit_state()
1768 basesink->priv->have_latency = TRUE; in gst_base_sink_commit_state()
1770 GST_STATE (basesink) = pending; in gst_base_sink_commit_state()
1771 GST_STATE_NEXT (basesink) = GST_STATE_VOID_PENDING; in gst_base_sink_commit_state()
1772 GST_STATE_PENDING (basesink) = GST_STATE_VOID_PENDING; in gst_base_sink_commit_state()
1773 GST_STATE_RETURN (basesink) = GST_STATE_CHANGE_SUCCESS; in gst_base_sink_commit_state()
1774 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_commit_state()
1777 GST_DEBUG_OBJECT (basesink, "posting PAUSED state change message"); in gst_base_sink_commit_state()
1778 gst_element_post_message (GST_ELEMENT_CAST (basesink), in gst_base_sink_commit_state()
1779 gst_message_new_state_changed (GST_OBJECT_CAST (basesink), in gst_base_sink_commit_state()
1783 GST_DEBUG_OBJECT (basesink, "posting async-done message"); in gst_base_sink_commit_state()
1784 gst_element_post_message (GST_ELEMENT_CAST (basesink), in gst_base_sink_commit_state()
1785 gst_message_new_async_done (GST_OBJECT_CAST (basesink), in gst_base_sink_commit_state()
1792 klass = GST_ELEMENT_GET_CLASS (basesink); in gst_base_sink_commit_state()
1793 basesink->have_preroll = TRUE; in gst_base_sink_commit_state()
1797 GST_BASE_SINK_PREROLL_UNLOCK (basesink); in gst_base_sink_commit_state()
1800 klass->change_state (GST_ELEMENT_CAST (basesink), in gst_base_sink_commit_state()
1803 GST_BASE_SINK_PREROLL_LOCK (basesink); in gst_base_sink_commit_state()
1806 if (G_UNLIKELY (basesink->flushing)) in gst_base_sink_commit_state()
1809 GST_DEBUG_OBJECT (basesink, "posting PLAYING state change message"); in gst_base_sink_commit_state()
1812 gst_element_post_message (GST_ELEMENT_CAST (basesink), in gst_base_sink_commit_state()
1813 gst_message_new_state_changed (GST_OBJECT_CAST (basesink), in gst_base_sink_commit_state()
1817 gst_element_post_message (GST_ELEMENT_CAST (basesink), in gst_base_sink_commit_state()
1818 gst_message_new_latency (GST_OBJECT_CAST (basesink))); in gst_base_sink_commit_state()
1820 GST_STATE_BROADCAST (basesink); in gst_base_sink_commit_state()
1831 GST_DEBUG_OBJECT (basesink, "nothing to commit, now in %s", in gst_base_sink_commit_state()
1835 basesink->need_preroll = FALSE; in gst_base_sink_commit_state()
1838 basesink->need_preroll = TRUE; in gst_base_sink_commit_state()
1841 basesink->need_preroll = FALSE; in gst_base_sink_commit_state()
1842 basesink->flushing = TRUE; in gst_base_sink_commit_state()
1846 basesink->priv->have_latency = TRUE; in gst_base_sink_commit_state()
1847 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_commit_state()
1849 gst_element_post_message (GST_ELEMENT_CAST (basesink), in gst_base_sink_commit_state()
1850 gst_message_new_latency (GST_OBJECT_CAST (basesink))); in gst_base_sink_commit_state()
1855 GST_OBJECT_LOCK (basesink); in gst_base_sink_commit_state()
1861 GST_DEBUG_OBJECT (basesink, "stopping"); in gst_base_sink_commit_state()
1862 basesink->need_preroll = FALSE; in gst_base_sink_commit_state()
1863 basesink->flushing = TRUE; in gst_base_sink_commit_state()
1864 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_commit_state()
2113 gst_base_sink_get_sync_times (GstBaseSink * basesink, GstMiniObject * obj, in gst_base_sink_get_sync_times() argument
2129 priv = basesink->priv; in gst_base_sink_get_sync_times()
2130 segment = &basesink->segment; in gst_base_sink_get_sync_times()
2132 bclass = GST_BASE_SINK_GET_CLASS (basesink); in gst_base_sink_get_sync_times()
2164 GST_DEBUG_OBJECT (basesink, "sync times for EOS %" GST_TIME_FORMAT, in gst_base_sink_get_sync_times()
2176 GST_DEBUG_OBJECT (basesink, "Got Gap time %" GST_TIME_FORMAT in gst_base_sink_get_sync_times()
2199 bclass->get_times (basesink, buffer, &start, &stop); in gst_base_sink_get_sync_times()
2204 gst_base_sink_default_get_times (basesink, buffer, &start, &stop); in gst_base_sink_get_sync_times()
2211 GST_DEBUG_OBJECT (basesink, "got times start: %" GST_TIME_FORMAT in gst_base_sink_get_sync_times()
2222 GST_DEBUG_OBJECT (basesink, "step out of segment"); in gst_base_sink_get_sync_times()
2237 GST_DEBUG_OBJECT (basesink, "clipped to: start %" GST_TIME_FORMAT in gst_base_sink_get_sync_times()
2269 if (!(*step_end = handle_stepping (basesink, segment, step, &cstart, &cstop, in gst_base_sink_get_sync_times()
2273 GST_DEBUG_OBJECT (basesink, "stepping busy"); in gst_base_sink_get_sync_times()
2284 GST_DEBUG_OBJECT (basesink, "flushing step ended"); in gst_base_sink_get_sync_times()
2285 stop_stepping (basesink, segment, step, rstart, rstop, eos); in gst_base_sink_get_sync_times()
2290 GST_DEBUG_OBJECT (basesink, "refresh sync times"); in gst_base_sink_get_sync_times()
2311 GST_LOG_OBJECT (basesink, "buffer skipped, not in segment"); in gst_base_sink_get_sync_times()
2320 gst_base_sink_adjust_time (GstBaseSink * basesink, GstClockTime time) in gst_base_sink_adjust_time() argument
2328 time += basesink->priv->latency; in gst_base_sink_adjust_time()
2331 ts_offset = basesink->priv->ts_offset; in gst_base_sink_adjust_time()
2342 if (time > basesink->priv->render_delay) in gst_base_sink_adjust_time()
2343 time -= basesink->priv->render_delay; in gst_base_sink_adjust_time()
2721 gst_base_sink_do_sync (GstBaseSink * basesink, in gst_base_sink_do_sync() argument
2735 priv = basesink->priv; in gst_base_sink_do_sync()
2753 syncable = gst_base_sink_get_sync_times (basesink, obj, in gst_base_sink_do_sync()
2784 GST_LOG_OBJECT (basesink, "avg frame diff %" GST_TIME_FORMAT, in gst_base_sink_do_sync()
2798 ret = gst_base_sink_do_preroll (basesink, obj); in gst_base_sink_do_sync()
2805 start_stepping (basesink, &basesink->segment, pending, current); in gst_base_sink_do_sync()
2818 GST_OBJECT_LOCK (basesink); in gst_base_sink_do_sync()
2821 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_do_sync()
2827 stime = gst_base_sink_adjust_time (basesink, rstart); in gst_base_sink_do_sync()
2831 GST_DEBUG_OBJECT (basesink, "reset rc_time to time %" GST_TIME_FORMAT, in gst_base_sink_do_sync()
2836 GST_DEBUG_OBJECT (basesink, "rate control next %" GST_TIME_FORMAT, in gst_base_sink_do_sync()
2843 GstBaseSinkClass *bclass = GST_BASE_SINK_GET_CLASS (basesink); in gst_base_sink_do_sync()
2845 stime = bclass->update_reach_time (basesink, stime); in gst_base_sink_do_sync()
2850 GST_DEBUG_OBJECT (basesink, "possibly waiting for clock to reach %" in gst_base_sink_do_sync()
2856 status = gst_base_sink_wait_clock (basesink, stime, &jitter); in gst_base_sink_do_sync()
2858 GST_DEBUG_OBJECT (basesink, "clock returned %d, jitter %c%" GST_TIME_FORMAT, in gst_base_sink_do_sync()
2866 if (G_UNLIKELY (basesink->flushing)) in gst_base_sink_do_sync()
2879 GST_DEBUG_OBJECT (basesink, "unscheduled, waiting some more"); in gst_base_sink_do_sync()
2888 *late = gst_base_sink_is_too_late (basesink, obj, rstart, rstop, in gst_base_sink_do_sync()
2897 GST_DEBUG_OBJECT (basesink, "skipped stepped object %p", obj); in gst_base_sink_do_sync()
2903 GST_DEBUG_OBJECT (basesink, "non syncable object %p", obj); in gst_base_sink_do_sync()
2908 GST_DEBUG_OBJECT (basesink, "dropped because of QoS %p", obj); in gst_base_sink_do_sync()
2914 GST_DEBUG_OBJECT (basesink, "we are flushing"); in gst_base_sink_do_sync()
2919 GST_DEBUG_OBJECT (basesink, "preroll failed"); in gst_base_sink_do_sync()
2926 gst_base_sink_send_qos (GstBaseSink * basesink, GstQOSType type, in gst_base_sink_send_qos() argument
2933 GST_CAT_DEBUG_OBJECT (GST_CAT_QOS, basesink, in gst_base_sink_send_qos()
2939 if (basesink->priv->instant_rate_sync_seqnum != GST_SEQNUM_INVALID) { in gst_base_sink_send_qos()
2945 GST_DEBUG_OBJECT (basesink, in gst_base_sink_send_qos()
2948 GST_TIME_ARGS (basesink->priv->last_anchor_running_time)); in gst_base_sink_send_qos()
2955 if (time < basesink->priv->last_anchor_running_time) { in gst_base_sink_send_qos()
2956 actual_duration = basesink->priv->last_anchor_running_time - time; in gst_base_sink_send_qos()
2959 actual_duration = time - basesink->priv->last_anchor_running_time; in gst_base_sink_send_qos()
2965 (actual_duration * basesink->segment.rate) / in gst_base_sink_send_qos()
2966 basesink->priv->upstream_segment.rate; in gst_base_sink_send_qos()
2974 GST_DEBUG_OBJECT (basesink, in gst_base_sink_send_qos()
2981 GST_STIME_ARGS (basesink->priv->instant_rate_offset + difference)); in gst_base_sink_send_qos()
2983 difference = basesink->priv->instant_rate_offset + difference; in gst_base_sink_send_qos()
2994 res = gst_pad_push_event (basesink->sinkpad, event); in gst_base_sink_send_qos()
3159 gst_base_sink_is_too_late (GstBaseSink * basesink, GstMiniObject * obj, in gst_base_sink_is_too_late() argument
3167 priv = basesink->priv; in gst_base_sink_is_too_late()
3175 max_lateness = basesink->max_lateness; in gst_base_sink_is_too_late()
3201 GST_CAT_DEBUG_OBJECT (GST_CAT_PERFORMANCE, basesink, in gst_base_sink_is_too_late()
3210 GST_ELEMENT_WARNING (basesink, CORE, CLOCK, in gst_base_sink_is_too_late()
3213 GST_CAT_DEBUG_OBJECT (GST_CAT_PERFORMANCE, basesink, in gst_base_sink_is_too_late()
3231 GST_DEBUG_OBJECT (basesink, "object was scheduled in time"); in gst_base_sink_is_too_late()
3236 GST_DEBUG_OBJECT (basesink, "frame dropping disabled"); in gst_base_sink_is_too_late()
3241 GST_DEBUG_OBJECT (basesink, "object is not a buffer"); in gst_base_sink_is_too_late()
3246 GST_DEBUG_OBJECT (basesink, "buffer has no timestamp"); in gst_base_sink_is_too_late()
3252 gst_base_sink_update_start_time (GstBaseSink * basesink) in gst_base_sink_update_start_time() argument
3256 GST_OBJECT_LOCK (basesink); in gst_base_sink_update_start_time()
3257 if (GST_STATE (basesink) == GST_STATE_PLAYING in gst_base_sink_update_start_time()
3258 && (clock = GST_ELEMENT_CLOCK (basesink))) { in gst_base_sink_update_start_time()
3262 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_update_start_time()
3268 GST_OBJECT_LOCK (basesink); in gst_base_sink_update_start_time()
3270 if (GST_ELEMENT_START_TIME (basesink) != GST_CLOCK_TIME_NONE) { in gst_base_sink_update_start_time()
3272 GST_ELEMENT_START_TIME (basesink) = in gst_base_sink_update_start_time()
3273 now - GST_ELEMENT_CAST (basesink)->base_time; in gst_base_sink_update_start_time()
3275 GST_WARNING_OBJECT (basesink, in gst_base_sink_update_start_time()
3280 GST_DEBUG_OBJECT (basesink, in gst_base_sink_update_start_time()
3283 GST_TIME_ARGS (GST_ELEMENT_START_TIME (basesink)), in gst_base_sink_update_start_time()
3285 GST_TIME_ARGS (GST_ELEMENT_CAST (basesink)->base_time)); in gst_base_sink_update_start_time()
3287 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_update_start_time()
3291 gst_base_sink_flush_start (GstBaseSink * basesink, GstPad * pad) in gst_base_sink_flush_start() argument
3295 gst_base_sink_set_flushing (basesink, pad, TRUE); in gst_base_sink_flush_start()
3301 gst_base_sink_reset_qos (basesink); in gst_base_sink_flush_start()
3304 basesink->playing_async = TRUE; in gst_base_sink_flush_start()
3305 if (basesink->priv->async_enabled) { in gst_base_sink_flush_start()
3306 gst_base_sink_update_start_time (basesink); in gst_base_sink_flush_start()
3307 gst_element_lost_state (GST_ELEMENT_CAST (basesink)); in gst_base_sink_flush_start()
3311 gst_element_set_start_time (GST_ELEMENT_CAST (basesink), 0); in gst_base_sink_flush_start()
3312 basesink->priv->have_latency = TRUE; in gst_base_sink_flush_start()
3314 gst_base_sink_set_last_buffer (basesink, NULL); in gst_base_sink_flush_start()
3315 gst_base_sink_set_last_buffer_list (basesink, NULL); in gst_base_sink_flush_start()
3320 gst_base_sink_flush_stop (GstBaseSink * basesink, GstPad * pad, in gst_base_sink_flush_stop() argument
3325 gst_base_sink_set_flushing (basesink, pad, FALSE); in gst_base_sink_flush_stop()
3328 GST_OBJECT_LOCK (basesink); in gst_base_sink_flush_stop()
3329 basesink->priv->current_sstart = GST_CLOCK_TIME_NONE; in gst_base_sink_flush_stop()
3330 basesink->priv->current_sstop = GST_CLOCK_TIME_NONE; in gst_base_sink_flush_stop()
3331 basesink->priv->eos_rtime = GST_CLOCK_TIME_NONE; in gst_base_sink_flush_stop()
3332 basesink->priv->call_preroll = TRUE; in gst_base_sink_flush_stop()
3333 basesink->priv->current_step.valid = FALSE; in gst_base_sink_flush_stop()
3334 basesink->priv->pending_step.valid = FALSE; in gst_base_sink_flush_stop()
3335 if (basesink->pad_mode == GST_PAD_MODE_PUSH) { in gst_base_sink_flush_stop()
3337 basesink->have_newsegment = FALSE; in gst_base_sink_flush_stop()
3339 gst_segment_init (&basesink->priv->upstream_segment, in gst_base_sink_flush_stop()
3341 gst_segment_init (&basesink->segment, GST_FORMAT_UNDEFINED); in gst_base_sink_flush_stop()
3342 GST_ELEMENT_START_TIME (basesink) = 0; in gst_base_sink_flush_stop()
3344 basesink->priv->last_instant_rate_seqnum = GST_SEQNUM_INVALID; in gst_base_sink_flush_stop()
3345 basesink->priv->instant_rate_sync_seqnum = GST_SEQNUM_INVALID; in gst_base_sink_flush_stop()
3346 basesink->priv->instant_rate_multiplier = 0; in gst_base_sink_flush_stop()
3347 basesink->priv->segment_seqnum = GST_SEQNUM_INVALID; in gst_base_sink_flush_stop()
3348 basesink->priv->instant_rate_offset = 0; in gst_base_sink_flush_stop()
3349 basesink->priv->last_anchor_running_time = 0; in gst_base_sink_flush_stop()
3352 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_flush_stop()
3355 GST_DEBUG_OBJECT (basesink, "posting reset-time message"); in gst_base_sink_flush_stop()
3356 gst_element_post_message (GST_ELEMENT_CAST (basesink), in gst_base_sink_flush_stop()
3357 gst_message_new_reset_time (GST_OBJECT_CAST (basesink), 0)); in gst_base_sink_flush_stop()
3362 gst_base_sink_default_wait_event (GstBaseSink * basesink, GstEvent * event) in gst_base_sink_default_wait_event() argument
3367 ret = gst_base_sink_do_sync (basesink, GST_MINI_OBJECT_CAST (event), in gst_base_sink_default_wait_event()
3374 gst_base_sink_wait_event (GstBaseSink * basesink, GstEvent * event) in gst_base_sink_wait_event() argument
3379 bclass = GST_BASE_SINK_GET_CLASS (basesink); in gst_base_sink_wait_event()
3382 ret = bclass->wait_event (basesink, event); in gst_base_sink_wait_event()
3390 gst_base_sink_default_event (GstBaseSink * basesink, GstEvent * event) in gst_base_sink_default_event() argument
3395 bclass = GST_BASE_SINK_GET_CLASS (basesink); in gst_base_sink_default_event()
3400 GST_DEBUG_OBJECT (basesink, "flush-start %p", event); in gst_base_sink_default_event()
3401 gst_base_sink_flush_start (basesink, basesink->sinkpad); in gst_base_sink_default_event()
3409 GST_DEBUG_OBJECT (basesink, "flush-stop %p, reset_time: %d", event, in gst_base_sink_default_event()
3411 gst_base_sink_flush_stop (basesink, basesink->sinkpad, reset_time); in gst_base_sink_default_event()
3421 basesink->priv->received_eos = TRUE; in gst_base_sink_default_event()
3424 if (G_UNLIKELY (gst_base_sink_wait_event (basesink, in gst_base_sink_default_event()
3434 GST_OBJECT_LOCK (basesink); in gst_base_sink_default_event()
3435 basesink->eos = TRUE; in gst_base_sink_default_event()
3436 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_default_event()
3439 GST_DEBUG_OBJECT (basesink, "Now posting EOS"); in gst_base_sink_default_event()
3441 seqnum = basesink->priv->seqnum = gst_event_get_seqnum (event); in gst_base_sink_default_event()
3442 GST_DEBUG_OBJECT (basesink, "Got seqnum #%" G_GUINT32_FORMAT, seqnum); in gst_base_sink_default_event()
3444 message = gst_message_new_eos (GST_OBJECT_CAST (basesink)); in gst_base_sink_default_event()
3446 gst_element_post_message (GST_ELEMENT_CAST (basesink), message); in gst_base_sink_default_event()
3456 GST_DEBUG_OBJECT (basesink, "Now posting STREAM_START (seqnum:%d)", in gst_base_sink_default_event()
3458 message = gst_message_new_stream_start (GST_OBJECT_CAST (basesink)); in gst_base_sink_default_event()
3462 GST_FIXME_OBJECT (basesink, "stream-start event without group-id. " in gst_base_sink_default_event()
3467 gst_element_post_message (GST_ELEMENT_CAST (basesink), message); in gst_base_sink_default_event()
3474 GST_DEBUG_OBJECT (basesink, "caps %p", event); in gst_base_sink_default_event()
3477 current_caps = gst_pad_get_current_caps (GST_BASE_SINK_PAD (basesink)); in gst_base_sink_default_event()
3480 GST_DEBUG_OBJECT (basesink, in gst_base_sink_default_event()
3484 result = bclass->set_caps (basesink, caps); in gst_base_sink_default_event()
3487 GST_OBJECT_LOCK (basesink); in gst_base_sink_default_event()
3488 gst_caps_replace (&basesink->priv->caps, caps); in gst_base_sink_default_event()
3489 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_default_event()
3504 GST_OBJECT_LOCK (basesink); in gst_base_sink_default_event()
3510 GST_DEBUG_OBJECT (basesink, in gst_base_sink_default_event()
3518 if (basesink->priv->instant_rate_sync_seqnum != GST_SEQNUM_INVALID) { in gst_base_sink_default_event()
3531 GST_DEBUG_OBJECT (basesink, in gst_base_sink_default_event()
3535 GST_TIME_ARGS (basesink->priv->last_anchor_running_time - in gst_base_sink_default_event()
3536 basesink->priv->instant_rate_offset)); in gst_base_sink_default_event()
3542 basesink->priv->last_anchor_running_time - in gst_base_sink_default_event()
3543 basesink->priv->instant_rate_offset) { in gst_base_sink_default_event()
3545 basesink->priv->last_anchor_running_time - in gst_base_sink_default_event()
3546 basesink->priv->instant_rate_offset - new_segment_running_time; in gst_base_sink_default_event()
3551 basesink->priv->last_anchor_running_time + in gst_base_sink_default_event()
3552 basesink->priv->instant_rate_offset; in gst_base_sink_default_event()
3558 (upstream_duration * basesink->priv->instant_rate_multiplier); in gst_base_sink_default_event()
3565 GST_DEBUG_OBJECT (basesink, in gst_base_sink_default_event()
3569 basesink->priv->instant_rate_offset + difference), in gst_base_sink_default_event()
3570 GST_TIME_ARGS (basesink->priv->last_anchor_running_time)); in gst_base_sink_default_event()
3573 basesink->priv->instant_rate_offset += difference; in gst_base_sink_default_event()
3575 GST_DEBUG_OBJECT (basesink, in gst_base_sink_default_event()
3583 GST_STIME_ARGS (basesink->priv->instant_rate_offset)); in gst_base_sink_default_event()
3585 if (basesink->priv->instant_rate_offset < 0 && in gst_base_sink_default_event()
3586 new_segment_running_time < -basesink->priv->instant_rate_offset) { in gst_base_sink_default_event()
3587 GST_WARNING_OBJECT (basesink, in gst_base_sink_default_event()
3591 GST_STIME_ARGS (basesink->priv->instant_rate_offset)); in gst_base_sink_default_event()
3593 basesink->priv->last_anchor_running_time = 0; in gst_base_sink_default_event()
3594 basesink->priv->instant_rate_offset = 0; in gst_base_sink_default_event()
3596 basesink->priv->last_anchor_running_time = in gst_base_sink_default_event()
3597 new_segment_running_time + basesink->priv->instant_rate_offset; in gst_base_sink_default_event()
3602 basesink->priv->upstream_segment = new_segment; in gst_base_sink_default_event()
3603 basesink->segment = new_segment; in gst_base_sink_default_event()
3605 basesink->segment.rate *= basesink->priv->instant_rate_multiplier; in gst_base_sink_default_event()
3607 gst_segment_offset_running_time (&basesink->segment, GST_FORMAT_TIME, in gst_base_sink_default_event()
3608 basesink->priv->instant_rate_offset); in gst_base_sink_default_event()
3610 GST_DEBUG_OBJECT (basesink, in gst_base_sink_default_event()
3611 "Adjusted segment is now %" GST_SEGMENT_FORMAT, &basesink->segment); in gst_base_sink_default_event()
3614 basesink->priv->upstream_segment = new_segment; in gst_base_sink_default_event()
3615 basesink->segment = new_segment; in gst_base_sink_default_event()
3616 basesink->priv->last_anchor_running_time = in gst_base_sink_default_event()
3619 basesink->priv->instant_rate_offset = 0; /* Should already be 0, but to be sure */ in gst_base_sink_default_event()
3622 GST_DEBUG_OBJECT (basesink, "configured segment %" GST_SEGMENT_FORMAT, in gst_base_sink_default_event()
3623 &basesink->segment); in gst_base_sink_default_event()
3624 basesink->priv->segment_seqnum = seqnum; in gst_base_sink_default_event()
3625 basesink->have_newsegment = TRUE; in gst_base_sink_default_event()
3626 gst_base_sink_reset_qos (basesink); in gst_base_sink_default_event()
3627 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_default_event()
3632 if (G_UNLIKELY (gst_base_sink_wait_event (basesink, in gst_base_sink_default_event()
3643 gst_element_post_message (GST_ELEMENT_CAST (basesink), in gst_base_sink_default_event()
3644 gst_message_new_tag (GST_OBJECT_CAST (basesink), in gst_base_sink_default_event()
3655 gst_element_post_message (GST_ELEMENT_CAST (basesink), in gst_base_sink_default_event()
3656 gst_message_new_toc (GST_OBJECT_CAST (basesink), toc, updated)); in gst_base_sink_default_event()
3667 gst_element_post_message (GST_ELEMENT_CAST (basesink), msg); in gst_base_sink_default_event()
3676 GST_OBJECT_LOCK (basesink); in gst_base_sink_default_event()
3677 if (G_UNLIKELY (basesink->priv->last_instant_rate_seqnum == seqnum)) { in gst_base_sink_default_event()
3679 GST_LOG_OBJECT (basesink, in gst_base_sink_default_event()
3681 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_default_event()
3684 if (basesink->priv->instant_rate_sync_seqnum == seqnum) { in gst_base_sink_default_event()
3686 GST_LOG_OBJECT (basesink, in gst_base_sink_default_event()
3688 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_default_event()
3692 basesink->priv->last_instant_rate_seqnum = seqnum; in gst_base_sink_default_event()
3693 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_default_event()
3698 gst_message_new_instant_rate_request (GST_OBJECT_CAST (basesink), in gst_base_sink_default_event()
3701 gst_element_post_message (GST_ELEMENT_CAST (basesink), msg); in gst_base_sink_default_event()
3717 GstBaseSink *basesink; in gst_base_sink_event() local
3721 basesink = GST_BASE_SINK_CAST (parent); in gst_base_sink_event()
3722 bclass = GST_BASE_SINK_GET_CLASS (basesink); in gst_base_sink_event()
3724 GST_DEBUG_OBJECT (basesink, "received event %p %" GST_PTR_FORMAT, event, in gst_base_sink_event()
3732 result = bclass->event (basesink, event); in gst_base_sink_event()
3736 GST_BASE_SINK_PREROLL_LOCK (basesink); in gst_base_sink_event()
3737 if (G_UNLIKELY (basesink->flushing)) in gst_base_sink_event()
3740 if (G_UNLIKELY (basesink->priv->received_eos)) in gst_base_sink_event()
3744 result = bclass->event (basesink, event); in gst_base_sink_event()
3746 GST_BASE_SINK_PREROLL_UNLOCK (basesink); in gst_base_sink_event()
3749 result = bclass->event (basesink, event); in gst_base_sink_event()
3759 GST_DEBUG_OBJECT (basesink, "we are flushing"); in gst_base_sink_event()
3760 GST_BASE_SINK_PREROLL_UNLOCK (basesink); in gst_base_sink_event()
3768 GST_DEBUG_OBJECT (basesink, "Event received after EOS, dropping"); in gst_base_sink_event()
3769 GST_BASE_SINK_PREROLL_UNLOCK (basesink); in gst_base_sink_event()
3780 gst_base_sink_default_get_times (GstBaseSink * basesink, GstBuffer * buffer, in gst_base_sink_default_get_times() argument
3802 gst_base_sink_needs_preroll (GstBaseSink * basesink) in gst_base_sink_needs_preroll() argument
3816 …is_prerolled = basesink->have_preroll || basesink->priv->received_eos || basesink->stream_group_do… in gst_base_sink_needs_preroll()
3818 is_prerolled = basesink->have_preroll || basesink->priv->received_eos; in gst_base_sink_needs_preroll()
3822 GST_DEBUG_OBJECT (basesink, "have_preroll: %d, EOS: %d => needs preroll: %d", in gst_base_sink_needs_preroll()
3823 basesink->have_preroll, basesink->priv->received_eos, res); in gst_base_sink_needs_preroll()
3830 get_sink_type_by_caps(GstBaseSink * basesink) in get_sink_type_by_caps() argument
3832 GstBaseSinkPrivate *priv = basesink->priv; in get_sink_type_by_caps()
3844 kpi_log_render_first_frame (GstBaseSink *basesink) in kpi_log_render_first_frame() argument
3846 GstBaseSinkPrivate *priv = basesink->priv; in kpi_log_render_first_frame()
3851 …GST_WARNING_OBJECT (basesink, "KPI-TRACE: render first %s frame", get_sink_type_by_caps(basesink)); in kpi_log_render_first_frame()
3857 kpi_log_fps(GstBaseSink *basesink) in kpi_log_fps() argument
3859 GstBaseSinkPrivate *priv = basesink->priv; in kpi_log_fps()
3876 GST_WARNING_OBJECT (basesink, "KPI-TRACE: fps=%f, time=%f, render nums=%" G_GUINT64_FORMAT, in kpi_log_fps()
3885 GST_WARNING_OBJECT (basesink, "KPI-TRACE: render_time_diff=%" G_GUINT64_FORMAT in kpi_log_fps()
3902 gst_base_sink_chain_unlocked (GstBaseSink * basesink, GstPad * pad, in gst_base_sink_chain_unlocked() argument
3906 GstBaseSinkPrivate *priv = basesink->priv; in gst_base_sink_chain_unlocked()
3913 if (G_UNLIKELY (basesink->flushing)) in gst_base_sink_chain_unlocked()
3932 segment = &basesink->segment; in gst_base_sink_chain_unlocked()
3934 if (G_UNLIKELY (!basesink->have_newsegment)) { in gst_base_sink_chain_unlocked()
3937 sync = gst_base_sink_get_sync (basesink); in gst_base_sink_chain_unlocked()
3939 GST_ELEMENT_WARNING (basesink, STREAM, FAILED, in gst_base_sink_chain_unlocked()
3945 GST_OBJECT_LOCK (basesink); in gst_base_sink_chain_unlocked()
3948 basesink->segment.start = 0; in gst_base_sink_chain_unlocked()
3949 basesink->segment.stop = -1; in gst_base_sink_chain_unlocked()
3950 basesink->have_newsegment = TRUE; in gst_base_sink_chain_unlocked()
3951 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_chain_unlocked()
3954 bclass = GST_BASE_SINK_GET_CLASS (basesink); in gst_base_sink_chain_unlocked()
3959 bclass->get_times (basesink, sync_buf, &start, &end); in gst_base_sink_chain_unlocked()
3964 gst_base_sink_default_get_times (basesink, sync_buf, &start, &end); in gst_base_sink_chain_unlocked()
3967 GST_DEBUG_OBJECT (basesink, "got times start: %" GST_TIME_FORMAT in gst_base_sink_chain_unlocked()
3999 gst_base_sink_get_sync_times (basesink, obj, &sstart, &sstop, &rstart, in gst_base_sink_chain_unlocked()
4005 if (syncable && do_sync && gst_base_sink_get_sync (basesink)) { in gst_base_sink_chain_unlocked()
4008 GST_OBJECT_LOCK (basesink); in gst_base_sink_chain_unlocked()
4009 clock = GST_ELEMENT_CLOCK (basesink); in gst_base_sink_chain_unlocked()
4010 if (clock && GST_STATE (basesink) == GST_STATE_PLAYING) { in gst_base_sink_chain_unlocked()
4015 base_time = GST_ELEMENT_CAST (basesink)->base_time; in gst_base_sink_chain_unlocked()
4016 stime = base_time + gst_base_sink_adjust_time (basesink, rstart); in gst_base_sink_chain_unlocked()
4018 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_chain_unlocked()
4021 gst_base_sink_is_too_late (basesink, obj, rstart, rstop, in gst_base_sink_chain_unlocked()
4024 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_chain_unlocked()
4030 ret = gst_base_sink_do_preroll (basesink, obj); in gst_base_sink_chain_unlocked()
4039 ret = bclass->prepare (basesink, GST_BUFFER_CAST (obj)); in gst_base_sink_chain_unlocked()
4045 ret = bclass->prepare_list (basesink, GST_BUFFER_LIST_CAST (obj)); in gst_base_sink_chain_unlocked()
4060 ret = gst_base_sink_do_sync (basesink, GST_MINI_OBJECT_CAST (sync_buf), in gst_base_sink_chain_unlocked()
4085 GST_DEBUG_OBJECT (basesink, "rendering object %p", obj); in gst_base_sink_chain_unlocked()
4089 gst_base_sink_set_last_buffer (basesink, GST_BUFFER_CAST (obj)); in gst_base_sink_chain_unlocked()
4090 gst_base_sink_set_last_buffer_list (basesink, NULL); in gst_base_sink_chain_unlocked()
4093 ret = bclass->render (basesink, GST_BUFFER_CAST (obj)); in gst_base_sink_chain_unlocked()
4098 ret = bclass->render_list (basesink, buffer_list); in gst_base_sink_chain_unlocked()
4101 gst_base_sink_set_last_buffer (basesink, sync_buf); in gst_base_sink_chain_unlocked()
4102 gst_base_sink_set_last_buffer_list (basesink, buffer_list); in gst_base_sink_chain_unlocked()
4108 if (G_UNLIKELY (basesink->flushing)) in gst_base_sink_chain_unlocked()
4113 kpi_log_render_first_frame(basesink); in gst_base_sink_chain_unlocked()
4114 kpi_log_fps(basesink); in gst_base_sink_chain_unlocked()
4120 GST_DEBUG_OBJECT (basesink, "step ended"); in gst_base_sink_chain_unlocked()
4121 stop_stepping (basesink, &basesink->segment, &priv->current_step, in gst_base_sink_chain_unlocked()
4122 priv->current_rstart, priv->current_rstop, basesink->eos); in gst_base_sink_chain_unlocked()
4126 gst_base_sink_perform_qos (basesink, late); in gst_base_sink_chain_unlocked()
4128 GST_DEBUG_OBJECT (basesink, "object unref after render %p", obj); in gst_base_sink_chain_unlocked()
4136 GST_DEBUG_OBJECT (basesink, "sink is flushing"); in gst_base_sink_chain_unlocked()
4142 GST_DEBUG_OBJECT (basesink, "we are EOS, dropping object, return EOS"); in gst_base_sink_chain_unlocked()
4148 GST_DEBUG_OBJECT (basesink, "buffer list with no buffers"); in gst_base_sink_chain_unlocked()
4154 GST_DEBUG_OBJECT (basesink, "dropping buffer, out of clipping segment"); in gst_base_sink_chain_unlocked()
4160 GST_DEBUG_OBJECT (basesink, "prepare buffer failed %s", in gst_base_sink_chain_unlocked()
4167 GST_DEBUG_OBJECT (basesink, "do_sync returned %s", gst_flow_get_name (ret)); in gst_base_sink_chain_unlocked()
4173 GST_DEBUG_OBJECT (basesink, "buffer late, dropping"); in gst_base_sink_chain_unlocked()
4182 GST_CAT_DEBUG_OBJECT (GST_CAT_QOS, basesink, in gst_base_sink_chain_unlocked()
4188 GST_CAT_DEBUG_OBJECT (GST_CAT_QOS, basesink, in gst_base_sink_chain_unlocked()
4193 gst_message_new_qos (GST_OBJECT_CAST (basesink), basesink->sync, in gst_base_sink_chain_unlocked()
4199 gst_element_post_message (GST_ELEMENT_CAST (basesink), qos_msg); in gst_base_sink_chain_unlocked()
4205 GST_DEBUG_OBJECT (basesink, "preroll failed: %s", gst_flow_get_name (ret)); in gst_base_sink_chain_unlocked()
4213 kpi_log_recv_first_frame(GstBaseSink *basesink) in kpi_log_recv_first_frame() argument
4215 GstBaseSinkPrivate *priv = basesink->priv; in kpi_log_recv_first_frame()
4223 gchar *sink_type = get_sink_type_by_caps(basesink); in kpi_log_recv_first_frame()
4231 GST_WARNING_OBJECT (basesink, "KPI-TRACE: recv first %s frame", sink_type); in kpi_log_recv_first_frame()
4238 gst_base_sink_chain_main (GstBaseSink * basesink, GstPad * pad, gpointer obj, in gst_base_sink_chain_main() argument
4243 if (G_UNLIKELY (basesink->pad_mode != GST_PAD_MODE_PUSH)) in gst_base_sink_chain_main()
4246 GST_BASE_SINK_PREROLL_LOCK (basesink); in gst_base_sink_chain_main()
4248 kpi_log_recv_first_frame(basesink); in gst_base_sink_chain_main()
4250 result = gst_base_sink_chain_unlocked (basesink, pad, obj, is_list); in gst_base_sink_chain_main()
4251 GST_BASE_SINK_PREROLL_UNLOCK (basesink); in gst_base_sink_chain_main()
4260 GST_WARNING_OBJECT (basesink, in gst_base_sink_chain_main()
4275 GstBaseSink *basesink; in gst_base_sink_chain() local
4277 basesink = GST_BASE_SINK (parent); in gst_base_sink_chain()
4279 return gst_base_sink_chain_main (basesink, pad, buf, FALSE); in gst_base_sink_chain()
4286 GstBaseSink *basesink; in gst_base_sink_chain_list() local
4290 basesink = GST_BASE_SINK (parent); in gst_base_sink_chain_list()
4291 bclass = GST_BASE_SINK_GET_CLASS (basesink); in gst_base_sink_chain_list()
4294 result = gst_base_sink_chain_main (basesink, pad, list, TRUE); in gst_base_sink_chain_list()
4306 result = gst_base_sink_chain_main (basesink, pad, in gst_base_sink_chain_list()
4733 GstBaseSink *basesink; in gst_base_sink_loop() local
4740 basesink = GST_BASE_SINK (parent); in gst_base_sink_loop()
4742 g_assert (basesink->pad_mode == GST_PAD_MODE_PULL); in gst_base_sink_loop()
4744 if ((blocksize = basesink->priv->blocksize) == 0) in gst_base_sink_loop()
4747 offset = basesink->segment.position; in gst_base_sink_loop()
4749 GST_DEBUG_OBJECT (basesink, "pulling %" G_GUINT64_FORMAT ", %u", in gst_base_sink_loop()
4761 basesink->segment.position = offset; in gst_base_sink_loop()
4763 GST_BASE_SINK_PREROLL_LOCK (basesink); in gst_base_sink_loop()
4764 result = gst_base_sink_chain_unlocked (basesink, pad, buf, FALSE); in gst_base_sink_loop()
4765 GST_BASE_SINK_PREROLL_UNLOCK (basesink); in gst_base_sink_loop()
4774 GST_LOG_OBJECT (basesink, "pausing task, reason %s", in gst_base_sink_loop()
4779 if (basesink->segment.flags & GST_SEGMENT_FLAG_SEGMENT) { in gst_base_sink_loop()
4780 gst_element_post_message (GST_ELEMENT_CAST (basesink), in gst_base_sink_loop()
4781 gst_message_new_segment_done (GST_OBJECT_CAST (basesink), in gst_base_sink_loop()
4782 basesink->segment.format, basesink->segment.position)); in gst_base_sink_loop()
4784 gst_event_new_segment_done (basesink->segment.format, in gst_base_sink_loop()
4785 basesink->segment.position)); in gst_base_sink_loop()
4796 GST_ELEMENT_FLOW_ERROR (basesink, result); in gst_base_sink_loop()
4803 GST_LOG_OBJECT (basesink, "no buffer, pausing"); in gst_base_sink_loop()
4804 GST_ELEMENT_ERROR (basesink, STREAM, FAILED, in gst_base_sink_loop()
4812 gst_base_sink_set_flushing (GstBaseSink * basesink, GstPad * pad, in gst_base_sink_set_flushing() argument
4817 bclass = GST_BASE_SINK_GET_CLASS (basesink); in gst_base_sink_set_flushing()
4823 bclass->unlock (basesink); in gst_base_sink_set_flushing()
4826 GST_BASE_SINK_PREROLL_LOCK (basesink); in gst_base_sink_set_flushing()
4827 basesink->flushing = flushing; in gst_base_sink_set_flushing()
4831 bclass->unlock_stop (basesink); in gst_base_sink_set_flushing()
4835 basesink->need_preroll = TRUE; in gst_base_sink_set_flushing()
4838 if (basesink->clock_id) { in gst_base_sink_set_flushing()
4839 gst_clock_id_unschedule (basesink->clock_id); in gst_base_sink_set_flushing()
4844 GST_DEBUG_OBJECT (basesink, in gst_base_sink_set_flushing()
4848 basesink->eos = FALSE; in gst_base_sink_set_flushing()
4851 basesink->stream_group_done = FALSE; in gst_base_sink_set_flushing()
4853 basesink->priv->received_eos = FALSE; in gst_base_sink_set_flushing()
4854 basesink->have_preroll = FALSE; in gst_base_sink_set_flushing()
4855 basesink->priv->step_unlock = FALSE; in gst_base_sink_set_flushing()
4857 if (basesink->priv->async_enabled) { in gst_base_sink_set_flushing()
4858 GST_OBJECT_LOCK (basesink); in gst_base_sink_set_flushing()
4859 basesink->priv->have_latency = FALSE; in gst_base_sink_set_flushing()
4860 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_set_flushing()
4863 GST_BASE_SINK_PREROLL_SIGNAL (basesink); in gst_base_sink_set_flushing()
4865 GST_BASE_SINK_PREROLL_UNLOCK (basesink); in gst_base_sink_set_flushing()
4871 gst_base_sink_default_activate_pull (GstBaseSink * basesink, gboolean active) in gst_base_sink_default_activate_pull() argument
4877 result = gst_pad_start_task (basesink->sinkpad, in gst_base_sink_default_activate_pull()
4878 (GstTaskFunction) gst_base_sink_loop, basesink->sinkpad, NULL); in gst_base_sink_default_activate_pull()
4881 result = gst_pad_stop_task (basesink->sinkpad); in gst_base_sink_default_activate_pull()
4891 GstBaseSink *basesink; in gst_base_sink_pad_activate() local
4895 basesink = GST_BASE_SINK (parent); in gst_base_sink_pad_activate()
4897 GST_DEBUG_OBJECT (basesink, "Trying pull mode first"); in gst_base_sink_pad_activate()
4899 gst_base_sink_set_flushing (basesink, pad, FALSE); in gst_base_sink_pad_activate()
4902 if (!basesink->can_activate_pull) { in gst_base_sink_pad_activate()
4903 GST_DEBUG_OBJECT (basesink, "pull mode disabled"); in gst_base_sink_pad_activate()
4912 GST_DEBUG_OBJECT (basesink, "peer query failed, no pull mode"); in gst_base_sink_pad_activate()
4921 GST_DEBUG_OBJECT (basesink, "pull mode not supported"); in gst_base_sink_pad_activate()
4928 basesink->pad_mode = GST_PAD_MODE_PULL; in gst_base_sink_pad_activate()
4932 if (!gst_base_sink_negotiate_pull (basesink)) { in gst_base_sink_pad_activate()
4933 GST_DEBUG_OBJECT (basesink, "failed to negotiate in pull mode"); in gst_base_sink_pad_activate()
4940 GST_OBJECT_LOCK (basesink); in gst_base_sink_pad_activate()
4941 gst_caps_replace (&basesink->priv->caps, NULL); in gst_base_sink_pad_activate()
4942 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_pad_activate()
4943 GST_DEBUG_OBJECT (basesink, "failed to activate in pull mode"); in gst_base_sink_pad_activate()
4947 GST_DEBUG_OBJECT (basesink, "Success activating pull mode"); in gst_base_sink_pad_activate()
4953 GST_DEBUG_OBJECT (basesink, "Falling back to push mode"); in gst_base_sink_pad_activate()
4955 GST_DEBUG_OBJECT (basesink, "Success activating push mode"); in gst_base_sink_pad_activate()
4960 GST_WARNING_OBJECT (basesink, "Could not activate pad in either mode"); in gst_base_sink_pad_activate()
4961 gst_base_sink_set_flushing (basesink, pad, TRUE); in gst_base_sink_pad_activate()
4972 GstBaseSink *basesink; in gst_base_sink_pad_activate_push() local
4974 basesink = GST_BASE_SINK (parent); in gst_base_sink_pad_activate_push()
4977 if (!basesink->can_activate_push) { in gst_base_sink_pad_activate_push()
4979 basesink->pad_mode = GST_PAD_MODE_NONE; in gst_base_sink_pad_activate_push()
4982 basesink->pad_mode = GST_PAD_MODE_PUSH; in gst_base_sink_pad_activate_push()
4985 if (G_UNLIKELY (basesink->pad_mode != GST_PAD_MODE_PUSH)) { in gst_base_sink_pad_activate_push()
4989 gst_base_sink_set_flushing (basesink, pad, TRUE); in gst_base_sink_pad_activate_push()
4991 basesink->pad_mode = GST_PAD_MODE_NONE; in gst_base_sink_pad_activate_push()
4999 gst_base_sink_negotiate_pull (GstBaseSink * basesink) in gst_base_sink_negotiate_pull() argument
5009 caps = gst_pad_get_allowed_caps (GST_BASE_SINK_PAD (basesink)); in gst_base_sink_negotiate_pull()
5013 GST_DEBUG_OBJECT (basesink, "allowed caps: %" GST_PTR_FORMAT, caps); in gst_base_sink_negotiate_pull()
5016 GST_DEBUG_OBJECT (basesink, "caps were ANY after fixating, " in gst_base_sink_negotiate_pull()
5023 caps = gst_base_sink_fixate (basesink, caps); in gst_base_sink_negotiate_pull()
5024 GST_DEBUG_OBJECT (basesink, "fixated to: %" GST_PTR_FORMAT, caps); in gst_base_sink_negotiate_pull()
5027 if (!gst_pad_set_caps (GST_BASE_SINK_PAD (basesink), caps)) in gst_base_sink_negotiate_pull()
5040 GST_INFO_OBJECT (basesink, "Pipeline could not agree on caps"); in gst_base_sink_negotiate_pull()
5041 GST_DEBUG_OBJECT (basesink, "get_allowed_caps() returned EMPTY"); in gst_base_sink_negotiate_pull()
5048 GST_INFO_OBJECT (basesink, "Could not set caps: %" GST_PTR_FORMAT, caps); in gst_base_sink_negotiate_pull()
5060 GstBaseSink *basesink; in gst_base_sink_pad_activate_pull() local
5063 basesink = GST_BASE_SINK (parent); in gst_base_sink_pad_activate_pull()
5064 bclass = GST_BASE_SINK_GET_CLASS (basesink); in gst_base_sink_pad_activate_pull()
5072 gst_segment_init (&basesink->segment, GST_FORMAT_BYTES); in gst_base_sink_pad_activate_pull()
5073 GST_OBJECT_LOCK (basesink); in gst_base_sink_pad_activate_pull()
5074 basesink->have_newsegment = TRUE; in gst_base_sink_pad_activate_pull()
5075 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_pad_activate_pull()
5080 GST_DEBUG_OBJECT (basesink, in gst_base_sink_pad_activate_pull()
5082 basesink->segment.duration = duration; in gst_base_sink_pad_activate_pull()
5084 GST_DEBUG_OBJECT (basesink, "unknown duration"); in gst_base_sink_pad_activate_pull()
5088 result = bclass->activate_pull (basesink, TRUE); in gst_base_sink_pad_activate_pull()
5096 if (G_UNLIKELY (basesink->pad_mode != GST_PAD_MODE_PULL)) { in gst_base_sink_pad_activate_pull()
5100 result = gst_base_sink_set_flushing (basesink, pad, TRUE); in gst_base_sink_pad_activate_pull()
5102 result &= bclass->activate_pull (basesink, FALSE); in gst_base_sink_pad_activate_pull()
5103 basesink->pad_mode = GST_PAD_MODE_NONE; in gst_base_sink_pad_activate_pull()
5113 basesink->pad_mode = GST_PAD_MODE_NONE; in gst_base_sink_pad_activate_pull()
5115 GST_ERROR_OBJECT (basesink, "subclass failed to activate in pull mode"); in gst_base_sink_pad_activate_pull()
5146 GstBaseSink *basesink = GST_BASE_SINK (element); in gst_base_sink_send_event() local
5152 pad = gst_object_ref (basesink->sinkpad); in gst_base_sink_send_event()
5153 mode = basesink->pad_mode; in gst_base_sink_send_event()
5159 GST_DEBUG_OBJECT (basesink, "handling event %p %" GST_PTR_FORMAT, event, in gst_base_sink_send_event()
5172 basesink->priv->latency = latency; in gst_base_sink_send_event()
5173 if (!basesink->priv->have_latency) in gst_base_sink_send_event()
5176 GST_DEBUG_OBJECT (basesink, "latency set to %" GST_TIME_FORMAT, in gst_base_sink_send_event()
5186 gst_base_sink_perform_instant_rate_change (basesink, pad, event); in gst_base_sink_send_event()
5199 result = gst_base_sink_perform_seek (basesink, pad, event); in gst_base_sink_send_event()
5202 result = gst_base_sink_perform_step (basesink, pad, event); in gst_base_sink_send_event()
5210 GST_DEBUG_OBJECT (basesink, "sending event %p %" GST_PTR_FORMAT, event, in gst_base_sink_send_event()
5215 if (basesink->priv->instant_rate_sync_seqnum != GST_SEQNUM_INVALID) { in gst_base_sink_send_event()
5222 GST_OBJECT_LOCK (basesink); in gst_base_sink_send_event()
5223 is_playing = GST_STATE (basesink) == GST_STATE_PLAYING in gst_base_sink_send_event()
5224 && (GST_STATE_PENDING (basesink) == GST_STATE_VOID_PENDING || in gst_base_sink_send_event()
5225 GST_STATE_PENDING (basesink) == GST_STATE_PLAYING); in gst_base_sink_send_event()
5231 base_time = GST_ELEMENT_CAST (basesink)->base_time; in gst_base_sink_send_event()
5232 clock = GST_ELEMENT_CLOCK (basesink); in gst_base_sink_send_event()
5233 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_send_event()
5240 now = GST_ELEMENT_START_TIME (basesink); in gst_base_sink_send_event()
5241 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_send_event()
5244 GST_DEBUG_OBJECT (basesink, in gst_base_sink_send_event()
5247 GST_TIME_ARGS (basesink->priv->last_anchor_running_time)); in gst_base_sink_send_event()
5255 if (now < basesink->priv->last_anchor_running_time) { in gst_base_sink_send_event()
5256 actual_duration = basesink->priv->last_anchor_running_time - now; in gst_base_sink_send_event()
5259 actual_duration = now - basesink->priv->last_anchor_running_time; in gst_base_sink_send_event()
5265 (actual_duration * basesink->segment.rate) / in gst_base_sink_send_event()
5266 basesink->priv->upstream_segment.rate; in gst_base_sink_send_event()
5274 GST_DEBUG_OBJECT (basesink, in gst_base_sink_send_event()
5281 GST_STIME_ARGS (basesink->priv->instant_rate_offset + difference)); in gst_base_sink_send_event()
5283 difference = basesink->priv->instant_rate_offset + difference; in gst_base_sink_send_event()
5298 GST_DEBUG_OBJECT (basesink, "handled event: %d", result); in gst_base_sink_send_event()
5304 gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format, in gst_base_sink_get_position() argument
5318 GST_OBJECT_LOCK (basesink); in gst_base_sink_get_position()
5320 if (!basesink->have_newsegment) in gst_base_sink_get_position()
5327 if (GST_STATE (basesink) != GST_STATE_PLAYING || in gst_base_sink_get_position()
5328 GST_STATE_PENDING (basesink) != GST_STATE_VOID_PENDING) { in gst_base_sink_get_position()
5332 segment = &basesink->segment; in gst_base_sink_get_position()
5338 last_seen = basesink->eos; in gst_base_sink_get_position()
5342 if (!basesink->sync) in gst_base_sink_get_position()
5346 if (G_UNLIKELY ((clock = GST_ELEMENT_CLOCK (basesink)) == NULL)) in gst_base_sink_get_position()
5354 if (in_paused && with_clock && g_atomic_int_get (&basesink->priv->to_playing)) { in gst_base_sink_get_position()
5355 GST_DEBUG_OBJECT (basesink, "going to PLAYING, so not PAUSED"); in gst_base_sink_get_position()
5377 latency = basesink->priv->latency; in gst_base_sink_get_position()
5381 base_time = GST_ELEMENT_START_TIME (basesink); in gst_base_sink_get_position()
5382 GST_DEBUG_OBJECT (basesink, "in paused, using start time %" GST_TIME_FORMAT, in gst_base_sink_get_position()
5386 base_time = GST_ELEMENT_CAST (basesink)->base_time; in gst_base_sink_get_position()
5387 GST_DEBUG_OBJECT (basesink, "using clock and base time %" GST_TIME_FORMAT, in gst_base_sink_get_position()
5391 GST_DEBUG_OBJECT (basesink, "no sync or no clock"); in gst_base_sink_get_position()
5403 start = basesink->priv->current_sstart; in gst_base_sink_get_position()
5404 stop = basesink->priv->current_sstop; in gst_base_sink_get_position()
5413 GST_DEBUG_OBJECT (basesink, "in PAUSED using last %" GST_TIME_FORMAT, in gst_base_sink_get_position()
5422 GST_DEBUG_OBJECT (basesink, "in PLAYING using last %" GST_TIME_FORMAT, in gst_base_sink_get_position()
5429 GST_DEBUG_OBJECT (basesink, "in using last %" G_GINT64_FORMAT, last); in gst_base_sink_get_position()
5435 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_get_position()
5442 GST_DEBUG_OBJECT (basesink, "no last seen timestamp, asking upstream"); in gst_base_sink_get_position()
5447 GST_DEBUG_OBJECT (basesink, "using last seen timestamp %" GST_TIME_FORMAT, in gst_base_sink_get_position()
5453 if (!gst_pad_query_convert (basesink->sinkpad, oformat, base, in gst_base_sink_get_position()
5456 if (!gst_pad_query_convert (basesink->sinkpad, oformat, duration, in gst_base_sink_get_position()
5459 if (!gst_pad_query_convert (basesink->sinkpad, oformat, time, in gst_base_sink_get_position()
5462 if (!gst_pad_query_convert (basesink->sinkpad, oformat, last, in gst_base_sink_get_position()
5501 GST_DEBUG_OBJECT (basesink, in gst_base_sink_get_position()
5510 if (!gst_pad_query_convert (basesink->sinkpad, oformat, *cur, format, cur)) in gst_base_sink_get_position()
5517 GST_DEBUG_OBJECT (basesink, "res: %d, POSITION: %" GST_TIME_FORMAT, in gst_base_sink_get_position()
5529 GST_DEBUG_OBJECT (basesink, "position in wrong state, return -1"); in gst_base_sink_get_position()
5532 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_get_position()
5537 GST_DEBUG_OBJECT (basesink, "convert failed, try upstream"); in gst_base_sink_get_position()
5545 gst_base_sink_get_duration (GstBaseSink * basesink, GstFormat format, in gst_base_sink_get_duration() argument
5550 if (basesink->pad_mode == GST_PAD_MODE_PULL) { in gst_base_sink_get_duration()
5558 gst_pad_peer_query_duration (basesink->sinkpad, GST_FORMAT_BYTES, in gst_base_sink_get_duration()
5561 basesink->segment.duration = uduration; in gst_base_sink_get_duration()
5565 gst_pad_query_convert (basesink->sinkpad, GST_FORMAT_BYTES, in gst_base_sink_get_duration()
5584 GstBaseSink *basesink = GST_BASE_SINK (element); in default_element_query() local
5595 GST_DEBUG_OBJECT (basesink, "position query in format %s", in default_element_query()
5600 gst_base_sink_get_position (basesink, format, &cur, &upstream))) { in default_element_query()
5604 res = gst_pad_peer_query (basesink->sinkpad, query); in default_element_query()
5611 res = gst_base_sink_get_position (basesink, GST_FORMAT_TIME, &cur, in default_element_query()
5615 gst_pad_peer_query_position (basesink->sinkpad, GST_FORMAT_TIME, in default_element_query()
5619 res = gst_base_sink_get_duration (basesink, GST_FORMAT_TIME, &dur, in default_element_query()
5623 gst_pad_peer_query_duration (basesink->sinkpad, in default_element_query()
5646 GST_DEBUG_OBJECT (basesink, "duration query in format %s", in default_element_query()
5650 gst_base_sink_get_duration (basesink, format, &dur, &upstream))) { in default_element_query()
5654 res = gst_pad_peer_query (basesink->sinkpad, query); in default_element_query()
5671 if ((res = gst_base_sink_query_latency (basesink, &live, &us_live, &min, in default_element_query()
5685 if (basesink->pad_mode == GST_PAD_MODE_PULL) { in default_element_query()
5689 format = basesink->segment.format; in default_element_query()
5692 gst_segment_to_stream_time (&basesink->segment, format, in default_element_query()
5693 basesink->segment.start); in default_element_query()
5694 if ((stop = basesink->segment.stop) == -1) in default_element_query()
5695 stop = basesink->segment.duration; in default_element_query()
5697 stop = gst_segment_to_stream_time (&basesink->segment, format, stop); in default_element_query()
5699 gst_query_set_segment (query, basesink->segment.rate, format, start, in default_element_query()
5703 res = gst_pad_peer_query (basesink->sinkpad, query); in default_element_query()
5711 res = gst_pad_peer_query (basesink->sinkpad, query); in default_element_query()
5714 GST_DEBUG_OBJECT (basesink, "query %s returns %d", in default_element_query()
5720 gst_base_sink_drain (GstBaseSink * basesink) in gst_base_sink_drain() argument
5725 GST_OBJECT_LOCK (basesink); in gst_base_sink_drain()
5726 if ((old = basesink->priv->last_buffer)) in gst_base_sink_drain()
5727 basesink->priv->last_buffer = gst_buffer_copy_deep (old); in gst_base_sink_drain()
5729 if ((old_list = basesink->priv->last_buffer_list)) in gst_base_sink_drain()
5730 basesink->priv->last_buffer_list = gst_buffer_list_copy_deep (old_list); in gst_base_sink_drain()
5731 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_drain()
5740 gst_base_sink_default_query (GstBaseSink * basesink, GstQuery * query) in gst_base_sink_default_query() argument
5745 bclass = GST_BASE_SINK_GET_CLASS (basesink); in gst_base_sink_default_query()
5750 gst_base_sink_drain (basesink); in gst_base_sink_default_query()
5752 res = bclass->propose_allocation (basesink, query); in gst_base_sink_default_query()
5762 caps = gst_base_sink_query_caps (basesink, basesink->sinkpad, filter); in gst_base_sink_default_query()
5775 allowed = gst_base_sink_query_caps (basesink, basesink->sinkpad, NULL); in gst_base_sink_default_query()
5777 GST_DEBUG_OBJECT (basesink, "Checking if requested caps %" GST_PTR_FORMAT in gst_base_sink_default_query()
5787 gst_base_sink_drain (basesink); in gst_base_sink_default_query()
5793 res = default_element_query (GST_ELEMENT (basesink), query); in gst_base_sink_default_query()
5798 gst_pad_query_default (basesink->sinkpad, GST_OBJECT_CAST (basesink), in gst_base_sink_default_query()
5808 GstBaseSink *basesink; in gst_base_sink_sink_query() local
5812 basesink = GST_BASE_SINK_CAST (parent); in gst_base_sink_sink_query()
5813 bclass = GST_BASE_SINK_GET_CLASS (basesink); in gst_base_sink_sink_query()
5816 res = bclass->query (basesink, query); in gst_base_sink_sink_query()
5827 GstBaseSink *basesink = GST_BASE_SINK (element); in gst_base_sink_change_state() local
5831 priv = basesink->priv; in gst_base_sink_change_state()
5833 bclass = GST_BASE_SINK_GET_CLASS (basesink); in gst_base_sink_change_state()
5838 if (!bclass->start (basesink)) in gst_base_sink_change_state()
5844 GST_BASE_SINK_PREROLL_LOCK (basesink); in gst_base_sink_change_state()
5845 GST_DEBUG_OBJECT (basesink, "READY to PAUSED"); in gst_base_sink_change_state()
5846 basesink->have_newsegment = FALSE; in gst_base_sink_change_state()
5847 gst_segment_init (&basesink->segment, GST_FORMAT_UNDEFINED); in gst_base_sink_change_state()
5848 gst_segment_init (&basesink->priv->upstream_segment, in gst_base_sink_change_state()
5850 basesink->offset = 0; in gst_base_sink_change_state()
5851 basesink->have_preroll = FALSE; in gst_base_sink_change_state()
5853 basesink->need_preroll = TRUE; in gst_base_sink_change_state()
5854 basesink->playing_async = TRUE; in gst_base_sink_change_state()
5859 basesink->eos = FALSE; in gst_base_sink_change_state()
5862 basesink->stream_group_done = FALSE; in gst_base_sink_change_state()
5865 gst_base_sink_reset_qos (basesink); in gst_base_sink_change_state()
5882 GST_DEBUG_OBJECT (basesink, "doing async state change"); in gst_base_sink_change_state()
5886 gst_element_post_message (GST_ELEMENT_CAST (basesink), in gst_base_sink_change_state()
5887 gst_message_new_async_start (GST_OBJECT_CAST (basesink))); in gst_base_sink_change_state()
5890 gst_element_post_message (GST_ELEMENT_CAST (basesink), in gst_base_sink_change_state()
5891 gst_message_new_latency (GST_OBJECT_CAST (basesink))); in gst_base_sink_change_state()
5893 GST_BASE_SINK_PREROLL_UNLOCK (basesink); in gst_base_sink_change_state()
5896 GST_BASE_SINK_PREROLL_LOCK (basesink); in gst_base_sink_change_state()
5897 g_atomic_int_set (&basesink->priv->to_playing, TRUE); in gst_base_sink_change_state()
5898 if (!gst_base_sink_needs_preroll (basesink)) { in gst_base_sink_change_state()
5899 GST_DEBUG_OBJECT (basesink, "PAUSED to PLAYING, don't need preroll"); in gst_base_sink_change_state()
5901 basesink->playing_async = FALSE; in gst_base_sink_change_state()
5902 basesink->need_preroll = FALSE; in gst_base_sink_change_state()
5903 if (basesink->eos) { in gst_base_sink_change_state()
5907 GST_DEBUG_OBJECT (basesink, "Now posting EOS"); in gst_base_sink_change_state()
5908 message = gst_message_new_eos (GST_OBJECT_CAST (basesink)); in gst_base_sink_change_state()
5909 gst_message_set_seqnum (message, basesink->priv->seqnum); in gst_base_sink_change_state()
5910 gst_element_post_message (GST_ELEMENT_CAST (basesink), message); in gst_base_sink_change_state()
5912 GST_DEBUG_OBJECT (basesink, "signal preroll"); in gst_base_sink_change_state()
5913 GST_BASE_SINK_PREROLL_SIGNAL (basesink); in gst_base_sink_change_state()
5916 GST_DEBUG_OBJECT (basesink, "PAUSED to PLAYING, we are not prerolled"); in gst_base_sink_change_state()
5917 basesink->need_preroll = TRUE; in gst_base_sink_change_state()
5918 basesink->playing_async = TRUE; in gst_base_sink_change_state()
5922 GST_DEBUG_OBJECT (basesink, "doing async state change"); in gst_base_sink_change_state()
5924 gst_element_post_message (GST_ELEMENT_CAST (basesink), in gst_base_sink_change_state()
5925 gst_message_new_async_start (GST_OBJECT_CAST (basesink))); in gst_base_sink_change_state()
5928 GST_BASE_SINK_PREROLL_UNLOCK (basesink); in gst_base_sink_change_state()
5947 g_atomic_int_set (&basesink->priv->to_playing, FALSE); in gst_base_sink_change_state()
5950 g_atomic_int_set (&basesink->priv->to_playing, FALSE); in gst_base_sink_change_state()
5951 GST_DEBUG_OBJECT (basesink, "PLAYING to PAUSED"); in gst_base_sink_change_state()
5957 bclass->unlock (basesink); in gst_base_sink_change_state()
5959 GST_BASE_SINK_PREROLL_LOCK (basesink); in gst_base_sink_change_state()
5960 GST_DEBUG_OBJECT (basesink, "got preroll lock"); in gst_base_sink_change_state()
5963 bclass->unlock_stop (basesink); in gst_base_sink_change_state()
5965 if (basesink->clock_id) { in gst_base_sink_change_state()
5966 GST_DEBUG_OBJECT (basesink, "unschedule clock"); in gst_base_sink_change_state()
5967 gst_clock_id_unschedule (basesink->clock_id); in gst_base_sink_change_state()
5972 if (!gst_base_sink_needs_preroll (basesink)) { in gst_base_sink_change_state()
5973 GST_DEBUG_OBJECT (basesink, "PLAYING to PAUSED, we are prerolled"); in gst_base_sink_change_state()
5974 basesink->playing_async = FALSE; in gst_base_sink_change_state()
5975 basesink->need_preroll = FALSE; in gst_base_sink_change_state()
5977 if (GST_STATE_TARGET (GST_ELEMENT (basesink)) <= GST_STATE_READY) { in gst_base_sink_change_state()
5978 GST_DEBUG_OBJECT (basesink, "element is <= READY"); in gst_base_sink_change_state()
5981 GST_DEBUG_OBJECT (basesink, in gst_base_sink_change_state()
5983 basesink->playing_async = TRUE; in gst_base_sink_change_state()
5984 basesink->need_preroll = TRUE; in gst_base_sink_change_state()
5988 GST_DEBUG_OBJECT (basesink, "doing async state change"); in gst_base_sink_change_state()
5990 gst_element_post_message (GST_ELEMENT_CAST (basesink), in gst_base_sink_change_state()
5991 gst_message_new_async_start (GST_OBJECT_CAST (basesink))); in gst_base_sink_change_state()
5995 GST_DEBUG_OBJECT (basesink, "rendered: %" G_GUINT64_FORMAT in gst_base_sink_change_state()
5998 gst_base_sink_reset_qos (basesink); in gst_base_sink_change_state()
5999 GST_BASE_SINK_PREROLL_UNLOCK (basesink); in gst_base_sink_change_state()
6002 GST_BASE_SINK_PREROLL_LOCK (basesink); in gst_base_sink_change_state()
6006 GST_OBJECT_LOCK (basesink); in gst_base_sink_change_state()
6007 basesink->have_newsegment = FALSE; in gst_base_sink_change_state()
6019 gst_caps_replace (&basesink->priv->caps, NULL); in gst_base_sink_change_state()
6020 GST_OBJECT_UNLOCK (basesink); in gst_base_sink_change_state()
6022 gst_base_sink_set_last_buffer (basesink, NULL); in gst_base_sink_change_state()
6023 gst_base_sink_set_last_buffer_list (basesink, NULL); in gst_base_sink_change_state()
6028 GST_DEBUG_OBJECT (basesink, "PAUSED to READY, posting async-done"); in gst_base_sink_change_state()
6030 gst_element_post_message (GST_ELEMENT_CAST (basesink), in gst_base_sink_change_state()
6031 gst_message_new_state_changed (GST_OBJECT_CAST (basesink), in gst_base_sink_change_state()
6034 gst_element_post_message (GST_ELEMENT_CAST (basesink), in gst_base_sink_change_state()
6035 gst_message_new_async_done (GST_OBJECT_CAST (basesink), in gst_base_sink_change_state()
6040 GST_DEBUG_OBJECT (basesink, "PAUSED to READY, don't need_preroll"); in gst_base_sink_change_state()
6042 GST_BASE_SINK_PREROLL_UNLOCK (basesink); in gst_base_sink_change_state()
6046 if (!bclass->stop (basesink)) { in gst_base_sink_change_state()
6047 GST_WARNING_OBJECT (basesink, "failed to stop"); in gst_base_sink_change_state()
6050 gst_base_sink_set_last_buffer (basesink, NULL); in gst_base_sink_change_state()
6051 gst_base_sink_set_last_buffer_list (basesink, NULL); in gst_base_sink_change_state()
6063 GST_DEBUG_OBJECT (basesink, "failed to start"); in gst_base_sink_change_state()
6066 GST_ELEMENT_ERROR (basesink, CORE, STATE_CHANGE, (NULL), in gst_base_sink_change_state()
6072 GST_DEBUG_OBJECT (basesink, in gst_base_sink_change_state()