Skip to content
This repository

Unify the assignment and usage of the name and language of streams #2162

Merged
16 commits merged into from over 1 year ago

5 participants

Andreas Zelend Joakim Plate Martijn Kaijser davilla da-anda
Andreas Zelend
Collaborator

The first few commits improve/correct the assignment of dvd streams' name and language.
Next the get*Language methods now return a three char code if possible.
This code is used to show the full language name in the gui.

Joakim Plate
Collaborator
Andreas Zelend
Collaborator

I'm not 100% sure what you mean since I haven't added any function to the player. Do you want to save method calls? If this is the goal I can add a commit, but I doubt that another lengthy method improves comprehensibility.

Joakim Plate
Collaborator
Andreas Zelend
Collaborator

@elupus ideally #2128 should go in first, because it fixes a bug in get_audio_info which I would only be too happy to use.

Andreas Zelend
Collaborator

Now the language of any selection stream should be a three char code. These are used for the language priority evaluations.

Joakim Plate elupus commented on the diff
...dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp
((67 lines not shown))
940   - switch( audio_attributes.lang_extension )
941   - {
942   - case DVD_AUDIO_LANG_EXT_VisuallyImpaired:
943   - strLanguage+= " (Visually Impaired)";
944   - break;
945   - case DVD_AUDIO_LANG_EXT_DirectorsComments1:
946   - strLanguage+= " (Directors Comments)";
947   - break;
948   - case DVD_AUDIO_LANG_EXT_DirectorsComments2:
949   - strLanguage+= " (Directors Comments 2)";
950   - break;
951   - case DVD_AUDIO_LANG_EXT_NotSpecified:
952   - case DVD_AUDIO_LANG_EXT_NormalCaptions:
953   - default:
954   - break;
955   - }
4
Joakim Plate Collaborator
elupus added a note

Why was this removed? This is the closest we get to an actual name.

Andreas Zelend Collaborator

The main problem is that with the current version of dvdnav the only thing that get_audio_info returns correctly is the language code, at least with any dvd I tested. The second thing was that this code fragment belonged to GetAudioStreamLanguage, I therefore removed it and then simply forgot to re-add it to GetAudioStreamName or rather search for an alternative to get this info.

I will adapt these commits after the new version of dvdnav got merged.

da-anda Collaborator
da-anda added a note

can we remove the hardcoded labels and make them translateable instead when refactoring this?

Andreas Zelend Collaborator

Sure, can do so!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Andreas Zelend
Collaborator

I'm working on an update, but found some other issues, e.g. audio_attributes.lang_extension is wrong, the info is store in audio_attributes.code_extension. Maybe I can push something tomorrow; when is the merge window closed?

Martijn Kaijser

At the end of tomorrow

Andreas Zelend
Collaborator

Some issues that I've noticed and don't know how to handle correctly, so comments are highly appreciated!
Moved here: https://gist.github.com/ace20022/c9da53faefebb3d76ef5

Andreas Zelend
Collaborator

Had a look at blurays in the meantime, no special handling is needed for them. Btw this pr should fix the auto language selection since this also uses 3 char codes.

Andreas Zelend
Collaborator

@elupus Could you please have a look at this pr. It is not only a gui gimmick, at least imo, it also fixes the subtitle auto-selection and fixes, or improves, json-rpc usage, e.g., remotes w.r.t. language representation. At the moment you get the full language names, sometimes even localised and in the wrong field:
For example: https://gist.github.com/ace20022/4a5207870ff4302b9ca0

Andreas Zelend
Collaborator

I have revised and extended this pr after 87047e9. It's quite large now.
There are some issues regarding libdvd that I've noticed. I opened a gist for discussion, so no mail spam will be generated: https://gist.github.com/ace20022/c9da53faefebb3d76ef5.

@davilla Could you please check the amlplayer commits? Especially 3ee15da.

Hopefully I haven't miss anything.

davilla
Collaborator

nm :) I see the previous commit that does the expansion at the source. looks fine.

Andreas Zelend
Collaborator

@davilla thanks, that was really quick ;)

I see the previous commit that does the expansion at the source.

Not exactly, that's just a conversion to 3 chars if necessary. The only place where the full name is required is the gui, imo.

davilla
Collaborator

do we do the convert to a full name over and over in the GUI ? if so, CPU sucker :)

Andreas Zelend
Collaborator

Only for presentation in the audio/subtitle settings dialog; for subs this is done already (in the current implementation)

Andreas Zelend
Collaborator

@elupus If you find some time, could you please have look? Especially at the gist thing. I'm afraid this month's deadline is coming closer ;)

Joakim Plate
Collaborator
Andreas Zelend
Collaborator

No problem, have fun :)

...s/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.h
... ... @@ -44,6 +44,19 @@
44 44
45 45 struct dvdnav_s;
46 46
  47 +struct DVDStreamInfo
1
Joakim Plate Collaborator
elupus added a note

DVDNavStreamInfo or make it a member of the navigator class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Joakim Plate
Collaborator

Fix above, rebase and then you can assign it to next merge window.

Andreas Zelend
Collaborator

@elupus will do soon. Any thoughts about this: https://gist.github.com/ace20022/c9da53faefebb3d76ef5 ?
I can't assign it to a merge window (not a team member), can I :) ?

ace20022 added some commits
Andreas Zelend ace20022 [DVDInputStreamNavigator/Players] Use a struct and dvdnav_get_audio_i…
…nfo(...) to query all required audio stream info at once.

[Fixes]
- Fix stream type, e.g. "(Directors Comments)", recognition. It is stored in code_extension not in lang_extension.

- Properly set the number of channels of a dvd audio stream.

- Set the stream language of dvd audio tracks properly/consistent with other audio streams, i.e. set it to a three char code.

- Set the stream name of dvd audio tracks properly/consistent with other audio streams.
63bb4a6
Andreas Zelend ace20022 [DVDInputStreamNavigator/Players] Use a struct and dvdnav_get_stitle_…
…info(...) to query all required subtitle stream info at once.

[Fixes]
- Set the stream language of dvd subtitles properly/consistent with other streams, i.e. set it to a three char code.

- Set the stream name of dvd subtitle tracks properly/consistent with other streams; in particular don't use the language as the name.
d8b2ca8
Andreas Zelend ace20022 Make the type, e.g. "(Forced)", of a stream translatable in its name. d3722b9
Andreas Zelend ace20022 [Players] Don't assign "unknown" to the audio/subtitle stream name, l…
…eave it empty instead.
e7dfb28
Andreas Zelend ace20022 [DVDDemuxer] Don't set the language as the stream name. d54456c
Andreas Zelend ace20022 [AMLPlayer] Set the name of a stream properly/consistent with the oth…
…er players, i.e., codec name (if possible) + channels.

