include/vlc_es.h: defines es_format_t, audio_format_t, video_format_t.

all: removed i_extra_type from es_format_t.
This commit is contained in:
Laurent Aimar 2003-11-20 22:10:56 +00:00
parent 6e94863269
commit b38ec88240
11 changed files with 173 additions and 153 deletions

View File

@ -89,14 +89,15 @@ HEADERS_include = \
include/stream_output.h \
include/variables.h \
include/video_output.h \
include/vlc_block.h \
include/vlc_bits.h \
include/vlc_block.h \
include/vlc_block_helper.h \
include/vlc_codec.h \
include/vlc_common.h \
include/vlc_config.h \
include/vlc_cpu.h \
include/vlc_error.h \
include/vlc_es.h \
include/vlc_help.h \
include/vlc_interface.h \
include/vlc_keys.h \

View File

@ -2,7 +2,7 @@
* audio_output.h : audio output interface
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: audio_output.h,v 1.85 2003/11/16 22:54:11 gbazin Exp $
* $Id: audio_output.h,v 1.86 2003/11/20 22:10:55 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
@ -23,42 +23,7 @@
#ifndef _VLC_AUDIO_OUTPUT_H
#define _VLC_AUDIO_OUTPUT_H 1
/*****************************************************************************
* audio_sample_format_t
*****************************************************************************
* This structure defines a format for audio samples.
*****************************************************************************/
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
* obliged to contain a integral number of so-called "frames". It's
* just here for the division :
* buffer_size = i_nb_samples * i_bytes_per_frame / i_frame_length
*/
/* FIXME ? (used by the codecs) */
int i_channels;
int i_blockalign;
int i_bitspersample;
};
#include "vlc_es.h"
#define AOUT_FMTS_IDENTICAL( p_first, p_second ) ( \
((p_first)->i_format == (p_second)->i_format) \

View File

@ -2,7 +2,7 @@
* ninput.h
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ninput.h,v 1.16 2003/11/19 00:14:39 fenrir Exp $
* $Id: ninput.h,v 1.17 2003/11/20 22:10:55 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
@ -24,69 +24,7 @@
#ifndef _NINPUT_H
#define _NINPUT_H 1
#include "audio_output.h"
#include "vlc_video.h"
enum es_extra_type_e
{
ES_EXTRA_TYPE_UNKNOWN,
ES_EXTRA_TYPE_WAVEFORMATEX,
ES_EXTRA_TYPE_BITMAPINFOHEADER,
ES_EXTRA_TYPE_SUBHEADER
};
typedef struct subs_format_t
{
char *psz_encoding;
} subs_format_t;
typedef struct
{
int i_cat;
vlc_fourcc_t i_codec;
int i_group; /* -1 : standalone
>= 0 then a "group" (program) is created
for each value */
int i_priority; /* -2 : mean not selectable by the users
-1 : mean not selected by default even
when no other stream
>=0: priority */
char *psz_language;
char *psz_description;
audio_format_t audio;
video_format_t video;
subs_format_t subs;
int i_bitrate;
int i_extra_type;
int i_extra;
void *p_extra;
} es_format_t;
static inline void es_format_Init( es_format_t *fmt,
int i_cat, vlc_fourcc_t i_codec )
{
fmt->i_cat = i_cat;
fmt->i_codec = i_codec;
fmt->i_group = 0;
fmt->i_priority = 0;
fmt->psz_language = NULL;
fmt->psz_description = 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_bitrate = 0;
fmt->i_extra_type = ES_EXTRA_TYPE_UNKNOWN;
fmt->i_extra = 0;
fmt->p_extra = NULL;
}
#include "vlc_es.h"
enum es_out_query_e
{

157
include/vlc_es.h Normal file
View File

@ -0,0 +1,157 @@
/*****************************************************************************
* vlc_es.h
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: vlc_es.h,v 1.1 2003/11/20 22:10:55 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef _VLC_ES_H
#define _VLC_ES_H 1
/**
* Description of a audio frame
*/
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
* obliged to contain a integral number of so-called "frames". It's
* just here for the division :
* buffer_size = i_nb_samples * i_bytes_per_frame / i_frame_length
*/
/* FIXME ? (used by the codecs) */
int i_channels;
int i_blockalign;
int i_bitspersample;
};
/**
* Description of a video frame
*/
struct video_format_t
{
vlc_fourcc_t i_chroma; /**< picture chroma */
unsigned int i_aspect; /**< aspect ratio */
unsigned int i_width; /**< picture width */
unsigned int i_height; /**< picture height */
unsigned int i_x_offset; /**< start offset of visible area */
unsigned int i_y_offset; /**< start offset of visible area */
unsigned int i_visible_width; /**< width of visible area */
unsigned int i_visible_height; /**< height of visible area */
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 */
};
/**
* Description of subs
*/
typedef struct subs_format_t
{
char *psz_encoding;
} subs_format_t;
/**
* ES definition
*/
typedef struct
{
int i_cat;
vlc_fourcc_t i_codec;
int i_group; /* -1 : standalone
>= 0 then a "group" (program) is created
for each value */
int i_priority; /* -2 : mean not selectable by the users
-1 : mean not selected by default even
when no other stream
>=0: priority */
char *psz_language;
char *psz_description;
audio_format_t audio;
video_format_t video;
subs_format_t subs;
int i_bitrate;
int i_extra;
void *p_extra;
} es_format_t;
static inline void es_format_Init( es_format_t *fmt,
int i_cat, vlc_fourcc_t i_codec )
{
fmt->i_cat = i_cat;
fmt->i_codec = i_codec;
fmt->i_group = 0;
fmt->i_priority = 0;
fmt->psz_language = NULL;
fmt->psz_description = 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_bitrate = 0;
fmt->i_extra = 0;
fmt->p_extra = NULL;
}
static inline void es_format_Copy( es_format_t *dst, es_format_t *src )
{
memcpy( dst, src, sizeof( es_format_t ) );
if( src->i_extra > 0 )
{
dst->p_extra = malloc( src->i_extra );
memcpy( dst->p_extra, src->p_extra,
src->i_extra );
}
else
{
dst->i_extra = 0;
dst->p_extra = NULL;
}
}
#endif

