view recpt1/decoder.c @ 3:6801fe7e04ff

updated to ariv25v023
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 17 Feb 2009 01:40:56 +0900
parents 8ac7c59fefc9
children 43d177fa65c9
line wrap: on
line source

#include <stdlib.h>

#include "decoder.h"

decoder *
b25_startup(void)
{
  decoder *dec = calloc(1, sizeof(decoder));
  int code;

  dec->b25 = create_arib_std_b25();
  dec->b25->set_multi2_round(dec->b25, 4); //xxx round should be configurable
  dec->b25->set_strip(dec->b25, 0); //ditto
  dec->b25->set_emm_proc(dec->b25, 0); //ditto
  dec->bcas = create_b_cas_card();
  code = dec->bcas->init(dec->bcas);
  code = dec->b25->set_b_cas_card(dec->b25, dec->bcas);

  return dec;
}

int
b25_shutdown(decoder *dec)
{
  dec->b25->release(dec->b25);
  dec->bcas->release(dec->bcas);
  free(dec);

  return 0;
}

int
b25_decode(decoder *dec, ARIB_STD_B25_BUFFER *sbuf, ARIB_STD_B25_BUFFER *dbuf)
{
  int code;

  code = dec->b25->put(dec->b25, sbuf);
  if(code < 0)
    return code;

  code = dec->b25->get(dec->b25, dbuf);
  return code;
}

int
b25_finish(decoder *dec, ARIB_STD_B25_BUFFER *sbuf, ARIB_STD_B25_BUFFER *dbuf)
{
  int code;

  code = dec->b25->flush(dec->b25);
  if(code < 0)
    return code;

  code = dec->b25->get(dec->b25, dbuf);
  return code;
}