Commit 2b4b4a32 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Vobsub: cosmetics and warnings fixes

parent aa4e4b13
......@@ -577,7 +577,7 @@ static inline int ps_psm_fill( ps_psm_t *p_psm, block_t *p_pkt,
{
int i_buffer = p_pkt->i_buffer;
uint8_t *p_buffer = p_pkt->p_buffer;
int i_length, i_version, i_info_length, i_esm_length, i_es_base;
int i_length, i_version, i_info_length, i_es_base;
if( !p_psm || p_buffer[3] != 0xbc ) return VLC_EGENERIC;
......@@ -595,8 +595,8 @@ static inline int ps_psm_fill( ps_psm_t *p_psm, block_t *p_pkt,
if( i_info_length + 10 > i_length ) return VLC_EGENERIC;
/* Elementary stream map */
i_esm_length = (uint16_t)(p_buffer[ 10 + i_info_length ] << 8) +
p_buffer[ 11 + i_info_length];
/* int i_esm_length = (uint16_t)(p_buffer[ 10 + i_info_length ] << 8) +
p_buffer[ 11 + i_info_length]; */
i_es_base = 12 + i_info_length;
while( i_es_base + 4 < i_length )
......
......@@ -25,23 +25,20 @@
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <sys/types.h>
#include <limits.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_demux.h>
#include "ps.h"
#include "vobsub.h"
#define MAX_LINE 8192
/*****************************************************************************
* Module descriptor
*****************************************************************************/
......@@ -69,8 +66,6 @@ typedef struct
int i_line;
char **line;
} text_t;
static int TextLoad( text_t *, stream_t *s );
static void TextUnload( text_t * );
typedef struct
{
......@@ -109,9 +104,12 @@ struct demux_sys_t
uint32_t palette[16];
};
static int Demux( demux_t * );
static int Control( demux_t *, int, va_list );
static int TextLoad( text_t *, stream_t *s );
static void TextUnload( text_t * );
static int ParseVobSubIDX( demux_t * );
static int DemuxVobSub( demux_t *, block_t *);
......@@ -138,7 +136,6 @@ static int Open ( vlc_object_t *p_this )
return VLC_EGENERIC;
}
free( s );
}
else
{
......@@ -146,11 +143,11 @@ static int Open ( vlc_object_t *p_this )
return VLC_EGENERIC;
}
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
/* */
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
if( unlikely( !p_sys ) )
return VLC_ENOMEM;
p_sys->i_length = 0;
p_sys->p_vobsub_stream = NULL;
p_sys->i_tracks = 0;
......@@ -174,8 +171,7 @@ static int Open ( vlc_object_t *p_this )
/* Find the total length of the vobsubs */
if( p_sys->i_tracks > 0 )
{
int i;
for( i = 0; i < p_sys->i_tracks; i++ )
for( int i = 0; i < p_sys->i_tracks; i++ )
{
if( p_sys->track[i].i_subtitles > 1 )
{
......@@ -185,8 +181,7 @@ static int Open ( vlc_object_t *p_this )
}
}
if( asprintf( &psz_vobname, "%s://%s", p_demux->psz_access,
p_demux->psz_location ) == -1 )
if( asprintf( &psz_vobname, "%s://%s", p_demux->psz_access, p_demux->psz_location ) == -1 )
goto error;
i_len = strlen( psz_vobname );
......@@ -203,6 +198,9 @@ static int Open ( vlc_object_t *p_this )
}
free( psz_vobname );
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
return VLC_SUCCESS;
error:
......@@ -220,19 +218,16 @@ error:
*****************************************************************************/
static void Close( vlc_object_t *p_this )
{
int i;
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys = p_demux->p_sys;
/* Clean all subs from all tracks */
for( i = 0; i < p_sys->i_tracks; i++ )
free( p_sys->track[i].p_subtitles );
free( p_sys->track );
if( p_sys->p_vobsub_stream )
stream_Delete( p_sys->p_vobsub_stream );
/* Clean all subs from all tracks */
for( int i = 0; i < p_sys->i_tracks; i++ )
free( p_sys->track[i].p_subtitles );
free( p_sys->track );
free( p_sys );
}
......@@ -354,9 +349,9 @@ static int Demux( demux_t *p_demux )
{
demux_sys_t *p_sys = p_demux->p_sys;
int64_t i_maxdate;
int i, i_read;
int i_read;
for( i = 0; i < p_sys->i_tracks; i++ )
for( int i = 0; i < p_sys->i_tracks; i++ )
{
#define tk p_sys->track[i]
if( tk.i_current_subtitle >= tk.i_subtitles )
......@@ -459,12 +454,10 @@ static int TextLoad( text_t *txt, stream_t *s )
static void TextUnload( text_t *txt )
{
int i;
for( i = 0; i < txt->i_line_count; i++ )
for( int i = 0; i < txt->i_line_count; i++ )
free( txt->line[i] );
free( txt->line );
txt->i_line = 0;
txt->i_line_count = 0;
}
......
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