Commit f5aac5a7 authored by Laurent Aimar's avatar Laurent Aimar

* copy: added raw audio/video support.

 * avi: added raw audio support (little endian only).
parent cc7c7f9c
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* avi.c * avi.c
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: avi.c,v 1.12 2003/04/13 20:00:21 fenrir Exp $ * $Id: avi.c,v 1.13 2003/05/02 00:33:42 fenrir Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -316,6 +316,27 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -316,6 +316,27 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
case VLC_FOURCC( 'w', 'm', 'a', '3' ): case VLC_FOURCC( 'w', 'm', 'a', '3' ):
p_wf->wFormatTag = WAVE_FORMAT_WMA3; p_wf->wFormatTag = WAVE_FORMAT_WMA3;
break; break;
/* raw codec */
case VLC_FOURCC( 'u', '8', ' ', ' ' ):
p_wf->wFormatTag = WAVE_FORMAT_PCM;
p_wf->nBlockAlign= p_wf->nChannels;
p_wf->wBitsPerSample = 8;
break;
case VLC_FOURCC( 's', '1', '6', 'l' ):
p_wf->wFormatTag = WAVE_FORMAT_PCM;
p_wf->nBlockAlign= 2 * p_wf->nChannels;
p_wf->wBitsPerSample = 16;
break;
case VLC_FOURCC( 's', '2', '4', 'l' ):
p_wf->wFormatTag = WAVE_FORMAT_PCM;
p_wf->nBlockAlign= 3 * p_wf->nChannels;
p_wf->wBitsPerSample = 24;
break;
case VLC_FOURCC( 's', '3', '2', 'l' ):
p_wf->wFormatTag = WAVE_FORMAT_PCM;
p_wf->nBlockAlign= 4 * p_wf->nChannels;
p_wf->wBitsPerSample = 32;
break;
default: default:
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -428,7 +449,9 @@ static int Mux ( sout_mux_t *p_mux ) ...@@ -428,7 +449,9 @@ static int Mux ( sout_mux_t *p_mux )
if( p_data->i_length < 0 ) if( p_data->i_length < 0 )
{ {
msg_Warn( p_mux, "argg length < 0 l" ); msg_Warn( p_mux, "argg length < 0 l" );
p_data->i_length = 0; sout_BufferDelete( p_mux->p_sout, p_data );
i_count--;
continue;
} }
p_stream->i_duration += p_data->i_length; p_stream->i_duration += p_data->i_length;
p_stream->i_totalsize += p_data->i_size; p_stream->i_totalsize += p_data->i_size;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* copy.c * copy.c
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: copy.c,v 1.7 2003/04/13 20:00:21 fenrir Exp $ * $Id: copy.c,v 1.8 2003/05/02 00:33:42 fenrir Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org> * Eric Petit <titer@videolan.org>
...@@ -144,6 +144,7 @@ static int InitThread( packetizer_thread_t *p_pack ) ...@@ -144,6 +144,7 @@ static int InitThread( packetizer_thread_t *p_pack )
switch( p_pack->p_fifo->i_fourcc ) switch( p_pack->p_fifo->i_fourcc )
{ {
/* video */
case VLC_FOURCC( 'm', '4', 's', '2'): case VLC_FOURCC( 'm', '4', 's', '2'):
case VLC_FOURCC( 'M', '4', 'S', '2'): case VLC_FOURCC( 'M', '4', 'S', '2'):
case VLC_FOURCC( 'm', 'p', '4', 's'): case VLC_FOURCC( 'm', 'p', '4', 's'):
...@@ -168,10 +169,6 @@ static int InitThread( packetizer_thread_t *p_pack ) ...@@ -168,10 +169,6 @@ static int InitThread( packetizer_thread_t *p_pack )
p_pack->output_format.i_fourcc = VLC_FOURCC( 'm', 'p', 'g', 'v' ); p_pack->output_format.i_fourcc = VLC_FOURCC( 'm', 'p', 'g', 'v' );
p_pack->output_format.i_cat = VIDEO_ES; p_pack->output_format.i_cat = VIDEO_ES;
break; break;
case VLC_FOURCC( 'm', 'p', 'g', 'a' ):
p_pack->output_format.i_fourcc = VLC_FOURCC( 'm', 'p', 'g', 'a' );
p_pack->output_format.i_cat = AUDIO_ES;
break;
case VLC_FOURCC( 'd', 'i', 'v', '1' ): case VLC_FOURCC( 'd', 'i', 'v', '1' ):
case VLC_FOURCC( 'D', 'I', 'V', '1' ): case VLC_FOURCC( 'D', 'I', 'V', '1' ):
...@@ -248,6 +245,20 @@ static int InitThread( packetizer_thread_t *p_pack ) ...@@ -248,6 +245,20 @@ static int InitThread( packetizer_thread_t *p_pack )
p_pack->output_format.i_cat = VIDEO_ES; p_pack->output_format.i_cat = VIDEO_ES;
break; break;
case VLC_FOURCC( 'I', '4', '2', '0' ):
p_pack->output_format.i_fourcc = VLC_FOURCC( 'I', '4', '2', '0' );
p_pack->output_format.i_cat = VIDEO_ES;
break;
case VLC_FOURCC( 'I', '4', '2', '2' ):
p_pack->output_format.i_fourcc = VLC_FOURCC( 'I', '4', '2', '2' );
p_pack->output_format.i_cat = VIDEO_ES;
break;
/* audio */
case VLC_FOURCC( 'm', 'p', 'g', 'a' ):
p_pack->output_format.i_fourcc = VLC_FOURCC( 'm', 'p', 'g', 'a' );
p_pack->output_format.i_cat = AUDIO_ES;
break;
case VLC_FOURCC( 'w', 'm', 'a', '1' ): case VLC_FOURCC( 'w', 'm', 'a', '1' ):
p_pack->output_format.i_fourcc = VLC_FOURCC( 'w', 'm', 'a', '1' ); p_pack->output_format.i_fourcc = VLC_FOURCC( 'w', 'm', 'a', '1' );
p_pack->output_format.i_cat = AUDIO_ES; p_pack->output_format.i_cat = AUDIO_ES;
...@@ -256,6 +267,102 @@ static int InitThread( packetizer_thread_t *p_pack ) ...@@ -256,6 +267,102 @@ static int InitThread( packetizer_thread_t *p_pack )
p_pack->output_format.i_fourcc = VLC_FOURCC( 'w', 'm', 'a', '2' ); p_pack->output_format.i_fourcc = VLC_FOURCC( 'w', 'm', 'a', '2' );
p_pack->output_format.i_cat = AUDIO_ES; p_pack->output_format.i_cat = AUDIO_ES;
break; break;
case VLC_FOURCC( 'a', 'r', 'a', 'w' ):
{
WAVEFORMATEX *p_wf = (WAVEFORMATEX*)p_pack->p_fifo->p_waveformatex;
if( p_wf )
{
switch( ( p_wf->wBitsPerSample + 7 ) / 8 )
{
case 1:
p_pack->output_format.i_fourcc = VLC_FOURCC('u','8',' ',' ');
break;
case 2:
p_pack->output_format.i_fourcc = VLC_FOURCC('s','1','6','l');
break;
case 3:
p_pack->output_format.i_fourcc = VLC_FOURCC('s','2','4','l');
break;
case 4:
p_pack->output_format.i_fourcc = VLC_FOURCC('s','3','2','l');
break;
default:
msg_Err( p_pack->p_fifo, "unknown raw audio sample size !!" );
return VLC_EGENERIC;
}
}
else
{
msg_Err( p_pack->p_fifo, "unknown raw audio sample size !!" );
return VLC_EGENERIC;
}
p_pack->output_format.i_cat = AUDIO_ES;
break;
}
case VLC_FOURCC( 't', 'w', 'o', 's' ):
{
WAVEFORMATEX *p_wf = (WAVEFORMATEX*)p_pack->p_fifo->p_waveformatex;
if( p_wf )
{
switch( ( p_wf->wBitsPerSample + 7 ) / 8 )
{
case 1:
p_pack->output_format.i_fourcc = VLC_FOURCC('s','8',' ',' ');
break;
case 2:
p_pack->output_format.i_fourcc = VLC_FOURCC('s','1','6','b');
break;
case 3:
p_pack->output_format.i_fourcc = VLC_FOURCC('s','2','4','b');
break;
case 4:
p_pack->output_format.i_fourcc = VLC_FOURCC('s','3','2','b');
break;
default:
msg_Err( p_pack->p_fifo, "unknown raw audio sample size !!" );
return VLC_EGENERIC;
}
}
else
{
msg_Err( p_pack->p_fifo, "unknown raw audio sample size !!" );
return VLC_EGENERIC;
}
p_pack->output_format.i_cat = AUDIO_ES;
break;
}
case VLC_FOURCC( 's', 'o', 'w', 't' ):
{
WAVEFORMATEX *p_wf = (WAVEFORMATEX*)p_pack->p_fifo->p_waveformatex;
if( p_wf )
{
switch( ( p_wf->wBitsPerSample + 7 ) / 8 )
{
case 1:
p_pack->output_format.i_fourcc = VLC_FOURCC('s','8',' ',' ');
break;
case 2:
p_pack->output_format.i_fourcc = VLC_FOURCC('s','1','6','l');
break;
case 3:
p_pack->output_format.i_fourcc = VLC_FOURCC('s','2','4','l');
break;
case 4:
p_pack->output_format.i_fourcc = VLC_FOURCC('s','3','2','l');
break;
default:
msg_Err( p_pack->p_fifo, "unknown raw audio sample size !!" );
return VLC_EGENERIC;
}
}
else
{
msg_Err( p_pack->p_fifo, "unknown raw audio sample size !!" );
return VLC_EGENERIC;
}
p_pack->output_format.i_cat = AUDIO_ES;
break;
}
default: default:
msg_Err( p_pack->p_fifo, "unknown es type !!" ); msg_Err( p_pack->p_fifo, "unknown es type !!" );
......
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