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

Function hb_bd_read

libhb/bd.c:868–971  ·  view source on GitHub ↗

* hb_bd_read *********************************************************************** * **********************************************************************/

Source from the content-addressed store, hash-verified

866 *
867 **********************************************************************/
868hb_buffer_t * hb_bd_read( hb_bd_t * d )
869{
870 int result;
871 int error_count = 0;
872 int retry_count = 0;
873 uint8_t buf[192];
874 BD_EVENT event;
875 uint64_t pos;
876 hb_buffer_t * out = NULL;
877 uint8_t discontinuity;
878
879 while ( 1 )
880 {
881 discontinuity = 0;
882 result = next_packet( d->bd, buf );
883 while ( bd_get_event( d->bd, &event ) )
884 {
885 switch ( event.event )
886 {
887 case BD_EVENT_CHAPTER:
888 // The muxers expect to only get chapter 2 and above
889 // They write chapter 1 when chapter 2 is detected.
890 if (event.param > d->chapter)
891 {
892 d->next_chap = event.param;
893 }
894 break;
895
896 case BD_EVENT_PLAYITEM:
897 discontinuity = 1;
898 hb_deep_log(2, "bd: Play item %u", event.param);
899 break;
900
901 case BD_EVENT_STILL:
902 bd_read_skip_still( d->bd );
903 break;
904
905 case BD_EVENT_END_OF_TITLE:
906 hb_log("bd: End of title");
907 if (result <= 0)
908 {
909 return NULL;
910 }
911 break;
912
913 default:
914 break;
915 }
916 }
917
918 if ( result < 0 )
919 {
920 hb_error("bd: Read Error");
921 pos = bd_tell( d->bd );
922 bd_seek( d->bd, pos + 192 );
923 error_count++;
924 if (error_count > 10)
925 {

Callers 2

reader_workFunction · 0.85
read_bufFunction · 0.85

Calls 6

hb_deep_logFunction · 0.85
hb_logFunction · 0.85
hb_errorFunction · 0.85
hb_set_work_errorFunction · 0.85
hb_ts_decode_pktFunction · 0.85
next_packetFunction · 0.70

Tested by

no test coverage detected