Пример #1
0
/*****************************************************************************
 * CloseDecoder: tarkin decoder destruction
 *****************************************************************************/
static void CloseDecoder( vlc_object_t *p_this )
{
    decoder_t *p_dec = (decoder_t *)p_this;
    decoder_sys_t *p_sys = p_dec->p_sys;

    tarkin_stream_destroy( p_sys->tarkin_stream );

    free( p_sys );
}
Пример #2
0
static void
gst_tarkinenc_chain (GstPad * pad, GstData * _data)
{
  GstBuffer *buf = GST_BUFFER (_data);
  TarkinEnc *tarkinenc;

  g_return_if_fail (pad != NULL);
  g_return_if_fail (GST_IS_PAD (pad));
  g_return_if_fail (buf != NULL);

  tarkinenc = GST_TARKINENC (gst_pad_get_parent (pad));

  if (!tarkinenc->setup) {
    GST_ELEMENT_ERROR (tarkinenc, CORE, NEGOTIATION, (NULL),
        ("encoder not initialized (input is not tarkin?)"));
    if (GST_IS_BUFFER (buf))
      gst_buffer_unref (buf);
    else
      gst_pad_event_default (pad, GST_EVENT (buf));
    return;
  }

  if (GST_IS_EVENT (buf)) {
    switch (GST_EVENT_TYPE (buf)) {
      case GST_EVENT_EOS:
        tarkin_analysis_framein (tarkinenc->tarkin_stream, NULL, 0, NULL);      /* EOS */
        tarkin_comment_clear (&tarkinenc->tc);
        tarkin_stream_destroy (tarkinenc->tarkin_stream);
      default:
        gst_pad_event_default (pad, GST_EVENT (buf));
        break;
    }
  } else {
    gchar *data;
    gulong size;
    TarkinTime date;

    /* data to encode */
    data = GST_BUFFER_DATA (buf);
    size = GST_BUFFER_SIZE (buf);

    date.numerator = tarkinenc->frame_num;
    date.denominator = 1;
    tarkin_analysis_framein (tarkinenc->tarkin_stream, data, 0, &date);
    tarkinenc->frame_num++;

    gst_buffer_unref (buf);
  }
}