MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / prune_streams

Function prune_streams

libhb/stream.c:760–823  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

758}
759
760static void prune_streams(hb_stream_t *d)
761{
762 if ( d->hb_stream_type == transport )
763 {
764 int ii, jj;
765 for ( ii = 0; ii < d->ts.count; ii++)
766 {
767 // If probing didn't find audio or video, and the pid
768 // is not the PCR, remove the track
769 if ( ts_stream_kind ( d, ii ) == U &&
770 !d->ts.list[ii].is_pcr )
771 {
772 hb_stream_delete_ts_entry(d, ii);
773 continue;
774 }
775
776 if ( ts_stream_kind ( d, ii ) == A )
777 {
778 for ( jj = d->ts.list[ii].pes_list; jj != -1;
779 jj = d->pes.list[jj].next )
780 {
781 if ( audio_inactive( d, d->pes.list[jj].stream_id,
782 d->pes.list[jj].stream_id_ext ) )
783 {
784 hb_stream_delete_ps_entry(d, jj);
785 }
786 }
787 if ( !d->ts.list[ii].is_pcr &&
788 hb_stream_try_delete_ts_entry(d, ii) )
789 {
790 continue;
791 }
792 }
793 }
794 // reset to beginning of file and reset some stream
795 // state information
796 hb_stream_seek( d, 0. );
797 }
798 else if ( d->hb_stream_type == program )
799 {
800 int ii;
801 for ( ii = 0; ii < d->pes.count; ii++)
802 {
803 // If probing didn't find audio or video, remove the track
804 if ( d->pes.list[ii].stream_kind == U )
805 {
806 hb_stream_delete_ps_entry(d, ii);
807 }
808
809 if ( d->pes.list[ii].stream_kind == A &&
810 audio_inactive( d, d->pes.list[ii].stream_id,
811 d->pes.list[ii].stream_id_ext ) )
812 {
813 // this PID isn't wanted (we don't have a codec for it
814 // or scan didn't find audio parameters)
815 hb_stream_delete_ps_entry(d, ii);
816 continue;
817 }

Callers 1

hb_stream_openFunction · 0.85

Calls 6

ts_stream_kindFunction · 0.85
audio_inactiveFunction · 0.85
hb_stream_seekFunction · 0.85

Tested by

no test coverage detected