Пример #1
0
int play (char * file, char ** opts) {
 OGGZ * oggz;
 struct roarfish_play_inst inst;

 inst.roarfh = -1;
 inst.begun  = 0;

 inst.fsound = fish_sound_new(FISH_SOUND_DECODE, &inst.fsinfo);
 fish_sound_set_interleave(inst.fsound, 1);

 fish_sound_set_decoded_float_ilv(inst.fsound, decoded_float, (void*)&inst);

 if ((oggz = oggz_open(file, OGGZ_READ)) == NULL) {
  ROAR_ERR("Can not open input file: %s", file);
  return -1;
 }

 oggz_set_read_callback(oggz, -1, read_packet, inst.fsound);

 // TODO: add some status display here?
 while (oggz_read(oggz, 1024));

 oggz_close(oggz);

 fish_sound_delete(inst.fsound);

 return -1;
}
Пример #2
0
/* DEPRECATED */
int fish_sound_set_decoded_callback (FishSound * fsound,
				     FishSoundDecoded_Float decoded,
				     void * user_data)
{
  if (fsound == NULL) return -1;

  return fsound->interleave ?
    fish_sound_set_decoded_float_ilv (fsound, decoded, user_data) :
    fish_sound_set_decoded_float (fsound, decoded, user_data);
}
Пример #3
0
static FS_DecEnc *
fs_encdec_new (char * infilename, char * outfilename, int format,
	       int interleave, int blocksize)
{
  FS_DecEnc * ed;

  if (infilename == NULL || outfilename == NULL) return NULL;

  ed = malloc (sizeof (FS_DecEnc));

  ed->infilename = strdup (infilename);
  ed->outfilename = strdup (outfilename);

  ed->oggz_in = oggz_open (infilename, OGGZ_READ);
  ed->oggz_out = oggz_open (outfilename, OGGZ_WRITE);

  oggz_set_read_callback (ed->oggz_in, -1, read_packet, ed);
  ed->serialno = oggz_serialno_new (ed->oggz_out);

  ed->decoder = fish_sound_new (FISH_SOUND_DECODE, NULL);

  fish_sound_set_interleave (ed->decoder, interleave);

  fish_sound_set_decoded_float_ilv (ed->decoder, decoded, ed);

  ed->format = format;
  ed->interleave = interleave;
  ed->blocksize = blocksize;
  ed->begun = 0;
  ed->b_o_s = 1;

  /* Delay the setting of channels and allocation of PCM buffers until
   * the number of channels is known from decoding the headers */
  ed->channels = 0;
  ed->pcm = NULL;

  ed->frames_in = 0;
  ed->frames_out = 0;

  return ed;
}
Пример #4
0
static OMX_ERRORTYPE init_vorbis_decoder (vorbisd_prc_t *ap_prc)
{
  OMX_ERRORTYPE rc = OMX_ErrorInsufficientResources;

  assert (NULL != ap_prc);

  tiz_check_null_ret_oom (
      ap_prc->p_fsnd_ = fish_sound_new (FISH_SOUND_DECODE, &(ap_prc->fsinfo_)));

  if (0 != fish_sound_set_interleave (ap_prc->p_fsnd_, 1))
    {
      TIZ_ERROR (handleOf (ap_prc),
                 "[OMX_ErrorInsufficientResources] : "
                 "Could not set interleaved.");
      goto end;
    }

  if (0 != fish_sound_set_decoded_float_ilv (
               ap_prc->p_fsnd_, fishsound_decoded_callback, ap_prc))
    {
      TIZ_ERROR (handleOf (ap_prc),
                 "[OMX_ErrorInsufficientResources] : "
                 "Could not set 'decoded' callback.");
      goto end;
    }

  rc = OMX_ErrorNone;

end:
  if (OMX_ErrorInsufficientResources == rc)
    {
      fish_sound_delete (ap_prc->p_fsnd_);
      ap_prc->p_fsnd_ = NULL;
    }

  return rc;
}