diff options
author | jstebbins <[email protected]> | 2014-12-19 19:17:17 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2014-12-19 19:17:17 +0000 |
commit | 83aa999e8f5e76547159c9fc202e109c706a03ac (patch) | |
tree | e3d3c3d160564584aa0c42acedd41406943d1a03 | |
parent | 6a9ee4e27df18461fb9dc731e99702e9eff605e0 (diff) |
libhb: make hb_get_preview2 always return a valid image
When we fail to read the preview image, create a blank image
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6612 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | libhb/hb.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libhb/hb.c b/libhb/hb.c index 2ae9e7e4c..141d68f8d 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -725,9 +725,9 @@ hb_image_t* hb_get_preview2(hb_handle_t * h, int title_idx, int picture, swsflags = SWS_LANCZOS | SWS_ACCURATE_RND; preview_buf = hb_frame_buffer_init(AV_PIX_FMT_RGB32, width, height); + // fill in AVPicture hb_avpicture_fill( &pic_preview, preview_buf ); - // Allocate the AVPicture frames and fill in memset( filename, 0, 1024 ); @@ -736,13 +736,13 @@ hb_image_t* hb_get_preview2(hb_handle_t * h, int title_idx, int picture, if (title == NULL) { hb_error( "hb_get_preview2: invalid title (%d)", title_idx ); - return NULL; + goto fail; } in_buf = hb_read_preview( h, title, picture ); if ( in_buf == NULL ) { - return NULL; + goto fail; } hb_avpicture_fill( &pic_in, in_buf ); @@ -788,6 +788,11 @@ hb_image_t* hb_get_preview2(hb_handle_t * h, int title_idx, int picture, hb_buffer_close( &preview_buf ); return image; + +fail: + + image = hb_image_init(AV_PIX_FMT_RGB32, width, height); + return image; } /** |