Lines 809-862
static void process_packets
Link Here
|
809 |
{ |
809 |
{ |
810 |
writetostream(packetid, buf + contentoffs, readlen - contentoffs); |
810 |
writetostream(packetid, buf + contentoffs, readlen - contentoffs); |
811 |
} /*if*/ |
811 |
} /*if*/ |
812 |
#if defined(HAVE_NESTED_ROUTINES) |
|
|
813 |
if (outputenglish && packetid >= MPID_VIDEO_FIRST && packetid <= MPID_VIDEO_LAST) |
814 |
{ |
815 |
/* look inside PES packet to report on details of video packets */ |
816 |
unsigned int remaining = readlen; |
817 |
jmp_buf resume; |
818 |
/* GCC extension! nested routine */ |
819 |
void bufread(void *ptr, int len, bool required) |
820 |
{ |
821 |
const unsigned int tocopy = remaining > len ? len : remaining; |
822 |
if (tocopy != 0) |
823 |
{ |
824 |
memcpy(ptr, buf + contentoffs, tocopy); |
825 |
ptr = (unsigned char *)ptr + tocopy; |
826 |
len -= tocopy; |
827 |
contentoffs += tocopy; |
828 |
remaining -= tocopy; |
829 |
inputpos += tocopy; |
830 |
} /*if*/ |
831 |
if (len != 0) |
832 |
{ |
833 |
/* read more of packet */ |
834 |
const unsigned int toread = packetlen < len ? packetlen : len; |
835 |
readinput(ptr, toread, required); |
836 |
if (dowrite) |
837 |
{ |
838 |
writetostream(packetid, ptr, toread); |
839 |
} /*if*/ |
840 |
packetlen -= toread; |
841 |
len -= toread; |
842 |
if (len != 0) |
843 |
{ |
844 |
if (false /*required*/) |
845 |
{ |
846 |
fprintf(stderr, "Unexpected nested read EOF\n"); |
847 |
} /*if*/ |
848 |
longjmp(resume, 1); |
849 |
} /*if*/ |
850 |
} /*if*/ |
851 |
} /*bufread*/ |
852 |
inputpos -= remaining; /* rewind to start of packet content */ |
853 |
if (!setjmp(resume)) |
854 |
{ |
855 |
process_packets(bufread, true); |
856 |
} /*if*/ |
857 |
} |
858 |
else |
859 |
#endif |
860 |
{ |
812 |
{ |
861 |
while (packetlen != 0) |
813 |
while (packetlen != 0) |
862 |
{ |
814 |
{ |