]> git.sesse.net Git - vlc/commitdiff
include/vlc_es.h: defines es_format_t, audio_format_t, video_format_t.
authorLaurent Aimar <fenrir@videolan.org>
Thu, 20 Nov 2003 22:10:56 +0000 (22:10 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Thu, 20 Nov 2003 22:10:56 +0000 (22:10 +0000)
 all: removed i_extra_type from es_format_t.

Makefile.am
include/audio_output.h
include/ninput.h
include/vlc_es.h [new file with mode: 0644]
include/vlc_video.h
modules/demux/asf/asf.c
modules/demux/avi/avi.c
modules/demux/livedotcom.cpp
modules/demux/mkv.cpp
modules/demux/util/sub.c
src/input/input.c

index e1d04cf96f8adb284ae0e57261e0272f1d02d28f..d4c7ed343154fd3aff33d4672ba7928507afd387 100644 (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 \
index 38035b0d6b88da466eaa15b66b727bae03546d68..8464511d646f8c7075c417178bb2d60e0dcbbc3f 100644 (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>
  *
 #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)                           \
index b9fa616d0358df07a22d7d80e79d59e2925d9639..e55ca836c6e0ed5e0a98deecd4b876d1053e7125 100644 (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>
  *
 #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
 {
diff --git a/include/vlc_es.h b/include/vlc_es.h
new file mode 100644 (file)
index 0000000..73cd4d2
--- /dev/null
@@ -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
+
index 70aedd27e57783df331b2ef3dfbdf840ddcc6d21..2e77478d5330dd44588f413decc0d6c0d8d9c538 100644 (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>
  *
 #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
index 94f98ab19afbc357627e4f5c7d0a38f9b1d72f72..228336468a3434e21a822e04f27d7736ca114285 100644 (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 );
index d1602a2dcce49269ceca06548d9e0008216b330d..9866d4cea6d9a9f074138b67cbe68a5b6c071a36 100644 (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 );
                 }
index c9ddbab42f313fd83a8da7f6b09caa5ce71fe831..497b05236d974a3199eae872457f5b80f217323c 100644 (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 );
 
index 5f1c7e21c7fb6731e18d154762c04e641bbd89ee..f4934100aa49c420688dffa7ae81f28f9f4243a8 100644 (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 )
                 {
index 67493e91b986f1dc1d364a8024db7223aadd4ef9..c967598ce6b38657b69a94287db81b4ca3270e03 100644 (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 );
     }
index 1f1e9b2be0ed38dbf15b01605424663656b3d6e5..d702e77feabe178c5834cd1055caf08b8d906123 100644 (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;