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
0880b6a6
Commit
0880b6a6
authored
Jan 20, 2011
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a setlang submodule to setid
Work based on Christophe Massiot setlang module, merged by /me
parent
d4e913a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
24 deletions
+96
-24
modules/stream_out/setid.c
modules/stream_out/setid.c
+96
-24
No files found.
modules/stream_out/setid.c
View file @
0880b6a6
/*****************************************************************************
* setid.c: set ID on a stream
* setid.c: set ID
/lang
on a stream
*****************************************************************************
* Copyright (C) 2009 VideoLAN and AUTHORS
* Copyright (C) 2009
-2011
VideoLAN and AUTHORS
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -46,45 +46,69 @@
#define NEWID_LONGTEXT N_( \
"Specify an new identifier integer for this elementary stream" )
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
#define LANG_TEXT N_("Language")
#define LANG_LONGTEXT N_( \
"Specify an ISO-639 code (three characters) for this elementary stream" )
#define SOUT_CFG_PREFIX "sout-setid-"
static
int
OpenId
(
vlc_object_t
*
);
static
int
OpenLang
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
#define SOUT_CFG_PREFIX_ID "sout-setid-"
#define SOUT_CFG_PREFIX_LANG "sout-setlang-"
vlc_module_begin
()
set_shortname
(
_
(
"setid"
))
set_description
(
_
(
"Automatically add/delete input streams"
))
set_capability
(
"sout stream"
,
50
)
add_shortcut
(
"setid"
)
set_callbacks
(
Open
,
Close
)
add_integer
(
SOUT_CFG_PREFIX
"id"
,
0
,
ID_TEXT
,
ID_LONGTEXT
,
false
)
add_integer
(
SOUT_CFG_PREFIX
"new-id"
,
0
,
NEWID_TEXT
,
NEWID_LONGTEXT
,
set_callbacks
(
OpenId
,
Close
)
add_integer
(
SOUT_CFG_PREFIX_ID
"id"
,
0
,
ID_TEXT
,
ID_LONGTEXT
,
false
)
add_integer
(
SOUT_CFG_PREFIX_ID
"new-id"
,
0
,
NEWID_TEXT
,
NEWID_LONGTEXT
,
false
)
add_submodule
()
set_section
(
N_
(
"setlang"
),
NULL
)
set_shortname
(
_
(
"setlang"
))
set_description
(
_
(
"Automatically add/delete input streams"
))
set_capability
(
"sout stream"
,
50
)
add_shortcut
(
"setlang"
);
set_callbacks
(
OpenLang
,
Close
)
add_integer
(
SOUT_CFG_PREFIX_LANG
"id"
,
0
,
ID_TEXT
,
ID_LONGTEXT
,
false
)
add_string
(
SOUT_CFG_PREFIX_LANG
"lang"
,
"eng"
,
LANG_TEXT
,
LANG_LONGTEXT
,
false
);
vlc_module_end
()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static
const
char
*
ppsz_sout_options
[]
=
{
static
const
char
*
ppsz_sout_options
_id
[]
=
{
"id"
,
"new-id"
,
NULL
};
static
sout_stream_id_t
*
Add
(
sout_stream_t
*
,
es_format_t
*
);
static
int
Del
(
sout_stream_t
*
,
sout_stream_id_t
*
);
static
int
Send
(
sout_stream_t
*
,
sout_stream_id_t
*
,
block_t
*
);
static
const
char
*
ppsz_sout_options_lang
[]
=
{
"id"
,
"lang"
,
NULL
};
static
sout_stream_id_t
*
AddId
(
sout_stream_t
*
,
es_format_t
*
);
static
sout_stream_id_t
*
AddLang
(
sout_stream_t
*
,
es_format_t
*
);
static
int
Del
(
sout_stream_t
*
,
sout_stream_id_t
*
);
static
int
Send
(
sout_stream_t
*
,
sout_stream_id_t
*
,
block_t
*
);
struct
sout_stream_sys_t
{
sout_stream_t
*
p_out
;
int
i_id
,
i_new_id
;
sout_stream_t
*
p_out
;
int
i_id
;
int
i_new_id
;
char
*
psz_language
;
};
/*****************************************************************************
* Open:
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
p_this
)
static
int
Open
Common
(
vlc_object_t
*
p_this
)
{
sout_stream_t
*
p_stream
=
(
sout_stream_t
*
)
p_this
;
sout_stream_sys_t
*
p_sys
;
...
...
@@ -100,13 +124,6 @@ static int Open( vlc_object_t *p_this )
return
VLC_EGENERIC
;
}
config_ChainParse
(
p_stream
,
SOUT_CFG_PREFIX
,
ppsz_sout_options
,
p_stream
->
p_cfg
);
p_sys
->
i_id
=
var_GetInteger
(
p_stream
,
SOUT_CFG_PREFIX
"id"
);
p_sys
->
i_new_id
=
var_GetInteger
(
p_stream
,
SOUT_CFG_PREFIX
"new-id"
);
p_stream
->
pf_add
=
Add
;
p_stream
->
pf_del
=
Del
;
p_stream
->
pf_send
=
Send
;
...
...
@@ -115,6 +132,46 @@ static int Open( vlc_object_t *p_this )
return
VLC_SUCCESS
;
}
static
int
OpenId
(
vlc_object_t
*
p_this
)
{
int
i_ret
=
OpenCommon
(
p_this
);
if
(
i_ret
!=
VLC_SUCCESS
)
return
i_ret
;
sout_stream_t
*
p_stream
=
(
sout_stream_t
*
)
p_this
;
p_stream
->
p_sys
->
i_id
=
var_GetInteger
(
p_stream
,
SOUT_CFG_PREFIX_ID
"id"
);
p_stream
->
p_sys
->
i_new_id
=
var_GetInteger
(
p_stream
,
SOUT_CFG_PREFIX_ID
"new-id"
);
p_stream
->
p_sys
->
psz_language
=
NULL
;
config_ChainParse
(
p_stream
,
SOUT_CFG_PREFIX_ID
,
ppsz_sout_options_id
,
p_stream
->
p_cfg
);
p_stream
->
pf_add
=
AddId
;
return
VLC_SUCCESS
;
}
static
int
OpenLang
(
vlc_object_t
*
p_this
)
{
int
i_ret
=
OpenCommon
(
p_this
);
if
(
i_ret
!=
VLC_SUCCESS
)
return
i_ret
;
sout_stream_t
*
p_stream
=
(
sout_stream_t
*
)
p_this
;
p_stream
->
p_sys
->
i_id
=
var_GetInteger
(
p_stream
,
SOUT_CFG_PREFIX_LANG
"id"
);
p_stream
->
p_sys
->
i_new_id
=
-
1
;
p_stream
->
p_sys
->
psz_language
=
var_GetString
(
p_stream
,
SOUT_CFG_PREFIX_LANG
"lang"
);
config_ChainParse
(
p_stream
,
SOUT_CFG_PREFIX_LANG
,
ppsz_sout_options_lang
,
p_stream
->
p_cfg
);
p_stream
->
pf_add
=
AddLang
;
return
VLC_SUCCESS
;
}
/*****************************************************************************
* Close:
*****************************************************************************/
...
...
@@ -123,10 +180,11 @@ static void Close( vlc_object_t * p_this )
sout_stream_t
*
p_stream
=
(
sout_stream_t
*
)
p_this
;
sout_stream_sys_t
*
p_sys
=
(
sout_stream_sys_t
*
)
p_stream
->
p_sys
;
free
(
p_sys
->
psz_language
);
free
(
p_sys
);
}
static
sout_stream_id_t
*
Add
(
sout_stream_t
*
p_stream
,
es_format_t
*
p_fmt
)
static
sout_stream_id_t
*
Add
Id
(
sout_stream_t
*
p_stream
,
es_format_t
*
p_fmt
)
{
sout_stream_sys_t
*
p_sys
=
(
sout_stream_sys_t
*
)
p_stream
->
p_sys
;
...
...
@@ -137,6 +195,20 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
p_fmt
->
i_id
=
p_sys
->
i_new_id
;
}
return
p_sys
->
p_out
->
pf_add
(
p_sys
->
p_out
,
p_fmt
);
}
static
sout_stream_id_t
*
AddLang
(
sout_stream_t
*
p_stream
,
es_format_t
*
p_fmt
)
{
sout_stream_sys_t
*
p_sys
=
(
sout_stream_sys_t
*
)
p_stream
->
p_sys
;
if
(
p_fmt
->
i_id
==
p_sys
->
i_id
)
{
msg_Dbg
(
p_stream
,
"turning language %s of ID %d to %s"
,
p_fmt
->
psz_language
?
p_fmt
->
psz_language
:
"unk"
,
p_sys
->
i_id
,
p_sys
->
psz_language
);
p_fmt
->
psz_language
=
strdup
(
p_sys
->
psz_language
);
}
return
p_sys
->
p_out
->
pf_add
(
p_sys
->
p_out
,
p_fmt
);
}
...
...
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