⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ifo_print.c

📁 有关mpeg2的deocde代码
💻 C
📖 第 1 页 / 共 3 页
字号:
/*  * Copyright (C) 2000, 2001, 2002, 2003 *               Bj鰎n Englund <d4bjorn@dtek.chalmers.se>,  *               H錵an Hjort <d95hjort@dtek.chalmers.se> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */#include "config.h"#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <inttypes.h>#include <string.h>#include <ctype.h>#include "ifo_types.h"#include "ifo_read.h"#include "ifo_print.h"#include "dvdread_internal.h"/* Put this in some other file / package?  It's used in nav_print too. */static void ifoPrint_time(dvd_time_t *dtime) {  const char *rate;  CHECK_VALUE((dtime->hour>>4) < 0xa && (dtime->hour&0xf) < 0xa);  CHECK_VALUE((dtime->minute>>4) < 0x7 && (dtime->minute&0xf) < 0xa);  CHECK_VALUE((dtime->second>>4) < 0x7 && (dtime->second&0xf) < 0xa);  CHECK_VALUE((dtime->frame_u&0xf) < 0xa);    printf("%02x:%02x:%02x.%02x", 	 dtime->hour,	 dtime->minute,	 dtime->second,	 dtime->frame_u & 0x3f);  switch((dtime->frame_u & 0xc0) >> 6) {  case 1:    rate = "25.00";    break;  case 3:    rate = "29.97";    break;  default:    if(dtime->hour == 0 && dtime->minute == 0        && dtime->second == 0 && dtime->frame_u == 0)      rate = "no";    else      rate = "(please send a bug report)";    break;  }   printf(" @ %s fps", rate);}/* Put this in some other file / package?  It's used in nav_print too.   Possibly also by the vm / navigator. */static void ifoPrint_CMD(int row, vm_cmd_t *command) {  int i;  printf("(%03d) ", row + 1);  for(i=0;i<8;i++)    printf("%02x ", command->bytes[i]);  printf("| ");  //vmcmd(command);  printf("\n");}static void ifoPrint_video_attributes(video_attr_t *attr) {    /* The following test is shorter but not correct ISO C,     memcmp(attr,my_friendly_zeros, sizeof(video_attr_t)) */  if(attr->mpeg_version == 0      && attr->video_format == 0      && attr->display_aspect_ratio == 0      && attr->permitted_df == 0      && attr->unknown1 == 0      && attr->line21_cc_1 == 0      && attr->line21_cc_2 == 0      && attr->bit_rate == 0      && attr->video_format == 0      && attr->letterboxed == 0      && attr->film_mode == 0) {    printf("-- Unspecified --");    return;  }    switch(attr->mpeg_version) {  case 0:    printf("mpeg1 ");    break;  case 1:    printf("mpeg2 ");    break;  default:    printf("(please send a bug report) ");  }    switch(attr->video_format) {  case 0:    printf("ntsc ");    break;  case 1:    printf("pal ");    break;  default:    printf("(please send a bug report) ");  }    switch(attr->display_aspect_ratio) {  case 0:    printf("4:3 ");    break;  case 3:    printf("16:9 ");    break;  default:    printf("(please send a bug report) ");  }    // Wide is allways allowed..!!!  switch(attr->permitted_df) {  case 0:    printf("pan&scan+letterboxed ");    break;  case 1:    printf("only pan&scan "); //??    break;  case 2:    printf("only letterboxed ");    break;  case 3:    // not specified    break;  default:    printf("(please send a bug report)");  }    printf("U%x ", attr->unknown1);  CHECK_VALUE(!attr->unknown1);    if(attr->line21_cc_1 || attr->line21_cc_2) {    printf("NTSC CC ");    if(attr->line21_cc_1)      printf("1 ");    if(attr->line21_cc_2)      printf("2 ");  }  switch(attr->bit_rate) {    case 0:      printf("Variable Bit Rate ");      break;    case 1:      printf("Constant Bit Rate ");      break;    default:      printf("(please send a bug report)");  }    {    int height = 480;    if(attr->video_format != 0)       height = 576;    switch(attr->picture_size) {    case 0:      printf("720x%d ", height);      break;    case 1:      printf("704x%d ", height);      break;    case 2:      printf("352x%d ", height);      break;    case 3:      printf("352x%d ", height/2);      break;          default:      printf("(please send a bug report) ");    }  }  if(attr->letterboxed) {    printf("source letterboxed ");  }    if(attr->film_mode) {    printf("film");  } else {    printf("video"); //camera  }}static void ifoPrint_audio_attributes(audio_attr_t *attr) {    if(attr->audio_format == 0     && attr->multichannel_extension == 0     && attr->lang_type == 0     && attr->application_mode == 0     && attr->quantization == 0     && attr->sample_frequency == 0     && attr->channels == 0     && attr->lang_code == 0     && attr->lang_extension == 0     && attr->code_extension == 0     && attr->unknown3 == 0     && attr->unknown1 == 0) {    printf("-- Unspecified --");    return;  }    switch(attr->audio_format) {  case 0:    printf("ac3 ");    break;  case 1:    printf("(please send a bug report) ");    break;  case 2:    printf("mpeg1 ");    break;  case 3:    printf("mpeg2ext ");    break;  case 4:    printf("lpcm ");    break;  case 5:    printf("(please send a bug report) ");    break;  case 6:    printf("dts ");    break;  default:    printf("(please send a bug report) ");  }    if(attr->multichannel_extension)    printf("multichannel_extension ");    switch(attr->lang_type) {  case 0:    // not specified    CHECK_VALUE(attr->lang_code == 0 || attr->lang_code == 0xffff);    break;  case 1:    printf("%c%c (%c) ", attr->lang_code>>8, attr->lang_code & 0xff,           attr->lang_extension ? attr->lang_extension : ' ');    break;  default:    printf("(please send a bug report) ");  }  switch(attr->application_mode) {  case 0:    // not specified    break;  case 1:    printf("karaoke mode ");    break;  case 2:    printf("surround sound mode ");    break;  default:    printf("(please send a bug report) ");  }    switch(attr->quantization) {  case 0:    printf("16bit ");    break;  case 1:    printf("20bit ");    break;  case 2:    printf("24bit ");    break;  case 3:    printf("drc ");    break;  default:    printf("(please send a bug report) ");  }    switch(attr->sample_frequency) {  case 0:    printf("48kHz ");    break;  case 1:    printf("??kHz ");    break;  default:    printf("sample_frequency %i (please send a bug report) ", 	   attr->sample_frequency);  }    printf("%dCh ", attr->channels + 1);    switch(attr->code_extension) {  case 0:    printf("Not specified ");    break;  case 1: // Normal audio    printf("Normal Caption ");    break;  case 2: // visually imparied    printf("Audio for visually impaired ");    break;  case 3: // Directors 1    printf("Director's comments 1 ");    break;  case 4: // Directors 2    printf("Director's comments 2 ");    break;    //case 4: // Music score ?      default:    printf("(please send a bug report) ");  }      printf("%d ", attr->unknown3);  if(attr->application_mode == 1) {    printf("ca=%d ", attr->app_info.karaoke.channel_assignment);    printf("%d ", attr->app_info.karaoke.version);    if(attr->app_info.karaoke.mc_intro)       printf("mc intro ");    printf("%s ", attr->app_info.karaoke.mode ? "duet" : "solo");    printf("%d ", attr->app_info.karaoke.unknown4);  }  if(attr->application_mode == 2) {    if(attr->app_info.surround.dolby_encoded) {      printf("dolby surround ");    }    printf("%d ", attr->app_info.surround.unknown5);    printf("%d ", attr->app_info.surround.unknown6);  }    }static void ifoPrint_subp_attributes(subp_attr_t *attr) {    if(attr->type == 0     && attr->code_mode == 0     && attr->lang_code == 0     && attr->lang_extension == 0     && attr->zero1 == 0     && attr->zero2 == 0     && attr->code_extension == 0) {    printf("-- Unspecified --");    return;  }    switch(attr->code_mode) {  case 0:    printf("Coding Mode RLE ");    break;  case 1:    printf("Coding Mode Extended ");    break;  default:    printf("(please send a bug report) ");  }       if(attr->type == 1) {    if(isalpha((int)(attr->lang_code >> 8))       && isalpha((int)(attr->lang_code & 0xff))) {      printf("%c%c ", attr->lang_code >> 8, attr->lang_code & 0xff);    } else {      printf("%02x%02x ", attr->lang_code >> 8, attr->lang_code & 0xff);    }  } else {      printf("lang not specified ");  }  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -