当前位置: 首页>>代码示例>>C++>>正文


C++ GST_BUFFER_CAST函数代码示例

本文整理汇总了C++中GST_BUFFER_CAST函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_BUFFER_CAST函数的具体用法?C++ GST_BUFFER_CAST怎么用?C++ GST_BUFFER_CAST使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GST_BUFFER_CAST函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gst_vdp_output_src_pad_push

GstFlowReturn
gst_vdp_output_src_pad_push (GstVdpOutputSrcPad * vdp_pad,
    GstVdpOutputBuffer * output_buf, GError ** error)
{
  GstPad *pad;
  GstBuffer *outbuf;

  g_return_val_if_fail (GST_IS_VDP_OUTPUT_SRC_PAD (vdp_pad), GST_FLOW_ERROR);
  g_return_val_if_fail (GST_IS_VDP_OUTPUT_BUFFER (output_buf), GST_FLOW_ERROR);

  pad = (GstPad *) vdp_pad;

  if (G_UNLIKELY (!GST_PAD_CAPS (pad)))
    return GST_FLOW_NOT_NEGOTIATED;

  switch (vdp_pad->output_format) {
    case GST_VDP_OUTPUT_SRC_PAD_FORMAT_RGB:
    {
      GstFlowReturn ret;
      guint size;

      gst_vdp_output_buffer_calculate_size (output_buf, &size);

      vdp_pad->lock_caps = TRUE;
      ret = gst_pad_alloc_buffer (pad, 0, size, GST_PAD_CAPS (vdp_pad),
          &outbuf);
      vdp_pad->lock_caps = FALSE;

      if (ret != GST_FLOW_OK) {
        gst_buffer_unref (GST_BUFFER_CAST (output_buf));
        return ret;
      }

      if (!gst_vdp_output_buffer_download (output_buf, outbuf, error)) {
        gst_buffer_unref (GST_BUFFER_CAST (output_buf));
        gst_buffer_unref (outbuf);
        return GST_FLOW_ERROR;
      }

      gst_buffer_copy_metadata (outbuf, (const GstBuffer *) output_buf,
          GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS);
      gst_buffer_unref (GST_BUFFER_CAST (output_buf));
      break;
    }
    case GST_VDP_OUTPUT_SRC_PAD_FORMAT_VDPAU:
    {
      outbuf = GST_BUFFER_CAST (output_buf);
      break;
    }

    default:
      g_assert_not_reached ();
      break;
  }

  gst_buffer_set_caps (outbuf, GST_PAD_CAPS (vdp_pad));

  return gst_pad_push (pad, outbuf);
}
开发者ID:collects,项目名称:gst-plugins-bad,代码行数:59,代码来源:gstvdpoutputsrcpad.c

示例2: gst_moz_video_buffer_copy

static GstMozVideoBuffer*
gst_moz_video_buffer_copy(GstMozVideoBuffer* self)
{
  GstMozVideoBuffer* copy;

  g_return_val_if_fail(GST_IS_MOZ_VIDEO_BUFFER(self), NULL);

  copy = gst_moz_video_buffer_new();

  /* we simply copy everything from our parent */
  GST_BUFFER_DATA(GST_BUFFER_CAST(copy)) =
      (guint8*)g_memdup(GST_BUFFER_DATA(GST_BUFFER_CAST(self)), GST_BUFFER_SIZE(GST_BUFFER_CAST(self)));

  /* make sure it gets freed(even if the parent is subclassed, we return a
     normal buffer) */
  GST_BUFFER_MALLOCDATA(GST_BUFFER_CAST(copy)) = GST_BUFFER_DATA(GST_BUFFER_CAST(copy));
  GST_BUFFER_SIZE(GST_BUFFER_CAST(copy)) = GST_BUFFER_SIZE(GST_BUFFER_CAST(self));

  /* copy metadata */
  gst_buffer_copy_metadata(GST_BUFFER_CAST(copy),
                           GST_BUFFER_CAST(self),
                           (GstBufferCopyFlags)GST_BUFFER_COPY_ALL);
  /* copy videobuffer */
  if(self->data)
    copy->data = (GstMozVideoBufferData*)g_boxed_copy(GST_TYPE_MOZ_VIDEO_BUFFER_DATA, self->data);

  return copy;
}
开发者ID:Incognito,项目名称:mozilla-central,代码行数:28,代码来源:GStreamerMozVideoBuffer.cpp

示例3: my_recycle_buffer_finalize

