* hb_bd_main_feature **********************************************************************/
| 745 | * hb_bd_main_feature |
| 746 | **********************************************************************/ |
| 747 | int hb_bd_main_feature( hb_bd_t * d, hb_list_t * list_title ) |
| 748 | { |
| 749 | int longest = 0; |
| 750 | int ii; |
| 751 | uint64_t longest_duration = 0; |
| 752 | int highest_rank = 0, rank; |
| 753 | int most_chapters = 0; |
| 754 | int ranks[9] = {0, 1, 3, 2, 6, 5, 7, 4, 8}; |
| 755 | BLURAY_TITLE_INFO * ti; |
| 756 | |
| 757 | for ( ii = 0; ii < hb_list_count( list_title ); ii++ ) |
| 758 | { |
| 759 | hb_title_t * title = hb_list_item( list_title, ii ); |
| 760 | ti = d->title_info[title->index - 1]; |
| 761 | if ( ti ) |
| 762 | { |
| 763 | BLURAY_STREAM_INFO * bdvideo = &ti->clips[0].video_streams[0]; |
| 764 | if ( title->duration > longest_duration * 0.7 && bdvideo->format < 8 ) |
| 765 | { |
| 766 | rank = 0; |
| 767 | if (bdvideo->format <= 8) |
| 768 | { |
| 769 | rank = ranks[bdvideo->format]; |
| 770 | } |
| 771 | if (highest_rank < rank || |
| 772 | ( title->duration > longest_duration && |
| 773 | highest_rank == rank)) |
| 774 | { |
| 775 | longest = title->index; |
| 776 | longest_duration = title->duration; |
| 777 | highest_rank = rank; |
| 778 | most_chapters = ti->chapter_count; |
| 779 | } |
| 780 | else if (highest_rank == rank && |
| 781 | title->duration == longest_duration && |
| 782 | ti->chapter_count > most_chapters) |
| 783 | { |
| 784 | longest = title->index; |
| 785 | most_chapters = ti->chapter_count; |
| 786 | } |
| 787 | } |
| 788 | } |
| 789 | else if ( title->duration > longest_duration ) |
| 790 | { |
| 791 | longest_duration = title->duration; |
| 792 | longest = title->index; |
| 793 | } |
| 794 | } |
| 795 | return longest; |
| 796 | } |
| 797 | |
| 798 | /*********************************************************************** |
| 799 | * hb_bd_start |
no test coverage detected