View File

@ -4,7 +4,7 @@
* includes all common video types and constants.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vlc_video.h,v 1.6 2003/11/16 21:07:30 gbazin Exp $
* $Id: vlc_video.h,v 1.7 2003/11/20 22:10:55 fenrir Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
@ -25,26 +25,7 @@
#ifndef _VLC_VIDEO_H
#define _VLC_VIDEO_H 1
/**
* Description of a video frame
*/
struct video_format_t
{
vlc_fourcc_t i_chroma; /**< picture chroma */
unsigned int i_aspect; /**< aspect ratio */
unsigned int i_width; /**< picture width */
unsigned int i_height; /**< picture height */
unsigned int i_x_offset; /**< start offset of visible area */
unsigned int i_y_offset; /**< start offset of visible area */
unsigned int i_visible_width; /**< width of visible area */
unsigned int i_visible_height; /**< height of visible area */
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 */
};
#include "vlc_es.h"
/**
* Description of a planar graphic field

View File

@ -2,7 +2,7 @@
* asf.c : ASFv01 file input module for vlc
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: asf.c,v 1.42 2003/11/16 22:54:12 gbazin Exp $
* $Id: asf.c,v 1.43 2003/11/20 22:10:56 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
@ -193,7 +193,6 @@ static int Open( vlc_object_t * p_this )
if( p_sp->i_type_specific_data_length > sizeof( WAVEFORMATEX ) )
{
fmt.i_extra_type = ES_EXTRA_TYPE_WAVEFORMATEX;
fmt.i_extra = __MIN( GetWLE( &p_data[16] ),
p_sp->i_type_specific_data_length - sizeof( WAVEFORMATEX ) );
fmt.p_extra = malloc( fmt.i_extra );
@ -220,7 +219,6 @@ static int Open( vlc_object_t * p_this )
if( p_sp->i_type_specific_data_length > 11 + sizeof( BITMAPINFOHEADER ) )
{
fmt.i_extra_type = ES_EXTRA_TYPE_BITMAPINFOHEADER;
fmt.i_extra = __MIN( GetDWLE( p_data ),
p_sp->i_type_specific_data_length - 11 - sizeof( BITMAPINFOHEADER ) );
fmt.p_extra = malloc( fmt.i_extra );

View File

@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: avi.c,v 1.70 2003/11/16 22:54:12 gbazin Exp $
* $Id: avi.c,v 1.71 2003/11/20 22:10:56 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -281,7 +281,6 @@ static int Open( vlc_object_t * p_this )
if( ( fmt.i_extra = __MIN( p_auds->p_wf->cbSize,
p_auds->i_chunk_size - sizeof(WAVEFORMATEX) ) ) > 0 )
{
fmt.i_extra_type = ES_EXTRA_TYPE_WAVEFORMATEX;
fmt.p_extra = malloc( fmt.i_extra );
memcpy( fmt.p_extra, &p_auds->p_wf[1], fmt.i_extra );
}
@ -302,7 +301,6 @@ static int Open( vlc_object_t * p_this )
if( ( fmt.i_extra = __MIN( p_vids->p_bih->biSize - sizeof( BITMAPINFOHEADER ),
p_vids->i_chunk_size - sizeof(BITMAPINFOHEADER) ) ) > 0 )
{
fmt.i_extra_type = ES_EXTRA_TYPE_BITMAPINFOHEADER;
fmt.p_extra = malloc( fmt.i_extra );
memcpy( fmt.p_extra, &p_vids->p_bih[1], fmt.i_extra );
}

View File

@ -2,7 +2,7 @@
* live.cpp : live.com support.
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: livedotcom.cpp,v 1.7 2003/11/16 21:07:31 gbazin Exp $
* $Id: livedotcom.cpp,v 1.8 2003/11/20 22:10:55 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
@ -494,7 +494,6 @@ static int DemuxOpen ( vlc_object_t *p_this )
if( ( p_extra = parseStreamMuxConfigStr( sub->fmtp_config(), i_extra ) ) )
{
tk->fmt.i_extra_type = ES_EXTRA_TYPE_WAVEFORMATEX;
tk->fmt.i_extra = i_extra;
tk->fmt.p_extra = malloc( sizeof( i_extra ) );
memcpy( tk->fmt.p_extra, p_extra, i_extra );
@ -510,7 +509,6 @@ static int DemuxOpen ( vlc_object_t *p_this )
if( ( p_extra = parseGeneralConfigStr( sub->fmtp_config(), i_extra ) ) )
{
tk->fmt.i_extra_type = ES_EXTRA_TYPE_WAVEFORMATEX;
tk->fmt.i_extra = i_extra;
tk->fmt.p_extra = malloc( i_extra );
memcpy( tk->fmt.p_extra, p_extra, i_extra );
@ -547,7 +545,6 @@ static int DemuxOpen ( vlc_object_t *p_this )
if( ( p_extra = parseGeneralConfigStr( sub->fmtp_config(), i_extra ) ) )
{
tk->fmt.i_extra_type = ES_EXTRA_TYPE_BITMAPINFOHEADER;
tk->fmt.i_extra = i_extra;
tk->fmt.p_extra = malloc( i_extra );
memcpy( tk->fmt.p_extra, p_extra, i_extra );
@ -838,7 +835,6 @@ static void StreamRead( void *p_private, unsigned int i_size, struct timeval pts
tk->fmt.video.i_height = (sdAtom[30] << 8) | sdAtom[31];
tk->fmt.i_extra = qtState.sdAtomSize - 16;
tk->fmt.i_extra_type = ES_EXTRA_TYPE_BITMAPINFOHEADER;
tk->fmt.p_extra = malloc( tk->fmt.i_extra );
memcpy( tk->fmt.p_extra, &sdAtom[12], tk->fmt.i_extra );

View File

@ -2,7 +2,7 @@
* mkv.cpp : matroska demuxer
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: mkv.cpp,v 1.41 2003/11/16 22:54:12 gbazin Exp $
* $Id: mkv.cpp,v 1.42 2003/11/20 22:10:55 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
@ -1029,7 +1029,6 @@ static int Open( vlc_object_t * p_this )
tk.fmt.video.i_height= GetDWLE( &p_bih->biHeight );
tk.fmt.i_codec = GetFOURCC( &p_bih->biCompression );
tk.fmt.i_extra_type = ES_EXTRA_TYPE_BITMAPINFOHEADER;
tk.fmt.i_extra = GetDWLE( &p_bih->biSize ) - sizeof( BITMAPINFOHEADER );
if( tk.fmt.i_extra > 0 )
{

View File

@ -2,7 +2,7 @@
* sub.c
*****************************************************************************
* Copyright (C) 1999-2003 VideoLAN
* $Id: sub.c,v 1.36 2003/11/13 13:31:12 fenrir Exp $
* $Id: sub.c,v 1.37 2003/11/20 22:10:56 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
@ -485,7 +485,6 @@ static int sub_open ( subtitle_demux_t *p_sub,
}
if( p_sub->psz_header != NULL )
{
fmt.i_extra_type = ES_EXTRA_TYPE_SUBHEADER;
fmt.i_extra = strlen( p_sub->psz_header ) + 1;
fmt.p_extra = strdup( p_sub->psz_header );
}

View File

@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: input.c,v 1.256 2003/11/16 22:54:11 gbazin Exp $
* $Id: input.c,v 1.257 2003/11/20 22:10:56 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
@ -1079,10 +1079,6 @@ static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt )
p_wf->cbSize = fmt->i_extra;
if( fmt->i_extra > 0 )
{
if( fmt->i_extra_type != ES_EXTRA_TYPE_WAVEFORMATEX )
{
msg_Warn( p_input, "extra type != WAVEFORMATEX for audio");
}
memcpy( &p_wf[1], fmt->p_extra, fmt->i_extra );
}
id->p_es->p_waveformatex = p_wf;
@ -1107,11 +1103,6 @@ static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt )
if( fmt->i_extra > 0 )
{
if( fmt->i_extra_type != ES_EXTRA_TYPE_BITMAPINFOHEADER )
{
msg_Warn( p_input,
"extra type != BITMAPINFOHEADER for video" );
}
memcpy( &p_bih[1], fmt->p_extra, fmt->i_extra );
}
id->p_es->p_bitmapinfoheader = p_bih;
@ -1123,11 +1114,8 @@ static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt )
memset( p_sub, 0, sizeof( subtitle_data_t ) );
if( fmt->i_extra > 0 )
{
if( fmt->i_extra_type == ES_EXTRA_TYPE_SUBHEADER )
{
p_sub->psz_header = malloc( fmt->i_extra );
memcpy( p_sub->psz_header, fmt->p_extra , fmt->i_extra );
}
p_sub->psz_header = malloc( fmt->i_extra );
memcpy( p_sub->psz_header, fmt->p_extra , fmt->i_extra );
}
/* FIXME beuuuuuurk */
id->p_es->p_demux_data = p_sub;