static void
my_recycle_buffer_finalize (GstMiniObject * mini_object)
{
  GstBuffer *self = GST_BUFFER_CAST (mini_object);

  if (self->pool != NULL) {
    my_buffer_pool_add (self->pool, GST_BUFFER_CAST (self));
    g_usleep (G_USEC_PER_SEC / 100);
  } else {
    GST_MINI_OBJECT_CLASS (my_recycle_buffer_parent_class)->finalize
        (mini_object);
  }
}
开发者ID:ConfusedReality,项目名称:pkg_multimedia_gstreamer,代码行数:13,代码来源:gstminiobject.c

示例4: gst_vdp_h264_dec_create_bitstream_buffers

static VdpBitstreamBuffer *
gst_vdp_h264_dec_create_bitstream_buffers (GstVdpH264Dec * h264_dec,
    GstH264Frame * h264_frame, guint * n_bufs)
{
  VdpBitstreamBuffer *bufs;

  if (h264_dec->packetized) {
    guint i;

    bufs = g_new (VdpBitstreamBuffer, h264_frame->slices->len * 2);
    *n_bufs = h264_frame->slices->len * 2;

    for (i = 0; i < h264_frame->slices->len; i++) {
      static const guint8 start_code[] = { 0x00, 0x00, 0x01 };
      guint idx;
      GstBuffer *buf;

      idx = i * 2;
      bufs[idx].bitstream = start_code;
      bufs[idx].bitstream_bytes = 3;
      bufs[idx].struct_version = VDP_BITSTREAM_BUFFER_VERSION;

      idx = idx + 1;
      buf = GST_BUFFER_CAST (g_ptr_array_index (h264_frame->slices, i));
      bufs[idx].bitstream = GST_BUFFER_DATA (buf) + h264_dec->nal_length_size;
      bufs[idx].bitstream_bytes = GST_BUFFER_SIZE (buf) -
          h264_dec->nal_length_size;
      bufs[idx].struct_version = VDP_BITSTREAM_BUFFER_VERSION;
    }
  }

  else {
    guint i;

    bufs = g_new (VdpBitstreamBuffer, h264_frame->slices->len);
    *n_bufs = h264_frame->slices->len;

    for (i = 0; i < h264_frame->slices->len; i++) {
      GstBuffer *buf;

      buf = GST_BUFFER_CAST (g_ptr_array_index (h264_frame->slices, i));
      bufs[i].bitstream = GST_BUFFER_DATA (buf);
      bufs[i].bitstream_bytes = GST_BUFFER_SIZE (buf);
      bufs[i].struct_version = VDP_BITSTREAM_BUFFER_VERSION;
    }
  }

  return bufs;
}
开发者ID:ylatuya,项目名称:gst-plugins-bad,代码行数:49,代码来源:gstvdph264dec.c

示例5: gst_buffer_list_iterator_next

/**
 * gst_buffer_list_iterator_next:
 * @it: a #GstBufferListIterator
 *
 * Returns the next buffer in the list iterated with @it. If the iterator is at
 * the end of a group, NULL will be returned. This function may be called
 * repeatedly to iterate through the current group.
 *
 * The caller will not get a new ref to the returned #GstBuffer and must not
 * unref it.
 *
 * Returns: the next buffer in the current group of the buffer list, or NULL
 *
 * Since: 0.10.24
 */
GstBuffer *
gst_buffer_list_iterator_next (GstBufferListIterator * it)
{
  GstBuffer *buffer;

  g_return_val_if_fail (it != NULL, NULL);

  while (it->next != NULL && it->next->data != GROUP_START &&
      it->next->data == STOLEN) {
    it->next = g_list_next (it->next);
  }

  if (it->next == NULL || it->next->data == GROUP_START) {
    goto no_buffer;
  }

  buffer = GST_BUFFER_CAST (it->next->data);

  it->last_returned = it->next;
  it->next = g_list_next (it->next);

  return buffer;

no_buffer:
  {
    it->last_returned = NULL;
    return NULL;
  }
}
开发者ID:spunktsch,项目名称:svtplayer,代码行数:44,代码来源:gstbufferlist.c

示例6: gst_funnel_sink_chain_object

static GstFlowReturn
gst_funnel_sink_chain_object (GstPad * pad, GstFunnel * funnel,
    gboolean is_list, GstMiniObject * obj)
{
  GstFlowReturn res;

  GST_DEBUG_OBJECT (pad, "received %" GST_PTR_FORMAT, obj);

  GST_PAD_STREAM_LOCK (funnel->srcpad);

  if ((funnel->last_sinkpad == NULL)
      || ((funnel->forward_sticky_events_mode !=
              GST_FUNNEL_FORWARD_STICKY_EVENTS_MODE_NEVER)
          && (funnel->last_sinkpad != pad))) {

    GST_DEBUG_OBJECT (pad, "Forwarding sticky events");
    gst_pad_sticky_events_foreach (pad, forward_events_on_stream_changed,
        funnel);

    gst_object_replace ((GstObject **) & funnel->last_sinkpad,
        GST_OBJECT (pad));
  }

  if (is_list)
    res = gst_pad_push_list (funnel->srcpad, GST_BUFFER_LIST_CAST (obj));
  else
    res = gst_pad_push (funnel->srcpad, GST_BUFFER_CAST (obj));

  GST_PAD_STREAM_UNLOCK (funnel->srcpad);

  GST_LOG_OBJECT (pad, "handled buffer%s %s", (is_list ? "list" : ""),
      gst_flow_get_name (res));

  return res;
}
开发者ID:Kurento,项目名称:gstreamer,代码行数:35,代码来源:gstfunnel.c

示例7: vorbis_dec_chain_reverse

static GstFlowReturn
vorbis_dec_chain_reverse (GstVorbisDec * vd, gboolean discont, GstBuffer * buf)
{
  GstFlowReturn result = GST_FLOW_OK;

  /* if we have a discont, move buffers to the decode list */
  if (G_UNLIKELY (discont)) {
    GST_DEBUG_OBJECT (vd, "received discont");
    while (vd->gather) {
      GstBuffer *gbuf;

      gbuf = GST_BUFFER_CAST (vd->gather->data);
      /* remove from the gather list */
      vd->gather = g_list_delete_link (vd->gather, vd->gather);
      /* copy to decode queue */
      vd->decode = g_list_prepend (vd->decode, gbuf);
    }
    /* flush and decode the decode queue */
    result = vorbis_dec_flush_decode (vd);
  }

  if (G_LIKELY (buf)) {
    GST_DEBUG_OBJECT (vd,
        "gathering buffer %p of size %u, time %" GST_TIME_FORMAT
        ", dur %" GST_TIME_FORMAT, buf, GST_BUFFER_SIZE (buf),
        GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
        GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));

    /* add buffer to gather queue */
    vd->gather = g_list_prepend (vd->gather, buf);
  }

  return result;
}
开发者ID:spunktsch,项目名称:svtplayer,代码行数:34,代码来源:gstvorbisdec.c

示例8: rtp_jitter_buffer_insert

/**
 * rtp_jitter_buffer_insert:
 * @jbuf: an #RTPJitterBuffer
 * @buf: a buffer
 * @time: a running_time when this buffer was received in nanoseconds
 * @clock_rate: the clock-rate of the payload of @buf
 * @max_delay: the maximum lateness of @buf
 * @tail: TRUE when the tail element changed.
 *
 * Inserts @buf into the packet queue of @jbuf. The sequence number of the
 * packet will be used to sort the packets. This function takes ownerhip of
 * @buf when the function returns %TRUE.
 * @buf should have writable metadata when calling this function.
 *
 * Returns: %FALSE if a packet with the same number already existed.
 */
gboolean
rtp_jitter_buffer_insert (RTPJitterBuffer * jbuf, GstBuffer * buf,
    GstClockTime time, guint32 clock_rate, GstClockTime max_delay,
    gboolean * tail)
{
  GList *list;
  guint32 rtptime;
  guint16 seqnum;

  g_return_val_if_fail (jbuf != NULL, FALSE);
  g_return_val_if_fail (buf != NULL, FALSE);

  seqnum = gst_rtp_buffer_get_seq (buf);

  /* loop the list to skip strictly smaller seqnum buffers */
  for (list = jbuf->packets->head; list; list = g_list_next (list)) {
    guint16 qseq;
    gint gap;

    qseq = gst_rtp_buffer_get_seq (GST_BUFFER_CAST (list->data));

    /* compare the new seqnum to the one in the buffer */
    gap = gst_rtp_buffer_compare_seqnum (seqnum, qseq);

    /* we hit a packet with the same seqnum, notify a duplicate */
    if (G_UNLIKELY (gap == 0))
      goto duplicate;

    /* seqnum > qseq, we can stop looking */
    if (G_LIKELY (gap < 0))
      break;
  }

  /* do skew calculation by measuring the difference between rtptime and the
   * receive time, this function will retimestamp @buf with the skew corrected
   * running time. */
  rtptime = gst_rtp_buffer_get_timestamp (buf);
  time = calculate_skew (jbuf, rtptime, time, clock_rate, max_delay);
  GST_BUFFER_TIMESTAMP (buf) = time;

  /* It's more likely that the packet was inserted in the front of the buffer */
  if (G_LIKELY (list))
    g_queue_insert_before (jbuf->packets, list, buf);
  else
    g_queue_push_tail (jbuf->packets, buf);

  /* tail was changed when we did not find a previous packet, we set the return
   * flag when requested. */
  if (G_LIKELY (tail))
    *tail = (list == NULL);

  return TRUE;

  /* ERRORS */
duplicate:
  {
    GST_WARNING ("duplicate packet %d found", (gint) seqnum);
    return FALSE;
  }
}
开发者ID:zsx,项目名称:ossbuild,代码行数:76,代码来源:rtpjitterbuffer.c

示例9: shmdata_base_reader_reset_time

gboolean
shmdata_base_reader_reset_time (GstPad *pad,
                                GstMiniObject * mini_obj,
                                gpointer user_data)
{

    shmdata_base_reader_t *context = (shmdata_base_reader_t *) user_data;
    if (GST_IS_EVENT (mini_obj))
    {
        //g_debug ("EVENT %s", GST_EVENT_TYPE_NAME (GST_EVENT_CAST(mini_obj)));
    }
    else if (GST_IS_BUFFER (mini_obj))
    {
        GstBuffer *buffer = GST_BUFFER_CAST (mini_obj);
        /* g_debug ("shmdata writer data frame (%p), data size %d, timestamp %llu, caps %s", */
        /* 	       GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer), */
        /* 	       GST_TIME_AS_MSECONDS (GST_BUFFER_TIMESTAMP (buffer)), */
        /* 	       gst_caps_to_string (GST_BUFFER_CAPS (buffer))); */
        if (context->timereset_)
        {
            context->timeshift_ = GST_BUFFER_TIMESTAMP (buffer);
            context->timereset_ = FALSE;
        }
        GST_BUFFER_TIMESTAMP (buffer) =
            GST_BUFFER_TIMESTAMP (buffer) - context->timeshift_;
    }
    else if (GST_IS_MESSAGE (mini_obj))
    {
    }

    return TRUE;
}
开发者ID:step21,项目名称:shmdata,代码行数:32,代码来源:base-reader.c

示例10: vorbis_parse_drain_queue

static GstFlowReturn
vorbis_parse_drain_queue (GstVorbisParse * parse, gint64 granulepos)
{
    GstFlowReturn ret = GST_FLOW_OK;
    GList *walk;
    gint64 cur = granulepos;
    gint64 gp;

    for (walk = parse->buffer_queue->head; walk; walk = walk->next)
        cur -= GST_BUFFER_OFFSET (walk->data);

    if (parse->prev_granulepos != -1)
        cur = MAX (cur, parse->prev_granulepos);

    while (!g_queue_is_empty (parse->buffer_queue)) {
        GstBuffer *buf;

        buf = GST_BUFFER_CAST (g_queue_pop_head (parse->buffer_queue));

        cur += GST_BUFFER_OFFSET (buf);
        gp = CLAMP (cur, 0, granulepos);

        ret = vorbis_parse_push_buffer (parse, buf, gp);

        if (ret != GST_FLOW_OK)
            goto done;
    }

    parse->prev_granulepos = granulepos;

done:
    return ret;
}
开发者ID:jwzl,项目名称:ossbuild,代码行数:33,代码来源:gstvorbisparse.c

示例11: gst_vdp_sink_stop

static gboolean
gst_vdp_sink_stop (GstBaseSink * bsink)
{
  VdpSink *vdp_sink = GST_VDP_SINK (bsink);

  vdp_sink->running = FALSE;
  /* Wait for our event thread to finish before we clean up our stuff. */
  if (vdp_sink->event_thread)
    g_thread_join (vdp_sink->event_thread);

  if (vdp_sink->cur_image) {
    gst_buffer_unref (GST_BUFFER_CAST (vdp_sink->cur_image));
    vdp_sink->cur_image = NULL;
  }

  g_mutex_lock (vdp_sink->flow_lock);
  if (vdp_sink->window) {
    gst_vdp_sink_window_destroy (vdp_sink, vdp_sink->window);
    vdp_sink->window = NULL;
  }
  g_mutex_unlock (vdp_sink->flow_lock);

  gst_vdp_device_clear (vdp_sink);

  return TRUE;
}
开发者ID:spunktsch,项目名称:svtplayer,代码行数:26,代码来源:gstvdpsink.c