Don't assign "unknown" to the audio/subtitle stream name, leave it empty instead.
25b1623
Andreas Zelend ace20022 [Players] Convert the language code of a selection stream to three ch…
…ars if necessary.
bee3993
Andreas Zelend ace20022 [AMLPlayer] Convert the language code of a stream to three chars if n…
…ecessary.
d65cd9c
Andreas Zelend ace20022 [AMLPlayer] Always set the name and language fields of a subtitle/aud…
…io stream in the getInfo methods.
e71cb79
Andreas Zelend ace20022 [GUI Audio] Adapt the presentation of audio and subtitle items. The l…
…abels are built as follows:

"[language|unknown] - name" or, if name is empty, "[language/unknown]"
1d8cf16
Andreas Zelend ace20022 [Players] Set the language code instead of the full name in the GetSu…
…btitleStreamInfo methods.
089ba3a
Andreas Zelend ace20022 [DVDDemux] Add "Dolby TrueHD" and 7.1 recognition to GetStreamType. A…
…dditionally adapt the default channel string to "channel count-chs"
33b0427
Andreas Zelend ace20022 [Player] Return the language code of a stream, or its name if the lan…
…guage is not specified.
93e562f
Andreas Zelend
Collaborator

@elupus done.

Andreas Zelend
Collaborator

@elupus I replied here: https://gist.github.com/ace20022/c9da53faefebb3d76ef5 (no notifications triggered from gist...)

Andreas Zelend
Collaborator

@elupus

OK, checked it with an hexeditor in combination with ifoedit and the newer pgcedit. The correct enum is/should be:

/* The audio format */
typedef enum {
  DVD_AUDIO_FORMAT_AC3        = 0,
  DVD_AUDIO_FORMAT_UNKNOWN_1  = 1,
  DVD_AUDIO_FORMAT_MPEG       = 2,
  DVD_AUDIO_FORMAT_MPEG2_ext  = 3,
  DVD_AUDIO_FORMAT_LPCM       = 4,
  DVD_AUDIO_FORMAT_UNKNOWN_5  = 5,
  DVD_AUDIO_FORMAT_DTS        = 6,
  DVD_AUDIO_FORMAT_SDDS       = 7
} DVDAudioFormat_t;

the include comes from xbmc\cores\dvdplayer\DVDInputStreams\dvdnav\dvd_types.h . Is it sufficient to only change it there? The other files are lib\libdvd\includes\dvdnav\dvd_types.h and lib\libdvd\libdvdnav\src\dvdnav\dvd_types.h

Joakim Plate
Collaborator
Andreas Zelend
Collaborator

@elupus changed it. Which upstream is the correct one, since videolan forked the project?

Joakim Plate
Collaborator
Andreas Zelend
Collaborator

@elupus I proposed it here: http://lists.mplayerhq.hu/pipermail/dvdnav-discuss/2013-March/thread.html.
Videolan.org has no mailing list for libdvdnav...

Andreas Zelend
Collaborator

@elupus Can this one go in this merge window?

Joakim Plate
Collaborator
Deleted user ghost merged commit c3c7fd3 into from
Deleted user ghost closed this
Andreas Zelend ace20022 deleted the branch
Joakim Plate

This can cash i think. You are using a string pointer here that the Format call could easily delete before it construct the new one.

Should be:

strItem.AppendFormat(" (%i/%i)", i + 1, (int)setting.max + 1);
Joakim Plate
Collaborator

okay, will change that while investigating the other issue regarding the indices. But it might take some days, or do you think it's urgent?

Collaborator

Nah probably not. It would have given crashes directly if it was a real problem. Should be fixed thou.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 16 unique commits by 1 author.

Mar 18, 2013
Andreas Zelend ace20022 [DVDInputStreamNavigator/Players] Use a struct and dvdnav_get_audio_i…
…nfo(...) to query all required audio stream info at once.

[Fixes]
- Fix stream type, e.g. "(Directors Comments)", recognition. It is stored in code_extension not in lang_extension.

- Properly set the number of channels of a dvd audio stream.

- Set the stream language of dvd audio tracks properly/consistent with other audio streams, i.e. set it to a three char code.

- Set the stream name of dvd audio tracks properly/consistent with other audio streams.
63bb4a6
Andreas Zelend ace20022 [DVDInputStreamNavigator/Players] Use a struct and dvdnav_get_stitle_…
…info(...) to query all required subtitle stream info at once.

[Fixes]
- Set the stream language of dvd subtitles properly/consistent with other streams, i.e. set it to a three char code.

- Set the stream name of dvd subtitle tracks properly/consistent with other streams; in particular don't use the language as the name.
d8b2ca8
Andreas Zelend ace20022 Make the type, e.g. "(Forced)", of a stream translatable in its name. d3722b9
Andreas Zelend ace20022 [Players] Don't assign "unknown" to the audio/subtitle stream name, l…
…eave it empty instead.
e7dfb28
Andreas Zelend ace20022 [DVDDemuxer] Don't set the language as the stream name. d54456c
Andreas Zelend ace20022 [AMLPlayer] Set the name of a stream properly/consistent with the oth…
…er players, i.e., codec name (if possible) + channels.

Don't assign "unknown" to the audio/subtitle stream name, leave it empty instead.
25b1623
Andreas Zelend ace20022 [Players] Convert the language code of a selection stream to three ch…
…ars if necessary.
bee3993
Andreas Zelend ace20022 [AMLPlayer] Convert the language code of a stream to three chars if n…
…ecessary.
d65cd9c
Andreas Zelend ace20022 [AMLPlayer] Always set the name and language fields of a subtitle/aud…
…io stream in the getInfo methods.
e71cb79
Andreas Zelend ace20022 [GUI Audio] Adapt the presentation of audio and subtitle items. The l…
…abels are built as follows:

"[language|unknown] - name" or, if name is empty, "[language/unknown]"
1d8cf16
Andreas Zelend ace20022 [Players] Set the language code instead of the full name in the GetSu…
…btitleStreamInfo methods.
089ba3a
Andreas Zelend ace20022 [DVDDemux] Add "Dolby TrueHD" and 7.1 recognition to GetStreamType. A…
…dditionally adapt the default channel string to "channel count-chs"
33b0427
Andreas Zelend ace20022 [Player] Return the language code of a stream, or its name if the lan…
…guage is not specified.
93e562f
Mar 20, 2013
Andreas Zelend ace20022 [Fix] Correct the audio format recognition. b60f700
Andreas Zelend ace20022 [Cosmetics] Fix indentations. e0e12a7
Andreas Zelend ace20022 [Fix] Fixes dvdnav_audio_stream_format(...). Don't change the audio f…
…ormat numbers, e.g. DTS is 6 not 5, 5 is unknown.
2e171e6
This page is out of date. Refresh to see the latest.
30 language/English/strings.po
@@ -11746,3 +11746,33 @@ msgstr ""
11746 11746 msgctxt "#36042"
11747 11747 msgid "Use limited color range (16-235)"
11748 11748 msgstr ""
  11749 +
  11750 +#: xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp
  11751 +msgctxt "#37000"
  11752 +msgid "(Visually Impaired)"
  11753 +msgstr ""
  11754 +
  11755 +#: xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp
  11756 +msgctxt "#37001"
  11757 +msgid "(Directors Comments)"
  11758 +msgstr ""
  11759 +
  11760 +#: xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp
  11761 +msgctxt "#37002"
  11762 +msgid "(Directors Comments 2)"
  11763 +msgstr ""
  11764 +
  11765 +#: xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp
  11766 +msgctxt "#37011"
  11767 +msgid "(CC)"
  11768 +msgstr ""
  11769 +
  11770 +#: xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp
  11771 +msgctxt "#37012"
  11772 +msgid "(Forced)"
  11773 +msgstr ""
  11774 +
  11775 +#: xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp
  11776 +msgctxt "#37013"
  11777 +msgid "(Directors Comments)"
  11778 +msgstr ""
