* Auto white-space cleanup.
* Do not override pixel aspect unnecessarily. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32046 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -67,7 +67,7 @@ MediaConverterApp::MessageReceived(BMessage *msg)
|
|||||||
|
|
||||||
case START_CONVERSION_MESSAGE:
|
case START_CONVERSION_MESSAGE:
|
||||||
if (!fConverting)
|
if (!fConverting)
|
||||||
StartConverting();
|
StartConverting();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CANCEL_CONVERSION_MESSAGE:
|
case CANCEL_CONVERSION_MESSAGE:
|
||||||
@@ -80,21 +80,21 @@ MediaConverterApp::MessageReceived(BMessage *msg)
|
|||||||
DetachCurrentMessage();
|
DetachCurrentMessage();
|
||||||
BMessenger(fWin).SendMessage(msg);
|
BMessenger(fWin).SendMessage(msg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BApplication::MessageReceived(msg);
|
BApplication::MessageReceived(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MediaConverterApp::ReadyToRun()
|
MediaConverterApp::ReadyToRun()
|
||||||
{
|
{
|
||||||
fWin->Show();
|
fWin->Show();
|
||||||
fWin->PostMessage(INIT_FORMAT_MENUS);
|
fWin->PostMessage(INIT_FORMAT_MENUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MediaConverterApp::RefsReceived(BMessage *msg)
|
MediaConverterApp::RefsReceived(BMessage *msg)
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
@@ -134,14 +134,14 @@ MediaConverterApp::RefsReceived(BMessage *msg)
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MediaConverterApp::IsConverting() const
|
MediaConverterApp::IsConverting() const
|
||||||
{
|
{
|
||||||
return fConverting;
|
return fConverting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MediaConverterApp::StartConverting()
|
MediaConverterApp::StartConverting()
|
||||||
{
|
{
|
||||||
bool locked = fWin->Lock();
|
bool locked = fWin->Lock();
|
||||||
@@ -152,7 +152,7 @@ MediaConverterApp::StartConverting()
|
|||||||
if (fConvertThreadID >= 0) {
|
if (fConvertThreadID >= 0) {
|
||||||
fConverting = true;
|
fConverting = true;
|
||||||
fCancel = false;
|
fCancel = false;
|
||||||
resume_thread(fConvertThreadID);
|
resume_thread(fConvertThreadID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ MediaConverterApp::StartConverting()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MediaConverterApp::SetStatusMessage(const char *message)
|
MediaConverterApp::SetStatusMessage(const char *message)
|
||||||
{
|
{
|
||||||
if (fWin != NULL && fWin->Lock()) {
|
if (fWin != NULL && fWin->Lock()) {
|
||||||
@@ -186,7 +186,7 @@ MediaConverterApp::_CreateOutputFile(BDirectory directory,
|
|||||||
name.Truncate(extIndex + 1);
|
name.Truncate(extIndex + 1);
|
||||||
else
|
else
|
||||||
name.Append(".");
|
name.Append(".");
|
||||||
|
|
||||||
name.Append(outputFormat->file_extension);
|
name.Append(outputFormat->file_extension);
|
||||||
|
|
||||||
BEntry inEntry(ref);
|
BEntry inEntry(ref);
|
||||||
@@ -298,8 +298,8 @@ MediaConverterApp::_RunConvert()
|
|||||||
}
|
}
|
||||||
fWin->Unlock();
|
fWin->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fWin->Unlock();
|
fWin->Unlock();
|
||||||
break;
|
break;
|
||||||
@@ -316,7 +316,7 @@ MediaConverterApp::_RunConvert()
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
|
MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
|
||||||
media_codec_info* audioCodec, media_codec_info* videoCodec,
|
media_codec_info* audioCodec, media_codec_info* videoCodec,
|
||||||
int32 audioQuality, int32 videoQuality,
|
int32 audioQuality, int32 videoQuality,
|
||||||
@@ -359,7 +359,7 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
|
|||||||
outAudFormat.type = B_MEDIA_RAW_AUDIO;
|
outAudFormat.type = B_MEDIA_RAW_AUDIO;
|
||||||
raf = &(outAudFormat.u.raw_audio);
|
raf = &(outAudFormat.u.raw_audio);
|
||||||
inTrack->DecodedFormat(&outAudFormat);
|
inTrack->DecodedFormat(&outAudFormat);
|
||||||
|
|
||||||
audioBuffer = new uint8[raf->buffer_size];
|
audioBuffer = new uint8[raf->buffer_size];
|
||||||
// audioFrameSize = (raf->format & media_raw_audio_format::B_AUDIO_SIZE_MASK)
|
// audioFrameSize = (raf->format & media_raw_audio_format::B_AUDIO_SIZE_MASK)
|
||||||
audioFrameSize = (raf->format & 0xf) * raf->channel_count;
|
audioFrameSize = (raf->format & 0xf) * raf->channel_count;
|
||||||
@@ -377,15 +377,13 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
|
|||||||
inVidTrack = inTrack;
|
inVidTrack = inTrack;
|
||||||
width = (int32)inFormat.Width();
|
width = (int32)inFormat.Width();
|
||||||
height = (int32)inFormat.Height();
|
height = (int32)inFormat.Height();
|
||||||
|
|
||||||
// construct desired decoded video format
|
// construct desired decoded video format
|
||||||
// memset(&outVidFormat, 0, sizeof(outVidFormat));
|
memset(&outVidFormat, 0, sizeof(outVidFormat));
|
||||||
outVidFormat.type = B_MEDIA_RAW_VIDEO;
|
outVidFormat.type = B_MEDIA_RAW_VIDEO;
|
||||||
rvf = &(outVidFormat.u.raw_video);
|
rvf = &(outVidFormat.u.raw_video);
|
||||||
rvf->last_active = (uint32)(height - 1);
|
rvf->last_active = (uint32)(height - 1);
|
||||||
rvf->orientation = B_VIDEO_TOP_LEFT_RIGHT;
|
rvf->orientation = B_VIDEO_TOP_LEFT_RIGHT;
|
||||||
rvf->pixel_width_aspect = 1;
|
|
||||||
rvf->pixel_height_aspect = 1;
|
|
||||||
rvf->display.format = B_RGB32;
|
rvf->display.format = B_RGB32;
|
||||||
rvf->display.bytes_per_row = 4 * width;
|
rvf->display.bytes_per_row = 4 * width;
|
||||||
rvf->display.line_width = width;
|
rvf->display.line_width = width;
|
||||||
@@ -410,7 +408,7 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile,
|
|||||||
= new MediaEncoderWindow(BRect(50, 50, 520, 555), encoderView);
|
= new MediaEncoderWindow(BRect(50, 50, 520, 555), encoderView);
|
||||||
encoderWin->Go();
|
encoderWin->Go();
|
||||||
// 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 read
|
||||||
// all the parameter settings
|
// all the parameter settings
|
||||||
@@ -594,6 +592,6 @@ main(int, char **)
|
|||||||
{
|
{
|
||||||
MediaConverterApp app;
|
MediaConverterApp app;
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user