Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
b8774b3c
Commit
b8774b3c
authored
Feb 09, 2012
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TS mux: simplify language setup
parent
9229335a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
56 deletions
+30
-56
modules/mux/mpeg/ts.c
modules/mux/mpeg/ts.c
+30
-56
No files found.
modules/mux/mpeg/ts.c
View file @
b8774b3c
...
@@ -903,6 +903,26 @@ static int Control( sout_mux_t *p_mux, int i_query, va_list args )
...
@@ -903,6 +903,26 @@ static int Control( sout_mux_t *p_mux, int i_query, va_list args )
}
}
}
}
/* returns a pointer to a valid string, with length 0 or 3 */
static
const
char
*
GetIso639_2LangCode
(
const
char
*
lang
)
{
const
iso639_lang_t
*
pl
;
if
(
strlen
(
lang
)
==
2
)
{
pl
=
GetLang_1
(
lang
);
}
else
{
pl
=
GetLang_2B
(
lang
);
/* try native code first */
if
(
!*
pl
->
psz_iso639_2T
)
pl
=
GetLang_2T
(
lang
);
/* else fallback to english code */
}
return
pl
->
psz_iso639_2T
;
/* returns the english code */
}
/*****************************************************************************
/*****************************************************************************
* AddStream: called for each stream addition
* AddStream: called for each stream addition
*****************************************************************************/
*****************************************************************************/
...
@@ -1029,72 +1049,26 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
...
@@ -1029,72 +1049,26 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
}
}
p_stream
->
i_langs
=
1
+
p_input
->
p_fmt
->
i_extra_languages
;
p_stream
->
i_langs
=
1
+
p_input
->
p_fmt
->
i_extra_languages
;
p_stream
->
lang
=
malloc
(
p_stream
->
i_langs
*
3
);
p_stream
->
lang
=
calloc
(
1
,
p_stream
->
i_langs
*
3
);
if
(
!
p_stream
->
lang
)
if
(
!
p_stream
->
lang
)
{
{
free
(
p_stream
);
free
(
p_stream
);
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
}
}
p_stream
->
lang
[
0
]
=
for
(
int
i
=
0
;
i
<
p_stream
->
i_langs
;
i
++
)
{
p_stream
->
lang
[
1
]
=
char
*
lang
=
(
i
==
0
)
p_stream
->
lang
[
2
]
=
'\0'
;
?
p_input
->
p_fmt
->
psz_language
if
(
p_input
->
p_fmt
->
psz_language
)
:
p_input
->
p_fmt
->
p_extra_languages
[
i
-
1
].
psz_language
;
{
char
*
psz
=
p_input
->
p_fmt
->
psz_language
;
const
iso639_lang_t
*
pl
=
NULL
;
if
(
strlen
(
psz
)
==
2
)
{
pl
=
GetLang_1
(
psz
);
}
else
if
(
strlen
(
psz
)
==
3
)
{
pl
=
GetLang_2B
(
psz
);
if
(
!
strcmp
(
pl
->
psz_iso639_1
,
"??"
)
)
{
pl
=
GetLang_2T
(
psz
);
}
}
if
(
pl
&&
strcmp
(
pl
->
psz_iso639_1
,
"??"
)
)
{
p_stream
->
lang
[
0
]
=
pl
->
psz_iso639_2T
[
0
];
p_stream
->
lang
[
1
]
=
pl
->
psz_iso639_2T
[
1
];
p_stream
->
lang
[
2
]
=
pl
->
psz_iso639_2T
[
2
];
msg_Dbg
(
p_mux
,
" - lang=%c%c%c"
,
if
(
!
lang
)
p_stream
->
lang
[
0
],
p_stream
->
lang
[
1
],
p_stream
->
lang
[
2
]
);
}
}
for
(
int
i
=
1
;
i
<
p_stream
->
i_langs
;
i
++
)
{
char
*
psz
=
p_input
->
p_fmt
->
p_extra_languages
[
i
-
1
].
psz_language
;
if
(
!
psz
)
continue
;
continue
;
const
iso639_lang_t
*
pl
=
NULL
;
const
char
*
code
=
GetIso639_2LangCode
(
lang
);
if
(
*
code
)
if
(
strlen
(
psz
)
==
2
)
{
{
pl
=
GetLang_1
(
psz
);
memcpy
(
&
p_stream
->
lang
[
i
*
3
],
code
,
3
);
}
msg_Dbg
(
p_mux
,
" - lang=%3.3s"
,
&
p_stream
->
lang
[
i
*
3
]
);
else
if
(
strlen
(
psz
)
==
3
)
{
pl
=
GetLang_2B
(
psz
);
if
(
!
strcmp
(
pl
->
psz_iso639_1
,
"??"
)
)
{
pl
=
GetLang_2T
(
psz
);
}
}
if
(
pl
&&
strcmp
(
pl
->
psz_iso639_1
,
"??"
)
)
{
p_stream
->
lang
[
i
*
3
+
0
]
=
pl
->
psz_iso639_2T
[
0
];
p_stream
->
lang
[
i
*
3
+
1
]
=
pl
->
psz_iso639_2T
[
1
];
p_stream
->
lang
[
i
*
3
+
2
]
=
pl
->
psz_iso639_2T
[
2
];
msg_Dbg
(
p_mux
,
" - lang=%c%c%c"
,
p_stream
->
lang
[
i
*
3
+
0
],
p_stream
->
lang
[
i
*
3
+
1
],
p_stream
->
lang
[
i
*
3
+
2
]
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment