if( xiph_SplitHeaders( pi_size, pp_data, &i_count,
p_dec->fmt_in.i_extra, p_dec->fmt_in.p_extra) )
return VLC_EGENERIC;
- int i_ret = VLC_SUCCESS;
+
if( i_count < 1 )
- {
- i_ret = VLC_EGENERIC;
- goto end;
- }
+ return VLC_EGENERIC;
/* Take care of the initial Kate header */
kp.nbytes = pi_size[0];
kp.data = pp_data[0];
- i_ret = kate_decode_headerin( &p_sys->ki, &p_sys->kc, &kp );
+ int i_ret = kate_decode_headerin( &p_sys->ki, &p_sys->kc, &kp );
if( i_ret < 0 )
{
msg_Err( p_dec, "this bitstream does not contain Kate data (%d)", i_ret );
- goto end;
+ return VLC_EGENERIC;
}
msg_Dbg( p_dec, "%s %s text, granule rate %f, granule shift %d",
if( i_ret < 0 )
{
msg_Err( p_dec, "Kate header %d is corrupted: %d", i_headeridx, i_ret );
- goto end;
+ return VLC_EGENERIC;
}
/* header 1 is comments */
}
#endif
-end:
- for( unsigned i = 0; i < i_count; i++ )
- free( pp_data[i] );
- return i_ret < 0 ? VLC_EGENERIC : VLC_SUCCESS;
+ return VLC_SUCCESS;
}
/*****************************************************************************
unsigned pi_size[XIPH_MAX_HEADER_COUNT];
void *pp_data[XIPH_MAX_HEADER_COUNT];
unsigned i_count;
- int ret = VLC_EGENERIC;
if( xiph_SplitHeaders( pi_size, pp_data, &i_count,
p_dec->fmt_in.i_extra, p_dec->fmt_in.p_extra) )
return VLC_EGENERIC;
if( i_count < 2 )
- goto end;
+ return VLC_EGENERIC;;
oggpacket.granulepos = -1;
oggpacket.e_o_s = 0;
oggpacket.b_o_s = 1; /* yes this actually is a b_o_s packet :) */
oggpacket.bytes = pi_size[0];
oggpacket.packet = pp_data[0];
- ret = ProcessInitialHeader( p_dec, &oggpacket );
+ int ret = ProcessInitialHeader( p_dec, &oggpacket );
if (ret != VLC_SUCCESS)
msg_Err( p_dec, "initial Opus header is corrupted" );
-end:
- for( unsigned i = 0; i < i_count; i++ )
- free( pp_data[i] );
-
return ret;
}
p_dec->fmt_in.i_extra, p_dec->fmt_in.p_extra) )
return VLC_EGENERIC;
if( i_count < 2 )
- goto error;
+ return VLC_EGENERIC;;
oggpacket.granulepos = -1;
oggpacket.e_o_s = 0;
if( ProcessInitialHeader( p_dec, &oggpacket ) != VLC_SUCCESS )
{
msg_Err( p_dec, "initial Speex header is corrupted" );
- goto error;
+ return VLC_EGENERIC;;
}
/* The next packet in order is the comments header */
p_dec->fmt_in.p_extra, p_dec->fmt_out.i_extra );
}
- for( unsigned i = 0; i < i_count; i++ )
- free( pp_data[i] );
return VLC_SUCCESS;
-
-error:
- for( unsigned i = 0; i < i_count; i++ )
- free( pp_data[i] );
- return VLC_EGENERIC;
}
/*****************************************************************************
p_dec->fmt_in.i_extra, p_dec->fmt_in.p_extra) )
return VLC_EGENERIC;
if( i_count < 3 )
- goto error;
+ return VLC_EGENERIC;
oggpacket.granulepos = -1;
oggpacket.e_o_s = 0;
p_dec->fmt_in.p_extra, p_dec->fmt_out.i_extra );
}
- for( unsigned i = 0; i < i_count; i++ )
- free( pp_data[i] );
/* Clean up the decoder setup info... we're done with it */
th_setup_free( ts );
return VLC_SUCCESS;
error:
- for( unsigned i = 0; i < i_count; i++ )
- free( pp_data[i] );
/* Clean up the decoder setup info... we're done with it */
th_setup_free( ts );
return VLC_EGENERIC;
ogg_packet oggpacket;
unsigned pi_size[XIPH_MAX_HEADER_COUNT];
- void *pp_data[XIPH_MAX_HEADER_COUNT];
+ void *pp_data[XIPH_MAX_HEADER_COUNT];
unsigned i_count;
if( xiph_SplitHeaders( pi_size, pp_data, &i_count,
p_dec->fmt_in.i_extra, p_dec->fmt_in.p_extra) )
return VLC_EGENERIC;
if( i_count < 3 )
- goto error;
+ return VLC_EGENERIC;
oggpacket.granulepos = -1;
oggpacket.e_o_s = 0;
if( vorbis_synthesis_headerin( &p_sys->vi, &p_sys->vc, &oggpacket ) < 0 )
{
msg_Err( p_dec, "this bitstream does not contain Vorbis audio data");
- goto error;
+ return VLC_EGENERIC;
}
/* Setup the format */
{
msg_Err( p_dec, "invalid number of channels (not between 1 and 9): %i",
p_dec->fmt_out.audio.i_channels );
- goto error;
+ return VLC_EGENERIC;
}
p_dec->fmt_out.audio.i_physical_channels =
if( vorbis_synthesis_headerin( &p_sys->vi, &p_sys->vc, &oggpacket ) < 0 )
{
msg_Err( p_dec, "2nd Vorbis header is corrupted" );
- goto error;
+ return VLC_EGENERIC;
}
ParseVorbisComments( p_dec );
ConfigureChannelOrder(p_sys->pi_chan_table, p_sys->vi.channels,
p_dec->fmt_out.audio.i_physical_channels, true);
- for( unsigned i = 0; i < i_count; i++ )
- free( pp_data[i] );
return VLC_SUCCESS;
-
-error:
- for( unsigned i = 0; i < i_count; i++ )
- free( pp_data[i] );
- return VLC_EGENERIC;
}
/*****************************************************************************
b_match = false;
}
- for( unsigned i = 0; i < i_new_count; i++ )
- free( pp_new_data[i] );
- for( unsigned i = 0; i < i_old_count; i++ )
- free( pp_old_data[i] );
return b_match;
}
memcmp(p_old_map, p_new_map,
i_new_channel_count*sizeof(*p_new_map)) == 0;
}
- for( unsigned i = 0; i < i_new_count; i++ )
- free( pp_new_data[i] );
- for( unsigned i = 0; i < i_old_count; i++ )
- free( pp_old_data[i] );
+
return b_match;
}
{
p_demux->info.i_update |= INPUT_UPDATE_TITLE_LIST;
}
-
- for( unsigned i = 0; i < i_count; i++ )
- free( pp_data[i] );
}
static void Ogg_ExtractMeta( demux_t *p_demux, es_format_t *p_fmt, const uint8_t *p_headers, int i_headers )
{
#define XIPH_MAX_HEADER_COUNT (256)
static inline int xiph_SplitHeaders(unsigned packet_size[], void *packet[], unsigned *packet_count,
- unsigned extra_size, const void *extra)
+ unsigned extra_size, void *extra)
{
- const uint8_t *current = (const uint8_t*)extra;
+ uint8_t *current = extra;
const uint8_t *end = ¤t[extra_size];
if (extra_size < 1)
return VLC_EGENERIC;
return VLC_EGENERIC;
packet_size[count - 1] = end - current - size;
- /* Copy the payloads */
- for (unsigned i = 0; i < count; i++) {
- packet[i] = malloc(packet_size[i]);
- if (!packet[i]) {
- for (unsigned j = 0; j < i; j++)
- free(packet[j]);
- return VLC_ENOMEM;
- }
+ for (unsigned i = 0; i < count; i++)
if (packet_size[i] > 0) {
- memcpy(packet[i], current, packet_size[i]);
+ packet[i] = current;
current += packet_size[i];
}
- }
+
return VLC_SUCCESS;
}
if (count >= XIPH_MAX_HEADER_COUNT)
return VLC_EGENERIC;
- free(*extra);
+ void *old = *extra;
packet_size[count] = size;
packet[count] = (void*)data;
*extra_size = 0;
*extra = NULL;
}
- for (unsigned i = 0; i < count; i++)
- free(packet[i]);
+
+ free(old);
if (*extra_size <= 0)
return VLC_EGENERIC;
p_stream->i_keyframe_granule_shift =
( (op.packet[40] & 0x03) << 3 ) | ( (op.packet[41] & 0xe0) >> 5 );
}
-
- for( unsigned i = 0; i < i_count; i++ )
- free( pp_data[i] );
}
else if( p_stream->i_fourcc == VLC_CODEC_DIRAC )
{
if( p_og )
block_ChainAppend( &p_hdr, p_og );
}
- for( unsigned i = 0; i < i_count; i++ )
- free( pp_data[i] );
}
else if( p_stream->i_fourcc != VLC_CODEC_FLAC &&
p_stream->i_fourcc != VLC_CODEC_DIRAC )
unsigned packet_size[XIPH_MAX_HEADER_COUNT];
void *packet[XIPH_MAX_HEADER_COUNT];
unsigned packet_count;
- int val = xiph_SplitHeaders(packet_size, packet, &packet_count,
- i_extra, p_extra);
- if (val != VLC_SUCCESS)
- return val;
+ if (xiph_SplitHeaders(packet_size, packet, &packet_count,
+ i_extra, p_extra))
+ return VLC_EGENERIC;;
if (packet_count < 3)
- {
- val = VLC_EGENERIC;
- goto free;
- }
+ return VLC_EGENERIC;;
if (theora_pixel_fmt != NULL)
{
if (packet_size[0] < 42)
- {
- val = VLC_EGENERIC;
- goto free;
- }
+ return VLC_EGENERIC;
*theora_pixel_fmt = (((uint8_t *)packet[0])[41] >> 3) & 0x03;
}
+ packet_size[0] + packet_size[1] + packet_size[2];
*p_buffer = malloc(*i_buffer);
if (*p_buffer == NULL)
- {
- val = VLC_ENOMEM;
- goto free;
- }
+ return VLC_ENOMEM;
uint8_t *p = *p_buffer + room;
/* Number of headers */
p += packet_size[i];
}
- val = VLC_SUCCESS;
-free:
- for (unsigned i = 0; i < packet_count; i++)
- free(packet[i]);
-
- return val;
+ return VLC_SUCCESS;
}
static char *rtp_xiph_b64_oob_config(void *p_extra, size_t i_extra,