MediaConverter: style fixes.

This commit is contained in:
Adrien Destugues 2014-10-18 18:29:05 +02:00
parent 37daf9367a
commit 0c90c6d7e5
1 changed files with 22 additions and 19 deletions

View File

@ -143,10 +143,10 @@ MediaConverterApp::RefsReceived(BMessage* msg)
} }
alertText << "\n" << errorFiles; alertText << "\n" << errorFiles;
BAlert* alert = new BAlert((errors > 1) ? BAlert* alert = new BAlert((errors > 1) ?
B_TRANSLATE("Error loading files") : B_TRANSLATE("Error loading files") :
B_TRANSLATE("Error loading a file"), B_TRANSLATE("Error loading a file"),
alertText.String(), B_TRANSLATE("Continue"), NULL, NULL, alertText.String(), B_TRANSLATE("Continue"), NULL, NULL,
B_WIDTH_AS_USUAL, B_STOP_ALERT); B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->Go(); alert->Go();
} }
@ -271,7 +271,8 @@ MediaConverterApp::_RunConvert()
media_codec_info* audioCodec; media_codec_info* audioCodec;
media_codec_info* videoCodec; media_codec_info* videoCodec;
media_file_format* fileFormat; media_file_format* fileFormat;
fWin->GetSelectedFormatInfo(&fileFormat, &audioCodec, &videoCodec); fWin->GetSelectedFormatInfo(&fileFormat, &audioCodec,
&videoCodec);
BDirectory directory = fWin->OutputDirectory(); BDirectory directory = fWin->OutputDirectory();
fWin->Unlock(); fWin->Unlock();
outEntry = _CreateOutputFile(directory, &inRef, fileFormat); outEntry = _CreateOutputFile(directory, &inRef, fileFormat);
@ -315,7 +316,7 @@ MediaConverterApp::_RunConvert()
srcIndex++; srcIndex++;
BString error( BString error(
B_TRANSLATE("Error converting '%filename'")); B_TRANSLATE("Error converting '%filename'"));
error.ReplaceAll("%filename", inRef.name); error.ReplaceAll("%filename", inRef.name);
fWin->SetStatusMessage(error.String()); fWin->SetStatusMessage(error.String());
} }
fWin->Unlock(); fWin->Unlock();
@ -445,21 +446,23 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
// blocks until the window is quit // blocks until the window is quit
// The quality setting is ignored by the 3ivx encoder if the // The quality setting is ignored by the 3ivx encoder if the
// view was displayed, but this method is the trigger to read // view was displayed, but this method is the trigger to
// all the parameter settings // read all the parameter settings
outVidTrack->SetQuality(videoQuality / 100.0f); outVidTrack->SetQuality(videoQuality / 100.0f);
// We can now delete the encoderView created for us by the encoder // We can now delete the encoderView created for us by the
// encoder
delete encoderView; delete encoderView;
encoderView = NULL; encoderView = NULL;
videoQualitySupport = videoQualitySupport
B_TRANSLATE("Video using parameters form settings"); = B_TRANSLATE("Video using parameters form settings");
} else { } else if (outVidTrack->SetQuality(videoQuality / 100.0f)
if (outVidTrack->SetQuality(videoQuality / 100.0f) >= B_OK) >= B_OK) {
videoQualitySupport = videoQualitySupport
B_TRANSLATE("Video quality not supported"); = B_TRANSLATE("Video quality not supported");
} }
if (videoQualitySupport && fWin->Lock()) { if (videoQualitySupport && fWin->Lock()) {
fWin->SetVideoQualityLabel(videoQualitySupport); fWin->SetVideoQualityLabel(videoQualitySupport);
fWin->Unlock(); fWin->Unlock();
@ -525,8 +528,8 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
for (int64 i = start; (i <= end) && !fCancel; i += framesRead) { for (int64 i = start; (i <= end) && !fCancel; i += framesRead) {
if ((ret = inVidTrack->ReadFrames(videoBuffer, &framesRead, if ((ret = inVidTrack->ReadFrames(videoBuffer, &framesRead,
&mh)) != B_OK) { &mh)) != B_OK) {
fprintf(stderr, "Error reading video frame %" B_PRId64 ": %s\n", i, fprintf(stderr, "Error reading video frame %" B_PRId64 ": %s\n",
strerror(ret)); i, strerror(ret));
snprintf(status.LockBuffer(128), 128, snprintf(status.LockBuffer(128), 128,
B_TRANSLATE("Error read video frame %" B_PRId64), i); B_TRANSLATE("Error read video frame %" B_PRId64), i);
status.UnlockBuffer(); status.UnlockBuffer();
@ -537,8 +540,8 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
if ((ret = outVidTrack->WriteFrames(videoBuffer, framesRead, if ((ret = outVidTrack->WriteFrames(videoBuffer, framesRead,
mh.u.encoded_video.field_flags)) != B_OK) { mh.u.encoded_video.field_flags)) != B_OK) {
fprintf(stderr, "Error writing video frame %" B_PRId64 ": %s\n", i, fprintf(stderr, "Error writing video frame %" B_PRId64 ": %s\n",
strerror(ret)); i, strerror(ret));
snprintf(status.LockBuffer(128), 128, snprintf(status.LockBuffer(128), 128,
B_TRANSLATE("Error writing video frame %" B_PRId64), i); B_TRANSLATE("Error writing video frame %" B_PRId64), i);
status.UnlockBuffer(); status.UnlockBuffer();