Make use of the new meta-data API and display the
audio track menu item label as the language of the track. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38688 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d174a87e1b
commit
5bacae95fe
@ -852,6 +852,41 @@ Controller::GetAudioCodecInfo(media_codec_info* info)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Controller::GetMetaData(BMessage* metaData)
|
||||
{
|
||||
// TODO: Move API into supplier classes
|
||||
if (fMediaFile == NULL)
|
||||
return B_NO_INIT;
|
||||
|
||||
return fMediaFile->GetMetaData(metaData);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Controller::GetVideoMetaData(int32 index, BMessage* metaData)
|
||||
{
|
||||
// TODO: Move API into supplier classes
|
||||
BMediaTrack* track = (BMediaTrack*)fVideoTrackList.ItemAt(index);
|
||||
if (track == NULL)
|
||||
return B_BAD_INDEX;
|
||||
|
||||
return track->GetMetaData(metaData);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Controller::GetAudioMetaData(int32 index, BMessage* metaData)
|
||||
{
|
||||
// TODO: Move API into supplier classes
|
||||
BMediaTrack* track = (BMediaTrack*)fAudioTrackList.ItemAt(index);
|
||||
if (track == NULL)
|
||||
return B_BAD_INDEX;
|
||||
|
||||
return track->GetMetaData(metaData);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
|
@ -134,6 +134,12 @@ public:
|
||||
status_t GetEncodedAudioFormat(media_format* format);
|
||||
status_t GetAudioCodecInfo(media_codec_info* info);
|
||||
|
||||
status_t GetMetaData(BMessage* metaData);
|
||||
status_t GetVideoMetaData(int32 track,
|
||||
BMessage* metaData);
|
||||
status_t GetAudioMetaData(int32 track,
|
||||
BMessage* metaData);
|
||||
|
||||
// video view
|
||||
void SetVideoView(VideoView *view);
|
||||
|
||||
|
@ -108,7 +108,7 @@ Application MediaPlayer :
|
||||
MainWin.cpp
|
||||
VideoView.cpp
|
||||
|
||||
: be game media tracker translation textencoding $(TARGET_LIBSTDC++)
|
||||
: be game locale media tracker translation textencoding $(TARGET_LIBSTDC++)
|
||||
: MediaPlayer.rdef
|
||||
;
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <Autolock.h>
|
||||
#include <Debug.h>
|
||||
#include <fs_attr.h>
|
||||
#include <Language.h>
|
||||
#include <Menu.h>
|
||||
#include <MenuBar.h>
|
||||
#include <MenuItem.h>
|
||||
@ -1548,7 +1549,18 @@ MainWin::_SetupTrackMenus(BMenu* audioTrackMenu, BMenu* videoTrackMenu)
|
||||
int count = fController->AudioTrackCount();
|
||||
int current = fController->CurrentAudioTrack();
|
||||
for (int i = 0; i < count; i++) {
|
||||
sprintf(s, "Track %d", i + 1);
|
||||
BMessage metaData;
|
||||
const char* languageString = NULL;
|
||||
if (fController->GetAudioMetaData(i, &metaData) == B_OK)
|
||||
metaData.FindString("language", &languageString);
|
||||
if (languageString != NULL) {
|
||||
BLanguage language(languageString);
|
||||
BString languageName;
|
||||
if (language.GetTranslatedName(languageName) == B_OK)
|
||||
languageString = languageName.String();
|
||||
snprintf(s, sizeof(s), "%s", languageString);
|
||||
} else
|
||||
snprintf(s, sizeof(s), "Track %d", i + 1);
|
||||
BMenuItem* item = new BMenuItem(s,
|
||||
new BMessage(M_SELECT_AUDIO_TRACK + i));
|
||||
item->SetMarked(i == current);
|
||||
@ -1563,7 +1575,7 @@ MainWin::_SetupTrackMenus(BMenu* audioTrackMenu, BMenu* videoTrackMenu)
|
||||
count = fController->VideoTrackCount();
|
||||
current = fController->CurrentVideoTrack();
|
||||
for (int i = 0; i < count; i++) {
|
||||
sprintf(s, "Track %d", i + 1);
|
||||
snprintf(s, sizeof(s), "Track %d", i + 1);
|
||||
BMenuItem* item = new BMenuItem(s,
|
||||
new BMessage(M_SELECT_VIDEO_TRACK + i));
|
||||
item->SetMarked(i == current);
|
||||
|
Loading…
Reference in New Issue
Block a user