Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
e5612c77
Commit
e5612c77
authored
Mar 19, 2004
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* avi: cosmetics.
parent
3ac57ab0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
117 deletions
+90
-117
modules/demux/avi/avi.c
modules/demux/avi/avi.c
+90
-24
modules/demux/avi/avi.h
modules/demux/avi/avi.h
+0
-93
No files found.
modules/demux/avi/avi.c
View file @
e5612c77
...
@@ -32,7 +32,6 @@
...
@@ -32,7 +32,6 @@
#include "codecs.h"
#include "codecs.h"
#include "libavi.h"
#include "libavi.h"
#include "avi.h"
/*****************************************************************************
/*****************************************************************************
* Module descriptor
* Module descriptor
...
@@ -43,10 +42,10 @@
...
@@ -43,10 +42,10 @@
#define INDEX_TEXT N_("Force index creation")
#define INDEX_TEXT N_("Force index creation")
#define INDEX_LONGTEXT N_( \
#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
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
vlc_module_begin
();
vlc_module_begin
();
set_description
(
_
(
"AVI demuxer"
)
);
set_description
(
_
(
"AVI demuxer"
)
);
...
@@ -63,14 +62,85 @@ vlc_module_end();
...
@@ -63,14 +62,85 @@ vlc_module_end();
/*****************************************************************************
/*****************************************************************************
* Local prototypes
* Local prototypes
*****************************************************************************/
*****************************************************************************/
static
int
Control
(
input_thread_t
*
,
int
,
va_list
);
static
int
Control
(
input_thread_t
*
,
int
,
va_list
);
static
int
Seek
(
input_thread_t
*
,
mtime_t
,
int
);
static
int
Seek
(
input_thread_t
*
,
mtime_t
,
int
);
static
int
Demux_Seekable
(
input_thread_t
*
);
static
int
Demux_Seekable
(
input_thread_t
*
);
static
int
Demux_UnSeekable
(
input_thread_t
*
p_input
);
static
int
Demux_UnSeekable
(
input_thread_t
*
);
#define FREE( p ) if( p ) { free( p ); (p) = NULL; }
#define FREE( p ) if( p ) { free( p ); (p) = NULL; }
#define __ABS( x ) ( (x) < 0 ? (-(x)) : (x) )
#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
)
static
inline
off_t
__EVEN
(
off_t
i
)
{
{
return
(
i
&
1
)
?
i
+
1
:
i
;
return
(
i
&
1
)
?
i
+
1
:
i
;
...
@@ -98,7 +168,7 @@ static int AVI_PacketSearch ( input_thread_t * );
...
@@ -98,7 +168,7 @@ static int AVI_PacketSearch ( input_thread_t * );
static
void
AVI_IndexLoad
(
input_thread_t
*
);
static
void
AVI_IndexLoad
(
input_thread_t
*
);
static
void
AVI_IndexCreate
(
input_thread_t
*
);
static
void
AVI_IndexCreate
(
input_thread_t
*
);
static
void
AVI_IndexAddEntry
(
demux_sys_t
*
,
int
,
AVIIndexE
ntry_t
*
);
static
void
AVI_IndexAddEntry
(
demux_sys_t
*
,
int
,
avi_e
ntry_t
*
);
static
mtime_t
AVI_MovieGetLength
(
input_thread_t
*
);
static
mtime_t
AVI_MovieGetLength
(
input_thread_t
*
);
...
@@ -686,7 +756,7 @@ static int Demux_Seekable( input_thread_t *p_input )
...
@@ -686,7 +756,7 @@ static int Demux_Seekable( input_thread_t *p_input )
else
else
{
{
/* add this chunk to the index */
/* add this chunk to the index */
AVIIndexE
ntry_t
index
;
avi_e
ntry_t
index
;
index
.
i_id
=
avi_pk
.
i_fourcc
;
index
.
i_id
=
avi_pk
.
i_fourcc
;
index
.
i_flags
=
index
.
i_flags
=
...
@@ -1348,7 +1418,7 @@ static int AVI_StreamChunkFind( input_thread_t *p_input,
...
@@ -1348,7 +1418,7 @@ static int AVI_StreamChunkFind( input_thread_t *p_input,
else
else
{
{
/* add this chunk to the index */
/* add this chunk to the index */
AVIIndexE
ntry_t
index
;
avi_e
ntry_t
index
;
index
.
i_id
=
avi_pk
.
i_fourcc
;
index
.
i_id
=
avi_pk
.
i_fourcc
;
index
.
i_flags
=
index
.
i_flags
=
...
@@ -1573,10 +1643,8 @@ static int AVI_GetKeyFlag( vlc_fourcc_t i_fourcc, uint8_t *p_byte )
...
@@ -1573,10 +1643,8 @@ static int AVI_GetKeyFlag( vlc_fourcc_t i_fourcc, uint8_t *p_byte )
/* it's not an msmpegv1 stream, strange...*/
/* it's not an msmpegv1 stream, strange...*/
return
AVIIF_KEYFRAME
;
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_DIV2
:
case
FOURCC_DIV3
:
/* wmv1 also */
case
FOURCC_DIV3
:
/* wmv1 also */
/* we have
/* we have
...
@@ -1593,10 +1661,8 @@ static int AVI_GetKeyFlag( vlc_fourcc_t i_fourcc, uint8_t *p_byte )
...
@@ -1593,10 +1661,8 @@ static int AVI_GetKeyFlag( vlc_fourcc_t i_fourcc, uint8_t *p_byte )
/* not true , need to find the first VOP header */
/* not true , need to find the first VOP header */
return
AVIIF_KEYFRAME
;
return
AVIIF_KEYFRAME
;
}
}
else
return
p_byte
[
4
]
&
0xC0
?
0
:
AVIIF_KEYFRAME
;
{
return
p_byte
[
4
]
&
0xC0
?
0
:
AVIIF_KEYFRAME
;
}
default:
default:
/* I can't do it, so say yes */
/* I can't do it, so say yes */
return
AVIIF_KEYFRAME
;
return
AVIIF_KEYFRAME
;
...
@@ -1837,7 +1903,7 @@ static int AVI_PacketSearch( input_thread_t *p_input )
...
@@ -1837,7 +1903,7 @@ static int AVI_PacketSearch( input_thread_t *p_input )
****************************************************************************/
****************************************************************************/
static
void
AVI_IndexAddEntry
(
demux_sys_t
*
p_sys
,
static
void
AVI_IndexAddEntry
(
demux_sys_t
*
p_sys
,
int
i_stream
,
int
i_stream
,
AVIIndexE
ntry_t
*
p_index
)
avi_e
ntry_t
*
p_index
)
{
{
avi_track_t
*
tk
=
p_sys
->
track
[
i_stream
];
avi_track_t
*
tk
=
p_sys
->
track
[
i_stream
];
...
@@ -1852,7 +1918,7 @@ static void AVI_IndexAddEntry( demux_sys_t *p_sys,
...
@@ -1852,7 +1918,7 @@ static void AVI_IndexAddEntry( demux_sys_t *p_sys,
{
{
tk
->
i_idxmax
+=
16384
;
tk
->
i_idxmax
+=
16384
;
tk
->
p_index
=
realloc
(
tk
->
p_index
,
tk
->
p_index
=
realloc
(
tk
->
p_index
,
tk
->
i_idxmax
*
sizeof
(
AVIIndexE
ntry_t
)
);
tk
->
i_idxmax
*
sizeof
(
avi_e
ntry_t
)
);
if
(
tk
->
p_index
==
NULL
)
if
(
tk
->
p_index
==
NULL
)
{
{
return
;
return
;
...
@@ -1919,7 +1985,7 @@ static int AVI_IndexLoad_idx1( input_thread_t *p_input )
...
@@ -1919,7 +1985,7 @@ static int AVI_IndexLoad_idx1( input_thread_t *p_input )
if
(
i_stream
<
p_sys
->
i_track
&&
if
(
i_stream
<
p_sys
->
i_track
&&
i_cat
==
p_sys
->
track
[
i_stream
]
->
i_cat
)
i_cat
==
p_sys
->
track
[
i_stream
]
->
i_cat
)
{
{
AVIIndexE
ntry_t
index
;
avi_e
ntry_t
index
;
index
.
i_id
=
p_idx1
->
entry
[
i_index
].
i_fourcc
;
index
.
i_id
=
p_idx1
->
entry
[
i_index
].
i_fourcc
;
index
.
i_flags
=
index
.
i_flags
=
p_idx1
->
entry
[
i_index
].
i_flags
&
(
~
AVIIF_FIXKEYFRAME
);
p_idx1
->
entry
[
i_index
].
i_flags
&
(
~
AVIIF_FIXKEYFRAME
);
...
@@ -1936,7 +2002,7 @@ static void __Parse_indx( input_thread_t *p_input,
...
@@ -1936,7 +2002,7 @@ static void __Parse_indx( input_thread_t *p_input,
avi_chunk_indx_t
*
p_indx
)
avi_chunk_indx_t
*
p_indx
)
{
{
demux_sys_t
*
p_sys
=
p_input
->
p_demux_data
;
demux_sys_t
*
p_sys
=
p_input
->
p_demux_data
;
AVIIndexE
ntry_t
index
;
avi_e
ntry_t
index
;
int32_t
i
;
int32_t
i
;
msg_Dbg
(
p_input
,
"loading subindex(0x%x) %d entries"
,
p_indx
->
i_indextype
,
p_indx
->
i_entriesinuse
);
msg_Dbg
(
p_input
,
"loading subindex(0x%x) %d entries"
,
p_indx
->
i_indextype
,
p_indx
->
i_entriesinuse
);
...
@@ -2097,7 +2163,7 @@ static void AVI_IndexCreate( input_thread_t *p_input )
...
@@ -2097,7 +2163,7 @@ static void AVI_IndexCreate( input_thread_t *p_input )
if
(
pk
.
i_stream
<
p_sys
->
i_track
&&
if
(
pk
.
i_stream
<
p_sys
->
i_track
&&
pk
.
i_cat
==
p_sys
->
track
[
pk
.
i_stream
]
->
i_cat
)
pk
.
i_cat
==
p_sys
->
track
[
pk
.
i_stream
]
->
i_cat
)
{
{
AVIIndexE
ntry_t
index
;
avi_e
ntry_t
index
;
index
.
i_id
=
pk
.
i_fourcc
;
index
.
i_id
=
pk
.
i_fourcc
;
index
.
i_flags
=
index
.
i_flags
=
AVI_GetKeyFlag
(
p_sys
->
track
[
pk
.
i_stream
]
->
i_codec
,
pk
.
i_peek
);
AVI_GetKeyFlag
(
p_sys
->
track
[
pk
.
i_stream
]
->
i_codec
,
pk
.
i_peek
);
...
...
modules/demux/avi/avi.h
deleted
100644 → 0
View file @
3ac57ab0
/*****************************************************************************
* 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
;
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment