| 3747 | } |
| 3748 | |
| 3749 | static int update_ts_streams( hb_stream_t * stream, int pid, int stream_id_ext, int stream_type, int in_kind, int *out_pes_idx ) |
| 3750 | { |
| 3751 | int ii; |
| 3752 | int pes_idx = update_ps_streams( stream, pid, stream_id_ext, |
| 3753 | stream_type, in_kind ); |
| 3754 | |
| 3755 | if ( out_pes_idx ) |
| 3756 | *out_pes_idx = pes_idx; |
| 3757 | |
| 3758 | if ( pes_idx < 0 ) |
| 3759 | return -1; |
| 3760 | |
| 3761 | kind_t kind = stream->pes.list[pes_idx].stream_kind; |
| 3762 | for ( ii = 0; ii < stream->ts.count; ii++ ) |
| 3763 | { |
| 3764 | if ( pid == stream->ts.list[ii].pid ) |
| 3765 | { |
| 3766 | break; |
| 3767 | } |
| 3768 | // Resolve multiple videos |
| 3769 | if ( kind == V && ts_stream_kind( stream, ii ) == V && |
| 3770 | pes_idx < stream->ts.list[ii].pes_list ) |
| 3771 | { |
| 3772 | // We have a new candidate for the primary video. Move |
| 3773 | // the current video to the end of the list. And put the |
| 3774 | // new video in this slot |
| 3775 | int jj = new_pid( stream ); |
| 3776 | memcpy( &stream->ts.list[jj], &stream->ts.list[ii], |
| 3777 | sizeof( hb_ts_stream_t ) ); |
| 3778 | break; |
| 3779 | } |
| 3780 | } |
| 3781 | if ( ii == stream->ts.count ) |
| 3782 | ii = new_pid( stream ); |
| 3783 | |
| 3784 | stream->ts.list[ii].pid = pid; |
| 3785 | ts_pes_list_add( stream, ii, pes_idx ); |
| 3786 | if ( in_kind == P ) |
| 3787 | stream->ts.list[ii].is_pcr = 1; |
| 3788 | |
| 3789 | return ii; |
| 3790 | } |
| 3791 | |
| 3792 | static int decode_ps_map( hb_stream_t * stream, uint8_t *buf, int len ) |
| 3793 | { |
no test coverage detected