23 lib/libdvd/libdvdnav/src/dvdnav.c
@@ -925,27 +925,10 @@ uint16_t dvdnav_audio_stream_format(dvdnav_t *this, uint8_t stream) {
925 925 attr = vm_get_audio_attr(this->vm, stream);
926 926 pthread_mutex_unlock(&this->vm_lock);
927 927
928   - switch(attr.audio_format) {
929   - case 0:
930   - format = DVDNAV_FORMAT_AC3;
931   - break;
932   - case 2: /* MPEG-1 or MPEG-2 without extension bitstream. */
933   - case 3: /* MPEG-2 with extension bitstream. */
934   - format = DVDNAV_FORMAT_MPEGAUDIO;
935   - break;
936   - case 4:
937   - format = DVDNAV_FORMAT_LPCM;
938   - break;
939   - case 6:
940   - format = DVDNAV_FORMAT_DTS;
941   - break;
942   - case 7:
943   - format = DVDNAV_FORMAT_SDDS;
944   - break;
945   - default:
  928 + if (attr.audio_format >=0 && attr.audio_format <= 7)
  929 + format = attr.audio_format;
  930 + else
946 931 format = 0xffff;
947   - break;
948   - }
949 932
950 933 return format;
951 934 }
13 lib/libdvd/libdvdnav/src/dvdnav/dvd_types.h
@@ -161,14 +161,13 @@ typedef enum {
161 161 /* The audio format */
162 162 typedef enum {
163 163 DVD_AUDIO_FORMAT_AC3 = 0,
164   - DVD_AUDIO_FORMAT_MPEG1 = 1,
165   - DVD_AUDIO_FORMAT_MPEG1_DRC = 2,
166   - DVD_AUDIO_FORMAT_MPEG2 = 3,
167   - DVD_AUDIO_FORMAT_MPEG2_DRC = 4,
168   - DVD_AUDIO_FORMAT_LPCM = 5,
  164 + DVD_AUDIO_FORMAT_UNKNOWN_1 = 1,
  165 + DVD_AUDIO_FORMAT_MPEG = 2,
  166 + DVD_AUDIO_FORMAT_MPEG2_EXT = 3,
  167 + DVD_AUDIO_FORMAT_LPCM = 4,
  168 + DVD_AUDIO_FORMAT_UNKNOWN_5 = 5,
169 169 DVD_AUDIO_FORMAT_DTS = 6,
170   - DVD_AUDIO_FORMAT_SDDS = 7,
171   - DVD_AUDIO_FORMAT_Other = 8
  170 + DVD_AUDIO_FORMAT_SDDS = 7
172 171 } DVDAudioFormat_t;
173 172
174 173 /* Audio language extension */
16 lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h
@@ -32,11 +32,11 @@
32 32 extern "C" {
33 33 #endif
34 34
35   -# include <dvdnav/dvd_types.h>
36   -# include <dvdread/dvd_reader.h>
37   -# include <dvdread/nav_types.h>
38   -# include <dvdread/ifo_types.h> /* For vm_cmd_t */
39   -# include <dvdnav/dvdnav_events.h>
  35 +#include <dvdnav/dvd_types.h>
  36 +#include <dvdread/dvd_reader.h>
  37 +#include <dvdread/nav_types.h>
  38 +#include <dvdread/ifo_types.h> /* For vm_cmd_t */
  39 +#include <dvdnav/dvdnav_events.h>
40 40
41 41
42 42
@@ -63,12 +63,6 @@ typedef int32_t dvdnav_status_t;
63 63 #define DVDNAV_STATUS_ERR 0
64 64 #define DVDNAV_STATUS_OK 1
65 65
66   -#define DVDNAV_FORMAT_AC3 0
67   -#define DVDNAV_FORMAT_MPEGAUDIO 3
68   -#define DVDNAV_FORMAT_LPCM 4
69   -#define DVDNAV_FORMAT_DTS 5
70   -#define DVDNAV_FORMAT_SDDS 6
71   -
72 66 /*********************************************************************
73 67 * initialisation & housekeeping functions *
74 68 *********************************************************************/
23 lib/libdvd/patches/libdvdnav_correct_audio_format_enum.diff
... ... @@ -0,0 +1,23 @@
  1 +--- libdvdnav-4.2.0/src/dvdnav/dvd_types.h Wed Mar 20 08:51:10 2013
  2 ++++ lib/libdvd/libdvdnav/src/dvdnav/dvd_types.h Wed Mar 20 12:22:25 2013
  3 +@@ -161,14 +161,13 @@
  4 + /* The audio format */
  5 + typedef enum {
  6 + DVD_AUDIO_FORMAT_AC3 = 0,
  7 +- DVD_AUDIO_FORMAT_MPEG1 = 1,
  8 +- DVD_AUDIO_FORMAT_MPEG1_DRC = 2,
  9 +- DVD_AUDIO_FORMAT_MPEG2 = 3,
  10 +- DVD_AUDIO_FORMAT_MPEG2_DRC = 4,
  11 +- DVD_AUDIO_FORMAT_LPCM = 5,
  12 ++ DVD_AUDIO_FORMAT_UNKNOWN_1 = 1,
  13 ++ DVD_AUDIO_FORMAT_MPEG = 2,
  14 ++ DVD_AUDIO_FORMAT_MPEG2_EXT = 3,
  15 ++ DVD_AUDIO_FORMAT_LPCM = 4,
  16 ++ DVD_AUDIO_FORMAT_UNKNOWN_5 = 5,
  17 + DVD_AUDIO_FORMAT_DTS = 6,
  18 +- DVD_AUDIO_FORMAT_SDDS = 7,
  19 +- DVD_AUDIO_FORMAT_Other = 8
  20 ++ DVD_AUDIO_FORMAT_SDDS = 7
  21 + } DVDAudioFormat_t;
  22 +
  23 + /* Audio language extension */
33 lib/libdvd/patches/libdvdnav_correct_dvdnav_audio_stream_format.diff
... ... @@ -0,0 +1,33 @@
  1 +--- libdvdnav-4.2.0/src/dvdnav.c Wed Mar 20 11:38:53 2013
  2 ++++ lib/libdvd/libdvdnav/src/dvdnav.c Wed Mar 20 13:20:35 2013
  3 +@@ -907,27 +925,10 @@
  4 + attr = vm_get_audio_attr(this->vm, stream);
  5 + pthread_mutex_unlock(&this->vm_lock);
  6 +
  7 +- switch(attr.audio_format) {
  8 +- case 0:
  9 +- format = DVDNAV_FORMAT_AC3;
  10 +- break;
  11 +- case 2: /* MPEG-1 or MPEG-2 without extension bitstream. */
  12 +- case 3: /* MPEG-2 with extension bitstream. */
  13 +- format = DVDNAV_FORMAT_MPEGAUDIO;
  14 +- break;
  15 +- case 4:
  16 +- format = DVDNAV_FORMAT_LPCM;
  17 +- break;
  18 +- case 6:
  19 +- format = DVDNAV_FORMAT_DTS;
  20 +- break;
  21 +- case 7:
  22 +- format = DVDNAV_FORMAT_SDDS;
  23 +- break;
  24 +- default:
  25 ++ if (attr.audio_format >=0 && attr.audio_format <= 7)
  26 ++ format = attr.audio_format;
  27 ++ else
  28 + format = 0xffff;
  29 +- break;
  30 +- }
  31 +
  32 + return format;
  33 + }
15 lib/libdvd/patches/libdvdnav_remove_unneeded_defines.diff
... ... @@ -0,0 +1,15 @@
  1 +--- libdvdnav-4.2.0/src/dvdnav/dvdnav.h Wed Mar 20 11:38:52 2013
  2 ++++ lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h Wed Mar 20 13:19:13 2013
  3 +@@ -63,12 +63,6 @@
  4 + #define DVDNAV_STATUS_ERR 0
  5 + #define DVDNAV_STATUS_OK 1
  6 +
  7 +-#define DVDNAV_FORMAT_AC3 0
  8 +-#define DVDNAV_FORMAT_MPEGAUDIO 3
  9 +-#define DVDNAV_FORMAT_LPCM 4
  10 +-#define DVDNAV_FORMAT_DTS 5
  11 +-#define DVDNAV_FORMAT_SDDS 6
  12 +-
  13 + /*********************************************************************
  14 + * initialisation & housekeeping functions *
  15 + *********************************************************************/
71 xbmc/cores/amlplayer/AMLPlayer.cpp
@@ -914,24 +914,9 @@ void CAMLPlayer::GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &inf
914 914 if (index > (int)m_subtitle_streams.size() -1 || index < 0)
915 915 return;
916 916
917   - if (m_subtitle_streams[m_subtitle_index]->source == STREAM_SOURCE_NONE)
918   - {
919   - if ( m_subtitle_streams[index]->language.size())
920   - {
921   - CStdString name;
922   - g_LangCodeExpander.Lookup(name, m_subtitle_streams[index]->language);
923   - info.name = name;
924   - }
925   - else
926   - info.name = g_localizeStrings.Get(13205); // Unknown
927   - }
928   - else
929   - {
930   - if(m_subtitle_streams[m_subtitle_index]->name.length() > 0)
931   - info.name = m_subtitle_streams[m_subtitle_index]->name;
932   - else
933   - info.name = g_localizeStrings.Get(13205); // Unknown
934   - }
  917 + info.language = m_subtitle_streams[index]->language;
  918 + info.name = m_subtitle_streams[m_subtitle_index]->name;
  919 +
935 920 if (m_log_level > 5)
936 921 CLog::Log(LOGDEBUG, "CAMLPlayer::GetSubtitleName, iStream(%d)", index);
937 922 }
@@ -1105,20 +1090,36 @@ void CAMLPlayer::GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info)
1105 1090
1106 1091 info.bitrate = m_audio_streams[index]->bit_rate;
1107 1092
1108   - if ( m_audio_streams[index]->language.size())
1109   - info.language = m_audio_streams[index]->language;
  1093 + info.language = m_audio_streams[index]->language;
