Use ffmpeg's memory allocator for transcode buffer

ffmpeg's allocator ensures the allocated memory is properly aligned for
any kind of optimized operation used in ffmpeg.
This commit is contained in:
Julien BLACHE 2009-07-24 08:19:31 +02:00
parent 2323fd302c
commit 11909725e2
1 changed files with 2 additions and 2 deletions

View File

@ -368,7 +368,7 @@ transcode_setup(struct media_file_info *mfi, size_t *est_size)
if (ctx->fd != -1) if (ctx->fd != -1)
DPRINTF(E_DBG, L_XCODE, "Set up raw mode for transcoding input\n"); DPRINTF(E_DBG, L_XCODE, "Set up raw mode for transcoding input\n");
ctx->abuffer = (uint8_t *)malloc(XCODE_BUFFER_SIZE); ctx->abuffer = (uint8_t *)av_malloc(XCODE_BUFFER_SIZE);
if (!ctx->abuffer) if (!ctx->abuffer)
{ {
DPRINTF(E_WARN, L_XCODE, "Could not allocate transcode buffer\n"); DPRINTF(E_WARN, L_XCODE, "Could not allocate transcode buffer\n");
@ -408,7 +408,7 @@ transcode_cleanup(struct transcode_ctx *ctx)
avcodec_close(ctx->acodec); avcodec_close(ctx->acodec);
av_close_input_file(ctx->fmtctx); av_close_input_file(ctx->fmtctx);
free(ctx->abuffer); av_free(ctx->abuffer);
free(ctx); free(ctx);
} }