Ejemplo n.º 1
0
static GstPadProbeReturn
process_buffer_probe_cb (GstPad * pad, GstPadProbeInfo * info,
    gpointer user_data)
{
  if (GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_BUFFER) {
    GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER (info);

    process_buffer (buffer, user_data);
  } else if (GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_BUFFER_LIST) {
    GstBufferList *list = GST_PAD_PROBE_INFO_BUFFER_LIST (info);

    gst_buffer_list_foreach (list, process_buffer_list_cb, user_data);
  }

  return GST_PAD_PROBE_OK;
}
Ejemplo n.º 2
0
static GstPadProbeReturn
kms_agnostic_bin2_src_reconfigure_probe (GstPad * pad, GstPadProbeInfo * info,
    gpointer user_data)
{
  KmsAgnosticBin2 *self = KMS_AGNOSTIC_BIN2 (gst_pad_get_parent_element (pad));
  GstPadProbeReturn ret = GST_PAD_PROBE_OK;
  GstEvent *event;

  if (self == NULL) {
    return GST_PAD_PROBE_OK;
  }

  if (GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_EVENT_BOTH) {
    event = gst_pad_probe_info_get_event (info);

    if (GST_EVENT_TYPE (event) == GST_EVENT_RECONFIGURE) {
      KmsAgnosticBin2 *self = user_data;

      GST_DEBUG_OBJECT (pad, "Received reconfigure event");

      KMS_AGNOSTIC_BIN2_LOCK (self);
      kms_agnostic_bin2_process_pad (self, pad);
      ret = GST_PAD_PROBE_DROP;
      KMS_AGNOSTIC_BIN2_UNLOCK (self);

      goto end;
    }
  }

end:
  g_object_unref (self);

  return ret;
}
static GstPadProbeReturn onAppsinkFlushCallback(GstPad*, GstPadProbeInfo* info, gpointer userData)
{
    if (GST_PAD_PROBE_INFO_TYPE(info) & (GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | GST_PAD_PROBE_TYPE_EVENT_FLUSH)) {
        GstEvent* event = GST_PAD_PROBE_INFO_EVENT(info);
        if (GST_EVENT_TYPE(event) == GST_EVENT_FLUSH_STOP) {
            AudioSourceProviderGStreamer* provider = reinterpret_cast<AudioSourceProviderGStreamer*>(userData);
            provider->clearAdapters();
        }
    }
    return GST_PAD_PROBE_OK;
}
static GstPadProbeReturn
pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
{
  GstInsertBin *self = GST_INSERT_BIN (user_data);

  g_assert (GST_PAD_PROBE_INFO_TYPE (info) &
      (GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_IDLE));

  gst_insert_bin_do_change (self, pad);

  return GST_PAD_PROBE_REMOVE;
}
Ejemplo n.º 5
0
static GstPadProbeReturn
dvdbin_dump_timing_info (GstPad * opad,
    GstPadProbeInfo * info, gpointer userdata)
{
  if (GST_PAD_PROBE_INFO_TYPE (info) & (GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM |
          GST_PAD_PROBE_TYPE_EVENT_FLUSH)) {
    GstEvent *event = GST_PAD_PROBE_INFO_EVENT (info);
    if (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) {
      const GstSegment *seg;

      gst_event_parse_segment (event, &seg);

      g_print ("%s:%s segment: rate %g format %d, start: %"
          GST_TIME_FORMAT ", stop: %" GST_TIME_FORMAT ", time: %"
          GST_TIME_FORMAT " base: %" GST_TIME_FORMAT "\n",
          GST_DEBUG_PAD_NAME (opad),
          seg->rate, seg->format, GST_TIME_ARGS (seg->start),
          GST_TIME_ARGS (seg->stop), GST_TIME_ARGS (seg->time),
          GST_TIME_ARGS (seg->base));
    } else if (GST_EVENT_TYPE (event) == GST_EVENT_GAP) {
      GstClockTime ts, dur, end;
      gst_event_parse_gap (event, &ts, &dur);
      end = ts;
      if (ts != GST_CLOCK_TIME_NONE && dur != GST_CLOCK_TIME_NONE)
        end += dur;
      g_print ("%s:%s Gap TS: %" GST_TIME_FORMAT " dur %" GST_TIME_FORMAT
          " (to %" GST_TIME_FORMAT ")\n", GST_DEBUG_PAD_NAME (opad),
          GST_TIME_ARGS (ts), GST_TIME_ARGS (dur), GST_TIME_ARGS (end));
    } else if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP) {
      g_print ("%s:%s FLUSHED\n", GST_DEBUG_PAD_NAME (opad));
    }
  }
  if (GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_BUFFER) {
    GstBuffer *buf = GST_PAD_PROBE_INFO_BUFFER (info);
    g_print ("%s:%s Buffer PTS %" GST_TIME_FORMAT " duration %" GST_TIME_FORMAT
        "\n", GST_DEBUG_PAD_NAME (opad), GST_TIME_ARGS (GST_BUFFER_PTS (buf)),
        GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
  }
  return GST_PAD_PROBE_OK;
}
Ejemplo n.º 6
0
static GstPadProbeReturn
pad_blocked_callback (GstPad * pad, GstPadProbeInfo * info, gpointer d)
{
  PadBlockedData *data = d;
  GstEvent *event;
  const GstStructure *st;

  if (GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_QUERY_BOTH) {
    /* Queries must be answered */
    return GST_PAD_PROBE_PASS;
  }

  if (!(GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_EVENT_BOTH)) {
    goto end;
  }

  if (~GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_BLOCK) {
    return data->drop ? GST_PAD_PROBE_DROP : GST_PAD_PROBE_OK;
  }

  event = GST_PAD_PROBE_INFO_EVENT (info);

  if (!(GST_EVENT_TYPE (event) & GST_EVENT_CUSTOM_BOTH)) {
    goto end;
  }

  st = gst_event_get_structure (event);

  if (g_strcmp0 (data->eventId, gst_structure_get_name (st)) != 0) {
    goto end;
  }

  data->callback (pad, data->userData);

  return GST_PAD_PROBE_DROP;

end:
  return data->drop ? GST_PAD_PROBE_DROP : GST_PAD_PROBE_PASS;
}
static GstPadProbeReturn
block_agnostic_sink (GstPad * pad, GstPadProbeInfo * info, gpointer data)
{
  static gboolean configuring = FALSE;

  /* HACK: Ignore caps event and stream start event that causes negotiation
   * failures.This is a workaround that should be removed
   */
  if (GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) {
    GstEvent *event = GST_PAD_PROBE_INFO_EVENT (info);

    if (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START
        || GST_EVENT_TYPE (event) == GST_EVENT_CAPS) {
      return GST_PAD_PROBE_PASS;
    }
  }

  /* HACK: Ignore query accept caps that causes negotiation errors.
   * This is a workaround that should be removed
   */
  if (GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM) {
    GstQuery *query = GST_PAD_PROBE_INFO_QUERY (info);

    if (GST_QUERY_TYPE (query) == GST_QUERY_ACCEPT_CAPS) {
      return GST_PAD_PROBE_PASS;
    }
  }

  if (!g_atomic_int_get (&configuring)) {
    g_atomic_int_set (&configuring, TRUE);
    change_input (data);
    g_atomic_int_set (&configuring, FALSE);
    return GST_PAD_PROBE_REMOVE;
  }

  return GST_PAD_PROBE_PASS;
}
Ejemplo n.º 8
0
GstPadProbeReturn
introbin_pad_block_cb(GstPad *pad,
                      GstPadProbeInfo *info,
		                    gpointer user_data)
{
   CustomData *data=(CustomData*)user_data;  
//   g_print("Introbin pad callback triggered. Type:%d\n",GST_PAD_PROBE_INFO_TYPE(info));
   if(GST_PAD_PROBE_INFO_TYPE(info)|GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) {
      GstEvent *event=GST_PAD_PROBE_INFO_EVENT(info);
//      g_print("Introbin blocking pad received %s event...",GST_EVENT_TYPE_NAME(event));
      if(strcmp(GST_EVENT_TYPE_NAME(event),"stream-start")==0) {
//         g_print("Dropped.\n");
         return GST_PAD_PROBE_DROP;
      }
      if(strcmp(GST_EVENT_TYPE_NAME(event),"eos")==0) {
         char *pad_name=gst_pad_get_name(pad);
         g_print("Introbin EOS received on pad:%s.\n",pad_name);
	 GstElement *valve;
	 if(strcmp(pad_name,"vsrc")==0) 
   	    valve=gst_bin_get_by_name(data->introbin,"introvvalve");
	 else 
	    valve=gst_bin_get_by_name(data->introbin,"introavalve");

	 g_object_set(G_OBJECT(valve),"drop",TRUE,NULL);
	 g_print("%s DROP set TRUE.\n",gst_element_get_name(valve));
	 g_object_unref(valve);
//	 GstPad *peer=gst_pad_get_peer(pad);
//         GstElement *mixer=gst_bin_get_by_name(data->pipeline,"mixer1");
//         gst_pad_unlink(pad,peer);
//         if(!gst_pad_send_event(peer,gst_event_new_eos())) {
//            g_print("couldn't send eos event to displaymixer");
//         }   
//         gst_element_release_request_pad(mixer,peer);  
//         gst_object_unref(peer);
//         gst_object_unref(mixer);
//         gst_object_ref(data->introbin); //Remove reduce to refcount...
//         gst_bin_remove(GST_BIN(data->pipeline),data->introbin);
           return GST_PAD_PROBE_PASS;
      }
      if(strcmp(GST_EVENT_TYPE_NAME(event),"segment")==0) {
         g_print("Introbin segment received.\n");
         return GST_PAD_PROBE_PASS;
      }
//      g_print("Passed.\n");
      return GST_PAD_PROBE_PASS;

   }
   return GST_PAD_PROBE_PASS;
}
Ejemplo n.º 9
0
static GstPadProbeReturn
tee_src_probe (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
{
  if (GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_EVENT_UPSTREAM) {
    GstEvent *event = gst_pad_probe_info_get_event (info);

    if (GST_EVENT_TYPE (event) == GST_EVENT_RECONFIGURE) {
      // Request key frame to upstream elements
      kms_utils_drop_until_keyframe (pad, TRUE);
      return GST_PAD_PROBE_DROP;
    }
  }

  return GST_PAD_PROBE_OK;
}
Ejemplo n.º 10
0
GstPadProbeReturn GstEnginePipeline::DecodebinProbe(GstPad* pad,
        GstPadProbeInfo* info,
        gpointer data) {
    GstEnginePipeline* instance = reinterpret_cast<GstEnginePipeline*>(data);
    const GstPadProbeType info_type = GST_PAD_PROBE_INFO_TYPE(info);

    if (info_type & GST_PAD_PROBE_TYPE_BUFFER) {
        // The decodebin produced a buffer.  Record its end time, so we can offset
        // the buffers produced by the next decodebin when transitioning to the next
        // song.
        GstBuffer* buffer = GST_PAD_PROBE_INFO_BUFFER(info);

        GstClockTime timestamp = GST_BUFFER_TIMESTAMP(buffer);
        GstClockTime duration = GST_BUFFER_DURATION(buffer);
        if (timestamp == GST_CLOCK_TIME_NONE) {
            timestamp = instance->last_decodebin_segment_.position;
        }

        if (duration != GST_CLOCK_TIME_NONE) {
            timestamp += duration;
        }

        instance->last_decodebin_segment_.position = timestamp;
    } else if (info_type & GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) {
        GstEvent* event = GST_PAD_PROBE_INFO_EVENT(info);
        GstEventType event_type = GST_EVENT_TYPE(event);

        if (event_type == GST_EVENT_SEGMENT) {
            // A new segment started, we need to save this to calculate running time
            // offsets later.
            gst_event_copy_segment(event, &instance->last_decodebin_segment_);
        } else if (event_type == GST_EVENT_FLUSH_START) {
            // A flushing seek resets the running time to 0, so remove any offset
            // we set on this pad before.
            gst_pad_set_offset(pad, 0);
        }
    }

    return GST_PAD_PROBE_OK;
}
Ejemplo n.º 11
0
static GstPadProbeReturn
remove_on_unlinked_blocked (GstPad * pad, GstPadProbeInfo * info, gpointer elem)
{
  KmsAgnosticBin2 *self;
  GstPad *sink;

  if (elem == NULL) {
    return GST_PAD_PROBE_REMOVE;
  }

  GST_DEBUG_OBJECT (pad, "Unlinking pad");

  GST_OBJECT_LOCK (pad);
  if (g_object_get_qdata (G_OBJECT (pad), unlinking_data_quark ())) {
    GST_OBJECT_UNLOCK (pad);
    if (GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_QUERY_BOTH) {
      /* Queries must be answered */
      return GST_PAD_PROBE_PASS;
    } else {
      return GST_PAD_PROBE_DROP;
    }
  }

  g_object_set_qdata (G_OBJECT (pad), unlinking_data_quark (),
      GINT_TO_POINTER (TRUE));

  GST_OBJECT_UNLOCK (pad);

  sink = gst_pad_get_peer (pad);
  if (sink != NULL) {
    gst_pad_unlink (pad, sink);
    g_object_unref (sink);
  }

  self = KMS_AGNOSTIC_BIN2 (GST_OBJECT_PARENT (elem));

  g_thread_pool_push (self->priv->remove_pool, g_object_ref (elem), NULL);

  return GST_PAD_PROBE_PASS;
}