Ejemplo n.º 1
0
/*****************************************************************************
 * OpenDecoder: probe the decoder and return score
 *****************************************************************************/
static int OpenDecoder( vlc_object_t *p_this )
{
    decoder_t *p_dec = (decoder_t*)p_this;
    decoder_sys_t *p_sys;

    if( p_dec->fmt_in.i_codec != VLC_CODEC_TARKIN )
    {
        return VLC_EGENERIC;
    }

    /* Allocate the memory needed to store the decoder's structure */
    if( ( p_dec->p_sys = p_sys =
          (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
        return VLC_ENOMEM;

    /* Set output properties */
    p_dec->fmt_out.i_cat = VIDEO_ES;
    p_sys->i_headers = 0;

    /* Set callbacks */
    p_dec->pf_decode_video = (picture_t *(*)(decoder_t *, block_t **))
        DecodeBlock;
    p_dec->pf_packetize    = (block_t *(*)(decoder_t *, block_t **))
        DecodeBlock;

    /* Init supporting Tarkin structures needed in header parsing */
    p_sys->tarkin_stream = tarkin_stream_new();
    tarkin_info_init( &p_sys->ti );
    tarkin_comment_init( &p_sys->tc );

    return VLC_SUCCESS;
}
Ejemplo n.º 2
0
static void
gst_tarkindec_setup (TarkinDec * tarkindec)
{
  tarkindec->tarkin_stream = tarkin_stream_new ();

  ogg_sync_init (&tarkindec->oy);
  ogg_stream_init (&tarkindec->os, 1);
  tarkin_info_init (&tarkindec->ti);
  tarkin_comment_init (&tarkindec->tc);

  tarkindec->setup = TRUE;
}
Ejemplo n.º 3
0
static void
gst_tarkinenc_setup (TarkinEnc * tarkinenc)
{
  gint i;
  GstBuffer *outbuf;

  ogg_stream_init (&tarkinenc->os, 1);
  tarkin_info_init (&tarkinenc->ti);

  tarkinenc->ti.inter.numerator = 1;
  tarkinenc->ti.inter.denominator = 1;

  tarkin_comment_init (&tarkinenc->tc);
  tarkin_comment_add_tag (&tarkinenc->tc, "TITLE", "GStreamer produced file");
  tarkin_comment_add_tag (&tarkinenc->tc, "ARTIST", "C coders ;)");

  tarkinenc->tarkin_stream = tarkin_stream_new ();
  tarkin_analysis_init (tarkinenc->tarkin_stream,
      &tarkinenc->ti, free_frame, packet_out, (void *) tarkinenc);
  tarkin_analysis_add_layer (tarkinenc->tarkin_stream, &tarkinenc->layer[0]);

  tarkin_analysis_headerout (tarkinenc->tarkin_stream, &tarkinenc->tc,
      tarkinenc->op, &tarkinenc->op[1], &tarkinenc->op[2]);
  for (i = 0; i < 3; i++) {
    ogg_stream_packetin (&tarkinenc->os, &tarkinenc->op[i]);
  }

  ogg_stream_flush (&tarkinenc->os, &tarkinenc->og);

  tarkinenc->frame_num = 0;

  outbuf = gst_buffer_new ();
  GST_BUFFER_DATA (outbuf) = tarkinenc->og.header;
  GST_BUFFER_SIZE (outbuf) = tarkinenc->og.header_len;
  GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_DONTFREE);
  gst_pad_push (tarkinenc->srcpad, GST_DATA (outbuf));

  outbuf = gst_buffer_new ();
  GST_BUFFER_DATA (outbuf) = tarkinenc->og.body;
  GST_BUFFER_SIZE (outbuf) = tarkinenc->og.body_len;
  GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_DONTFREE);
  gst_pad_push (tarkinenc->srcpad, GST_DATA (outbuf));

  tarkinenc->setup = TRUE;
}