示例12: vorbis_parse_drain_queue_prematurely

static GstFlowReturn
vorbis_parse_drain_queue_prematurely (GstVorbisParse * parse)
{
    GstFlowReturn ret = GST_FLOW_OK;
    gint64 granulepos = MAX (parse->prev_granulepos, 0);

    /* got an EOS event, make sure to push out any buffers that were in the queue
     * -- won't normally be the case, but this catches the
     * didn't-get-a-granulepos-on-the-last-packet case. Assuming a continuous
     * stream. */

    /* if we got EOS before any buffers came, go ahead and push the other events
     * first */
    vorbis_parse_drain_event_queue (parse);

    while (!g_queue_is_empty (parse->buffer_queue)) {
        GstBuffer *buf;

        buf = GST_BUFFER_CAST (g_queue_pop_head (parse->buffer_queue));

        granulepos += GST_BUFFER_OFFSET (buf);
        ret = vorbis_parse_push_buffer (parse, buf, granulepos);

        if (ret != GST_FLOW_OK)
            goto done;
    }

    parse->prev_granulepos = granulepos;

done:
    return ret;
}
开发者ID:jwzl,项目名称:ossbuild,代码行数:32,代码来源:gstvorbisparse.c

示例13: vorbis_dec_flush_decode

/*
 * Input:
 *  Buffer decoding order:  7  8  9  4  5  6  3  1  2  EOS
 *  Discont flag:           D        D        D  D
 *
 * - Each Discont marks a discont in the decoding order.
 *
 * for vorbis, each buffer is a keyframe when we have the previous
 * buffer. This means that to decode buffer 7, we need buffer 6, which
 * arrives out of order.
 *
 * we first gather buffers in the gather queue until we get a DISCONT. We
 * prepend each incomming buffer so that they are in reversed order.
 *
 *    gather queue:    9  8  7
 *    decode queue:
 *    output queue:
 *
 * When a DISCONT is received (buffer 4), we move the gather queue to the
 * decode queue. This is simply done be taking the head of the gather queue
 * and prepending it to the decode queue. This yields:
 *
 *    gather queue:
 *    decode queue:    7  8  9
 *    output queue:
 *
 * Then we decode each buffer in the decode queue in order and put the output
 * buffer in the output queue. The first buffer (7) will not produce any output
 * because it needs the previous buffer (6) which did not arrive yet. This
 * yields:
 *
 *    gather queue:
 *    decode queue:    7  8  9
 *    output queue:    9  8
 *
 * Then we remove the consumed buffers from the decode queue. Buffer 7 is not
 * completely consumed, we need to keep it around for when we receive buffer
 * 6. This yields:
 *
 *    gather queue:
 *    decode queue:    7
 *    output queue:    9  8
 *
 * Then we accumulate more buffers:
 *
 *    gather queue:    6  5  4
 *    decode queue:    7
 *    output queue:
 *
 * prepending to the decode queue on DISCONT yields:
 *
 *    gather queue:
 *    decode queue:    4  5  6  7
 *    output queue:
 *
 * after decoding and keeping buffer 4:
 *
 *    gather queue:
 *    decode queue:    4
 *    output queue:    7  6  5
 *
 * Etc..
 */
