Пример #1
0
static GstPadProbeReturn
events_cb (GstPad * pad, GstPadProbeInfo * probe_info, gpointer user_data)
{
    APP_STATE_T *state = (APP_STATE_T *) user_data;
    GstEvent *event = GST_PAD_PROBE_INFO_EVENT (probe_info);

    switch (GST_EVENT_TYPE (event)) {
    case GST_EVENT_CAPS:
    {
        if (state->caps) {
            gst_caps_unref (state->caps);
            state->caps = NULL;
        }
        gst_event_parse_caps (event, &state->caps);
        if (state->caps)
            gst_caps_ref (state->caps);
        break;
    }
    case GST_EVENT_FLUSH_START:
        flush_start (state);
        break;
    case GST_EVENT_FLUSH_STOP:
        flush_stop (state);
        break;
    case GST_EVENT_EOS:
        queue_object (state, GST_MINI_OBJECT_CAST (gst_event_ref (event)), FALSE);
        break;
    default:
        break;
    }

    return GST_PAD_PROBE_OK;
}
Пример #2
0
static void
preroll_cb (GstElement * fakesink, GstBuffer * buffer, GstPad * pad,
    gpointer user_data)
{
  APP_STATE_T *state = (APP_STATE_T *) user_data;
  queue_object (state, GST_MINI_OBJECT_CAST (gst_buffer_ref (buffer)), FALSE);
}
Пример #3
0
 bool Null()
 {
     msgpack::object* o = queue_object();
     if (!o) { return false; }
     o->type = msgpack::type::NIL;
     return true;
 }
Пример #4
0
 bool Double(double d)
 {
     msgpack::object* o = queue_object();
     if (!o) { return false; }
     o->type = msgpack::type::FLOAT;
     o->via.f64 = d;
     return true;
 }
Пример #5
0
 bool Uint64(uint64_t i)
 {
     msgpack::object* o = queue_object();
     if (!o) { return false; }
     o->type = msgpack::type::POSITIVE_INTEGER;
     o->via.u64 = i;
     return true;
 }
Пример #6
0
 bool Bool(bool b)
 {
     msgpack::object* o = queue_object();
     if (!o) { return false; }
     o->type = msgpack::type::BOOLEAN;
     o->via.boolean = b;
     return true;
 }
Пример #7
0
 bool StartArray()
 {
     msgpack::object* o = queue_object();
     if (!o) { return false; }
     o->type = msgpack::type::ARRAY;
     m_stIndexStack.push(m_stQueued.size() - 1);
     return true;
 }
Пример #8
0
    bool Int64(int64_t i)
    {
        if (i >= 0) { return Uint64(static_cast<uint64_t>(i)); }

        msgpack::object* o = queue_object();
        if (!o) { return false; }
        o->type = msgpack::type::NEGATIVE_INTEGER;
        o->via.i64 = i;
        return true;
    }
Пример #9
0
    bool String(const char* str, std::size_t length, bool copy)
    {
        msgpack::object* o = queue_object();
        if (!o) { return false; }

        o->type = msgpack::type::STR;
        if (copy)
        {
            char* tmp = static_cast<char*> (m_stZone.allocate_align(length));
            if (!tmp) { return false; }
            std::memcpy(tmp, str, length);
            o->via.str.ptr = tmp;
        }
        else
        {
            o->via.str.ptr = str;
        }
        o->via.str.size = length;
        return true;
    }
Пример #10
0
static GstFlowReturn
gst_egl_image_buffer_pool_alloc_buffer (GstBufferPool * bpool,
    GstBuffer ** buffer, GstBufferPoolAcquireParams * params)
{
  GstEGLImageBufferPool *pool = GST_EGL_IMAGE_BUFFER_POOL (bpool);
  *buffer = NULL;

  if (!pool->add_metavideo || !pool->want_eglimage)
    return
        GST_BUFFER_POOL_CLASS
        (gst_egl_image_buffer_pool_parent_class)->alloc_buffer (bpool,
        buffer, params);

  if (!pool->allocator)
    return GST_FLOW_NOT_NEGOTIATED;

  switch (pool->info.finfo->format) {
    case GST_VIDEO_FORMAT_RGBA:{
      GstFlowReturn ret;
      GstQuery *query;
      GstStructure *s;
      const GValue *v;

      s = gst_structure_new ("eglglessink-allocate-eglimage",
          "format", GST_TYPE_VIDEO_FORMAT, pool->info.finfo->format,
          "width", G_TYPE_INT, pool->info.width,
          "height", G_TYPE_INT, pool->info.height, NULL);
      query = gst_query_new_custom (GST_QUERY_CUSTOM, s);

      ret = queue_object (state, GST_MINI_OBJECT_CAST (query), TRUE);

      if (ret != TRUE || !gst_structure_has_field (s, "buffer")) {
        GST_WARNING ("Fallback memory allocation");
        gst_query_unref (query);
        return
            GST_BUFFER_POOL_CLASS
            (gst_egl_image_buffer_pool_parent_class)->alloc_buffer (bpool,
            buffer, params);
      }

      v = gst_structure_get_value (s, "buffer");
      *buffer = GST_BUFFER_CAST (g_value_get_pointer (v));
      gst_query_unref (query);

      if (!*buffer) {
        GST_WARNING ("Fallback memory allocation");
        return
            GST_BUFFER_POOL_CLASS
            (gst_egl_image_buffer_pool_parent_class)->alloc_buffer (bpool,
            buffer, params);
      }

      return GST_FLOW_OK;
      break;
    }
    default:
      return
          GST_BUFFER_POOL_CLASS
          (gst_egl_image_buffer_pool_parent_class)->alloc_buffer (bpool,
          buffer, params);
      break;
  }

  return GST_FLOW_ERROR;
}