1110 1094
1111 1095 info.channels = m_audio_streams[index]->channel;
1112 1096
1113 1097 info.audioCodecName = AudioCodecName(m_audio_streams[index]->format);
1114 1098
1115   - info.name.Format("Undefined");
1116   -
1117   - if ( m_audio_streams[index]->language.size())
  1099 + if (info.audioCodecName.size())
  1100 + info.name = info.audioCodecName + " ";
  1101 +
  1102 + switch(info.channels)
1118 1103 {
1119   - CStdString name;
1120   - g_LangCodeExpander.Lookup( name, m_audio_streams[index]->language);
1121   - info.name = name;
  1104 + case 1:
  1105 + info.name += "Mono";
  1106 + break;
  1107 + case 2:
  1108 + info.name += "Stereo";
  1109 + break;
  1110 + case 6:
  1111 + info.name += "5.1";
  1112 + break;
  1113 + case 7:
  1114 + info.name += "6.1";
  1115 + break;
  1116 + case 8:
  1117 + info.name += "7.1";
  1118 + break;
  1119 + default:
  1120 + char temp[32];
  1121 + sprintf(temp, "%d-chs", info.channels);
  1122 + info.name += temp;
1122 1123 }
1123 1124 }
1124 1125
@@ -1929,7 +1930,16 @@ bool CAMLPlayer::WaitForFormatValid(int timeout_ms)
1929 1930 info->format = media_info.audio_info[i]->aformat;
1930 1931 #if !defined(TARGET_ANDROID)
1931 1932 if (media_info.audio_info[i]->audio_language[0] != 0)
  1933 + {
1932 1934 info->language = std::string(media_info.audio_info[i]->audio_language, 3);
  1935 +
  1936 + if (info->language.length() == 2)
  1937 + {
  1938 + CStdString lang;
  1939 + g_LangCodeExpander.ConvertToThreeCharCode(lang, info->language);
  1940 + info->language = lang;
  1941 + }
  1942 + }
1933 1943 #endif
1934 1944 m_audio_streams.push_back(info);
1935 1945 }
@@ -1953,7 +1963,16 @@ bool CAMLPlayer::WaitForFormatValid(int timeout_ms)
1953 1963 info->id = media_info.sub_info[i]->id;
1954 1964 info->type = STREAM_SUBTITLE;
1955 1965 if (media_info.sub_info[i]->sub_language && media_info.sub_info[i]->sub_language[0] != 0)
  1966 + {
1956 1967 info->language = std::string(media_info.sub_info[i]->sub_language, 3);
  1968 +
  1969 + if (info->language.length() == 2)
  1970 + {
  1971 + CStdString lang;
  1972 + g_LangCodeExpander.ConvertToThreeCharCode(lang, info->language);
  1973 + info->language = lang;
  1974 + }
  1975 + }
