Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
279ec69a
Commit
279ec69a
authored
Feb 09, 2012
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TS mux: factor out CSA setup
parent
88e8e86f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
52 deletions
+55
-52
modules/mux/mpeg/ts.c
modules/mux/mpeg/ts.c
+55
-52
No files found.
modules/mux/mpeg/ts.c
View file @
279ec69a
...
@@ -471,6 +471,58 @@ static void TSSetPCR( block_t *p_ts, mtime_t i_dts );
...
@@ -471,6 +471,58 @@ static void TSSetPCR( block_t *p_ts, mtime_t i_dts );
static
void
PEStoTS
(
sout_instance_t
*
,
sout_buffer_chain_t
*
,
block_t
*
,
ts_stream_t
*
);
static
void
PEStoTS
(
sout_instance_t
*
,
sout_buffer_chain_t
*
,
block_t
*
,
ts_stream_t
*
);
static
csa_t
*
csaSetup
(
vlc_object_t
*
p_this
)
{
sout_mux_t
*
p_mux
=
(
sout_mux_t
*
)
p_this
;
sout_mux_sys_t
*
p_sys
=
p_mux
->
p_sys
;
char
*
csack
=
var_CreateGetNonEmptyStringCommand
(
p_mux
,
SOUT_CFG_PREFIX
"csa-ck"
);
if
(
!
csack
)
return
NULL
;
csa_t
*
csa
=
csa_New
();
if
(
csa_SetCW
(
p_this
,
csa
,
csack
,
true
)
)
{
free
(
csack
);
csa_Delete
(
csa
);
return
NULL
;
}
vlc_mutex_init
(
&
p_sys
->
csa_lock
);
p_sys
->
b_crypt_audio
=
var_GetBool
(
p_mux
,
SOUT_CFG_PREFIX
"crypt-audio"
);
p_sys
->
b_crypt_video
=
var_GetBool
(
p_mux
,
SOUT_CFG_PREFIX
"crypt-video"
);
char
*
csa2ck
=
var_CreateGetNonEmptyStringCommand
(
p_mux
,
SOUT_CFG_PREFIX
"csa2-ck"
);
if
(
!
csa2ck
||
csa_SetCW
(
p_this
,
p_sys
->
csa
,
csa2ck
,
false
)
)
csa_SetCW
(
p_this
,
p_sys
->
csa
,
csack
,
false
);
free
(
csa2ck
);
var_Create
(
p_mux
,
SOUT_CFG_PREFIX
"csa-use"
,
VLC_VAR_STRING
|
VLC_VAR_DOINHERIT
|
VLC_VAR_ISCOMMAND
);
var_AddCallback
(
p_mux
,
SOUT_CFG_PREFIX
"csa-use"
,
ActiveKeyCallback
,
NULL
);
var_AddCallback
(
p_mux
,
SOUT_CFG_PREFIX
"csa-ck"
,
ChangeKeyCallback
,
(
void
*
)
1
);
var_AddCallback
(
p_mux
,
SOUT_CFG_PREFIX
"csa2-ck"
,
ChangeKeyCallback
,
NULL
);
vlc_value_t
use_val
;
var_Get
(
p_mux
,
SOUT_CFG_PREFIX
"csa-use"
,
&
use_val
);
if
(
var_Set
(
p_mux
,
SOUT_CFG_PREFIX
"csa-use"
,
use_val
)
)
var_SetString
(
p_mux
,
SOUT_CFG_PREFIX
"csa-use"
,
"odd"
);
free
(
use_val
.
psz_string
);
p_sys
->
i_csa_pkt_size
=
var_GetInteger
(
p_mux
,
SOUT_CFG_PREFIX
"csa-pkt"
);
if
(
p_sys
->
i_csa_pkt_size
<
12
||
p_sys
->
i_csa_pkt_size
>
188
)
{
msg_Err
(
p_mux
,
"wrong packet size %d specified"
,
p_sys
->
i_csa_pkt_size
);
p_sys
->
i_csa_pkt_size
=
188
;
}
msg_Dbg
(
p_mux
,
"encrypting %d bytes of packet"
,
p_sys
->
i_csa_pkt_size
);
free
(
csack
);
return
csa
;
}
/*****************************************************************************
/*****************************************************************************
* Open:
* Open:
*****************************************************************************/
*****************************************************************************/
...
@@ -489,8 +541,6 @@ static int Open( vlc_object_t *p_this )
...
@@ -489,8 +541,6 @@ static int Open( vlc_object_t *p_this )
p_sys
->
dvbpmt
=
NULL
;
p_sys
->
dvbpmt
=
NULL
;
memset
(
&
p_sys
->
pmtmap
,
0
,
sizeof
(
p_sys
->
pmtmap
)
);
memset
(
&
p_sys
->
pmtmap
,
0
,
sizeof
(
p_sys
->
pmtmap
)
);
vlc_mutex_init
(
&
p_sys
->
csa_lock
);
p_mux
->
pf_control
=
Control
;
p_mux
->
pf_control
=
Control
;
p_mux
->
pf_addstream
=
AddStream
;
p_mux
->
pf_addstream
=
AddStream
;
p_mux
->
pf_delstream
=
DelStream
;
p_mux
->
pf_delstream
=
DelStream
;
...
@@ -739,56 +789,9 @@ static int Open( vlc_object_t *p_this )
...
@@ -739,56 +789,9 @@ static int Open( vlc_object_t *p_this )
p_sys
->
b_use_key_frames
=
var_GetBool
(
p_mux
,
SOUT_CFG_PREFIX
"use-key-frames"
);
p_sys
->
b_use_key_frames
=
var_GetBool
(
p_mux
,
SOUT_CFG_PREFIX
"use-key-frames"
);
/* for TS generation */
/* for TS generation */
p_sys
->
i_pcr
=
0
;
p_sys
->
i_pcr
=
0
;
p_sys
->
csa
=
NULL
;
char
*
csack
=
var_CreateGetNonEmptyStringCommand
(
p_mux
,
SOUT_CFG_PREFIX
"csa-ck"
);
if
(
csack
)
{
p_sys
->
csa
=
csa_New
();
if
(
!
csa_SetCW
(
p_this
,
p_sys
->
csa
,
csack
,
true
)
)
{
char
*
csa2ck
=
var_CreateGetNonEmptyStringCommand
(
p_mux
,
SOUT_CFG_PREFIX
"csa2-ck"
);
if
(
!
csa2ck
||
csa_SetCW
(
p_this
,
p_sys
->
csa
,
csa2ck
,
false
)
)
csa_SetCW
(
p_this
,
p_sys
->
csa
,
csack
,
false
);
free
(
csa2ck
);
vlc_value_t
use_val
;
p_sys
->
csa
=
csaSetup
(
p_this
);
var_Create
(
p_mux
,
SOUT_CFG_PREFIX
"csa-use"
,
VLC_VAR_STRING
|
VLC_VAR_DOINHERIT
|
VLC_VAR_ISCOMMAND
);
var_Get
(
p_mux
,
SOUT_CFG_PREFIX
"csa-use"
,
&
use_val
);
var_AddCallback
(
p_mux
,
SOUT_CFG_PREFIX
"csa-use"
,
ActiveKeyCallback
,
NULL
);
var_AddCallback
(
p_mux
,
SOUT_CFG_PREFIX
"csa-ck"
,
ChangeKeyCallback
,
(
void
*
)
1
);
var_AddCallback
(
p_mux
,
SOUT_CFG_PREFIX
"csa2-ck"
,
ChangeKeyCallback
,
NULL
);
if
(
var_Set
(
p_mux
,
SOUT_CFG_PREFIX
"csa-use"
,
use_val
)
!=
VLC_SUCCESS
)
{
var_SetString
(
p_mux
,
SOUT_CFG_PREFIX
"csa-use"
,
"odd"
);
}
free
(
use_val
.
psz_string
);
p_sys
->
i_csa_pkt_size
=
var_GetInteger
(
p_mux
,
SOUT_CFG_PREFIX
"csa-pkt"
);
if
(
p_sys
->
i_csa_pkt_size
<
12
||
p_sys
->
i_csa_pkt_size
>
188
)
{
msg_Err
(
p_mux
,
"wrong packet size %d specified"
,
p_sys
->
i_csa_pkt_size
);
p_sys
->
i_csa_pkt_size
=
188
;
}
msg_Dbg
(
p_mux
,
"encrypting %d bytes of packet"
,
p_sys
->
i_csa_pkt_size
);
}
else
{
csa_Delete
(
p_sys
->
csa
);
p_sys
->
csa
=
NULL
;
}
free
(
csack
);
}
p_sys
->
b_crypt_audio
=
var_GetBool
(
p_mux
,
SOUT_CFG_PREFIX
"crypt-audio"
);
p_sys
->
b_crypt_video
=
var_GetBool
(
p_mux
,
SOUT_CFG_PREFIX
"crypt-video"
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -807,6 +810,7 @@ static void Close( vlc_object_t * p_this )
...
@@ -807,6 +810,7 @@ static void Close( vlc_object_t * p_this )
var_DelCallback
(
p_mux
,
SOUT_CFG_PREFIX
"csa2-ck"
,
ChangeKeyCallback
,
NULL
);
var_DelCallback
(
p_mux
,
SOUT_CFG_PREFIX
"csa2-ck"
,
ChangeKeyCallback
,
NULL
);
var_DelCallback
(
p_mux
,
SOUT_CFG_PREFIX
"csa-use"
,
ActiveKeyCallback
,
NULL
);
var_DelCallback
(
p_mux
,
SOUT_CFG_PREFIX
"csa-use"
,
ActiveKeyCallback
,
NULL
);
csa_Delete
(
p_sys
->
csa
);
csa_Delete
(
p_sys
->
csa
);
vlc_mutex_destroy
(
&
p_sys
->
csa_lock
);
}
}
for
(
int
i
=
0
;
i
<
MAX_PMT
;
i
++
)
for
(
int
i
=
0
;
i
<
MAX_PMT
;
i
++
)
...
@@ -815,7 +819,6 @@ static void Close( vlc_object_t * p_this )
...
@@ -815,7 +819,6 @@ static void Close( vlc_object_t * p_this )
free
(
p_sys
->
sdt_descriptors
[
i
].
psz_provider
);
free
(
p_sys
->
sdt_descriptors
[
i
].
psz_provider
);
}
}
vlc_mutex_destroy
(
&
p_sys
->
csa_lock
);
free
(
p_sys
->
dvbpmt
);
free
(
p_sys
->
dvbpmt
);
free
(
p_sys
);
free
(
p_sys
);
}
}
...
...
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