static void ext_user_data() { int code,ext_ID; startcode(); while ((code = showbits(32))==EXT_START_CODE || code==USER_START_CODE) { if (code==EXT_START_CODE) { flushbits32(); ext_ID = getbits(4); switch (ext_ID) { case SEQ_ID: sequence_extension(); break; case DISP_ID: sequence_display_extension(); break; case QUANT_ID: quant_matrix_extension(); break; case SEQSCAL_ID: sequence_scalable_extension(); break; case PANSCAN_ID: picture_display_extension(); break; case CODING_ID: picture_coding_extension(); break; case SPATSCAL_ID: picture_spatial_scalable_extension(); break; case TEMPSCAL_ID: picture_temporal_scalable_extension(); break; default: fprintf(stderr,"reserved extension start code ID %d\n",ext_ID); break; } startcode(); } else { if (verbose) printf("user data\n"); flushbits32(); startcode(); } } }
int getheader () { unsigned int code, gob; /* look for startcode */ startcode (); code = getbits (PSC_LENGTH); gob = getbits (5); if (gob == SE_CODE) return 0; if (gob == 0) { if (trace) { fprintf (trace_file, "\nPSC: "); printbits ((code << (5 + gob)), 22, 22); } getpicturehdr (); if (syntax_arith_coding) /* reset decoder after receiving */ decoder_reset (); /* fixed length PSC string */ } else { if (trace) { fprintf (trace_file, "\nGBSC: "); printbits ((code << (5 + gob)), 22, 22); } } return gob + 1; }
static int gethdr() { unsigned int code; for (;;) { /* look for startcode */ startcode(); code = getbits32(); switch (code) { case SEQ_START_CODE: getseqhdr(); break; case GOP_START_CODE: getgophdr(); break; case PICTURE_START_CODE: getpicturehdr(); return 1; break; case SEQ_END_CODE: return 0; break; default: if (!quiet) fprintf(stderr,"Unexpected startcode %08x (ignored)\n",code); break; } } }