#include "codecs.h"
#include "libavi.h"
-#include "avi.h"
/*****************************************************************************
* Module descriptor
#define INDEX_TEXT N_("Force index creation")
#define INDEX_LONGTEXT N_( \
- "Recreate a index for the AVI file so we can seek trough it more reliably." )
+ "Recreate a index for the AVI file so we can seek trough it more reliably." )
-static int Open ( vlc_object_t * );
-static void Close ( vlc_object_t * );
+static int Open ( vlc_object_t * );
+static void Close( vlc_object_t * );
vlc_module_begin();
set_description( _("AVI demuxer") );
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int Control ( input_thread_t *, int, va_list );
-static int Seek ( input_thread_t *, mtime_t, int );
-static int Demux_Seekable ( input_thread_t * );
-static int Demux_UnSeekable( input_thread_t *p_input );
+static int Control ( input_thread_t *, int, va_list );
+static int Seek ( input_thread_t *, mtime_t, int );
+static int Demux_Seekable ( input_thread_t * );
+static int Demux_UnSeekable( input_thread_t * );
#define FREE( p ) if( p ) { free( p ); (p) = NULL; }
#define __ABS( x ) ( (x) < 0 ? (-(x)) : (x) )
+typedef struct
+{
+ vlc_fourcc_t i_fourcc;
+ off_t i_pos;
+ uint32_t i_size;
+ vlc_fourcc_t i_type; /* only for AVIFOURCC_LIST */
+
+ uint8_t i_peek[8]; /* first 8 bytes */
+
+ unsigned int i_stream;
+ unsigned int i_cat;
+} avi_packet_t;
+
+
+typedef struct
+{
+ vlc_fourcc_t i_id;
+ uint32_t i_flags;
+ off_t i_pos;
+ uint32_t i_length;
+ uint32_t i_lengthtotal;
+
+} avi_entry_t;
+
+typedef struct
+{
+ vlc_bool_t b_activated;
+
+ unsigned int i_cat; /* AUDIO_ES, VIDEO_ES */
+ vlc_fourcc_t i_codec;
+
+ int i_rate;
+ int i_scale;
+ int i_samplesize;
+
+ es_out_id_t *p_es;
+
+ avi_entry_t *p_index;
+ unsigned int i_idxnb;
+ unsigned int i_idxmax;
+
+ unsigned int i_idxposc; /* numero of chunk */
+ unsigned int i_idxposb; /* byte in the current chunk */
+
+ /* For VBR audio only */
+ unsigned int i_blockno;
+ unsigned int i_blocksize;
+} avi_track_t;
+
+struct demux_sys_t
+{
+ mtime_t i_time;
+ mtime_t i_length;
+ mtime_t i_pcr;
+
+ vlc_bool_t b_seekable;
+ avi_chunk_t ck_root;
+
+ vlc_bool_t b_odml;
+
+ off_t i_movi_begin;
+ off_t i_movi_lastchunk_pos; /* XXX position of last valid chunk */
+
+ /* number of streams and information */
+ unsigned int i_track;
+ avi_track_t **track;
+
+ /* meta */
+ vlc_meta_t *meta;
+};
+
static inline off_t __EVEN( off_t i )
{
return (i & 1) ? i + 1 : i;
static void AVI_IndexLoad ( input_thread_t * );
static void AVI_IndexCreate ( input_thread_t * );
-static void AVI_IndexAddEntry( demux_sys_t *, int, AVIIndexEntry_t * );
+static void AVI_IndexAddEntry( demux_sys_t *, int, avi_entry_t * );
static mtime_t AVI_MovieGetLength( input_thread_t * );
else
{
/* add this chunk to the index */
- AVIIndexEntry_t index;
+ avi_entry_t index;
index.i_id = avi_pk.i_fourcc;
index.i_flags =
else
{
/* add this chunk to the index */
- AVIIndexEntry_t index;
+ avi_entry_t index;
index.i_id = avi_pk.i_fourcc;
index.i_flags =
/* it's not an msmpegv1 stream, strange...*/
return AVIIF_KEYFRAME;
}
- else
- {
- return p_byte[4] & 0x06 ? 0 : AVIIF_KEYFRAME;
- }
+ return p_byte[4] & 0x06 ? 0 : AVIIF_KEYFRAME;
+
case FOURCC_DIV2:
case FOURCC_DIV3: /* wmv1 also */
/* we have
/* not true , need to find the first VOP header */
return AVIIF_KEYFRAME;
}
- else
- {
- return p_byte[4] & 0xC0 ? 0 : AVIIF_KEYFRAME;
- }
+ return p_byte[4] & 0xC0 ? 0 : AVIIF_KEYFRAME;
+
default:
/* I can't do it, so say yes */
return AVIIF_KEYFRAME;
****************************************************************************/
static void AVI_IndexAddEntry( demux_sys_t *p_sys,
int i_stream,
- AVIIndexEntry_t *p_index)
+ avi_entry_t *p_index)
{
avi_track_t *tk = p_sys->track[i_stream];
{
tk->i_idxmax += 16384;
tk->p_index = realloc( tk->p_index,
- tk->i_idxmax * sizeof( AVIIndexEntry_t ) );
+ tk->i_idxmax * sizeof( avi_entry_t ) );
if( tk->p_index == NULL )
{
return;
if( i_stream < p_sys->i_track &&
i_cat == p_sys->track[i_stream]->i_cat )
{
- AVIIndexEntry_t index;
+ avi_entry_t index;
index.i_id = p_idx1->entry[i_index].i_fourcc;
index.i_flags =
p_idx1->entry[i_index].i_flags&(~AVIIF_FIXKEYFRAME);
avi_chunk_indx_t *p_indx )
{
demux_sys_t *p_sys = p_input->p_demux_data;
- AVIIndexEntry_t index;
+ avi_entry_t index;
int32_t i;
msg_Dbg( p_input, "loading subindex(0x%x) %d entries", p_indx->i_indextype, p_indx->i_entriesinuse );
if( pk.i_stream < p_sys->i_track &&
pk.i_cat == p_sys->track[pk.i_stream]->i_cat )
{
- AVIIndexEntry_t index;
+ avi_entry_t index;
index.i_id = pk.i_fourcc;
index.i_flags =
AVI_GetKeyFlag(p_sys->track[pk.i_stream]->i_codec, pk.i_peek);
+++ /dev/null
-/*****************************************************************************
- * avi.h : AVI file Stream input module for vlc
- *****************************************************************************
- * Copyright (C) 2001-2004 VideoLAN
- * $Id: avi.h,v 1.20 2004/01/31 14:49:52 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.
- *****************************************************************************/
-
-typedef struct avi_packet_s
-{
- vlc_fourcc_t i_fourcc;
- off_t i_pos;
- uint32_t i_size;
- vlc_fourcc_t i_type; /* only for AVIFOURCC_LIST */
-
- uint8_t i_peek[8]; /* first 8 bytes */
-
- unsigned int i_stream;
- unsigned int i_cat;
-} avi_packet_t;
-
-
-typedef struct AVIIndexEntry_s
-{
- vlc_fourcc_t i_id;
- uint32_t i_flags;
- off_t i_pos;
- uint32_t i_length;
- uint32_t i_lengthtotal;
-
-} AVIIndexEntry_t;
-
-typedef struct
-{
- vlc_bool_t b_activated;
-
- unsigned int i_cat; /* AUDIO_ES, VIDEO_ES */
- vlc_fourcc_t i_codec;
-
- int i_rate;
- int i_scale;
- int i_samplesize;
-
- es_out_id_t *p_es;
-
- AVIIndexEntry_t *p_index;
- unsigned int i_idxnb;
- unsigned int i_idxmax;
-
- unsigned int i_idxposc; /* numero of chunk */
- unsigned int i_idxposb; /* byte in the current chunk */
-
- /* For VBR audio only */
- unsigned int i_blockno;
- unsigned int i_blocksize;
-} avi_track_t;
-
-struct demux_sys_t
-{
- mtime_t i_time;
- mtime_t i_length;
- mtime_t i_pcr;
-
- vlc_bool_t b_seekable;
- avi_chunk_t ck_root;
-
- vlc_bool_t b_odml;
-
- off_t i_movi_begin;
- off_t i_movi_lastchunk_pos; /* XXX position of last valid chunk */
-
- /* number of streams and information */
- unsigned int i_track;
- avi_track_t **track;
-
- /* meta */
- vlc_meta_t *meta;
-};
-