1957 1976 m_subtitle_streams.push_back(info);
1958 1977 }
1959 1978 m_subtitle_index = media_info.stream_info.cur_sub_index;
14 xbmc/cores/dvdplayer/DVDDemuxers/DVDDemux.cpp
@@ -20,7 +20,6 @@
20 20
21 21 #include "DVDDemux.h"
22 22 #include "DVDCodecs/DVDCodecs.h"
23   -#include "utils/LangCodeExpander.h"
24 23
25 24 void CDemuxStreamTeletext::GetStreamInfo(std::string& strInfo)
26 25 {
@@ -44,15 +43,17 @@ void CDemuxStreamAudio::GetStreamType(std::string& strInfo)
44 43 strcpy(sInfo, "DTS ");
45 44 }
46 45 else if (codec == CODEC_ID_MP2) strcpy(sInfo, "MP2 ");
  46 + else if (codec == CODEC_ID_TRUEHD) strcpy(sInfo, "Dolby TrueHD ");
47 47 else strcpy(sInfo, "");
48 48
49 49 if (iChannels == 1) strcat(sInfo, "Mono");
50 50 else if (iChannels == 2) strcat(sInfo, "Stereo");
51 51 else if (iChannels == 6) strcat(sInfo, "5.1");
  52 + else if (iChannels == 8) strcat(sInfo, "7.1");
52 53 else if (iChannels != 0)
53 54 {
54 55 char temp[32];
55   - sprintf(temp, " %d %s", iChannels, "Channels");
  56 + sprintf(temp, " %d%s", iChannels, "-chs");
56 57 strcat(sInfo, temp);
57 58 }
58 59 strInfo = sInfo;
@@ -168,14 +169,7 @@ CDemuxStreamTeletext* CDVDDemux::GetStreamFromTeletextId(int iTeletextIndex)
168 169
169 170 void CDemuxStream::GetStreamName( std::string& strInfo )
170 171 {
171   - if( language[0] == 0 )
172   - strInfo = "";
173   - else
174   - {
175   - CStdString name;
176   - g_LangCodeExpander.Lookup( name, language );
177   - strInfo = name;
178   - }
  172 + strInfo = "";
179 173 }
180 174
181 175 AVDiscard CDemuxStream::GetDiscard()
195 xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.cpp
@@ -27,6 +27,8 @@
27 27 #include "utils/log.h"
28 28 #include "guilib/Geometry.h"
29 29 #include "utils/URIUtils.h"
  30 +#include "utils/StringUtils.h"
  31 +#include "guilib/LocalizeStrings.h"
30 32 #if defined(TARGET_DARWIN)
31 33 #include "osx/CocoaInterface.h"
32 34 #endif
@@ -822,52 +824,61 @@ int CDVDInputStreamNavigator::GetActiveSubtitleStream()
822 824 return activeStream;
823 825 }
824 826
825   -std::string CDVDInputStreamNavigator::GetSubtitleStreamLanguage(int iId)
  827 +bool CDVDInputStreamNavigator::GetSubtitleStreamInfo(const int iId, DVDNavStreamInfo &info)
826 828 {
827   - if (!m_dvdnav) return NULL;
828   -
829   - CStdString strLanguage;
  829 + if (!m_dvdnav) return false;
830 830
831   - subp_attr_t subp_attributes;
832 831 int streamId = ConvertSubtitleStreamId_XBMCToExternal(iId);
  832 + subp_attr_t subp_attributes;
  833 +
833 834 if( m_dll.dvdnav_get_stitle_info(m_dvdnav, streamId, &subp_attributes) == DVDNAV_STATUS_OK )
834 835 {
  836 + SetSubtitleStreamName(info, subp_attributes);
835 837
836   - if (subp_attributes.type == DVD_SUBPICTURE_TYPE_Language ||
837   - subp_attributes.type == DVD_SUBPICTURE_TYPE_NotSpecified)
838   - {
839   - if (!g_LangCodeExpander.Lookup(strLanguage, subp_attributes.lang_code)) strLanguage = "Unknown";
  838 + char lang[3];
  839 + lang[2] = 0;
  840 + lang[1] = (subp_attributes.lang_code & 255);
  841 + lang[0] = (subp_attributes.lang_code >> 8) & 255;
840 842
841   - switch (subp_attributes.lang_extension)
842   - {
843   - case DVD_SUBPICTURE_LANG_EXT_NotSpecified:
844   - case DVD_SUBPICTURE_LANG_EXT_NormalCaptions:
845   - case DVD_SUBPICTURE_LANG_EXT_BigCaptions:
846   - case DVD_SUBPICTURE_LANG_EXT_ChildrensCaptions:
847   - break;
  843 + CStdString temp;
  844 + g_LangCodeExpander.ConvertToThreeCharCode(temp, lang);
  845 + info.language = temp;
848 846
849   - case DVD_SUBPICTURE_LANG_EXT_NormalCC:
850   - case DVD_SUBPICTURE_LANG_EXT_BigCC:
851   - case DVD_SUBPICTURE_LANG_EXT_ChildrensCC:
852   - strLanguage+= " (CC)";
853   - break;
854   - case DVD_SUBPICTURE_LANG_EXT_Forced:
855   - strLanguage+= " (Forced)";
856   - break;
857   - case DVD_SUBPICTURE_LANG_EXT_NormalDirectorsComments:
858   - case DVD_SUBPICTURE_LANG_EXT_BigDirectorsComments:
859   - case DVD_SUBPICTURE_LANG_EXT_ChildrensDirectorsComments:
860   - strLanguage+= " (Directors Comments)";
861   - break;
862   - }
863   - }
864   - else
  847 + return true;
  848 + }
  849 + return false;
  850 +}
  851 +
  852 +void CDVDInputStreamNavigator::SetSubtitleStreamName(DVDNavStreamInfo &info, const subp_attr_t subp_attributes)
  853 +{
  854 + if (subp_attributes.type == DVD_SUBPICTURE_TYPE_Language ||
  855 + subp_attributes.type == DVD_SUBPICTURE_TYPE_NotSpecified)
  856 + {
  857 + switch (subp_attributes.lang_extension)
865 858 {
866   - strLanguage = "Unknown";
  859 + case DVD_SUBPICTURE_LANG_EXT_NotSpecified:
  860 + case DVD_SUBPICTURE_LANG_EXT_NormalCaptions:
  861 + case DVD_SUBPICTURE_LANG_EXT_BigCaptions:
  862 + case DVD_SUBPICTURE_LANG_EXT_ChildrensCaptions:
  863 + break;
  864 +
  865 + case DVD_SUBPICTURE_LANG_EXT_NormalCC:
  866 + case DVD_SUBPICTURE_LANG_EXT_BigCC:
  867 + case DVD_SUBPICTURE_LANG_EXT_ChildrensCC:
  868 + info.name += g_localizeStrings.Get(37011);
  869 + break;
  870 + case DVD_SUBPICTURE_LANG_EXT_Forced:
  871 + info.name += g_localizeStrings.Get(37012);
  872 + break;
  873 + case DVD_SUBPICTURE_LANG_EXT_NormalDirectorsComments:
  874 + case DVD_SUBPICTURE_LANG_EXT_BigDirectorsComments:
  875 + case DVD_SUBPICTURE_LANG_EXT_ChildrensDirectorsComments:
  876 + info.name += g_localizeStrings.Get(37013);
  877 + break;
  878 + default:
  879 + break;
867 880 }
868 881 }
869   -
870   - return strLanguage;
871 882 }
872 883
873 884 int CDVDInputStreamNavigator::GetSubTitleStreamCount()
@@ -925,37 +936,105 @@ int CDVDInputStreamNavigator::GetActiveAudioStream()
925 936 return activeStream;
926 937 }
927 938
928   -std::string CDVDInputStreamNavigator::GetAudioStreamLanguage(int iId)
  939 +void CDVDInputStreamNavigator::SetAudioStreamName(DVDNavStreamInfo &info, const audio_attr_t audio_attributes)
