Fixed a bug in the conversion API.
This commit is contained in:
parent
59becbb18b
commit
b10185be2a
1 changed files with 9 additions and 4 deletions
|
@ -32,15 +32,15 @@ namespace Converter {
|
||||||
while ( !(feof(outFile) || ferror(outFile)) && (getline(&fileBuf, &fileBufLen, outFile) != -1)){
|
while ( !(feof(outFile) || ferror(outFile)) && (getline(&fileBuf, &fileBufLen, outFile) != -1)){
|
||||||
if (strstr(fileBuf, "aac") || strstr(fileBuf, "AAC")){
|
if (strstr(fileBuf, "aac") || strstr(fileBuf, "AAC")){
|
||||||
strtok(fileBuf, " \t");
|
strtok(fileBuf, " \t");
|
||||||
allCodecs["ffmpeg"]["audio"][strtok(NULL, " \t")] = "aac";
|
allCodecs["ffmpeg"][strtok(NULL, " \t")] = "aac";
|
||||||
}
|
}
|
||||||
if (strstr(fileBuf, "h264") || strstr(fileBuf, "H264")){
|
if (strstr(fileBuf, "h264") || strstr(fileBuf, "H264")){
|
||||||
strtok(fileBuf, " \t");
|
strtok(fileBuf, " \t");
|
||||||
allCodecs["ffmpeg"]["video"][strtok(NULL, " \t")] = "h264";
|
allCodecs["ffmpeg"][strtok(NULL, " \t")] = "h264";
|
||||||
}
|
}
|
||||||
if (strstr(fileBuf, "mp3") || strstr(fileBuf, "MP3")){
|
if (strstr(fileBuf, "mp3") || strstr(fileBuf, "MP3")){
|
||||||
strtok(fileBuf, " \t");
|
strtok(fileBuf, " \t");
|
||||||
allCodecs["ffmpeg"]["audio"][strtok(NULL, " \t")] = "mp3";
|
allCodecs["ffmpeg"][strtok(NULL, " \t")] = "mp3";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose( outFile );
|
fclose( outFile );
|
||||||
|
@ -54,7 +54,12 @@ namespace Converter {
|
||||||
JSON::Value result;
|
JSON::Value result;
|
||||||
for (converterInfo::iterator convIt = allCodecs.begin(); convIt != allCodecs.end(); convIt++){
|
for (converterInfo::iterator convIt = allCodecs.begin(); convIt != allCodecs.end(); convIt++){
|
||||||
for (codecInfo::iterator codIt = convIt->second.begin(); codIt != convIt->second.end(); codIt++){
|
for (codecInfo::iterator codIt = convIt->second.begin(); codIt != convIt->second.end(); codIt++){
|
||||||
result[convIt->first][codIt->first] = codIt->second;
|
if (codIt->second == "h264"){
|
||||||
|
result[convIt->first]["video"][codIt->first] = codIt->second;
|
||||||
|
}else{
|
||||||
|
result[convIt->first]["audio"][codIt->first] = codIt->second;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Add table
Reference in a new issue