예제 #1
0
// Return TRUE if all was read.  FALSE if a problem occured:
// If a bitstream syntax problem occured the bitstream will
// point to after the problem, in case we run out of data the bitstream
// will point to where we want to restart after getting more.
static int read_eau_info(struct bitstream *esstream, int udtype)
{
    dbg_print(DMT_VERBOSE, "Read Extension and User Info\n");

    // We only get here after seeing that start code
    unsigned char *tst = next_bytes(esstream, 4);
    if (!tst || tst[0]!=0x00 || tst[1]!=0x00 || tst[2]!=0x01
        || (tst[3]!=0xB2 && tst[3]!=0xB5) ) // (0x000001 B2||B5)
        fatal(EXIT_BUG_BUG, "Impossible!");

    // The following extension_and_user_data() function makes sure that
    // user data is not evaluated twice. Should the function run out of
    // data it will make sure that esstream points to where we want to
    // continue after getting more.
    if( !extension_and_user_data(esstream, udtype) )
    {
        if (esstream->error)
            dbg_print(DMT_VERBOSE, "\nWarning: Retry while reading Extension and User Data!\n");
        else
            dbg_print(DMT_VERBOSE, "\nBitstream problem while reading Extension and User Data!\n");

        return 0;
    }

    dbg_print(DMT_VERBOSE, "Read Extension and User Info - processed\n\n");

    return 1;
}
예제 #2
0
// Return TRUE if all was read.  FALSE if a problem occured:
// If a bitstream syntax problem occured the bitstream will
// point to after the problem, in case we run out of data the bitstream
// will point to where we want to restart after getting more.
static int read_eau_info(struct lib_cc_decode* ctx, struct bitstream *esstream, int udtype, struct cc_subtitle *sub)
{
	debug("Read Extension and User Info\n");

	// We only get here after seeing that start code
	unsigned char *tst = next_bytes(esstream, 4);
	if (!tst || tst[0]!=0x00 || tst[1]!=0x00 || tst[2]!=0x01
			|| (tst[3]!=0xB2 && tst[3]!=0xB5) ) // (0x000001 B2||B5)
				fatal(CCX_COMMON_EXIT_BUG_BUG, "read_eau_info: Impossible values for tst. Please file a bug report in GitHub.\n");

	// The following extension_and_user_data() function makes sure that
	// user data is not evaluated twice. Should the function run out of
	// data it will make sure that esstream points to where we want to
	// continue after getting more.
	if( !extension_and_user_data(ctx, esstream, udtype, sub) )
	{
		if (esstream->error)
			debug("\nWarning: Retry while reading Extension and User Data!\n");
		else
			debug("\nBitstream problem while reading Extension and User Data!\n");

		return 0;
	}

	debug("Read Extension and User Info - processed\n\n");

	return 1;
}
예제 #3
0
int main(int argc, char* argv[])
{
  char tmpStr[256];

  col = 0;
  verbose_level = 1;
  sequence_headers = 0;
  sequence_extensions = 0;
  user_data_bytes = 0;
  sequence_scalable_extension_present = 0;
  printf("bbVINFO - version 1.7, by Brent Beyeler ([email protected])\n");
  printf("   speed increases by, Apachez and Christian Vogelgsang\n\n");
  if (argc < 2)
  {
    printf("\nbbVINFO is an MPEG video stream analyzer\n\n");
    printf("Usage: bbVINFO  MPEG video filename  <verbose level 1..3, default = 1>\n\n");
    printf("Examples:\n");
    printf("  To list all packet start codes (excluding slice codes) to file test.txt\n");
    printf("     bbVINFO test.mpg 1 > test.txt\n\n");
    printf("  To list all packets (excluding slice packets) in detail\n");
    printf("     bbVINFO test.vob 2\n\n");
    printf("  To list all packets (including slice packets) in detail to file test.txt\n");
    printf("     bbVINFO test.mpg 3 > test.txt\n\n");
	 exit (1);
  }

  init_getbits(argv[1]);
  strcpy(tmpStr, argv[1]);
//  strlwr(tmpStr);
  if (argc > 2)
  {
    sscanf(argv[2], "%d", &verbose_level);

    if (verbose_level < 1)
      verbose_level = 1;
    if (verbose_level > 3)
      verbose_level = 3;
  }

  next_start_code();
  if (getbits(8) != SEQUENCE_HEADER_CODE)
  {
    printf("\nFile is not an MPEG Video Stream\n");
    exit(1);
  }

  next_start_code();

  if (getbits(8) != EXTENSION_START_CODE)
    mpeg2 = 0;
  else
    mpeg2 = 1;

  printf("\nFile %s is an MPEG-%d video stream\n", argv[1], mpeg2 + 1);

  finish_getbits();
  init_getbits(argv[1]);

  next_start_code();
  sequence_header();

  if (mpeg2)
    sequence_extension();

  do
  {
    extension_and_user_data(0);
    do
    {
      if (nextbits(8) == GROUP_START_CODE)
      {
        group_of_pictures_header();
        extension_and_user_data(1);
      }
      picture_header();
      if (mpeg2)
        picture_coding_extension();
      extension_and_user_data(2);
      picture_data();
    } while ((nextbits(8) == PICTURE_START_CODE) ||
             (nextbits(8) == GROUP_START_CODE));
    if (nextbits(8) != SEQUENCE_END_CODE)
    {
      sequence_header();
      if (mpeg2)
        sequence_extension();
    }
  } while (nextbits(8) != SEQUENCE_END_CODE);
  zprintf(1, "\nsequence_end_code = 0x000001%02X\n", getbits(8));

  finish_getbits();
  return (0);
}