MCPcopy Create free account
hub / github.com/TASEmulators/fceux / loadCodecConfig

Function loadCodecConfig

src/drivers/Qt/AviRecord.cpp:853–989  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

851}
852
853int loadCodecConfig( int type, const char *codec_name, AVCodecContext *ctx)
854{
855 int i,j;
856 char filename[4096];
857 char line[512];
858 char section[256], id[256], val[256];
859 void *obj, *child;
860 FILE *fp;
861 const char *baseDir = FCEUI_GetBaseDirectory();
862
863 snprintf( filename, sizeof(filename), "%s/avi/%s.conf", baseDir, codec_name );
864
865 filename[sizeof(filename)-1] = 0;
866
867 fp = fopen( filename, "r");
868
869 if ( fp == NULL )
870 {
871 printf("Error: Failed to open file '%s' for reading\n", filename );
872 return -1;
873 }
874 section[0] = 0;
875
876 obj = ctx;
877
878 while ( fgets( line, sizeof(line), fp ) != 0 )
879 {
880 i=0;
881
882 while ( line[i] != 0 )
883 {
884 if ( line[i] == '#' )
885 {
886 line[i] = 0; break;
887 }
888 i++;
889 }
890 i=0;
891
892 while ( isspace(line[i]) ) i++;
893
894 if ( line[i] == '[' )
895 {
896 i++;
897 while ( isspace(line[i]) ) i++;
898
899 j=0;
900 while ( (line[i] != 0) && (line[i] != ']') )
901 {
902 section[j] = line[i]; i++; j++;
903 }
904 section[j] = 0; j--;
905
906 while ( (j >= 0) && isspace(section[j]) )
907 {
908 section[j] = 0; j--;
909 }
910 //printf("Section: '%s'\n", section);

Callers 3

initVideoStreamFunction · 0.85
initAudioStreamFunction · 0.85
LibavEncOptWinMethod · 0.85

Calls 2

FCEUI_GetBaseDirectoryFunction · 0.85
isspaceClass · 0.85

Tested by

no test coverage detected