胡斌

try to avoid the start time is not 0

@@ -76,6 +76,9 @@ const char * default_acodec_param = "-acodec copy"; @@ -76,6 +76,9 @@ const char * default_acodec_param = "-acodec copy";
76 char vcodec_param[1024]; 76 char vcodec_param[1024];
77 char acodec_param[1024]; 77 char acodec_param[1024];
78 78
  79 +bool first_time_set = false;
  80 +float start_time = 0.0f;
  81 +
79 void addinfo(string t, string name, bool bstart){ 82 void addinfo(string t, string name, bool bstart){
80 media_type mtype = name.substr(name.length() - 4, name.length()) == ".aac" ? type_audio : type_video; 83 media_type mtype = name.substr(name.length() - 4, name.length()) == ".aac" ? type_audio : type_video;
81 if (bstart) { 84 if (bstart) {
@@ -86,6 +89,13 @@ void addinfo(string t, string name, bool bstart){ @@ -86,6 +89,13 @@ void addinfo(string t, string name, bool bstart){
86 f.end_time_str = t; 89 f.end_time_str = t;
87 f.name = name; 90 f.name = name;
88 91
  92 + if (!first_time_set) {
  93 + first_time_set = true;
  94 + start_time = f.start_time;
  95 + }
  96 +
  97 + f.start_time -= start_time;
  98 +
89 media_files[mtype].push_back(f); 99 media_files[mtype].push_back(f);
90 } 100 }
91 else { 101 else {
@@ -95,6 +105,7 @@ void addinfo(string t, string name, bool bstart){ @@ -95,6 +105,7 @@ void addinfo(string t, string name, bool bstart){
95 if (files[i].name == name) { 105 if (files[i].name == name) {
96 files[i].end_time = atof(t.c_str()); 106 files[i].end_time = atof(t.c_str());
97 files[i].end_time_str = t; 107 files[i].end_time_str = t;
  108 + files[i].end_time -= start_time;
98 break; 109 break;
99 } 110 }
100 } 111 }