diff options
author | jstebbins <[email protected]> | 2015-08-24 15:40:24 +0000 |
---|---|---|
committer | John Stebbins <[email protected]> | 2015-08-29 10:26:16 -0700 |
commit | 6b026943abebd52b0eaf575259665f2788d54f10 (patch) | |
tree | 6c80b7f049e80628a0cc862f93874beeb3a63f4a | |
parent | 20716410f9da4a6e12bf30d1b04818a5ff19c23a (diff) |
cropscale: prevent crash when scale dimensions too small
This will result in no video in the output file, but in such cases, this
might actually be desirable. Scaling to such small dimensions is often
used simply to re-encode audio.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7412 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | libhb/cropscale.c | 6 | ||||
-rw-r--r-- | libhb/hb.c | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/libhb/cropscale.c b/libhb/cropscale.c index 23964a71b..fee95cb13 100644 --- a/libhb/cropscale.c +++ b/libhb/cropscale.c @@ -202,6 +202,12 @@ static hb_buffer_t* crop_scale( hb_filter_private_t * pv, hb_buffer_t * in ) pv->pix_fmt = in->f.fmt; } + if (pv->context == NULL) + { + hb_buffer_close(&out); + return NULL; + } + // Scale pic_crop into pic_render according to the // context set up above sws_scale(pv->context, diff --git a/libhb/hb.c b/libhb/hb.c index b2a1f38d2..ab71570f6 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -222,7 +222,7 @@ hb_sws_get_context(int srcW, int srcH, enum AVPixelFormat srcFormat, 1 << 16 ); // saturation if (sws_init_context(ctx, NULL, NULL) < 0) { - fprintf(stderr, "Cannot initialize resampling context\n"); + hb_error("Cannot initialize resampling context"); sws_freeContext(ctx); ctx = NULL; } |