static GstFlowReturn
vorbis_dec_flush_decode (GstVorbisDec * dec)
{
  GstFlowReturn res = GST_FLOW_OK;
  GList *walk;

  walk = dec->decode;

  GST_DEBUG_OBJECT (dec, "flushing buffers to decoder");

  while (walk) {
    GList *next;
    GstBuffer *buf = GST_BUFFER_CAST (walk->data);

    GST_DEBUG_OBJECT (dec, "decoding buffer %p, ts %" GST_TIME_FORMAT,
        buf, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));

    next = g_list_next (walk);

    /* decode buffer, prepend to output queue */
    res = vorbis_dec_decode_buffer (dec, buf);

    /* if we generated output, we can discard the buffer, else we
     * keep it in the queue */
    if (dec->queued) {
      GST_DEBUG_OBJECT (dec, "decoded buffer to %p", dec->queued->data);
      dec->decode = g_list_delete_link (dec->decode, walk);
      gst_buffer_unref (buf);
    } else {
      GST_DEBUG_OBJECT (dec, "buffer did not decode, keeping");
    }
    walk = next;
  }
  while (dec->queued) {
    GstBuffer *buf = GST_BUFFER_CAST (dec->queued->data);
    GstClockTime timestamp, duration;

//.........这里部分代码省略.........
开发者ID:spunktsch,项目名称:svtplayer,代码行数:101,代码来源:gstvorbisdec.c

示例14: handle_queued_objects

static gboolean
handle_queued_objects (APP_STATE_T * state)
{
    GstMiniObject *object = NULL;

    g_mutex_lock (&state->queue_lock);
    if (state->flushing) {
        g_cond_broadcast (&state->cond);
        goto beach;
    } else if (g_async_queue_length (state->queue) == 0) {
        goto beach;
    }

    if ((object = g_async_queue_try_pop (state->queue))) {
        if (GST_IS_BUFFER (object)) {
            GstBuffer *buffer = GST_BUFFER_CAST (object);
            update_image (state, buffer);
            render_scene (state);
            gst_buffer_unref (buffer);
            if (!SYNC_BUFFERS) {
                object = NULL;
            }
        } else if (GST_IS_QUERY (object)) {
            GstQuery *query = GST_QUERY_CAST (object);
            GstStructure *s = (GstStructure *) gst_query_get_structure (query);

            if (gst_structure_has_name (s, "not-used")) {
                g_assert_not_reached ();
            } else {
                g_assert_not_reached ();
            }
        } else if (GST_IS_EVENT (object)) {
            GstEvent *event = GST_EVENT_CAST (object);
            g_print ("\nevent %p %s\n", event,
                     gst_event_type_get_name (GST_EVENT_TYPE (event)));

            switch (GST_EVENT_TYPE (event)) {
            case GST_EVENT_EOS:
                flush_internal (state);
                break;
            default:
                break;
            }
            gst_event_unref (event);
            object = NULL;
        }
    }

    if (object) {
        state->popped_obj = object;
        g_cond_broadcast (&state->cond);
    }

beach:
    g_mutex_unlock (&state->queue_lock);

    return FALSE;
}
开发者ID:ryumiel,项目名称:gst-omx,代码行数:58,代码来源:testegl.c

示例15: theora_parse_drain_queue

static GstFlowReturn
theora_parse_drain_queue (GstTheoraParse * parse, gint64 granulepos)
{
  GstFlowReturn ret = GST_FLOW_OK;
  gint64 keyframe, prev_frame, frame;

  parse_granulepos (parse, granulepos, &keyframe, &frame);

  GST_DEBUG ("draining queue of length %d",
      g_queue_get_length (parse->buffer_queue));

  GST_LOG_OBJECT (parse, "gp %" G_GINT64_FORMAT ", kf %" G_GINT64_FORMAT
      ", frame %" G_GINT64_FORMAT, granulepos, keyframe, frame);

  prev_frame = frame - g_queue_get_length (parse->buffer_queue);

  GST_LOG_OBJECT (parse,
      "new prev %" G_GINT64_FORMAT ", prev %" G_GINT64_FORMAT, prev_frame,
      parse->prev_frame);

  if (prev_frame < parse->prev_frame) {
    GST_WARNING ("jumped %" G_GINT64_FORMAT
        " frames backwards! not sure what to do here",
        parse->prev_frame - prev_frame);
    parse->prev_frame = prev_frame;
  } else if (prev_frame > parse->prev_frame) {
    GST_INFO ("discontinuity detected (%" G_GINT64_FORMAT
        " frames)", prev_frame - parse->prev_frame);
    if (keyframe <= prev_frame && keyframe > parse->prev_keyframe)
      parse->prev_keyframe = keyframe;
    parse->prev_frame = prev_frame;
  }

  while (!g_queue_is_empty (parse->buffer_queue)) {
    GstBuffer *buf;

    parse->prev_frame++;
    g_assert (parse->prev_frame >= 0);

    buf = GST_BUFFER_CAST (g_queue_pop_head (parse->buffer_queue));

    if (is_keyframe (buf))
      /* we have a keyframe */
      parse->prev_keyframe = parse->prev_frame;
    else
      GST_BUFFER_FLAGS (buf) |= GST_BUFFER_FLAG_DELTA_UNIT;

    ret = theora_parse_push_buffer (parse, buf, parse->prev_keyframe,
        parse->prev_frame);

    if (ret != GST_FLOW_OK)
      goto done;
  }

done:
  return ret;
}
开发者ID:aHuaLiu,项目名称:gst-plugins-base,代码行数:57,代码来源:gsttheoraparse.c


注:本文中的GST_BUFFER_CAST函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。