929 940 {
930   - if (!m_dvdnav) return NULL;
  941 + switch( audio_attributes.code_extension )
  942 + {
  943 + case DVD_AUDIO_LANG_EXT_VisuallyImpaired:
  944 + info.name = g_localizeStrings.Get(37000);
  945 + break;
  946 + case DVD_AUDIO_LANG_EXT_DirectorsComments1:
  947 + info.name = g_localizeStrings.Get(37001);
  948 + break;
  949 + case DVD_AUDIO_LANG_EXT_DirectorsComments2:
  950 + info.name = g_localizeStrings.Get(37002);
  951 + break;
  952 + case DVD_AUDIO_LANG_EXT_NotSpecified:
  953 + case DVD_AUDIO_LANG_EXT_NormalCaptions:
  954 + default:
  955 + break;
  956 + }
931 957
932   - CStdString strLanguage;
  958 + switch(audio_attributes.audio_format)
  959 + {
  960 + case DVD_AUDIO_FORMAT_AC3:
  961 + info.name += " AC3";
  962 + break;
  963 + case DVD_AUDIO_FORMAT_UNKNOWN_1:
  964 + info.name += " UNKNOWN #1";
  965 + break;
  966 + case DVD_AUDIO_FORMAT_MPEG:
  967 + info.name += " MPEG AUDIO";
  968 + break;
  969 + case DVD_AUDIO_FORMAT_MPEG2_EXT:
  970 + info.name += " MP2 Ext.";
  971 + break;
  972 + case DVD_AUDIO_FORMAT_LPCM:
  973 + info.name += " LPCM";
  974 + break;
  975 + case DVD_AUDIO_FORMAT_UNKNOWN_5:
  976 + info.name += " UNKNOWN #5";
  977 + break;
  978 + case DVD_AUDIO_FORMAT_DTS:
  979 + info.name += " DTS";
  980 + break;
  981 + case DVD_AUDIO_FORMAT_SDDS:
  982 + info.name += " SDDS";
  983 + break;
  984 + default:
  985 + info.name += " Other";
  986 + break;
  987 + }
  988 +
  989 + switch(audio_attributes.channels + 1)
  990 + {
  991 + case 1:
  992 + info.name += " Mono";
  993 + break;
  994 + case 2:
  995 + info.name += " Stereo";
  996 + break;
  997 + case 6:
  998 + info.name += " 5.1";
  999 + break;
  1000 + case 7:
  1001 + info.name += " 6.1";
  1002 + break;
  1003 + default:
  1004 + char temp[32];
  1005 + sprintf(temp, " %d-chs", audio_attributes.channels + 1);
  1006 + info.name += temp;
  1007 + }
  1008 +
  1009 + StringUtils::TrimLeft(info.name);
  1010 +
  1011 +}
  1012 +
  1013 +bool CDVDInputStreamNavigator::GetAudioStreamInfo(const int iId, DVDNavStreamInfo &info)
  1014 +{
  1015 + if (!m_dvdnav) return false;
933 1016
934   - audio_attr_t audio_attributes;
935 1017 int streamId = ConvertAudioStreamId_XBMCToExternal(iId);
  1018 + audio_attr_t audio_attributes;
  1019 +
936 1020 if( m_dll.dvdnav_get_audio_info(m_dvdnav, streamId, &audio_attributes) == DVDNAV_STATUS_OK )
937 1021 {
938   - if (!g_LangCodeExpander.Lookup(strLanguage, audio_attributes.lang_code)) strLanguage = "Unknown";
  1022 + SetAudioStreamName(info, audio_attributes);
939 1023
940   - switch( audio_attributes.lang_extension )
941   - {
942   - case DVD_AUDIO_LANG_EXT_VisuallyImpaired:
943   - strLanguage+= " (Visually Impaired)";
944   - break;
945   - case DVD_AUDIO_LANG_EXT_DirectorsComments1:
946   - strLanguage+= " (Directors Comments)";
947   - break;
948   - case DVD_AUDIO_LANG_EXT_DirectorsComments2:
949   - strLanguage+= " (Directors Comments 2)";
950   - break;
951   - case DVD_AUDIO_LANG_EXT_NotSpecified:
952   - case DVD_AUDIO_LANG_EXT_NormalCaptions:
953   - default:
954   - break;
955   - }
956   - }
  1024 + char lang[3];
  1025 + lang[2] = 0;
  1026 + lang[1] = (audio_attributes.lang_code & 255);
  1027 + lang[0] = (audio_attributes.lang_code >> 8) & 255;
  1028 +
  1029 + CStdString temp;
  1030 + g_LangCodeExpander.ConvertToThreeCharCode(temp, lang);
  1031 + info.language = temp;
  1032 +
  1033 + info.channels = audio_attributes.channels + 1;
957 1034
958   - return strLanguage;
  1035 + return true;
  1036 + }
  1037 + return false;
959 1038 }
960 1039
961 1040 int CDVDInputStreamNavigator::GetAudioStreamCount()
16 xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamNavigator.h
@@ -44,6 +44,15 @@ class CDVDOverlayPicture;
44 44
45 45 struct dvdnav_s;
46 46
  47 +struct DVDNavStreamInfo
  48 +{
  49 + std::string name;
  50 + std::string language;
  51 + int channels;
  52 +
  53 + DVDNavStreamInfo() : channels(0) {}
  54 +};
  55 +
