Commit 498f44ad authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* backport more formats and fixes

 - DVR-ms support
 - TTA support
 - [17142] add 5.1 support for flac
 - [17158] fixes for max amount of audio channels
 - [17180] lower SDL_image priority to fix mjpeg
 - [17194] require libgcrypt explicitly
parent a067022e
......@@ -1095,7 +1095,7 @@ dnl
dnl default modules
dnl
VLC_ADD_PLUGINS([dummy logger memcpy])
VLC_ADD_PLUGINS([mpgv mpga m4v m4a h264 ps pva avi asf mp4 rawdv nsv real aiff mjpeg demuxdump flac])
VLC_ADD_PLUGINS([mpgv mpga m4v m4a h264 ps pva avi asf mp4 rawdv nsv real aiff mjpeg demuxdump flac tta])
VLC_ADD_PLUGINS([cvdsub svcdsub spudec subsdec dvbsub mpeg_audio lpcm a52 dts cinepak flacdec])
VLC_ADD_PLUGINS([deinterlace invert adjust transform distort motionblur rv32])
VLC_ADD_PLUGINS([fixed32tos16 s16tofixed32 u8tofixed32])
......@@ -4934,6 +4934,9 @@ AS_IF([test "${enable_gnutls}" != "no"], [
AC_MSG_ERROR([gnutls not present or too old (version 1.2.9 required)])
])
])
AC_CHECK_LIB([gcrypt], [gcry_control], [
VLC_ADD_LDFLAGS([gnutls], [-lgcrypt])
])
])
......
......@@ -1091,6 +1091,12 @@ static struct
AUDIO_ES, "Cook Audio" },
#endif
#if LIBAVCODEC_BUILD >= ((51<<16)+(4<<8)+0)
/* TTA: The Lossless True Audio */
{ VLC_FOURCC('T','T','A','1'), CODEC_ID_TTA,
AUDIO_ES, "The Lossless True Audio" },
#endif
#if LIBAVCODEC_BUILD >= ((51<<16)+(8<<8)+0)
/* Shorten */
{ VLC_FOURCC('s','h','n',' '), CODEC_ID_SHORTEN,
......@@ -1110,6 +1116,23 @@ static struct
AUDIO_ES, "PCM U16 LE" },
{ VLC_FOURCC('u','1','6','b'), CODEC_ID_PCM_U16BE,
AUDIO_ES, "PCM U16 BE" },
{ VLC_FOURCC('s','2','4','l'), CODEC_ID_PCM_S24LE,
AUDIO_ES, "PCM S24 LE" },
{ VLC_FOURCC('s','2','4','b'), CODEC_ID_PCM_S24BE,
AUDIO_ES, "PCM S24 BE" },
{ VLC_FOURCC('u','2','4','l'), CODEC_ID_PCM_U24LE,
AUDIO_ES, "PCM U24 LE" },
{ VLC_FOURCC('u','2','4','b'), CODEC_ID_PCM_U24BE,
AUDIO_ES, "PCM U24 BE" },
{ VLC_FOURCC('s','3','2','l'), CODEC_ID_PCM_S32LE,
AUDIO_ES, "PCM S32 LE" },
{ VLC_FOURCC('s','3','2','b'), CODEC_ID_PCM_S32BE,
AUDIO_ES, "PCM S32 BE" },
{ VLC_FOURCC('u','3','2','l'), CODEC_ID_PCM_U32LE,
AUDIO_ES, "PCM U32 LE" },
{ VLC_FOURCC('u','3','2','b'), CODEC_ID_PCM_U32BE,
AUDIO_ES, "PCM U32 BE" },
{ VLC_FOURCC('a','l','a','w'), CODEC_ID_PCM_ALAW,
{ VLC_FOURCC('a','l','a','w'), CODEC_ID_PCM_ALAW,
AUDIO_ES, "PCM ALAW" },
{ VLC_FOURCC('u','l','a','w'), CODEC_ID_PCM_MULAW,
......
......@@ -97,7 +97,7 @@ enum {
STATE_SEND_DATA
};
static int pi_channels_maps[6] =
static int pi_channels_maps[7] =
{
0,
AOUT_CHAN_CENTER,
......@@ -106,7 +106,9 @@ static int pi_channels_maps[6] =
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_REARLEFT
| AOUT_CHAN_REARRIGHT,
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT,
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT | AOUT_CHAN_LFE
};
/*****************************************************************************
......@@ -285,7 +287,7 @@ static void CloseDecoder( vlc_object_t *p_this )
}
/*****************************************************************************
* ProcessHeader: processe Flac header.
* ProcessHeader: process Flac header.
*****************************************************************************/
static void ProcessHeader( decoder_t *p_dec )
{
......@@ -347,6 +349,12 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
if( !p_sys->b_stream_info ) ProcessHeader( p_dec );
if( p_sys->stream_info.channels > 6 )
{
msg_Err( p_dec, "This stream uses too many audio channels" );
return NULL;
}
if( !aout_DateGet( &p_sys->end_date ) && !(*pp_block)->i_pts )
{
/* We've just started the stream, wait for the first PTS. */
......
......@@ -185,6 +185,14 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC;
}
if( p_dec->fmt_in.audio.i_channels <= 0 ||
p_dec->fmt_in.audio.i_channels > 6 )
{
msg_Err( p_dec, "invalid number of channels (not between 1 and 6): %i",
p_dec->fmt_in.audio.i_channels );
return VLC_EGENERIC;
}
p_dec->p_sys = p_sys = malloc( sizeof( decoder_sys_t ) );
memset( p_sys, 0, sizeof(decoder_sys_t) );
......
......@@ -52,7 +52,7 @@ vlc_module_begin();
set_category( CAT_INPUT );
set_subcategory( SUBCAT_INPUT_VCODEC );
set_description( _("SDL_image video decoder") );
set_capability( "decoder", 900 );
set_capability( "decoder", 60 );
set_callbacks( OpenDecoder, CloseDecoder );
add_shortcut( "sdl_image" );
vlc_module_end();
......
......@@ -383,6 +383,13 @@ static int ProcessInitialHeader( decoder_t *p_dec, ogg_packet *p_oggpacket )
callback.data = &p_sys->stereo;
speex_decoder_ctl( p_state, SPEEX_SET_HANDLER, &callback );
}
if( p_header->nb_channels <= 0 ||
p_header->nb_channels > 5 )
{
msg_Err( p_dec, "invalid number of channels (not between 1 and 5): %i",
p_header->nb_channels );
return VLC_EGENERIC;
}
/* Setup the format */
p_dec->fmt_out.audio.i_physical_channels =
......
......@@ -387,6 +387,15 @@ static int ProcessHeaders( decoder_t *p_dec )
/* Setup the format */
p_dec->fmt_out.audio.i_rate = p_sys->vi.rate;
p_dec->fmt_out.audio.i_channels = p_sys->vi.channels;
if( p_dec->fmt_out.audio.i_channels < 0 ||
p_dec->fmt_out.audio.i_channels > 6 )
{
msg_Err( p_dec, "invalid number of channels (not between 1 and 6): %i",
p_dec->fmt_out.audio.i_channels );
return VLC_EGENERIC;
}
p_dec->fmt_out.audio.i_physical_channels =
p_dec->fmt_out.audio.i_original_channels =
pi_channels_maps[p_sys->vi.channels];
......
......@@ -26,3 +26,4 @@ SOURCES_xa = xa.c
SOURCES_nuv = nuv.c
SOURCES_nsc = nsc.c
SOURCES_mpc = mpc.c
SOURCES_tta = tta.c
......@@ -704,6 +704,14 @@ static int DemuxInit( demux_t *p_demux )
fmt.video.i_width = GetDWLE( p_data + 4 );
fmt.video.i_height= GetDWLE( p_data + 8 );
if( fmt.i_codec == VLC_FOURCC( 'D','V','R',' ') )
{
/* DVR-MS special ASF */
fmt.i_codec = VLC_FOURCC( 'm','p','g','2' ) ;
fmt.b_packetized = VLC_FALSE;
}
if( p_sp->i_type_specific_data_length > 11 +
sizeof( BITMAPINFOHEADER ) )
{
......@@ -755,6 +763,53 @@ static int DemuxInit( demux_t *p_demux )
msg_Dbg( p_demux, "added new video stream(ID:%d)",
p_sp->i_stream_number );
}
else if( ASF_CmpGUID( &p_sp->i_stream_type, &asf_object_extended_stream_header ) &&
p_sp->i_type_specific_data_length >= 64 )
{
/* Now follows a 64 byte header of which we don't know much */
es_format_t fmt;
guid_t *p_ref = (guid_t *)p_sp->p_type_specific_data;
uint8_t *p_data = p_sp->p_type_specific_data + 64;
unsigned int i_data = p_sp->i_type_specific_data_length - 64;
msg_Dbg( p_demux, "Ext stream header detected. datasize = %d", p_sp->i_type_specific_data_length );
if( ASF_CmpGUID( p_ref, &asf_object_extended_stream_type_audio ) &&
i_data >= sizeof( WAVEFORMATEX ) - 2)
{
int i_format;
es_format_Init( &fmt, AUDIO_ES, 0 );
i_format = GetWLE( &p_data[0] );
if( i_format == 0 )
fmt.i_codec = VLC_FOURCC( 'a','5','2',' ');
else
wf_tag_to_fourcc( i_format, &fmt.i_codec, NULL );
fmt.audio.i_channels = GetWLE( &p_data[2] );
fmt.audio.i_rate = GetDWLE( &p_data[4] );
fmt.i_bitrate = GetDWLE( &p_data[8] ) * 8;
fmt.audio.i_blockalign = GetWLE( &p_data[12] );
fmt.audio.i_bitspersample = GetWLE( &p_data[14] );
fmt.b_packetized = VLC_TRUE;
if( p_sp->i_type_specific_data_length > sizeof( WAVEFORMATEX ) &&
i_format != WAVE_FORMAT_MPEGLAYER3 &&
i_format != WAVE_FORMAT_MPEG )
{
fmt.i_extra = __MIN( GetWLE( &p_data[16] ),
p_sp->i_type_specific_data_length -
sizeof( WAVEFORMATEX ) );
fmt.p_extra = malloc( fmt.i_extra );
memcpy( fmt.p_extra, &p_data[sizeof( WAVEFORMATEX )],
fmt.i_extra );
}
tk->i_cat = AUDIO_ES;
tk->p_es = es_out_Add( p_demux->out, &fmt );
es_format_Clean( &fmt );
msg_Dbg( p_demux, "added new audio stream (codec:0x%x,ID:%d)",
i_format, p_sp->i_stream_number );
}
}
else
{
tk->i_cat = UNKNOWN_ES;
......
......@@ -119,6 +119,12 @@ static const guid_t asf_object_stream_prioritization =
static const guid_t asf_object_extended_content_description =
{0xD2D0A440, 0xE307, 0x11D2, {0x97, 0xF0, 0x00, 0xA0, 0xC9, 0x5E, 0xA8, 0x50}};
static const guid_t asf_object_extended_stream_header =
{0x3afb65e2, 0x47ef, 0x40f2, { 0xac, 0x2c, 0x70, 0xa9, 0x0d, 0x71, 0xd3, 0x43}};
static const guid_t asf_object_extended_stream_type_audio =
{0x31178c9d, 0x03e1, 0x4528, { 0xb5, 0x82, 0x3d, 0xf9, 0xdb, 0x22, 0xf5, 0x03}};
#define ASF_OBJECT_COMMON \
int i_type; \
guid_t i_object_id; \
......
/*****************************************************************************
* tta.c : The Lossless True Audio parser
*****************************************************************************
* Copyright (C) 2006 the VideoLAN team
* $Id$
*
* Authors: Derk-Jan Hartman <hartman at videolan dot org>
*
* 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <vlc/vlc.h>
#include <vlc/input.h>
#include <vlc_codec.h>
#include <math.h>
/*****************************************************************************
* Module descriptor
*****************************************************************************/
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
vlc_module_begin();
set_shortname( "TTA" );
set_description( _("TTA demuxer") );
set_category( CAT_INPUT );
set_subcategory( SUBCAT_INPUT_DEMUX );
set_capability( "demux2", 145 );
set_callbacks( Open, Close );
add_shortcut( "tta" );
vlc_module_end();
#define TTA_FRAMETIME 1.04489795918367346939
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int Demux ( demux_t * );
static int Control( demux_t *, int, va_list );
struct demux_sys_t
{
/* */
es_out_id_t *p_es;
/* */
int i_totalframes;
int i_currentframe;
uint32_t *pi_seektable;
int i_datalength;
int i_framelength;
/* */
vlc_meta_t *p_meta;
int64_t i_start;
};
/*****************************************************************************
* Open: initializes ES structures
*****************************************************************************/
static int Open( vlc_object_t * p_this )
{
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
es_format_t fmt;
uint8_t *p_peek;
uint8_t p_header[22];
uint8_t *p_seektable;
int i_seektable_size = 0, i;
//char psz_info[4096];
//module_t *p_id3;
if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 )
return VLC_EGENERIC;
if( memcmp( p_peek, "TTA1", 4 ) )
{
if( !p_demux->b_force ) return VLC_EGENERIC;
/* User forced */
msg_Err( p_demux, "this doesn't look like a flac stream, "
"continuing anyway" );
}
if( stream_Read( p_demux->s, p_header, 22 ) < 22 )
return VLC_EGENERIC;
/* Fill p_demux fields */
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
/* Read the metadata */
es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC( 'T', 'T', 'A', '1' ) );
fmt.audio.i_channels = GetWLE( &p_header[6] );
fmt.audio.i_bitspersample = GetWLE( &p_header[8] );
fmt.audio.i_rate = GetDWLE( &p_header[10] );
p_sys->i_datalength = GetDWLE( &p_header[14] );
p_sys->i_framelength = TTA_FRAMETIME * fmt.audio.i_rate;
p_sys->i_totalframes = p_sys->i_datalength / p_sys->i_framelength +
((p_sys->i_datalength % p_sys->i_framelength) ? 1 : 0);
p_sys->i_currentframe = 0;
i_seektable_size = sizeof(uint32_t)*p_sys->i_totalframes;
p_seektable = (uint8_t *)malloc( i_seektable_size );
stream_Read( p_demux->s, p_seektable, i_seektable_size );
p_sys->pi_seektable = (uint32_t *)malloc(i_seektable_size);
for( i = 0; i < p_sys->i_totalframes; i++ )
p_sys->pi_seektable[i] = GetDWLE( &p_seektable[i*4] );
stream_Read( p_demux->s, NULL, 4 ); /* CRC */
/* Store the header and Seektable for avcodec */
fmt.i_extra = 22 + (p_sys->i_totalframes * 4) + 4;
fmt.p_extra = malloc( fmt.i_extra );
memcpy( fmt.p_extra, p_header, 22 );
memcpy( fmt.p_extra+22, p_seektable, fmt.i_extra -22 );
p_sys->p_es = es_out_Add( p_demux->out, &fmt );
free( p_seektable );
p_sys->i_start = stream_Tell( p_demux->s );
#if 0
/* Parse possible id3 header */
if( ( p_id3 = module_Need( p_demux, "meta reader", NULL, 0 ) ) )
{
p_sys->p_meta = (vlc_meta_t *)p_demux->p_private;
p_demux->p_private = NULL;
module_Unneed( p_demux, p_id3 );
}
if( !p_sys->p_meta )
p_sys->p_meta = vlc_meta_New();
#endif
return VLC_SUCCESS;
}
/*****************************************************************************
* Close: frees unused data
*****************************************************************************/
static void Close( vlc_object_t * p_this )
{
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys = p_demux->p_sys;
free( p_sys );
}
/*****************************************************************************
* Demux:
*****************************************************************************
* Returns -1 in case of error, 0 in case of EOF, 1 otherwise
*****************************************************************************/
static int Demux( demux_t *p_demux )
{
demux_sys_t *p_sys = p_demux->p_sys;
block_t *p_data;
if( p_sys->i_currentframe > p_sys->i_totalframes )
return 0;
p_data = stream_Block( p_demux->s, p_sys->pi_seektable[p_sys->i_currentframe] );
if( p_data == NULL ) return 0;
p_data->i_dts = p_data->i_pts = (int64_t)(1 + I64C(1000000) * p_sys->i_currentframe) * TTA_FRAMETIME;
p_sys->i_currentframe++;
es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_data->i_dts );
es_out_Send( p_demux->out, p_sys->p_es, p_data );
return 1;
}
/*****************************************************************************
* Control:
*****************************************************************************/
static int Control( demux_t *p_demux, int i_query, va_list args )
{
demux_sys_t *p_sys = p_demux->p_sys;
double f, *pf;
int64_t i64, *pi64;
vlc_meta_t *p_meta;
switch( i_query )
{
case DEMUX_GET_POSITION:
pf = (double*) va_arg( args, double* );
i64 = stream_Size( p_demux->s ) - p_sys->i_start;
if( i64 > 0 )
{
*pf = (double)(stream_Tell( p_demux->s ) - p_sys->i_start )/ (double)i64;
}
else
{
*pf = 0.0;
}
return VLC_SUCCESS;
case DEMUX_SET_POSITION:
f = (double)va_arg( args, double );
i64 = (int64_t)(f * (stream_Size( p_demux->s ) - p_sys->i_start));
es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
if( i64 > 0 )
{
int64_t tmp = 0;
int i;
for( i=0; i < p_sys->i_totalframes && tmp+p_sys->pi_seektable[i] < i64; i++)
{
tmp += p_sys->pi_seektable[i];
}
stream_Seek( p_demux->s, tmp+p_sys->i_start );
p_sys->i_currentframe = i;
return VLC_SUCCESS;
}
return VLC_EGENERIC;
case DEMUX_GET_LENGTH:
pi64 = (int64_t*)va_arg( args, int64_t * );
*pi64 = I64C(1000000) * p_sys->i_totalframes * TTA_FRAMETIME;
return VLC_SUCCESS;
case DEMUX_GET_TIME:
pi64 = (int64_t*)va_arg( args, int64_t * );
*pi64 = I64C(1000000) * p_sys->i_currentframe * TTA_FRAMETIME;
return VLC_SUCCESS;
default:
return VLC_EGENERIC;
}
}
......@@ -434,13 +434,7 @@ static int Open( vlc_object_t *p_this )
sout_access_out_t *p_grab;
char *psz_rtpmap, url[NI_MAXHOST + 8], access[17], psz_ttl[5], ipv;
if( b_rtsp )
{
msg_Err( p_stream, "muxing is not supported in RTSP mode" );
free( p_sys );
return VLC_EGENERIC;
}
else if( !p_sys->psz_destination || *p_sys->psz_destination == '\0' )
if( !p_sys->psz_destination || *p_sys->psz_destination == '\0' )
{
msg_Err( p_stream, "rtp needs a destination when muxing" );
free( p_sys );
......
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