| 948 | } |
| 949 | |
| 950 | hb_stream_t * hb_bd_stream_open( hb_handle_t *h, hb_title_t *title ) |
| 951 | { |
| 952 | int ii; |
| 953 | |
| 954 | hb_stream_t *d = calloc( sizeof( hb_stream_t ), 1 ); |
| 955 | if ( d == NULL ) |
| 956 | { |
| 957 | hb_error( "hb_bd_stream_open: can't allocate space for stream state" ); |
| 958 | return NULL; |
| 959 | } |
| 960 | |
| 961 | d->h = h; |
| 962 | d->file_handle = NULL; |
| 963 | d->title = title; |
| 964 | d->path = NULL; |
| 965 | d->ts.packet = NULL; |
| 966 | |
| 967 | int pid = title->video_id; |
| 968 | int stream_type = title->video_stream_type; |
| 969 | update_ts_streams( d, pid, 0, stream_type, V, NULL ); |
| 970 | |
| 971 | hb_audio_t * audio; |
| 972 | for ( ii = 0; ( audio = hb_list_item( title->list_audio, ii ) ); ++ii ) |
| 973 | { |
| 974 | int stream_id_ext = audio->config.in.substream_type; |
| 975 | pid = audio->id & 0xFFFF; |
| 976 | stream_type = audio->config.in.stream_type; |
| 977 | |
| 978 | update_ts_streams( d, pid, stream_id_ext, stream_type, A, NULL ); |
| 979 | } |
| 980 | |
| 981 | hb_subtitle_t * subtitle; |
| 982 | for ( ii = 0; ( subtitle = hb_list_item( title->list_subtitle, ii ) ); ++ii ) |
| 983 | { |
| 984 | // If the subtitle track is CC embedded in the video stream, then |
| 985 | // it does not have an independent pid. In this case, we assigned |
| 986 | // the subtitle->id to HB_SUBTITLE_EMBEDDED_CC_TAG. |
| 987 | if (subtitle->id != HB_SUBTITLE_EMBEDDED_CC_TAG) |
| 988 | { |
| 989 | pid = subtitle->id & 0xFFFF; |
| 990 | stream_type = subtitle->stream_type; |
| 991 | |
| 992 | update_ts_streams( d, pid, 0, stream_type, S, NULL ); |
| 993 | } |
| 994 | } |
| 995 | |
| 996 | // We don't need to wait for a PCR when scanning. In fact, it |
| 997 | // trips us up on the first preview of every title since we would |
| 998 | // have to read quite a lot of data before finding the PCR. |
| 999 | if ( title->flags & HBTF_SCAN_COMPLETE ) |
| 1000 | { |
| 1001 | /* BD has PCRs, but the BD index always points to a packet |
| 1002 | * after a PCR packet, so we will not see the initial PCR |
| 1003 | * after any seek. So don't set the flag that causes us |
| 1004 | * to drop packets till we see a PCR. */ |
| 1005 | //d->ts_flags = TS_HAS_RAP | TS_HAS_PCR; |
| 1006 | |
| 1007 | // BD PCR PID is specified to always be 0x1001 |
no test coverage detected