コード例 #1
0
static int
read_page_first_pass (OGGZ * ap_oggz, const ogg_page * ap_og, long a_serialno,
                      void * ap_user_data)
{
  int rc = OGGZ_CONTINUE;
  oggdmux_prc_t * p_prc = ap_user_data;
  assert (p_prc);
  assert (ap_oggz);

  if (oggz_get_bos (ap_oggz, a_serialno) > 0)
    {
      TIZ_TRACE (handleOf (p_prc), "serialno = [%d]", a_serialno);
      if (!oggz_table_insert (
            p_prc->p_tracks_, a_serialno,
            &read_page_first_pass)) /* NULL makes it barf, needs
                                                                                                 * something */
        {
          TIZ_ERROR (handleOf (p_prc),
                     "serialno = [%d] - "
                     "Could not insert serialno in oggz table",
                     a_serialno);
          rc = OGGZ_STOP_ERR;
        }
    }

  if (oggz_get_bos (ap_oggz, ALL_OGG_STREAMS) == 0)
    {
      TIZ_TRACE (handleOf (p_prc), "Number of tracks [%d]",
                 oggz_get_numtracks (ap_oggz));
      return OGGZ_STOP_OK;
    }

  return rc;
}
コード例 #2
0
static int
read_page (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
{
  OggzTable * tracks = (OggzTable *)user_data;

  if (ogg_page_bos ((ogg_page *)og)) {
    oggz_table_insert (tracks, serialno, NULL);
  }

  if (fwrite (og->header, 1, og->header_len, stdout) == (size_t)og->header_len)
    if (fwrite (og->body, 1, og->body_len, stdout) != (size_t)og->body_len)
      return OGGZ_STOP_ERR;

  return 0;
}