Exemplo n.º 1
0
ffemu_t *ffemu_new(const struct ffemu_params *params)
{
   av_register_all();

   ffemu_t *handle = (ffemu_t*)calloc(1, sizeof(*handle));
   if (!handle)
      goto error;

   handle->params = *params;

   if (!ffemu_init_video(&handle->video, &handle->params))
      goto error;

   if (!ffemu_init_audio(&handle->audio, &handle->params))
      goto error;

   if (!ffemu_init_muxer(handle))
      goto error;

   if (!init_thread(handle))
      goto error;

   return handle;

error:
   ffemu_free(handle);
   return NULL;
}
Exemplo n.º 2
0
ffemu_t *ffemu_new(const struct ffemu_params *params)
{
   av_register_all();
   avformat_network_init();

   ffemu_t *handle = (ffemu_t*)calloc(1, sizeof(*handle));
   if (!handle)
      goto error;

   handle->params = *params;

   if (!ffemu_init_config(&handle->config, params->config))
      goto error;

   if (!ffemu_init_muxer_pre(handle))
      goto error;

   if (!ffemu_init_video(handle))
      goto error;

   if (handle->config.audio_enable && !ffemu_init_audio(handle))
      goto error;

   if (!ffemu_init_muxer_post(handle))
      goto error;

   if (!init_thread(handle))
      goto error;

   return handle;

error:
   ffemu_free(handle);
   return NULL;
}