47 56 class DVDNavResult
48 57 {
49 58 public:
@@ -96,17 +105,17 @@ class CDVDInputStreamNavigator
96 105 bool IsInMenu() { return m_bInMenu; }
97 106
98 107 int GetActiveSubtitleStream();
99   - std::string GetSubtitleStreamLanguage(int iId);
100 108 int GetSubTitleStreamCount();
  109 + bool GetSubtitleStreamInfo(const int iId, DVDNavStreamInfo &info);
101 110
102 111 bool SetActiveSubtitleStream(int iId);
103 112 void EnableSubtitleStream(bool bEnable);
104 113 bool IsSubtitleStreamEnabled();
105 114
106 115 int GetActiveAudioStream();
107   - std::string GetAudioStreamLanguage(int iId);
108 116 int GetAudioStreamCount();
109 117 bool SetActiveAudioStream(int iId);
  118 + bool GetAudioStreamInfo(const int iId, DVDNavStreamInfo &info);
110 119
111 120 bool GetNavigatorState(std::string &xmlstate);
112 121 bool SetNavigatorState(std::string &xmlstate);
@@ -145,6 +154,9 @@ class CDVDInputStreamNavigator
145 154 int ConvertSubtitleStreamId_XBMCToExternal(int id);
146 155 int ConvertSubtitleStreamId_ExternalToXBMC(int id);
147 156
  157 + void SetAudioStreamName(DVDNavStreamInfo &info, const audio_attr_t audio_attributes);
  158 + void SetSubtitleStreamName(DVDNavStreamInfo &info, const subp_attr_t subp_attributes);
  159 +
148 160 DllDvdNav m_dll;
149 161 bool m_bCheckButtons;
150 162 bool m_bEOF;
17 xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvd_types.h
@@ -163,15 +163,14 @@ typedef enum {
163 163
164 164 /* The audio format */
165 165 typedef enum {
166   - DVD_AUDIO_FORMAT_AC3 = 0,
167   - DVD_AUDIO_FORMAT_MPEG1 = 1,
168   - DVD_AUDIO_FORMAT_MPEG1_DRC = 2,
169   - DVD_AUDIO_FORMAT_MPEG2 = 3,
170   - DVD_AUDIO_FORMAT_MPEG2_DRC = 4,
171   - DVD_AUDIO_FORMAT_LPCM = 5,
172   - DVD_AUDIO_FORMAT_DTS = 6,
173   - DVD_AUDIO_FORMAT_SDDS = 7,
174   - DVD_AUDIO_FORMAT_Other = 8
  166 + DVD_AUDIO_FORMAT_AC3 = 0,
  167 + DVD_AUDIO_FORMAT_UNKNOWN_1 = 1,
  168 + DVD_AUDIO_FORMAT_MPEG = 2,
  169 + DVD_AUDIO_FORMAT_MPEG2_EXT = 3,
  170 + DVD_AUDIO_FORMAT_LPCM = 4,
  171 + DVD_AUDIO_FORMAT_UNKNOWN_5 = 5,
  172 + DVD_AUDIO_FORMAT_DTS = 6,
  173 + DVD_AUDIO_FORMAT_SDDS = 7
175 174 } DVDAudioFormat_t;
176 175
177 176 /* Audio language extension */
32 xbmc/cores/dvdplayer/DVDPlayer.cpp
@@ -318,10 +318,14 @@ void CSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer)
318 318 s.source = source;
319 319 s.type = STREAM_AUDIO;
320 320 s.id = i;
321   - s.name = nav->GetAudioStreamLanguage(i);
322 321 s.flags = CDemuxStream::FLAG_NONE;
323 322 s.filename = filename;
324   - s.channels = 0;
  323 +
  324 + DVDNavStreamInfo info;
  325 + nav->GetAudioStreamInfo(i, info);
  326 + s.name = info.name;
  327 + s.language = info.language;
  328 + s.channels = info.channels;
325 329 Update(s);
326 330 }
327 331
@@ -332,10 +336,14 @@ void CSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer)
332 336 s.source = source;
333 337 s.type = STREAM_SUBTITLE;
334 338 s.id = i;
335   - s.name = nav->GetSubtitleStreamLanguage(i);
336 339 s.flags = CDemuxStream::FLAG_NONE;
337 340 s.filename = filename;
338 341 s.channels = 0;
  342 +
  343 + DVDNavStreamInfo info;
  344 + nav->GetSubtitleStreamInfo(i, info);
  345 + s.name = info.name;
  346 + s.language = info.language;
339 347 Update(s);
340 348 }
341 349 }
@@ -361,6 +369,14 @@ void CSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer)
361 369 s.type = stream->type;
362 370 s.id = stream->iId;
363 371 s.language = stream->language;
  372 +
  373 + if (s.language.length() == 2)
  374 + {
  375 + CStdString lang;
  376 + g_LangCodeExpander.ConvertToThreeCharCode(lang, stream->language);
  377 + s.language = lang;
  378 + }
  379 +
364 380 s.flags = stream->flags;
365 381 s.filename = demuxer->GetFileName();
366 382 stream->GetStreamName(s.name);
@@ -2691,17 +2707,11 @@ void CDVDPlayer::GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &inf
2691 2707 SelectionStream& s = m_SelectionStreams.Get(STREAM_SUBTITLE, index);
2692 2708 if(s.name.length() > 0)
2693 2709 info.name = s.name;
2694   - else
2695   - info.name = g_localizeStrings.Get(13205); // Unknown
2696 2710
2697 2711 if(s.type == STREAM_NONE)
2698 2712 info.name += "(Invalid)";
2699 2713
2700   - CStdString strStreamLang;
2701   - if (!g_LangCodeExpander.Lookup(strStreamLang, s.language))
2702   - info.language = g_localizeStrings.Get(13205); // Unknown
2703   - else
2704   - info.language = strStreamLang;
  2714 + info.language = s.language;
2705 2715 }
2706 2716
2707 2717 void CDVDPlayer::SetSubtitle(int iStream)
@@ -3835,8 +3845,6 @@ void CDVDPlayer::GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info)
3835 3845
3836 3846 if(s.name.length() > 0)
3837 3847 info.name = s.name;
3838   - else
3839   - info.name += "Unknown";
3840 3848
3841 3849 if(s.type == STREAM_NONE)
3842 3850 info.name += " (Invalid)";
32 xbmc/cores/omxplayer/OMXPlayer.cpp
@@ -318,10 +318,14 @@ void COMXSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer)
318 318 s.source = source;
319 319 s.type = STREAM_AUDIO;
320 320 s.id = i;
321   - s.name = nav->GetAudioStreamLanguage(i);
322 321 s.flags = CDemuxStream::FLAG_NONE;
323 322 s.filename = filename;
324   - s.channels = 0;
  323 +
  324 + DVDNavStreamInfo info;
  325 + nav->GetAudioStreamInfo(i, info);
  326 + s.name = info.name;
  327 + s.language = info.language;
  328 + s.channels = info.channels;
