display codec id when codec not available\nSome layout changes too

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25520 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
David McPaul
2008-05-16 02:30:50 +00:00
parent fa9257456d
commit cca73f2ab9
+22 -20
View File
@@ -34,7 +34,7 @@
#define NAME "File Info" #define NAME "File Info"
#define MIN_WIDTH 350 #define MIN_WIDTH 400
#define BASE_HEIGHT (32 + 32) #define BASE_HEIGHT (32 + 32)
@@ -78,7 +78,7 @@ InfoView::Draw(BRect updateRect)
InfoWin::InfoWin(BPoint leftTop, Controller* controller) InfoWin::InfoWin(BPoint leftTop, Controller* controller)
: BWindow(BRect(leftTop.x, leftTop.y, leftTop.x + MIN_WIDTH - 1, : BWindow(BRect(leftTop.x, leftTop.y, leftTop.x + MIN_WIDTH - 1,
leftTop.y + 250), NAME, B_TITLED_WINDOW, leftTop.y + 300), NAME, B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE) B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE)
, fController(controller) , fController(controller)
, fControllerObserver(new ControllerObserver(this, , fControllerObserver(new ControllerObserver(this,
@@ -223,16 +223,16 @@ printf("InfoWin::Update(0x%08lx)\n", which);
fLabelsView->SetText(""); fLabelsView->SetText("");
fContentsView->SetText(""); fContentsView->SetText("");
fLabelsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kBlue); fLabelsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kBlue);
fLabelsView->Insert("\n"); fLabelsView->Insert(" ");
fContentsView->SetFontAndColor(be_plain_font, B_FONT_ALL); fContentsView->SetFontAndColor(be_plain_font, B_FONT_ALL);
fContentsView->Insert("\n"); // fContentsView->Insert("");
fLabelsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kRed); fLabelsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kRed);
status_t err; status_t err;
// video track format information // video track format information
if ((which & INFO_VIDEO) && fController->VideoTrackCount() > 0) { if ((which & INFO_VIDEO) && fController->VideoTrackCount() > 0) {
fLabelsView->Insert("Video\n\n\n"); fLabelsView->Insert("Video\n\n\n\n");
BString s; BString s;
media_format format; media_format format;
media_raw_video_format videoFormat; media_raw_video_format videoFormat;
@@ -243,9 +243,12 @@ printf("InfoWin::Update(0x%08lx)\n", which);
videoFormat = format.u.encoded_video.output; videoFormat = format.u.encoded_video.output;
media_codec_info mci; media_codec_info mci;
err = fController->GetVideoCodecInfo(&mci); err = fController->GetVideoCodecInfo(&mci);
if (err < B_OK) if (err < B_OK) {
s << "(" << strerror(err) << ")"; s << "Haiku Media Kit:\n(" << strerror(err) << ")";
else if (format.user_data_type == B_CODEC_TYPE_INFO) {
s << (char *)format.user_data << " not supported";
}
} else
s << mci.pretty_name; //<< "(" << mci.short_name << ")"; s << mci.pretty_name; //<< "(" << mci.short_name << ")";
} else if (format.type == B_MEDIA_RAW_VIDEO) { } else if (format.type == B_MEDIA_RAW_VIDEO) {
videoFormat = format.u.raw_video; videoFormat = format.u.raw_video;
@@ -262,7 +265,7 @@ printf("InfoWin::Update(0x%08lx)\n", which);
// audio track format information // audio track format information
if ((which & INFO_AUDIO) && fController->AudioTrackCount() > 0) { if ((which & INFO_AUDIO) && fController->AudioTrackCount() > 0) {
fLabelsView->Insert("Audio\n\n\n"); fLabelsView->Insert("Audio\n\n\n\n");
BString s; BString s;
media_format format; media_format format;
media_raw_audio_format audioFormat; media_raw_audio_format audioFormat;
@@ -275,9 +278,12 @@ printf("InfoWin::Update(0x%08lx)\n", which);
audioFormat = format.u.encoded_audio.output; audioFormat = format.u.encoded_audio.output;
media_codec_info mci; media_codec_info mci;
err = fController->GetAudioCodecInfo(&mci); err = fController->GetAudioCodecInfo(&mci);
if (err < 0) if (err < 0) {
s << "(" << strerror(err) << ")"; s << "Haiku Media Kit:\n(" << strerror(err) << ") ";
else if (format.user_data_type == B_CODEC_TYPE_INFO) {
s << (char *)format.user_data << " not supported";
}
} else
s << mci.pretty_name; //<< "(" << mci.short_name << ")"; s << mci.pretty_name; //<< "(" << mci.short_name << ")";
} else if (format.type == B_MEDIA_RAW_AUDIO) { } else if (format.type == B_MEDIA_RAW_AUDIO) {
audioFormat = format.u.raw_audio; audioFormat = format.u.raw_audio;
@@ -344,7 +350,7 @@ printf("InfoWin::Update(0x%08lx)\n", which);
fContentsView->Insert("DrawBitmap\n"); fContentsView->Insert("DrawBitmap\n");
fLabelsView->Insert("\n"); fLabelsView->Insert("\n");
fContentsView->Insert("\n"); fContentsView->Insert("\n\n");
} }
if (which & INFO_TRANSPORT) { if (which & INFO_TRANSPORT) {
@@ -356,12 +362,12 @@ printf("InfoWin::Update(0x%08lx)\n", which);
media_file_format ff; media_file_format ff;
BString s; BString s;
if (fController->GetFileFormatInfo(&ff) == B_OK) { if (fController->GetFileFormatInfo(&ff) == B_OK) {
fLabelsView->Insert("Container\n\n"); fLabelsView->Insert("Container\n");
s << ff.pretty_name; s << ff.pretty_name;
s << "\n\n"; s << "\n";
fContentsView->Insert(s.String()); fContentsView->Insert(s.String());
} else } else
fContentsView->Insert("\n\n"); fContentsView->Insert("\n");
fLabelsView->Insert("Location\n"); fLabelsView->Insert("Location\n");
if (fController->GetLocation(&s) < B_OK) if (fController->GetLocation(&s) < B_OK)
s = "<unknown>"; s = "<unknown>";
@@ -389,7 +395,3 @@ printf("InfoWin::Update(0x%08lx)\n", which);
ResizeToPreferred(); ResizeToPreferred();
} }