Пример #1
0
LIBDE265_API de265_decoder_context* de265_new_decoder()
{
  decoder_context* ctx = (decoder_context*)calloc(sizeof(decoder_context),1);
  if (!ctx) { return NULL; }

  init_decoder_context(ctx);
  return (de265_decoder_context*)ctx;
}
Пример #2
0
struct x264lib_ctx *init_decoder(int width, int height, int csc_fmt)
{
	struct x264lib_ctx *ctx = malloc(sizeof(struct x264lib_ctx));
	memset(ctx, 0, sizeof(struct x264lib_ctx));
	if (init_decoder_context(ctx, width, height, csc_fmt)) {
		free(ctx);
		return NULL;
	}
	return ctx;
}
Пример #3
0
void set_decoder_csc_format(struct x264lib_ctx *ctx, int csc_fmt)
{
	if (csc_fmt<0)
		csc_fmt = PIX_FMT_YUV420P;
	if (ctx->csc_format!=csc_fmt) {
		//we need to re-initialize with the new format:
		do_clean_decoder(ctx);
		if (init_decoder_context(ctx, ctx->width, ctx->height, csc_fmt)) {
			fprintf(stderr, "Failed to reconfigure decoder\n");
		}
	}
}
Пример #4
0
/**
 * creates a new decoder context
 */
LIBDE265_API de265_decoder_context* de265_new_decoder()
{
  de265_error init_err = de265_init();
  if (init_err != DE265_OK) {
    return NULL;
  }

  decoder_context* ctx = (decoder_context*)calloc(sizeof(decoder_context),1);
  if (!ctx) {
    de265_free();
    return NULL;
  }

  init_decoder_context(ctx);

  return (de265_decoder_context*)ctx;
}
Пример #5
0
LIBDE265_API void de265_reset(de265_decoder_context* de265ctx)
{
  decoder_context* ctx = (decoder_context*)de265ctx;

  int num_worker_threads = ctx->num_worker_threads;
  if (num_worker_threads>0) {
    //flush_thread_pool(&ctx->thread_pool);
    stop_thread_pool(&ctx->thread_pool);
  }
  
  // TODO: maybe we can do things better here

  free_decoder_context(ctx);
  init_decoder_context(ctx);
  if (num_worker_threads>0) {
    // TODO: need error checking
    de265_start_worker_threads(de265ctx, num_worker_threads);
  }
}