325 329 Update(s);
326 330 }
327 331
@@ -332,10 +336,14 @@ void COMXSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer)
332 336 s.source = source;
333 337 s.type = STREAM_SUBTITLE;
334 338 s.id = i;
335   - s.name = nav->GetSubtitleStreamLanguage(i);
336 339 s.flags = CDemuxStream::FLAG_NONE;
337 340 s.filename = filename;
338 341 s.channels = 0;
  342 +
  343 + DVDNavStreamInfo info;
  344 + nav->GetSubtitleStreamInfo(i, info);
  345 + s.name = info.name;
  346 + s.language = info.language;
339 347 Update(s);
340 348 }
341 349 }
@@ -361,6 +369,14 @@ void COMXSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer)
361 369 s.type = stream->type;
362 370 s.id = stream->iId;
363 371 s.language = stream->language;
  372 +
  373 + if (s.language.length() == 2)
  374 + {
  375 + CStdString lang;
  376 + g_LangCodeExpander.ConvertToThreeCharCode(lang, stream->language);
  377 + s.language = lang;
  378 + }
  379 +
364 380 s.flags = stream->flags;
365 381 s.filename = demuxer->GetFileName();
366 382 stream->GetStreamName(s.name);
@@ -2692,17 +2708,11 @@ void COMXPlayer::GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &inf
2692 2708 OMXSelectionStream& s = m_SelectionStreams.Get(STREAM_SUBTITLE, index);
2693 2709 if(s.name.length() > 0)
2694 2710 info.name = s.name;
2695   - else
2696   - info.name = g_localizeStrings.Get(13205); // Unknown
2697 2711
2698 2712 if(s.type == STREAM_NONE)
2699 2713 info.name += "(Invalid)";
2700 2714
2701   - CStdString strStreamLang;
2702   - if (!g_LangCodeExpander.Lookup(strStreamLang, s.language))
2703   - info.language = g_localizeStrings.Get(13205); // Unknown
2704   - else
2705   - info.language = strStreamLang;
  2715 + info.language = s.language;
2706 2716 }
2707 2717
2708 2718 void COMXPlayer::SetSubtitle(int iStream)
@@ -3789,8 +3799,6 @@ void COMXPlayer::GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info)
3789 3799
3790 3800 if(s.name.length() > 0)
3791 3801 info.name = s.name;
3792   - else
3793   - info.name += "Unknown";
3794 3802
3795 3803 if(s.type == STREAM_NONE)
3796 3804 info.name += " (Invalid)";
26 xbmc/interfaces/legacy/Player.cpp
@@ -28,7 +28,6 @@
28 28 #include "ApplicationMessenger.h"
29 29 #include "GUIInfoManager.h"
30 30 #include "AddonUtils.h"
31   -#include "utils/LangCodeExpander.h"
32 31 #include "utils/log.h"
33 32 #include "cores/IPlayer.h"
34 33
@@ -396,11 +395,11 @@ namespace XBMCAddon
396 395 {
397 396 SPlayerSubtitleStreamInfo info;
398 397 g_application.m_pPlayer->GetSubtitleStreamInfo(g_application.m_pPlayer->GetSubtitle(), info);
399   - CStdString strName = info.name;
400 398
401   - if (strName == "Unknown(Invalid)")
402   - strName = "";
403   - return strName;
  399 + if (info.language.length() > 0)
  400 + return info.language;
  401 + else
  402 + return info.name;
404 403 }
405 404
406 405 return NULL;
@@ -428,10 +427,10 @@ namespace XBMCAddon
428 427 SPlayerSubtitleStreamInfo info;
429 428 g_application.m_pPlayer->GetSubtitleStreamInfo(iStream, info);
430 429
431   - CStdString FullLang;
432   - if (!g_LangCodeExpander.Lookup(FullLang, info.name))
433   - FullLang = info.name;
434   - (*ret)[iStream] = FullLang;
  430 + if (info.language.length() > 0)
  431 + (*ret)[iStream] = info.language;
  432 + else
  433 + (*ret)[iStream] = info.name;
435 434 }
436 435 return ret;
437 436 }
@@ -463,11 +462,10 @@ namespace XBMCAddon
463 462 SPlayerAudioStreamInfo info;
464 463 g_application.m_pPlayer->GetAudioStreamInfo(iStream, info);
465 464
466   - CStdString FullLang;
467   - g_LangCodeExpander.Lookup(FullLang, info.language);
468   - if (FullLang.IsEmpty())
469   - FullLang = info.name;
470   - (*ret)[iStream] = FullLang;
  465 + if (info.language.length() > 0)
  466 + (*ret)[iStream] = info.language;
  467 + else
  468 + (*ret)[iStream] = info.name;
471 469 }
472 470 return ret;
473 471 }
29 xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp
@@ -38,6 +38,7 @@
38 38 #include "pvr/PVRManager.h"
39 39 #include "cores/AudioEngine/Utils/AEUtil.h"
40 40 #include "cores/IPlayer.h"
  41 +#include "utils/LangCodeExpander.h"
41 42
42 43 using namespace std;
43 44 using namespace XFILE;
@@ -162,16 +163,20 @@ void CGUIDialogAudioSubtitleSettings::AddAudioStreams(unsigned int id)
162 163 for (int i = 0; i <= setting.max; ++i)
163 164 {
164 165 CStdString strItem;
165   - CStdString strName;
  166 + CStdString strLanguage;
166 167
167 168 SPlayerAudioStreamInfo info;
168 169 g_application.m_pPlayer->GetAudioStreamInfo(i, info);
169 170
170   - strName = info.name;
171   - if (strName.length() == 0)
172   - strName = "Unnamed";
  171 + if (!g_LangCodeExpander.Lookup(strLanguage, info.language))
  172 + strLanguage = g_localizeStrings.Get(13205); // Unknown
173 173
174   - strItem.Format("%s (%i/%i)", strName.c_str(), i + 1, (int)setting.max + 1);
  174 + if (info.name.length() == 0)
  175 + strItem = strLanguage;
  176 + else
  177 + strItem.Format("%s - %s", strLanguage.c_str(), info.name.c_str());
  178 +
  179 + strItem.Format("%s (%i/%i)", strItem.c_str(), i + 1, (int)setting.max + 1);
175 180 setting.entry.push_back(make_pair(setting.entry.size(), strItem));
176 181 }
177 182
@@ -207,15 +212,17 @@ void CGUIDialogAudioSubtitleSettings::AddSubtitleStreams(unsigned int id)
207 212 g_application.m_pPlayer->GetSubtitleStreamInfo(i, info);
208 213
209 214 CStdString strItem;
210   - CStdString strName = info.name;
  215 + CStdString strLanguage;
211 216
212   - if (strName.length() == 0)
213   - strName = "Unnamed";
  217 + if (!g_LangCodeExpander.Lookup(strLanguage, info.language))
  218 + strLanguage = g_localizeStrings.Get(13205); // Unknown
214 219