[svn] / branches / dev-api-4 / xvidcore / vfw / src / config.c Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/vfw/src/config.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1346, Sat Jan 31 14:03:26 2004 UTC revision 1358, Mon Feb 9 10:14:54 2004 UTC
# Line 76  Line 76 
76  HWND g_hTooltip;  HWND g_hTooltip;
77    
78  static int g_use_bitrate = 1;  static int g_use_bitrate = 1;
79    
80    
81  int pp_dy, pp_duv, pp_dr, pp_fe; /* decoder options */  int pp_dy, pp_duv, pp_dr, pp_fe; /* decoder options */
82    
83  /* enumerates child windows, assigns tooltips */  /* enumerates child windows, assigns tooltips */
# Line 159  Line 161 
161    
162  typedef struct {  typedef struct {
163          char * name;          char * name;
164          int value;          int avi_interval;               /* audio overhead intervals (milliseconds) */
165            float mkv_multiplier;   /* mkv multiplier */
166  } named_int_t;  } named_int_t;
167    
 /* audio overhead intervals (milliseconds) */  
168    
169    #define NO_AUDIO        5
170  static const named_int_t audio_type_list[] = {  static const named_int_t audio_type_list[] = {
171          {       "MP3-CBR",              1000    },          {       "MP3-CBR",              1000,   48000/1152/6                                    },
172          {       "MP3-VBR",                24    },          {       "MP3-VBR",                24,   48000/1152/6                                    },
173          {       "AC3",                    64    },          {       "OGG",     /*?*/1000,   48000*(0.7F/1024 + 0.3F/180)    },
174          {       "DTS",                    21    },          {       "AC3",                    64,   48000/1536/6                                    },
175          {       "(None)",                  0    },          {       "DTS",                    21,   /*?*/48000/1152/6                               },
176            {       "(None)",                  0,   0                                                               },
177  };  };
178    
179    
# Line 366  Line 370 
370    
371          reg.profile = 0;          reg.profile = 0;
372          for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) {          for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) {
373                  if (strcmpi(profiles[i].name, reg.profile_name) == 0) {                  if (lstrcmpi(profiles[i].name, reg.profile_name) == 0) {
374                          reg.profile = i;                          reg.profile = i;
375                  }                  }
376          }          }
# Line 721  Line 725 
725          case IDD_BITRATE :          case IDD_BITRATE :
726                  SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"AVI-Legacy");                  SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"AVI-Legacy");
727                  SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"AVI-OpenDML");                  SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"AVI-OpenDML");
728                    SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"Matroska");
729                    SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"OGM");
730                  SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"(None)");                  SendDlgItemMessage(hDlg, IDC_BITRATE_CFORMAT, CB_ADDSTRING, 0, (LPARAM)"(None)");
731    
732                  SendDlgItemMessage(hDlg, IDC_BITRATE_TSIZE, CB_ADDSTRING, 0, (LPARAM)"665600");                  SendDlgItemMessage(hDlg, IDC_BITRATE_TSIZE, CB_ADDSTRING, 0, (LPARAM)"665600");
# Line 870  Line 876 
876                          int audio_mode = IsDlgChecked(hDlg, IDC_BITRATE_AMODE_SIZE);                          int audio_mode = IsDlgChecked(hDlg, IDC_BITRATE_AMODE_SIZE);
877                          int audio_rate = config_get_uint(hDlg, IDC_BITRATE_ARATE, 0);                          int audio_rate = config_get_uint(hDlg, IDC_BITRATE_ARATE, 0);
878                          int audio_size = config_get_uint(hDlg, IDC_BITRATE_ASIZE, 0);                          int audio_size = config_get_uint(hDlg, IDC_BITRATE_ASIZE, 0);
                         int audio_value;  
879    
880                          int frames;                          int frames;
881                          int overhead;                          int overhead;
# Line 886  Line 891 
891                                  audio_type = 0;                                  audio_type = 0;
892                          }                          }
893    
894                          /* audio_value tells us the audio overhead interval (milliseconds), or                          EnableDlgWindow(hDlg, IDC_BITRATE_AMODE_RATE, audio_type!=NO_AUDIO);
895                             zero if audio is not selected*/                          EnableDlgWindow(hDlg, IDC_BITRATE_AMODE_SIZE, audio_type!=NO_AUDIO);
896                            EnableDlgWindow(hDlg, IDC_BITRATE_ARATE, audio_type!=NO_AUDIO && !audio_mode);
897                          audio_value = audio_type_list[audio_type].value;                          EnableDlgWindow(hDlg, IDC_BITRATE_ASIZE, audio_type!=NO_AUDIO && audio_mode);
898                            EnableDlgWindow(hDlg, IDC_BITRATE_ASELECT, audio_type!=NO_AUDIO && audio_mode);
                         EnableDlgWindow(hDlg, IDC_BITRATE_AMODE_RATE, audio_value);  
                         EnableDlgWindow(hDlg, IDC_BITRATE_AMODE_SIZE, audio_value);  
                         EnableDlgWindow(hDlg, IDC_BITRATE_ARATE, audio_value && !audio_mode);  
                         EnableDlgWindow(hDlg, IDC_BITRATE_ASIZE, audio_value && audio_mode);  
                         EnableDlgWindow(hDlg, IDC_BITRATE_ASELECT, audio_value && audio_mode);  
