예제 #1
0
파일: options.c 프로젝트: timmassingham/SLR
int GetString (int maxsize, char *string, FILE * fp)
{
  int i = 0;
  int c;

  do {
    c = fgetc(fp);
  } while (isspace(c) && c != '\n' && c != EOF);

  while (c == '#' && c!='\n' && c != EOF) {
    c = skip_to_end(fp);
    while (isspace (c = fgetc (fp)) && c != EOF);
  }
  if (c != '\n')
    ungetc (c, fp);

  while (i < (maxsize - 1) && c!='\n' && (c = fgetc (fp)) != EOF && !isspace (c)
	 && c != '#') {
    if (c == '#'){
      c = skip_to_end(fp);
    }
    if (!ispunct (c) || c == '_' || c == '-' || c == '.' || c == '+')
      string[i++] = c;
  };
  string[i] = '\0';

  if (c == '#'){
    c = skip_to_end(fp);
  }
 
  return c;
}
예제 #2
0
void TsPacket::parse_data_byte(Bitstream & bitstream, bool parse_data)
{
//	level3_timer->start();
	if(adaptation_field_control == 0x1 || adaptation_field_control == 0x3)
	{
		switch(pid)
		{
		case 1:
		case 2:
			//conditional access & transport stream description table
		case 0x1fff:
			//null packet
			skip_to_end(bitstream);
			break;


		default:
			if(payload_unit_start_indicator && parse_data)
			{
				pes_packet->input_bitstream(bitstream);
				skip_to_end(bitstream);
				log4c_category_log(mycat, LOG4C_PRIORITY_INFO, "PTS %llu DTS %llu", pes_packet->get_PTS(), pes_packet->get_DTS());
				//std::cout << "PTS " << pes_packet->get_PTS() << std::endl;
				//std::cout << "DTS " << pes_packet->get_DTS() << std::endl;
			}
			else
			{
				//bitstream.skip_bytes(data_packet_start_byte_offset, TS_PKT_SIZE_BYTES);
				//throw TS_exception();
				skip_to_end(bitstream);
			}
		}
	}
	else
	{
		//throw TS_exception();
		skip_to_end(bitstream);
	}
//	level3_timer->stop();
}