diff options
author | jstebbins <[email protected]> | 2012-07-10 12:37:37 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2012-07-10 12:37:37 +0000 |
commit | 6a5520c420ff6bcf0a6ebc049ac71050042a8957 (patch) | |
tree | 75671d735f868f3ab3bec86acf475aef857f0a3a /libhb | |
parent | aea2c5f0a32428671182a5e9d680ab4c016fce2c (diff) |
libhb: fix problem reading preview
The title "index" is not an index into list_title. It is a unique number
assigned to each title in the list. So we must scan the list for a matching
"index".
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4822 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/hb.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libhb/hb.c b/libhb/hb.c index 9e331f0b3..74ca82291 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -715,9 +715,18 @@ hb_buffer_t * hb_read_preview( hb_handle_t * h, int title_idx, int preview ) { FILE * file; char filename[1024]; + hb_title_t * title = NULL; - hb_title_t * title = hb_list_item( h->list_title, title_idx - 1); - if ( title == NULL ) + int ii; + for (ii = 0; ii < hb_list_count(h->list_title); ii++) + { + title = hb_list_item( h->list_title, ii); + if (title != NULL && title->index == title_idx) + { + break; + } + } + if (title == NULL) { hb_error( "hb_read_preview: invalid title (%d)", title_idx ); return NULL; |