899    
900                          /* step 1: calculate number of frames */                          /* step 1: calculate number of frames */
   
901                          frames = (int)(duration * video_fps_list[fps].value);                          frames = (int)(duration * video_fps_list[fps].value);
902    
903                          /* step 2: calculate audio_size (kbytes)*/                          /* step 2: calculate audio_size (kbytes)*/
904                            if (audio_type!=NO_AUDIO) {
                         if (audio_value) {  
905                                  if (audio_mode==0) {                                  if (audio_mode==0) {
906                                          audio_size = (duration * audio_rate) / 8;                                          audio_size = (duration * audio_rate) / 8;
907                                  }                                  }
# Line 919  Line 917 
917    
918                                  overhead = frames;                                  overhead = frames;
919    
920                                  if (audio_value) {                                  if (audio_type!=NO_AUDIO) {
921                                          overhead += (duration * 1000) / audio_value;                                          overhead += (duration * 1000) / audio_type_list[audio_type].avi_interval;
922                                  }                                  }
923    
924                                  overhead *= (ctype==0) ? 24 : 16;                                  overhead *= (ctype==0) ? 24 : 16;
925    
926                                  overhead /= 1024;                                  overhead /= 1024;
927                                  break;                                  break;
928    
929                            case 2 :        /* Matroska: gknot formula */
930    
931                                    /* common overhead */
932                                    overhead = 40 + 12 + 8+ 16*duration + 200 + 100*1/*one audio stream*/ + 11*duration;
933    
934                                    /* video overhead */
935                                    overhead += frames*8 + (int)(frames * 4 * 0.94);
936    
937                                    /* cue tables and menu seek entries (300k default) */
938                                    overhead += 300 * 1024;
939    
940                                    /* audio */
941                                    overhead += (int)(duration * audio_type_list[audio_type].mkv_multiplier);
942    
943                                    overhead /= 1024;
944                                    break;
945    
946                            case 3 :        /* OGM: inaccurate model */
947                                    overhead = (int)(0.0039F * (target_size - subtitle_size));
948                                    break;
949    
950                          default :       /* (none) */                          default :       /* (none) */
951                                  overhead = 0;                                  overhead = 0;
952                                  break;                                  break;
# Line 1379  Line 1399 
1399                                                  (filesize = GetFileSize(hFile, NULL)) == INVALID_FILE_SIZE) {                                                  (filesize = GetFileSize(hFile, NULL)) == INVALID_FILE_SIZE) {
1400                                                  MessageBox(hDlg, "Could not get file size", "Error", 0);                                                  MessageBox(hDlg, "Could not get file size", "Error", 0);
1401                                          }else{                                          }else{
1402                                                  SetDlgItemInt(hDlg, IDC_BITRATE_SSIZE, filesize / 1024, FALSE);                                                  SetDlgItemInt(hDlg,
1403                                                                    LOWORD(wParam)==IDC_BITRATE_SSELECT? IDC_BITRATE_SSIZE : IDC_BITRATE_ASIZE,
1404                                                                    filesize / 1024, FALSE);
1405                                                  CloseHandle(hFile);                                                  CloseHandle(hFile);
1406                                          }                                          }
1407                                  }                                  }
# Line 1412  Line 1434 
1434                                          ofn.Flags |= OFN_FILEMUSTEXIST;                                          ofn.Flags |= OFN_FILEMUSTEXIST;
1435                                  }                                  }
1436    
1437                                  if (GetSaveFileName(&ofn))                                  if ((psi->idd==IDD_RC_2PASS1 && GetSaveFileName(&ofn)) ||
1438                                  {                                          (psi->idd==IDD_RC_2PASS2 && GetOpenFileName(&ofn))) {
1439                                          SetDlgItemText(hDlg, IDC_STATS, tmp);                                          SetDlgItemText(hDlg, IDC_STATS, tmp);
1440                                  }                                  }
1441                                  }                                  }
# Line 1561  Line 1583 
1583          }          }
1584    
1585          psh.dwSize = sizeof(PROPSHEETHEADER);          psh.dwSize = sizeof(PROPSHEETHEADER);
1586          psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;          psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP;
1587          psh.hwndParent = hParent;          psh.hwndParent = hParent;
1588          psh.hInstance = g_hInst;          psh.hInstance = g_hInst;
1589          psh.pszCaption = (LPSTR) "XviD Configuration";          psh.pszCaption = (LPSTR) "XviD Configuration";

Legend:
Removed from v.1346  
changed lines
  Added in v.1358

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4