Commit 34acedc6 authored by Frédéric Yhuel's avatar Frédéric Yhuel Committed by Jean-Baptiste Kempf

demux/mp4: drop DRMS support

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 790d3d45
...@@ -7,6 +7,6 @@ SOURCES_mkv = mkv.hpp mkv.cpp \ ...@@ -7,6 +7,6 @@ SOURCES_mkv = mkv.hpp mkv.cpp \
chapters.hpp chapters.cpp \ chapters.hpp chapters.cpp \
chapter_command.hpp chapter_command.cpp \ chapter_command.hpp chapter_command.cpp \
stream_io_callback.hpp stream_io_callback.cpp \ stream_io_callback.hpp stream_io_callback.cpp \
../mp4/libmp4.c ../mp4/drms.c \ ../mp4/libmp4.c \
../vobsub.h ../vobsub.h
...@@ -2,9 +2,6 @@ SOURCES_mp4 = \ ...@@ -2,9 +2,6 @@ SOURCES_mp4 = \
mp4.c \ mp4.c \
libmp4.c \ libmp4.c \
libmp4.h \ libmp4.h \
drms.c \
drms.h \
drmstables.h \
id3genres.h \ id3genres.h \
$(NULL) $(NULL)
......
This diff is collapsed.
/*****************************************************************************
* drms.h : DRMS
*****************************************************************************
* Copyright (C) 2004 the VideoLAN team
* $Id$
*
* Author: Jon Lech Johansen <jon-vl@nanocrew.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef _VLC_DRMS_H
#define _VLC_DRMS_H 1
extern void *drms_alloc( const char *psz_homedir );
extern void drms_free( void *p_drms );
extern int drms_init( void *p_drms, uint32_t i_type,
uint8_t *p_info, uint32_t i_len );
extern void drms_decrypt( void *p_drms, uint32_t *p_buffer,
uint32_t i_len, uint32_t *p_key );
extern void drms_get_p_key( void *p_drms, uint32_t *p_key );
#endif
This diff is collapsed.
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#endif #endif
#include "libmp4.h" #include "libmp4.h"
#include "drms.h"
#include <math.h> #include <math.h>
/***************************************************************************** /*****************************************************************************
...@@ -1671,13 +1670,8 @@ static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1671,13 +1670,8 @@ static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box )
if( p_box->i_type == ATOM_drms ) if( p_box->i_type == ATOM_drms )
{ {
char *home = config_GetUserDir( VLC_HOME_DIR ); msg_Warn( p_stream, "DRM protected streams are not supported." );
if( home != NULL ) MP4_READBOX_EXIT( 0 );
{
p_box->data.p_sample_soun->p_drms = drms_alloc( home );
if( p_box->data.p_sample_soun->p_drms == NULL )
msg_Err( p_stream, "drms_alloc() failed" );
}
} }
if( p_box->i_type == ATOM_samr || p_box->i_type == ATOM_sawb ) if( p_box->i_type == ATOM_samr || p_box->i_type == ATOM_sawb )
...@@ -1704,14 +1698,6 @@ static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1704,14 +1698,6 @@ static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box )
static void MP4_FreeBox_sample_soun( MP4_Box_t *p_box ) static void MP4_FreeBox_sample_soun( MP4_Box_t *p_box )
{ {
FREENULL( p_box->data.p_sample_soun->p_qt_description ); FREENULL( p_box->data.p_sample_soun->p_qt_description );
if( p_box->i_type == ATOM_drms )
{
if( p_box->data.p_sample_soun->p_drms )
{
drms_free( p_box->data.p_sample_soun->p_drms );
}
}
} }
...@@ -1770,13 +1756,8 @@ int MP4_ReadBox_sample_vide( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1770,13 +1756,8 @@ int MP4_ReadBox_sample_vide( stream_t *p_stream, MP4_Box_t *p_box )
if( p_box->i_type == ATOM_drmi ) if( p_box->i_type == ATOM_drmi )
{ {
char *home = config_GetUserDir( VLC_HOME_DIR ); msg_Warn( p_stream, "DRM protected streams are not supported." );
if( home != NULL ) MP4_READBOX_EXIT( 0 );
{
p_box->data.p_sample_vide->p_drms = drms_alloc( home );
if( p_box->data.p_sample_vide->p_drms == NULL )
msg_Err( p_stream, "drms_alloc() failed" );
}
} }
MP4_ReadBoxContainerRaw( p_stream, p_box ); MP4_ReadBoxContainerRaw( p_stream, p_box );
...@@ -1795,14 +1776,6 @@ int MP4_ReadBox_sample_vide( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -1795,14 +1776,6 @@ int MP4_ReadBox_sample_vide( stream_t *p_stream, MP4_Box_t *p_box )
void MP4_FreeBox_sample_vide( MP4_Box_t *p_box ) void MP4_FreeBox_sample_vide( MP4_Box_t *p_box )
{ {
FREENULL( p_box->data.p_sample_vide->p_qt_image_description ); FREENULL( p_box->data.p_sample_vide->p_qt_image_description );
if( p_box->i_type == ATOM_drmi )
{
if( p_box->data.p_sample_vide->p_drms )
{
drms_free( p_box->data.p_sample_vide->p_drms );
}
}
} }
static int MP4_ReadBox_sample_mp4s( stream_t *p_stream, MP4_Box_t *p_box ) static int MP4_ReadBox_sample_mp4s( stream_t *p_stream, MP4_Box_t *p_box )
...@@ -2593,56 +2566,11 @@ static int MP4_ReadBox_skcr( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -2593,56 +2566,11 @@ static int MP4_ReadBox_skcr( stream_t *p_stream, MP4_Box_t *p_box )
static int MP4_ReadBox_drms( stream_t *p_stream, MP4_Box_t *p_box ) static int MP4_ReadBox_drms( stream_t *p_stream, MP4_Box_t *p_box )
{ {
MP4_Box_t *p_drms_box = p_box; /* ATOMs 'user', 'key', 'iviv', and 'priv' will be skipped,
void *p_drms = NULL; * so unless data decrypt itself by magic, there will be no playback,
* but we never know... */
MP4_READBOX_ENTER( uint8_t ); msg_Warn( p_stream, "DRM protected streams are not supported." );
return 1;
do
{
p_drms_box = p_drms_box->p_father;
} while( p_drms_box && p_drms_box->i_type != ATOM_drms
&& p_drms_box->i_type != ATOM_drmi );
if( p_drms_box && p_drms_box->i_type == ATOM_drms )
p_drms = p_drms_box->data.p_sample_soun->p_drms;
else if( p_drms_box && p_drms_box->i_type == ATOM_drmi )
p_drms = p_drms_box->data.p_sample_vide->p_drms;
if( p_drms_box && p_drms )
{
int i_ret = drms_init( p_drms, p_box->i_type, p_peek, i_read );
if( i_ret )
{
const char *psz_error;
switch( i_ret )
{
case -1: psz_error = "unimplemented"; break;
case -2: psz_error = "invalid argument"; break;
case -3: psz_error = "could not get system key"; break;
case -4: psz_error = "could not get SCI data"; break;
case -5: psz_error = "no user key found in SCI data"; break;
case -6: psz_error = "invalid user key"; break;
default: psz_error = "unknown error"; break;
}
if MP4_BOX_TYPE_ASCII()
msg_Err( p_stream, "drms_init(%4.4s) failed (%s)",
(char *)&p_box->i_type, psz_error );
else
msg_Err( p_stream, "drms_init(c%3.3s) failed (%s)",
(char *)&p_box->i_type+1, psz_error );
drms_free( p_drms );
if( p_drms_box->i_type == ATOM_drms )
p_drms_box->data.p_sample_soun->p_drms = NULL;
else if( p_drms_box->i_type == ATOM_drmi )
p_drms_box->data.p_sample_vide->p_drms = NULL;
}
}
MP4_READBOX_EXIT( 1 );
} }
static int MP4_ReadBox_name( stream_t *p_stream, MP4_Box_t *p_box ) static int MP4_ReadBox_name( stream_t *p_stream, MP4_Box_t *p_box )
......
...@@ -487,8 +487,6 @@ typedef struct MP4_Box_data_sample_soun_s ...@@ -487,8 +487,6 @@ typedef struct MP4_Box_data_sample_soun_s
int i_qt_description; int i_qt_description;
uint8_t *p_qt_description; uint8_t *p_qt_description;
void *p_drms;
} MP4_Box_data_sample_soun_t; } MP4_Box_data_sample_soun_t;
typedef struct MP4_Box_data_sample_vide_s typedef struct MP4_Box_data_sample_vide_s
...@@ -521,8 +519,6 @@ typedef struct MP4_Box_data_sample_vide_s ...@@ -521,8 +519,6 @@ typedef struct MP4_Box_data_sample_vide_s
int i_qt_image_description; int i_qt_image_description;
uint8_t *p_qt_image_description; uint8_t *p_qt_image_description;
void *p_drms;
} MP4_Box_data_sample_vide_t; } MP4_Box_data_sample_vide_t;
#define MP4_TEXT_DISPLAY_FLAG_DONT_DISPLAY (1<<0) #define MP4_TEXT_DISPLAY_FLAG_DONT_DISPLAY (1<<0)
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <vlc_input.h> #include <vlc_input.h>
#include "libmp4.h" #include "libmp4.h"
#include "drms.h"
#include "id3genres.h" /* for ATOM_gnre */ #include "id3genres.h" /* for ATOM_gnre */
/***************************************************************************** /*****************************************************************************
...@@ -135,8 +134,6 @@ typedef struct ...@@ -135,8 +134,6 @@ typedef struct
MP4_Box_t *p_stsd; /* will contain all data to initialize decoder */ MP4_Box_t *p_stsd; /* will contain all data to initialize decoder */
MP4_Box_t *p_sample;/* point on actual sdsd */ MP4_Box_t *p_sample;/* point on actual sdsd */
bool b_drms;
void *p_drms;
MP4_Box_t *p_skcr; MP4_Box_t *p_skcr;
} mp4_track_t; } mp4_track_t;
...@@ -684,27 +681,6 @@ static int Demux( demux_t *p_demux ) ...@@ -684,27 +681,6 @@ static int Demux( demux_t *p_demux )
break; break;
} }
if( tk->b_drms && tk->p_drms )
{
if( tk->p_skcr )
{
uint32_t p_key[4];
drms_get_p_key( tk->p_drms, p_key );
for( size_t i_pos = tk->p_skcr->data.p_skcr->i_init; i_pos < p_block->i_buffer; )
{
int n = __MIN( tk->p_skcr->data.p_skcr->i_encr, p_block->i_buffer - i_pos );
drms_decrypt( tk->p_drms, (uint32_t*)&p_block->p_buffer[i_pos], n, p_key );
i_pos += n;
i_pos += __MIN( tk->p_skcr->data.p_skcr->i_decr, p_block->i_buffer - i_pos );
}
}
else
{
drms_decrypt( tk->p_drms, (uint32_t*)p_block->p_buffer,
p_block->i_buffer, NULL );
}
}
else if( tk->fmt.i_cat == SPU_ES ) else if( tk->fmt.i_cat == SPU_ES )
{ {
if( tk->fmt.i_codec == VLC_FOURCC( 's', 'u', 'b', 't' ) && if( tk->fmt.i_codec == VLC_FOURCC( 's', 'u', 'b', 't' ) &&
...@@ -745,8 +721,7 @@ static int Demux( demux_t *p_demux ) ...@@ -745,8 +721,7 @@ static int Demux( demux_t *p_demux )
else else
p_block->i_pts = VLC_TS_INVALID; p_block->i_pts = VLC_TS_INVALID;
if( !tk->b_drms || ( tk->b_drms && tk->p_drms ) ) es_out_Send( p_demux->out, tk->p_es, p_block );
es_out_Send( p_demux->out, tk->p_es, p_block );
} }
/* Next sample */ /* Next sample */
...@@ -2273,8 +2248,6 @@ static void MP4_TrackCreate( demux_t *p_demux, mp4_track_t *p_track, ...@@ -2273,8 +2248,6 @@ static void MP4_TrackCreate( demux_t *p_demux, mp4_track_t *p_track,
MP4_Box_t *p_vmhd; MP4_Box_t *p_vmhd;
MP4_Box_t *p_smhd; MP4_Box_t *p_smhd;
MP4_Box_t *p_drms;
unsigned int i; unsigned int i;
char language[4]; char language[4];
...@@ -2396,22 +2369,6 @@ static void MP4_TrackCreate( demux_t *p_demux, mp4_track_t *p_track, ...@@ -2396,22 +2369,6 @@ static void MP4_TrackCreate( demux_t *p_demux, mp4_track_t *p_track,
return; return;
} }
p_drms = MP4_BoxGet( p_track->p_stsd, "drms" );
p_track->b_drms = p_drms != NULL;
p_track->p_drms = p_track->b_drms ?
p_drms->data.p_sample_soun->p_drms : NULL;
if ( !p_drms )
{
p_drms = MP4_BoxGet( p_track->p_stsd, "drmi" );
p_track->b_drms = p_drms != NULL;
p_track->p_drms = p_track->b_drms ?
p_drms->data.p_sample_vide->p_drms : NULL;
}
if( p_drms )
p_track->p_skcr = MP4_BoxGet( p_drms, "sinf/skcr" );
/* Set language */ /* Set language */
if( *language && strcmp( language, "```" ) && strcmp( language, "und" ) ) if( *language && strcmp( language, "```" ) && strcmp( language, "und" ) )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment