[vlc-devel] [PATCH 1/1] mux/ts: Fix setting of even CSA key.
Georgi Chorbadzhiyski
gf at unixsol.org
Wed Apr 11 12:51:04 CEST 2012
Around 04/10/2012 07:03 PM, Rafaël Carré scribbled:
> Le 2012-04-10 06:21, Georgi Chorbadzhiyski a écrit :
>> Without this fix the second CSA key can not be set, which results
>> in a stream that is impossible to decrypt.
>>
>> Tested with:
>> cvlc \
>> -I dummy -vv \
>> --sout '#standard{access=udp,mux=ts,dst=239.78.78.78:5000}' \
>> --sout-ts-crypt-audio --no-sout-ts-crypt-video \
>> --sout-ts-csa-ck=1111111111111111 \
>> --sout-ts-csa2-ck=0000000000000000 \
>> http://example.com/source.ts
>>
>> Before the patch:
>> mux_ts mux debug: using CSA (de)scrambling with odd key=11:11:11:11:11:11:11:11
>> mux_ts mux debug: no CSA found
>> mux_ts mux debug: no CSA found
>>
>> After the patch:
>> mux_ts mux debug: using CSA (de)scrambling with odd key=11:11:11:11:11:11:11:11
>> mux_ts mux debug: using CSA (de)scrambling with even key=0:0:0:0:0:0:0:0
>> ---
>> modules/mux/mpeg/ts.c | 1 +
>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
>> index a887095..03f452c 100644
>> --- a/modules/mux/mpeg/ts.c
>> +++ b/modules/mux/mpeg/ts.c
>> @@ -464,6 +464,7 @@ static csa_t *csaSetup( vlc_object_t *p_this )
>> 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" );
>> + p_sys->csa = csa;
>>
>> char *csa2ck = var_CreateGetNonEmptyStringCommand( p_mux, SOUT_CFG_PREFIX "csa2-ck");
>> if (!csa2ck || csa_SetCW( p_this, p_sys->csa, csa2ck, false ) )
>
> Thanks for the patch,
>
> diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
> index a887095..e1057ee 100644
> --- a/modules/mux/mpeg/ts.c
> +++ b/modules/mux/mpeg/ts.c
> @@ -466,8 +466,8 @@ static csa_t *csaSetup( vlc_object_t *p_this )
> 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 );
> + if (!csa2ck || csa_SetCW( p_this, csa, csa2ck, false ) )
> + csa_SetCW( p_this, csa, csack, false );
> free(csa2ck);
>
> var_Create( p_mux, SOUT_CFG_PREFIX "csa-use", VLC_VAR_STRING |
> VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
>
>
> Should be cleaner, since csaSetup() returns the context created (those 2
> csa_SetCW calls still used p_sys->csa).
>
> Does it work for you?
Your patch works and it is correct. Mine was wrong (I missed that Open() was
initializing p_sys->csa). Please apply.
--
Georgi Chorbadzhiyski
http://georgi.unixsol.org/
More information about the vlc-devel
mailing list