Commit 1e9f16e2 authored by Gildas Bazin's avatar Gildas Bazin

* ALL: final improvements to the decoders/packetizers api.
   (There are still a few decoders/packetizers left to be converted but this shouldn't take too long).
* ALL: small improvements to the encoders api.
parent 1b973c94
......@@ -2,7 +2,7 @@
* aout_internal.h : internal defines for audio output
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: aout_internal.h,v 1.41 2003/10/27 21:54:10 gbazin Exp $
* $Id: aout_internal.h,v 1.42 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -97,7 +97,7 @@ struct aout_fifo_t
/*****************************************************************************
* aout_filter_t : audio output filter
*****************************************************************************/
typedef struct aout_filter_t
struct aout_filter_t
{
VLC_COMMON_MEMBERS
......@@ -113,7 +113,7 @@ typedef struct aout_filter_t
struct aout_buffer_t * );
vlc_bool_t b_in_place;
vlc_bool_t b_continuity;
} aout_filter_t;
};
/*****************************************************************************
* aout_mixer_t : audio output mixer
......@@ -255,20 +255,10 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
aout_buffer_t * p_buffer );
/* From filters.c : */
int aout_FiltersCreatePipeline( aout_instance_t * p_aout,
aout_filter_t ** pp_filters,
int * pi_nb_filters,
const audio_sample_format_t * p_input_format,
const audio_sample_format_t * p_output_format );
void aout_FiltersDestroyPipeline( aout_instance_t * p_aout,
aout_filter_t ** pp_filters,
int i_nb_filters );
void aout_FiltersHintBuffers( aout_instance_t * p_aout,
aout_filter_t ** pp_filters,
int i_nb_filters, aout_alloc_t * p_first_alloc );
void aout_FiltersPlay( aout_instance_t * p_aout,
aout_filter_t ** pp_filters,
int i_nb_filters, aout_buffer_t ** pp_input_buffer );
VLC_EXPORT( int, aout_FiltersCreatePipeline, ( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int * pi_nb_filters, const audio_sample_format_t * p_input_format, const audio_sample_format_t * p_output_format ) );
VLC_EXPORT( void, aout_FiltersDestroyPipeline, ( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int i_nb_filters ) );
VLC_EXPORT( void, aout_FiltersPlay, ( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int i_nb_filters, aout_buffer_t ** pp_input_buffer ) );
void aout_FiltersHintBuffers( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int i_nb_filters, aout_alloc_t * p_first_alloc );
/* From mixer.c : */
int aout_MixerNew( aout_instance_t * p_aout );
......
......@@ -2,7 +2,7 @@
* audio_output.h : audio output interface
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: audio_output.h,v 1.83 2003/10/08 21:01:07 gbazin Exp $
* $Id: audio_output.h,v 1.84 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -28,19 +28,24 @@
*****************************************************************************
* This structure defines a format for audio samples.
*****************************************************************************/
struct audio_sample_format_t
struct audio_format_t
{
vlc_fourcc_t i_format;
unsigned int i_rate;
/* Describes the channels configuration of the samples (ie. number of
* channels which are available in the buffer, and positions). */
uint32_t i_physical_channels;
/* Describes from which original channels, before downmixing, the
* buffer is derived. */
uint32_t i_original_channels;
/* Optional - for A/52, SPDIF and DTS types : */
/* Bytes used by one compressed frame, depends on bitrate. */
unsigned int i_bytes_per_frame;
/* Number of sampleframes contained in one compressed frame. */
unsigned int i_frame_length;
/* Please note that it may be completely arbitrary - buffers are not
......@@ -48,6 +53,12 @@ struct audio_sample_format_t
* just here for the division :
* buffer_size = i_nb_samples * i_bytes_per_frame / i_frame_length
*/
/* FIXME ? (used by the codecs) */
int i_bitrate;
int i_channels;
int i_blockalign;
int i_bitspersample;
};
#define AOUT_FMTS_IDENTICAL( p_first, p_second ) ( \
......
......@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.97 2003/11/06 16:36:41 nitrox Exp $
* $Id: input_ext-intf.h,v 1.98 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -26,6 +26,8 @@
#ifndef _VLC_INPUT_EXT_INTF_H
#define _VLC_INPUT_EXT_INTF_H 1
#include "ninput.h"
/*
* Communication input -> interface
*/
......@@ -65,6 +67,7 @@ struct es_descriptor_t
unsigned int i_pes_real_size; /* as indicated by the header */
/* Decoder information */
es_format_t fmt;
decoder_fifo_t * p_decoder_fifo;
void * p_waveformatex;
void * p_bitmapinfoheader;
......
......@@ -2,7 +2,7 @@
* ninput.h
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ninput.h,v 1.14 2003/11/13 17:59:34 gbazin Exp $
* $Id: ninput.h,v 1.15 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -24,6 +24,9 @@
#ifndef _NINPUT_H
#define _NINPUT_H 1
#include "audio_output.h"
#include "vlc_video.h"
enum es_extra_type_e
{
ES_EXTRA_TYPE_UNKNOWN,
......@@ -32,6 +35,12 @@ enum es_extra_type_e
ES_EXTRA_TYPE_SUBHEADER
};
typedef struct subs_format_t
{
char *psz_encoding;
} subs_format_t;
typedef struct
{
int i_cat;
......@@ -47,31 +56,16 @@ typedef struct
char *psz_language;
char *psz_description;
struct
{
int i_samplerate;
int i_channels;
audio_format_t audio;
video_format_t video;
subs_format_t subs;
int i_bitrate;
int i_blockalign;
int i_bitspersample;
} audio;
struct
{
int i_width;
int i_height;
int i_display_width;
int i_display_height;
} video;
struct
{
char *psz_encoding;
} subs;
int i_extra_type;
int i_extra;
void *p_extra;
} es_format_t;
static inline void es_format_Init( es_format_t *fmt,
......@@ -84,18 +78,9 @@ static inline void es_format_Init( es_format_t *fmt,
fmt->psz_language = NULL;
fmt->psz_description = NULL;
fmt->audio.i_samplerate = 0;
fmt->audio.i_channels = 0;
fmt->audio.i_bitrate = 0;
fmt->audio.i_blockalign = 0;
fmt->audio.i_bitspersample = 0;
fmt->video.i_width = 0;
fmt->video.i_height = 0;
fmt->video.i_display_width = 0;
fmt->video.i_display_height = 0;
fmt->subs.psz_encoding = NULL;
memset( &fmt->audio, 0, sizeof(audio_format_t) );
memset( &fmt->video, 0, sizeof(video_format_t) );
memset( &fmt->subs, 0, sizeof(subs_format_t) );
fmt->i_extra_type = ES_EXTRA_TYPE_UNKNOWN;
fmt->i_extra = 0;
......
......@@ -2,7 +2,7 @@
* vlc_block_helper.h: Helper functions for data blocks management.
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: vlc_block_helper.h,v 1.4 2003/10/23 20:51:20 gbazin Exp $
* $Id: vlc_block_helper.h,v 1.5 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -29,26 +29,38 @@ typedef struct block_bytestream_t
block_t *p_chain;
block_t *p_block;
int i_offset;
} block_bytestream_t;
#define block_BytestreamInit( a, b, c ) __block_BytestreamInit( VLC_OBJECT(a), b, c )
#define block_BytestreamInit( a ) __block_BytestreamInit( VLC_OBJECT(a) )
/*****************************************************************************
* block_bytestream_t management
*****************************************************************************/
static inline block_bytestream_t __block_BytestreamInit( vlc_object_t *p_obj,
block_t *p_block, int i_offset )
static inline block_bytestream_t __block_BytestreamInit( vlc_object_t *p_obj )
{
block_bytestream_t bytestream;
bytestream.i_offset = i_offset;
bytestream.p_block = p_block;
bytestream.p_chain = p_block;
bytestream.i_offset = 0;
bytestream.p_chain = bytestream.p_block = NULL;
return bytestream;
}
static inline block_t *block_BytestreamFlush( block_bytestream_t *p_bytestream)
static inline void block_BytestreamRelease( block_bytestream_t *p_bytestream )
{
while( p_bytestream->p_chain )
{
block_t *p_next;
p_next = p_bytestream->p_chain->p_next;
p_bytestream->p_chain->pf_release( p_bytestream->p_chain );
p_bytestream->p_chain = p_next;
}
p_bytestream->i_offset = 0;
p_bytestream->p_chain = p_bytestream->p_block = NULL;
}
static inline void block_BytestreamFlush( block_bytestream_t *p_bytestream )
{
while( p_bytestream->p_chain != p_bytestream->p_block )
{
......@@ -57,8 +69,54 @@ static inline block_t *block_BytestreamFlush( block_bytestream_t *p_bytestream)
p_bytestream->p_chain->pf_release( p_bytestream->p_chain );
p_bytestream->p_chain = p_next;
}
while( p_bytestream->p_block &&
(p_bytestream->p_block->i_buffer - p_bytestream->i_offset) == 0 )
{
block_t *p_next;
p_next = p_bytestream->p_chain->p_next;
p_bytestream->p_chain->pf_release( p_bytestream->p_chain );
p_bytestream->p_chain = p_bytestream->p_block = p_next;
p_bytestream->i_offset = 0;
}
}
return p_bytestream->p_chain;
static inline void block_BytestreamPush( block_bytestream_t *p_bytestream,
block_t *p_block )
{
block_ChainAppend( &p_bytestream->p_chain, p_block );
if( !p_bytestream->p_block ) p_bytestream->p_block = p_block;
}
static inline block_t *block_BytestreamPop( block_bytestream_t *p_bytestream )
{
block_t *p_block;
block_BytestreamFlush( p_bytestream );
p_block = p_bytestream->p_block;
if( p_block == NULL )
{
return NULL;
}
else if( !p_block->p_next )
{
p_block->p_buffer += p_bytestream->i_offset;
p_block->i_buffer -= p_bytestream->i_offset;
p_bytestream->i_offset = 0;
p_bytestream->p_chain = p_bytestream->p_block = NULL;
return p_block;
}
while( p_block->p_next && p_block->p_next->p_next )
p_block = p_block->p_next;
{
block_t *p_block_old = p_block;
p_block = p_block->p_next;
p_block_old->p_next = NULL;
}
return p_block;
}
static inline int block_SkipByte( block_bytestream_t *p_bytestream )
......@@ -151,6 +209,34 @@ static inline int block_GetByte( block_bytestream_t *p_bytestream,
return VLC_EGENERIC;
}
static inline int block_WaitBytes( block_bytestream_t *p_bytestream,
int i_data )
{
block_t *p_block;
int i_offset, i_copy, i_size;
/* Check we have that much data */
i_offset = p_bytestream->i_offset;
i_size = i_data;
i_copy = 0;
for( p_block = p_bytestream->p_block;
p_block != NULL; p_block = p_block->p_next )
{
i_copy = __MIN( i_size, p_block->i_buffer - i_offset );
i_size -= i_copy;
i_offset = 0;
if( !i_size ) break;
}
if( i_size )
{
/* Not enough data, bail out */
return VLC_EGENERIC;
}
return VLC_SUCCESS;
}
static inline int block_SkipBytes( block_bytestream_t *p_bytestream,
int i_data )
{
......
......@@ -2,7 +2,7 @@
* vlc_codec.h: codec related structures
*****************************************************************************
* Copyright (C) 1999-2003 VideoLAN
* $Id: vlc_codec.h,v 1.3 2003/11/05 18:59:01 gbazin Exp $
* $Id: vlc_codec.h,v 1.4 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -23,11 +23,15 @@
#ifndef _VLC_CODEC_H
#define _VLC_CODEC_H 1
#include "ninput.h"
/**
* \file
* This file defines the structure and types used by decoders and encoders
*/
typedef struct decoder_owner_sys_t decoder_owner_sys_t;
/**
* \defgroup decoder Decoder
*
......@@ -43,15 +47,39 @@ struct decoder_t
/* Module properties */
module_t * p_module;
decoder_sys_t * p_sys;
int ( * pf_init ) ( decoder_t * );
/* Deprecated */
int ( * pf_decode )( decoder_t *, block_t * );
int ( * pf_end ) ( decoder_t * );
decoder_fifo_t * p_fifo;
int ( * pf_run ) ( decoder_fifo_t * );
/* End deprecated */
/* Input properties */
decoder_fifo_t * p_fifo; /* stores the PES stream data */
picture_t * ( * pf_decode_video )( decoder_t *, block_t ** );
aout_buffer_t * ( * pf_decode_audio )( decoder_t *, block_t ** );
void ( * pf_decode_sub) ( decoder_t *, block_t ** );
block_t * ( * pf_packetize ) ( decoder_t *, block_t ** );
/* Tmp field for old decoder api */
int ( * pf_run ) ( decoder_fifo_t * );
/* Input format ie from demuxer (XXX: a lot of field could be invalid) */
es_format_t fmt_in;
/* Output format of decoder/packetizer */
es_format_t fmt_out;
/*
* Buffers allocation
*/
/* Audio output callbacks */
aout_buffer_t * ( * pf_aout_buffer_new) ( decoder_t *, int );
void ( * pf_aout_buffer_del) ( decoder_t *, aout_buffer_t * );
/* Video output callbacks */
picture_t * ( * pf_vout_buffer_new) ( decoder_t * );
void ( * pf_vout_buffer_del) ( decoder_t *, picture_t * );
/* Private structure for the owner of the decoder */
decoder_owner_sys_t *p_owner;
};
/**
......@@ -79,22 +107,12 @@ struct encoder_t
block_t * ( * pf_encode_audio )( encoder_t *, aout_buffer_t * );
/* Properties of the input data fed to the encoder */
union {
audio_sample_format_t audio;
video_frame_format_t video;
} format;
es_format_t fmt_in;
/* Properties of the output of the encoder */
vlc_fourcc_t i_fourcc;
int i_bitrate;
int i_extra_data;
uint8_t *p_extra_data;
es_format_t fmt_out;
/* FIXME: move these to the ffmpeg encoder */
int i_frame_rate;
int i_frame_rate_base;
int i_aspect;
int i_key_int;
int i_b_frames;
int i_vtolerance;
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.85 2003/10/29 17:32:54 zorglub Exp $
* $Id: vlc_common.h,v 1.86 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -229,14 +229,17 @@ typedef struct aout_sys_t aout_sys_t;
typedef struct aout_fifo_t aout_fifo_t;
typedef struct aout_input_t aout_input_t;
typedef struct aout_buffer_t aout_buffer_t;
typedef struct audio_sample_format_t audio_sample_format_t;
typedef struct audio_format_t audio_format_t;
typedef audio_format_t audio_sample_format_t;
typedef struct audio_date_t audio_date_t;
typedef struct aout_filter_t aout_filter_t;
/* Video */
typedef struct vout_thread_t vout_thread_t;
typedef struct vout_sys_t vout_sys_t;
typedef struct chroma_sys_t chroma_sys_t;
typedef struct video_frame_format_t video_frame_format_t;
typedef struct video_format_t video_format_t;
typedef video_format_t video_frame_format_t;
typedef struct picture_t picture_t;
typedef struct picture_sys_t picture_sys_t;
typedef struct picture_heap_t picture_heap_t;
......
......@@ -4,7 +4,7 @@
* includes all common video types and constants.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vlc_video.h,v 1.5 2003/10/24 21:27:06 gbazin Exp $
* $Id: vlc_video.h,v 1.6 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -28,7 +28,7 @@
/**
* Description of a video frame
*/
struct video_frame_format_t
struct video_format_t
{
vlc_fourcc_t i_chroma; /**< picture chroma */
unsigned int i_aspect; /**< aspect ratio */
......@@ -42,6 +42,8 @@ struct video_frame_format_t
unsigned int i_bits_per_pixel; /**< number of bits per pixel */
unsigned int i_frame_rate; /**< frame rate numerator */
unsigned int i_frame_rate_base; /**< frame rate denominator */
};
/**
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,7 @@
* cinepak.c: cinepak video decoder
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: cinepak.c,v 1.2 2003/10/25 00:49:13 sam Exp $
* $Id: cinepak.c,v 1.3 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -71,20 +71,14 @@ struct decoder_sys_t
* Cinepak properties
*/
cinepak_context_t *p_context;
/*
* Output properties
*/
vout_thread_t *p_vout;
};
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int OpenDecoder( vlc_object_t * );
static int InitDecoder( decoder_t * );
static int RunDecoder ( decoder_t *, block_t * );
static int EndDecoder ( decoder_t * );
static void CloseDecoder( vlc_object_t * );
static picture_t *DecodeBlock ( decoder_t *, block_t ** );
static int cinepak_decode_frame( cinepak_context_t *, int, uint8_t * );
......@@ -94,7 +88,7 @@ static int cinepak_decode_frame( cinepak_context_t *, int, uint8_t * );
vlc_module_begin();
set_description( _("Cinepak video decoder") );
set_capability( "decoder", 70 );
set_callbacks( OpenDecoder, NULL );
set_callbacks( OpenDecoder, CloseDecoder );
vlc_module_end();
/*****************************************************************************
......@@ -106,8 +100,10 @@ vlc_module_end();
static int OpenDecoder( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
decoder_sys_t *p_sys;
vlc_value_t val;
switch( p_dec->p_fifo->i_fourcc )
switch( p_dec->fmt_in.i_codec )
{
case VLC_FOURCC('c','v','i','d'):
case VLC_FOURCC('C','V','I','D'):
......@@ -118,30 +114,13 @@ static int OpenDecoder( vlc_object_t *p_this )
}
/* Allocate the memory needed to store the decoder's structure */
if( ( p_dec->p_sys =
if( ( p_dec->p_sys = p_sys =
(decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
{
msg_Err( p_dec, "out of memory" );
return VLC_EGENERIC;
}
p_dec->pf_init = InitDecoder;
p_dec->pf_decode = RunDecoder;
p_dec->pf_end = EndDecoder;
return VLC_SUCCESS;
}
/*****************************************************************************
* InitDecoder: Initalize the decoder
*****************************************************************************/
static int InitDecoder( decoder_t *p_dec )
{
decoder_sys_t *p_sys = p_dec->p_sys;
vlc_value_t val;
p_sys->p_vout = NULL;
if( !(p_sys->p_context = malloc( sizeof( cinepak_context_t ) ) ) )
{
msg_Err( p_dec, "out of memory" );
......@@ -152,57 +131,53 @@ static int InitDecoder( decoder_t *p_dec )
var_Get( p_dec, "grayscale", &val );
p_sys->p_context->b_grayscale = val.b_bool;
p_dec->pf_decode_video = DecodeBlock;
msg_Dbg( p_dec, "cinepak decoder started" );
return VLC_SUCCESS;
}
/****************************************************************************
* RunDecoder: the whole thing
* DecodeBlock: the whole thing
****************************************************************************
* This function must be fed with whole frames.
****************************************************************************/
static int RunDecoder( decoder_t *p_dec, block_t *p_block )
static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
decoder_sys_t *p_sys = p_dec->p_sys;
int i_status, i_plane;
uint8_t *p_dst, *p_src;
picture_t *p_pic;
block_t *p_block;
if( !pp_block || !*pp_block ) return NULL;
i_status = cinepak_decode_frame( p_sys->p_context,
p_block->i_buffer, p_block->p_buffer );
p_block = *pp_block;
i_status = cinepak_decode_frame( p_sys->p_context, p_block->i_buffer,
p_block->p_buffer );
if( i_status < 0 )
{
msg_Warn( p_dec, "cannot decode one frame (%d bytes)",
p_block->i_buffer );
block_Release( p_block );
return VLC_SUCCESS;
return NULL;
}
/* Check our vout */
p_sys->p_vout = vout_Request( p_dec, p_sys->p_vout,
p_sys->p_context->i_width,
p_sys->p_context->i_height,
VLC_FOURCC('I','4','2','0'),
p_sys->p_context->i_width
* VOUT_ASPECT_FACTOR
/ p_sys->p_context->i_height );
if( !p_sys->p_vout )
{
msg_Err( p_dec, "cannot create vout" );
block_Release( p_block );
return VLC_EGENERIC;
}
p_dec->fmt_out.video.i_width = p_sys->p_context->i_width;
p_dec->fmt_out.video.i_height = p_sys->p_context->i_height;
p_dec->fmt_out.video.i_aspect = p_sys->p_context->i_width
* VOUT_ASPECT_FACTOR / p_sys->p_context->i_height;
p_dec->fmt_out.i_codec = VLC_FOURCC('I','4','2','0');
/* Send decoded frame to vout */
while( !(p_pic = vout_CreatePicture( p_sys->p_vout, 0, 0, 0 ) ) )
{
if( p_dec->p_fifo->b_die || p_dec->p_fifo->b_error )
/* Get a new picture */
p_pic = p_dec->pf_vout_buffer_new( p_dec );
if( p_pic == NULL )
{
block_Release( p_block );
return VLC_EGENERIC;
}
msleep( VOUT_OUTMEM_SLEEP );
return NULL;
}
for( i_plane = 0; i_plane < 3; i_plane++ )
......@@ -224,25 +199,23 @@ static int RunDecoder( decoder_t *p_dec, block_t *p_block )
}
}
vout_DatePicture( p_sys->p_vout, p_pic, p_block->i_pts);
vout_DisplayPicture( p_sys->p_vout, p_pic );
p_pic->date = p_block->i_pts;
block_Release( p_block );
return VLC_SUCCESS;
return p_pic;
}
/*****************************************************************************
* EndDecoder: theora decoder destruction
* CloseDecoder: decoder destruction
*****************************************************************************/
static int EndDecoder( decoder_t *p_dec )
static void CloseDecoder( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t *)p_this;
decoder_sys_t *p_sys = p_dec->p_sys;
int i;
msg_Dbg( p_dec, "cinepak decoder stopped" );
vout_Request( p_dec, p_sys->p_vout, 0, 0, 0, 0 );
for( i = 0; i < 3; i++ )
{
if( p_sys->p_context->p_pix[i] ) free( p_sys->p_context->p_pix[i] );
......@@ -251,8 +224,6 @@ static int EndDecoder( decoder_t *p_dec )
free( p_sys->p_context );
free( p_sys );
return VLC_SUCCESS;
}
/*****************************************************************************
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* dv.c: a decoder for DV video
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: dv.c,v 1.5 2003/09/02 20:19:25 gbazin Exp $
* $Id: dv.c,v 1.6 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -59,7 +59,7 @@ static int OpenDecoder ( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
if( p_dec->p_fifo->i_fourcc != VLC_FOURCC('d','v','s','d') )
if( p_dec->fmt_in.i_codec != VLC_FOURCC('d','v','s','d') )
{
return VLC_EGENERIC;
}
......
......@@ -2,7 +2,7 @@
* dvbsub.c : DVB subtitles decoder thread
*****************************************************************************
* Copyright (C) 2003 ANEVIA
* $Id: dvbsub.c,v 1.2 2003/11/06 19:35:05 nitrox Exp $
* $Id: dvbsub.c,v 1.3 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Damien LUCAS <damien.lucas@anevia.com>
*
......@@ -275,7 +275,7 @@ vlc_module_end();
static int OpenDecoder( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*) p_this;
if( p_dec->p_fifo->i_fourcc != VLC_FOURCC('d','v','b','s') )
if( p_dec->fmt_in.i_codec != VLC_FOURCC('d','v','b','s') )
{
return VLC_EGENERIC;
}
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* audio.c: audio decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2003 VideoLAN
* $Id: audio.c,v 1.21 2003/10/27 10:00:40 gbazin Exp $
* $Id: audio.c,v 1.22 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -29,19 +29,9 @@
#include <string.h>
#include <vlc/vlc.h>
#include <vlc/vout.h>
#include <vlc/aout.h>
#include <vlc/decoder.h>
#include <vlc/input.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* getpid() */
#endif
#ifdef HAVE_SYS_TIMES_H
# include <sys/times.h>
#endif
#include "codecs.h"
#include "aout_internal.h"
......@@ -83,8 +73,6 @@ struct decoder_sys_t
/*
* Output properties
*/
aout_instance_t *p_aout;
aout_input_t *p_aout_input;
audio_sample_format_t aout_format;
audio_date_t end_date;
};
......@@ -98,7 +86,6 @@ int E_(InitAudioDec)( decoder_t *p_dec, AVCodecContext *p_context,
AVCodec *p_codec, int i_codec_id, char *psz_namecodec )
{
decoder_sys_t *p_sys;
WAVEFORMATEX wf, *p_wf;
/* Allocate the memory needed to store the decoder's structure */
if( ( p_dec->p_sys = p_sys =
......@@ -113,25 +100,19 @@ int E_(InitAudioDec)( decoder_t *p_dec, AVCodecContext *p_context,
p_dec->p_sys->i_codec_id = i_codec_id;
p_dec->p_sys->psz_namecodec = psz_namecodec;
if( ( p_wf = p_dec->p_fifo->p_waveformatex ) == NULL )
{
msg_Warn( p_dec, "audio informations missing" );
p_wf = &wf;
memset( p_wf, 0, sizeof( WAVEFORMATEX ) );
}
/* ***** Fill p_context with init values ***** */
p_sys->p_context->sample_rate = p_wf->nSamplesPerSec;
p_sys->p_context->channels = p_wf->nChannels;
p_sys->p_context->block_align = p_wf->nBlockAlign;
p_sys->p_context->bit_rate = p_wf->nAvgBytesPerSec * 8;
p_sys->p_context->sample_rate = p_dec->fmt_in.audio.i_rate;
p_sys->p_context->channels = p_dec->fmt_in.audio.i_channels;
p_sys->p_context->block_align = p_dec->fmt_in.audio.i_blockalign;
p_sys->p_context->bit_rate = p_dec->fmt_in.i_bitrate;
if( ( p_sys->p_context->extradata_size = p_wf->cbSize ) > 0 )
if( ( p_sys->p_context->extradata_size = p_dec->fmt_in.i_extra ) > 0 )
{
p_sys->p_context->extradata =
malloc( p_wf->cbSize + FF_INPUT_BUFFER_PADDING_SIZE );
memcpy( p_sys->p_context->extradata, &p_wf[1], p_wf->cbSize);
memset( &((uint8_t*)p_sys->p_context->extradata)[p_wf->cbSize], 0,
malloc( p_dec->fmt_in.i_extra + FF_INPUT_BUFFER_PADDING_SIZE );
memcpy( p_sys->p_context->extradata,
p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra );
memset( p_sys->p_context->extradata + p_dec->fmt_in.i_extra, 0,
FF_INPUT_BUFFER_PADDING_SIZE );
}
......@@ -148,131 +129,106 @@ int E_(InitAudioDec)( decoder_t *p_dec, AVCodecContext *p_context,
p_sys->p_output = malloc( 3 * AVCODEC_MAX_AUDIO_FRAME_SIZE );
p_sys->p_aout = NULL;
p_sys->p_aout_input = NULL;
aout_DateSet( &p_sys->end_date, 0 );
/* Set output properties */
p_dec->fmt_out.i_cat = AUDIO_ES;
p_dec->fmt_out.i_codec = AOUT_FMT_S16_NE;
return VLC_SUCCESS;
}
/*****************************************************************************
* DecodeAudio: Called to decode one frame
*****************************************************************************/
int E_( DecodeAudio )( decoder_t *p_dec, block_t *p_block )
aout_buffer_t *E_( DecodeAudio )( decoder_t *p_dec, block_t **pp_block )
{
decoder_sys_t *p_sys = p_dec->p_sys;
aout_buffer_t *p_aout_buffer;
mtime_t i_pts;
int i_used, i_output, i_samples;
uint8_t *p_samples;
aout_buffer_t *p_buffer;
block_t *p_block;
if( !pp_block || !*pp_block ) return NULL;
uint8_t *p_buffer, *p_samples;
int i_buffer, i_samples;
p_block = *pp_block;
if( !aout_DateGet( &p_sys->end_date ) && !p_block->i_pts )
{
/* We've just started the stream, wait for the first PTS. */
block_Release( p_block );
return VLC_SUCCESS;
return NULL;
}
i_pts = p_block->i_pts;
i_buffer = p_block->i_buffer;
p_buffer = p_block->p_buffer;
while( i_buffer )
if( !p_block->i_buffer )
{
int i_used, i_output;
block_Release( p_block );
return NULL;
}
i_used = avcodec_decode_audio( p_sys->p_context,
(int16_t*)p_sys->p_output, &i_output,
p_buffer, i_buffer );
if( i_used < 0 )
p_block->p_buffer, p_block->i_buffer );
if( i_used < 0 )//|| i_output == 0 )
{
msg_Warn( p_dec, "cannot decode one frame (%d bytes)", i_buffer );
break;
if( i_used < 0 )
msg_Warn( p_dec, "cannot decode one frame (%d bytes)",
p_block->i_buffer );
block_Release( p_block );
return NULL;
}
i_buffer -= i_used;
p_buffer += i_used;
p_block->i_buffer -= i_used;
p_block->p_buffer += i_used;
if( p_sys->p_context->channels <= 0 || p_sys->p_context->channels > 6 )
{
msg_Warn( p_dec, "invalid channels count %d",
p_sys->p_context->channels );
break;
block_Release( p_block );
return NULL;
}
/* **** First check if we have a valid output **** */
if( p_sys->p_aout_input == NULL ||
p_sys->aout_format.i_original_channels !=
pi_channels_maps[p_sys->p_context->channels] )
if( p_dec->fmt_out.audio.i_rate != p_sys->p_context->sample_rate )
{
if( p_sys->p_aout_input != NULL )
{
/* **** Delete the old **** */
aout_DecDelete( p_sys->p_aout, p_sys->p_aout_input );
aout_DateInit( &p_sys->end_date, p_sys->p_context->sample_rate );
aout_DateSet( &p_sys->end_date, p_block->i_pts );
}
/* **** Create a new audio output **** */
p_sys->aout_format.i_format = AOUT_FMT_S16_NE;
p_sys->aout_format.i_rate = p_sys->p_context->sample_rate;
p_sys->aout_format.i_physical_channels =
p_sys->aout_format.i_original_channels =
/* **** Set audio output parameters **** */
p_dec->fmt_out.audio.i_rate = p_sys->p_context->sample_rate;
p_dec->fmt_out.audio.i_channels = p_sys->p_context->channels;
p_dec->fmt_out.audio.i_original_channels =
p_dec->fmt_out.audio.i_physical_channels =
pi_channels_maps[p_sys->p_context->channels];
aout_DateInit( &p_sys->end_date, p_sys->aout_format.i_rate );
p_sys->p_aout_input = aout_DecNew( p_dec, &p_sys->p_aout,
&p_sys->aout_format );
}
if( !p_sys->p_aout_input )
{
msg_Err( p_dec, "cannot create audio output" );
block_Release( p_block );
return VLC_EGENERIC;
}
if( i_pts != 0 && i_pts != aout_DateGet( &p_sys->end_date ) )
if( p_block->i_pts != 0 &&
p_block->i_pts != aout_DateGet( &p_sys->end_date ) )
{
aout_DateSet( &p_sys->end_date, i_pts );
i_pts = 0;
aout_DateSet( &p_sys->end_date, p_block->i_pts );
p_block->i_pts = 0;
}
/* **** Now we can output these samples **** */
i_samples = i_output / 2 / p_sys->p_context->channels;
p_samples = p_sys->p_output;
while( i_samples > 0 )
{
int i_smaller_samples;
i_smaller_samples = __MIN( 8000, i_samples );
p_aout_buffer = aout_DecNewBuffer( p_sys->p_aout,
p_sys->p_aout_input,
i_smaller_samples );
if( !p_aout_buffer )
p_buffer = p_dec->pf_aout_buffer_new( p_dec, i_samples );
if( !p_buffer )
{
msg_Err( p_dec, "cannot get aout buffer" );
block_Release( p_block );
return VLC_EGENERIC;
return NULL;
}
p_aout_buffer->start_date = aout_DateGet( &p_sys->end_date );
p_aout_buffer->end_date = aout_DateIncrement( &p_sys->end_date,
i_smaller_samples );
memcpy( p_aout_buffer->p_buffer, p_samples,
p_aout_buffer->i_nb_bytes );
aout_DecPlay( p_sys->p_aout, p_sys->p_aout_input, p_aout_buffer );
p_buffer->start_date = aout_DateGet( &p_sys->end_date );
p_buffer->end_date = aout_DateIncrement( &p_sys->end_date, i_samples );
p_samples += i_smaller_samples * 2 * p_sys->p_context->channels;
i_samples -= i_smaller_samples;
}
}
memcpy( p_buffer->p_buffer, p_samples, p_buffer->i_nb_bytes );
block_Release( p_block );
return VLC_SUCCESS;
return p_buffer;
}
/*****************************************************************************
......@@ -283,9 +239,4 @@ void E_(EndAudioDec)( decoder_t *p_dec )
decoder_sys_t *p_sys = p_dec->p_sys;
if( p_sys->p_output ) free( p_sys->p_output );
if( p_sys->p_aout_input )
{
aout_DecDelete( p_sys->p_aout, p_sys->p_aout_input );
}
}
This diff is collapsed.
......@@ -2,7 +2,7 @@
* ffmpeg.c: video decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ffmpeg.c,v 1.58 2003/10/29 20:53:41 gbazin Exp $
* $Id: ffmpeg.c,v 1.59 2003/11/16 21:07:31 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -29,15 +29,9 @@
#include <string.h>
#include <vlc/vlc.h>
#include <vlc/vout.h>
#include <vlc/aout.h>
#include <vlc/decoder.h>
#include <vlc/input.h>
#ifdef HAVE_SYS_TIMES_H
# include <sys/times.h>
#endif
/* ffmpeg header */
#ifdef HAVE_FFMPEG_AVCODEC_H
# include <ffmpeg/avcodec.h>
......@@ -77,10 +71,7 @@ struct decoder_sys_t
* Local prototypes
****************************************************************************/
static int OpenDecoder( vlc_object_t * );
static int InitDecoder( decoder_t * );
static int EndDecoder( decoder_t * );
static int b_ffmpeginit = 0;
static void CloseDecoder( vlc_object_t * );
/*****************************************************************************
* Module descriptor
......@@ -90,7 +81,7 @@ vlc_module_begin();
/* decoder main module */
add_category_hint( N_("ffmpeg"), NULL, VLC_FALSE );
set_capability( "decoder", 70 );
set_callbacks( OpenDecoder, NULL );
set_callbacks( OpenDecoder, CloseDecoder );
set_description( _("ffmpeg audio/video decoder((MS)MPEG4,SVQ1,H263,WMV,WMA)") );
add_bool( "ffmpeg-dr", 1, NULL, DR_TEXT, DR_TEXT, VLC_TRUE );
......@@ -115,17 +106,11 @@ vlc_module_begin();
set_callbacks( E_(OpenChroma), NULL );
set_description( _("ffmpeg chroma conversion") );
/* video encoder submodule */
add_submodule();
set_description( _("ffmpeg video encoder") );
set_capability( "video encoder", 100 );
set_callbacks( E_(OpenVideoEncoder), E_(CloseVideoEncoder) );
/* audio encoder submodule */
/* encoder submodule */
add_submodule();
set_description( _("ffmpeg audio encoder") );
set_capability( "audio encoder", 10 );
set_callbacks( E_(OpenAudioEncoder), E_(CloseAudioEncoder) );
set_description( _("ffmpeg audio/video encoder") );
set_capability( "encoder", 100 );
set_callbacks( E_(OpenEncoder), E_(CloseEncoder) );
var_Create( p_module->p_libvlc, "avcodec", VLC_VAR_MUTEX );
vlc_module_end();
......@@ -136,10 +121,14 @@ vlc_module_end();
static int OpenDecoder( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*) p_this;
int i_cat, i_codec_id;
int i_cat, i_codec_id, i_result;
char *psz_namecodec;
if( !E_(GetFfmpegCodec)( p_dec->p_fifo->i_fourcc, &i_cat, &i_codec_id,
AVCodecContext *p_context;
AVCodec *p_codec;
/* *** determine codec type *** */
if( !E_(GetFfmpegCodec)( p_dec->fmt_in.i_codec, &i_cat, &i_codec_id,
&psz_namecodec ) )
{
return VLC_EGENERIC;
......@@ -148,54 +137,51 @@ static int OpenDecoder( vlc_object_t *p_this )
/* Initialization must be done before avcodec_find_decoder() */
E_(InitLibavcodec)(p_this);
if( !avcodec_find_decoder( i_codec_id ) )
{
msg_Dbg( p_dec, "codec not found (%s)", psz_namecodec );
return VLC_EGENERIC;
}
p_dec->pf_init = InitDecoder;
p_dec->pf_decode = (i_cat == VIDEO_ES) ? E_(DecodeVideo) : E_(DecodeAudio);
p_dec->pf_end = EndDecoder;
return VLC_SUCCESS;
}
/*****************************************************************************
* InitDecoder: Initalize the decoder
*****************************************************************************/
static int InitDecoder( decoder_t *p_dec )
{
int i_cat, i_codec_id, i_result;
char *psz_namecodec;
AVCodecContext *p_context;
AVCodec *p_codec;
/* *** determine codec type *** */
E_(GetFfmpegCodec)( p_dec->p_fifo->i_fourcc,
&i_cat, &i_codec_id, &psz_namecodec );
/* *** ask ffmpeg for a decoder *** */
if( !( p_codec = avcodec_find_decoder( i_codec_id ) ) )
{
msg_Err( p_dec, "codec not found (%s)", psz_namecodec );
msg_Dbg( p_dec, "codec not found (%s)", psz_namecodec );
return VLC_EGENERIC;
}
/* *** get a p_context *** */
p_context = avcodec_alloc_context();
/* Set CPU capabilities */
#ifdef HAVE_MMX
p_context->dsp_mask = 0;
if( p_dec->p_libvlc->i_cpu & CPU_CAPABILITY_MMX )
{
p_context->dsp_mask &= FF_MM_MMX;
}
if( p_dec->p_libvlc->i_cpu & CPU_CAPABILITY_MMXEXT )
{
p_context->dsp_mask &= FF_MM_MMXEXT;
}
if( p_dec->p_libvlc->i_cpu & CPU_CAPABILITY_3DNOW )
{
p_context->dsp_mask &= FF_MM_3DNOW;
}
if( p_enc->p_libvlc->i_cpu & CPU_CAPABILITY_SSE )
{
p_context->dsp_mask &= FF_MM_SSE;
p_context->dsp_mask &= FF_MM_SSE2; /* FIXME */
}
/* Hack to make sure everything can be disabled **/
p_context->dsp_mask &= (FF_MM_FORCE >> 1);
#endif
switch( i_cat )
{
case VIDEO_ES:
p_dec->pf_decode_video = E_(DecodeVideo);
i_result = E_( InitVideoDec )( p_dec, p_context, p_codec,
i_codec_id, psz_namecodec );
p_dec->pf_decode = E_(DecodeVideo);
break;
case AUDIO_ES:
p_dec->pf_decode_audio = E_(DecodeAudio);
i_result = E_( InitAudioDec )( p_dec, p_context, p_codec,
i_codec_id, psz_namecodec );
p_dec->pf_decode = E_(DecodeAudio);
break;
default:
i_result = VLC_EGENERIC;
......@@ -207,10 +193,11 @@ static int InitDecoder( decoder_t *p_dec )
}
/*****************************************************************************
* EndDecoder: decoder destruction
* CloseDecoder: decoder destruction
*****************************************************************************/
static int EndDecoder( decoder_t *p_dec )
static void CloseDecoder( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t *)p_this;
decoder_sys_t *p_sys = p_dec->p_sys;
if( !p_sys->p_context )
......@@ -234,7 +221,6 @@ static int EndDecoder( decoder_t *p_dec )
}
free( p_sys );
return VLC_SUCCESS;
}
/*****************************************************************************
......@@ -692,6 +678,7 @@ int E_(GetFfmpegChroma)( vlc_fourcc_t i_chroma )
void E_(InitLibavcodec)( vlc_object_t *p_object )
{
static int b_ffmpeginit = 0;
vlc_value_t lockval;
var_Get( p_object->p_libvlc, "avcodec", &lockval );
......
......@@ -2,7 +2,7 @@
* ffmpeg.h: decoder using the ffmpeg library
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: ffmpeg.h,v 1.27 2003/10/27 01:04:38 gbazin Exp $
* $Id: ffmpeg.h,v 1.28 2003/11/16 21:07:31 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -42,20 +42,20 @@ int E_(GetFfmpegChroma)( vlc_fourcc_t );
int E_( InitVideoDec )( decoder_t *, AVCodecContext *, AVCodec *,
int, char * );
void E_( EndVideoDec ) ( decoder_t * );
int E_( DecodeVideo ) ( decoder_t *, block_t * );
picture_t *E_( DecodeVideo ) ( decoder_t *, block_t ** );
/* Audio decoder module */
int E_( InitAudioDec )( decoder_t *, AVCodecContext *, AVCodec *,
int, char * );
void E_( EndAudioDec ) ( decoder_t * );
int E_( DecodeAudio ) ( decoder_t *, block_t * );
aout_buffer_t *E_( DecodeAudio ) ( decoder_t *, block_t ** );
/* Chroma conversion module */
int E_(OpenChroma)( vlc_object_t * );
/* Video encoder module */
int E_(OpenVideoEncoder) ( vlc_object_t * );
void E_(CloseVideoEncoder)( vlc_object_t * );
int E_(OpenEncoder) ( vlc_object_t * );
void E_(CloseEncoder)( vlc_object_t * );
/* Audio encoder module */
int E_(OpenAudioEncoder) ( vlc_object_t * );
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* flac.c: flac decoder module making use of libflac
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: flacdec.c,v 1.4 2003/09/02 20:19:25 gbazin Exp $
* $Id: flacdec.c,v 1.5 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -116,7 +116,7 @@ static int OpenDecoder( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
if( p_dec->p_fifo->i_fourcc != VLC_FOURCC('f','l','a','c') )
if( p_dec->fmt_in.i_codec != VLC_FOURCC('f','l','a','c') )
{
return VLC_EGENERIC;
}
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* lpcm.c: lpcm decoder module
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: lpcm.c,v 1.17 2003/09/02 20:19:25 gbazin Exp $
* $Id: lpcm.c,v 1.18 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Henri Fallon <henri@videolan.org>
......@@ -104,8 +104,8 @@ static int OpenDecoder( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
if( p_dec->p_fifo->i_fourcc != VLC_FOURCC('l','p','c','m')
&& p_dec->p_fifo->i_fourcc != VLC_FOURCC('l','p','c','b') )
if( p_dec->fmt_in.i_codec != VLC_FOURCC('l','p','c','m')
&& p_dec->fmt_in.i_codec != VLC_FOURCC('l','p','c','b') )
{
return VLC_EGENERIC;
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,7 @@
* spudec.c : SPU decoder thread
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: spudec.c,v 1.26 2003/11/06 16:36:41 nitrox Exp $
* $Id: spudec.c,v 1.27 2003/11/16 21:07:31 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -61,8 +61,8 @@ static int OpenDecoder( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
if( p_dec->p_fifo->i_fourcc != VLC_FOURCC('s','p','u',' ')
&& p_dec->p_fifo->i_fourcc != VLC_FOURCC('s','p','u','b') )
if( p_dec->fmt_in.i_codec != VLC_FOURCC('s','p','u',' ')
&& p_dec->fmt_in.i_codec != VLC_FOURCC('s','p','u','b') )
{
return VLC_EGENERIC;
}
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* tarkin.c: tarkin decoder module making use of libtarkin.
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: tarkin.c,v 1.6 2003/10/25 00:49:13 sam Exp $
* $Id: tarkin.c,v 1.7 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -105,7 +105,7 @@ static int OpenDecoder( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
if( p_dec->p_fifo->i_fourcc != VLC_FOURCC('t','a','r','k') )
if( p_dec->fmt_in.i_codec != VLC_FOURCC('t','a','r','k') )
{
return VLC_EGENERIC;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,7 @@
* xvid.c: a decoder for libxvidcore, the Xvid video codec
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: xvid.c,v 1.6 2003/09/02 20:19:25 gbazin Exp $
* $Id: xvid.c,v 1.7 2003/11/16 21:07:30 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -61,9 +61,9 @@ static int OpenDecoder ( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
if( p_dec->p_fifo->i_fourcc != VLC_FOURCC('x','v','i','d')
&& p_dec->p_fifo->i_fourcc != VLC_FOURCC('X','V','I','D')
&& p_dec->p_fifo->i_fourcc != VLC_FOURCC('D','I','V','X') )
if( p_dec->fmt_in.i_codec != VLC_FOURCC('x','v','i','d')
&& p_dec->fmt_in.i_codec != VLC_FOURCC('X','V','I','D')
&& p_dec->fmt_in.i_codec != VLC_FOURCC('D','I','V','X') )
{
return VLC_EGENERIC;
}
......
......@@ -2,7 +2,7 @@
* a52.c : Raw a52 Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: a52sys.c,v 1.8 2003/11/13 12:28:34 fenrir Exp $
* $Id: a52sys.c,v 1.9 2003/11/16 21:07:31 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -144,10 +144,10 @@ static int Open( vlc_object_t * p_this )
{
int i_frame_size;
HeaderInfo( p_peek, &fmt.audio.i_channels, &fmt.audio.i_samplerate, &i_frame_size );
HeaderInfo( p_peek, &fmt.audio.i_channels, &fmt.audio.i_rate, &i_frame_size );
msg_Dbg( p_input, "a52 channels=%d sample_rate=%d",
fmt.audio.i_channels, fmt.audio.i_samplerate );
fmt.audio.i_channels, fmt.audio.i_rate );
}
vlc_mutex_lock( &p_input->stream.stream_lock );
......
......@@ -2,7 +2,7 @@
* aac.c : Raw aac Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: aac.c,v 1.6 2003/11/13 12:28:34 fenrir Exp $
* $Id: aac.c,v 1.7 2003/11/16 21:07:31 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -157,7 +157,7 @@ static int Open( vlc_object_t * p_this )
if( HeaderCheck( p_peek ) )
{
fmt.audio.i_channels = AAC_CHANNELS( p_peek );
fmt.audio.i_samplerate = AAC_SAMPLE_RATE( p_peek );
fmt.audio.i_rate = AAC_SAMPLE_RATE( p_peek );
msg_Dbg( p_input,
"adts header: id=%d channels=%d sample_rate=%d",
......
......@@ -2,7 +2,7 @@
* asf.c : ASFv01 file input module for vlc
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: asf.c,v 1.40 2003/11/13 12:28:34 fenrir Exp $
* $Id: asf.c,v 1.41 2003/11/16 21:07:31 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -186,7 +186,7 @@ static int Open( vlc_object_t * p_this )
es_format_Init( &fmt, AUDIO_ES, 0 );
wf_tag_to_fourcc( GetWLE( &p_data[0] ), &fmt.i_codec, NULL );
fmt.audio.i_channels = GetWLE( &p_data[2] );
fmt.audio.i_samplerate = GetDWLE( &p_data[4] );
fmt.audio.i_rate = GetDWLE( &p_data[4] );
fmt.audio.i_bitrate = GetDWLE( &p_data[8] ) * 8;
fmt.audio.i_blockalign = GetWLE( &p_data[12] );
fmt.audio.i_bitspersample = GetWLE( &p_data[14] );
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: avi.c,v 1.68 2003/11/16 15:51:59 titer Exp $
* $Id: avi.c,v 1.69 2003/11/16 21:07:31 gbazin Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -274,7 +274,7 @@ static int Open( vlc_object_t * p_this )
es_format_Init( &fmt, AUDIO_ES, tk->i_codec );
fmt.audio.i_channels = p_auds->p_wf->nChannels;
fmt.audio.i_samplerate = p_auds->p_wf->nSamplesPerSec;
fmt.audio.i_rate = p_auds->p_wf->nSamplesPerSec;
fmt.audio.i_bitrate = p_auds->p_wf->nAvgBytesPerSec * 8;
fmt.audio.i_blockalign = p_auds->p_wf->nBlockAlign;
fmt.audio.i_bitspersample = p_auds->p_wf->wBitsPerSample;
......
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,7 @@
* mpga.c : MPEG-I/II Audio input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: mpga.c,v 1.7 2003/11/13 12:28:34 fenrir Exp $
* $Id: mpga.c,v 1.8 2003/11/16 21:07:31 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -311,7 +311,7 @@ static int Open( vlc_object_t * p_this )
MPGA_SAMPLE_RATE( header ) );
fmt.audio.i_channels = MPGA_CHANNELS( header );
fmt.audio.i_samplerate = MPGA_SAMPLE_RATE( header );
fmt.audio.i_rate = MPGA_SAMPLE_RATE( header );
fmt.audio.i_bitrate = p_sys->i_bitrate_avg;
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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