胡斌

support load audio codec param and video codec param from merge_av.cfg

... ... @@ -6,6 +6,7 @@
#include <vector>
#include <string.h>
bool only_print = false;
using namespace std;
... ... @@ -214,10 +215,59 @@ int readfile(char * filename)
return 0;
}
#ifdef WIN32
#include <Windows.h>
char exe_path[MAX_PATH] = { 0 };
int GetExePath()
{
char path_buffer[MAX_PATH] = "";
char drive[32] = "";
char dir[256] = "";
char fname[64] = "";
char ext[32] = "";
GetModuleFileNameA(NULL, path_buffer, 256);
_splitpath(path_buffer, drive, dir, fname, ext);
strcpy(exe_path, drive);
strcat(exe_path, dir);
return 0;
}
#endif
void load_codec_param()
{
strcpy(acodec_param, default_acodec_param);
strcpy(vcodec_param, default_vcodec_param);
char cfgfile[1024];
#ifdef WIN32
GetExePath();
strcpy(cfgfile, exe_path);
#else
strcpy(cfgfile , "~/";
#endif
strcat(cfgfile, "merge_av.cfg");
ifstream fin(cfgfile);
if (!fin) {
return;
}
const int LINE_LENGTH = 1000;
char str[LINE_LENGTH];
str[0] = 0;
if (fin.getline(str, LINE_LENGTH))
{
printf("\nload video codec from %s: %s\n", cfgfile, str);
strcpy(vcodec_param, str);
}
str[0] = 0;
if (fin.getline(str, LINE_LENGTH))
{
printf("load audio codec from %s: %s\n", cfgfile, str);
strcpy(acodec_param, str);
}
}
int main(int argc, char * argv[])
... ...