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
ec8efba6
Commit
ec8efba6
authored
Oct 28, 2002
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* avi.c : fix a bug (bad choice in stream to be read)
* libioRIFF : now useless files.
parent
6cd47c0c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
236 deletions
+11
-236
modules/demux/avi/avi.c
modules/demux/avi/avi.c
+11
-17
modules/demux/avi/libioRIFF.c
modules/demux/avi/libioRIFF.c
+0
-179
modules/demux/avi/libioRIFF.h
modules/demux/avi/libioRIFF.h
+0
-40
No files found.
modules/demux/avi/avi.c
View file @
ec8efba6
...
...
@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: avi.c,v 1.
7 2002/10/27 15:37:16
fenrir Exp $
* $Id: avi.c,v 1.
8 2002/10/28 01:51:37
fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -788,6 +788,8 @@ static int AVIInit( vlc_object_t * p_this )
p_avi
->
i_pcr
=
0
;
p_avi
->
b_seekable
=
(
(
p_input
->
stream
.
b_seekable
)
&&
(
p_input
->
stream
.
i_method
==
INPUT_METHOD_FILE
)
);
p_avi
->
i_movi_lastchunk_pos
=
0
;
/* *** for unseekable stream, automaticaly use AVIDemux_interleaved *** */
if
(
!
p_avi
->
b_seekable
||
config_GetInt
(
p_input
,
"avi-interleaved"
)
)
{
...
...
@@ -1073,7 +1075,6 @@ static int AVIInit( vlc_object_t * p_this )
AVI_SkipBytes
(
p_input
,
12
);
// enter in p_movi
p_avi
->
i_movi_begin
=
p_movi
->
i_chunk_pos
;
p_avi
->
i_movi_lastchunk_pos
=
0
;
return
(
0
);
}
...
...
@@ -1249,11 +1250,7 @@ static int AVI_SetStreamChunk( input_thread_t *p_input,
p_stream
->
i_idxposc
=
i_ck
;
p_stream
->
i_idxposb
=
0
;
if
(
i_ck
<
p_stream
->
i_idxnb
)
{
return
(
1
);
}
else
if
(
i_ck
>=
p_stream
->
i_idxnb
)
{
p_stream
->
i_idxposc
=
p_stream
->
i_idxnb
-
1
;
do
...
...
@@ -1265,9 +1262,9 @@ static int AVI_SetStreamChunk( input_thread_t *p_input,
}
}
while
(
p_stream
->
i_idxposc
<
i_ck
);
}
return
(
1
);
}
}
...
...
@@ -1676,21 +1673,18 @@ static int AVIDemux_Seekable( input_thread_t *p_input )
if
(
toread
[
i
].
i_posf
>
0
)
{
i_stream
=
i
;
if
(
i_pos
==
-
1
)
{
i_pos
=
toread
[
i_stream
].
i_posf
;
}
else
if
(
i_pos
==
-
1
||
i_pos
>
toread
[
i_stream
].
i_posf
)
{
i_pos
=
__MIN
(
i_pos
,
toread
[
i_stream
].
i_posf
);
i_stream
=
i
;
i_pos
=
toread
[
i
].
i_posf
;
}
}
}
if
(
b_done
)
{
return
(
b_stream
?
1
:
0
);
// return( b_stream ? 1 : 0 );
return
(
1
);
}
if
(
i_pos
==
-
1
)
...
...
modules/demux/avi/libioRIFF.c
deleted
100644 → 0
View file @
6cd47c0c
/*****************************************************************************
* libioRIFF.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: libioRIFF.c,v 1.4 2002/10/26 19:14:45 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h>
/* malloc(), free() */
#include <vlc/vlc.h>
#include <vlc/input.h>
#include "video.h"
#include "libioRIFF.h"
static
inline
u16
__GetWLE
(
byte_t
*
p_buff
)
{
return
(
(
*
p_buff
)
+
(
*
(
p_buff
+
1
)
<<
8
)
);
}
static
inline
u32
__GetDWLE
(
byte_t
*
p_buff
)
{
return
(
*
(
p_buff
)
+
(
*
(
p_buff
+
1
)
<<
8
)
+
(
*
(
p_buff
+
2
)
<<
16
)
+
(
*
(
p_buff
+
3
)
<<
24
)
);
}
static
inline
u32
__EVEN
(
u32
i
)
{
return
(
(
i
&
1
)
?
++
i
:
i
);
}
int
__RIFF_TellPos
(
input_thread_t
*
p_input
,
u32
*
pos
)
{
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
*
pos
=
p_input
->
stream
.
p_selected_area
->
i_tell
;
// - ( p_input->p_last_data - p_input->p_current_data );
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
return
0
;
}
int
__RIFF_SkipBytes
(
input_thread_t
*
p_input
,
int
nb
)
{
data_packet_t
*
p_pack
;
int
i
;
int
i_rest
;
if
(
(
p_input
->
stream
.
b_seekable
)
&&
(
p_input
->
stream
.
i_method
==
INPUT_METHOD_FILE
)
)
{
u32
i_pos
;
__RIFF_TellPos
(
p_input
,
&
i_pos
);
p_input
->
pf_seek
(
p_input
,
(
off_t
)(
i_pos
+
nb
)
);
input_AccessReinit
(
p_input
);
}
else
{
msg_Warn
(
p_input
,
"cannot seek, it will take times"
);
if
(
nb
<
0
)
{
return
(
-
1
);
}
i_rest
=
nb
;
while
(
i_rest
!=
0
)
{
if
(
i_rest
>=
4096
)
{
i
=
input_SplitBuffer
(
p_input
,
&
p_pack
,
4096
);
}
else
{
i
=
input_SplitBuffer
(
p_input
,
&
p_pack
,
i_rest
);
}
if
(
i
<
0
)
{
return
(
-
1
);
}
i_rest
-=
i
;
input_DeletePacket
(
p_input
->
p_method_data
,
p_pack
);
if
(
(
i
==
0
)
&&
(
i_rest
!=
0
))
{
return
(
-
1
);
}
}
}
return
(
0
);
}
void
RIFF_DeleteChunk
(
input_thread_t
*
p_input
,
riffchunk_t
*
p_chunk
)
{
if
(
p_chunk
!=
NULL
)
{
if
(
p_chunk
->
p_data
!=
NULL
)
{
input_DeletePacket
(
p_input
->
p_method_data
,
p_chunk
->
p_data
);
}
free
(
p_chunk
);
}
}
riffchunk_t
*
RIFF_ReadChunk
(
input_thread_t
*
p_input
)
{
riffchunk_t
*
p_riff
;
int
count
;
byte_t
*
p_peek
;
if
(
!
(
p_riff
=
malloc
(
sizeof
(
riffchunk_t
)))
)
{
return
(
NULL
);
}
p_riff
->
p_data
=
NULL
;
/* peek to have the begining, 8+8 get i_8bytes */
if
(
(
count
=
input_Peek
(
p_input
,
&
p_peek
,
16
)
)
<
8
)
{
msg_Err
(
p_input
,
"cannot peek()"
);
free
(
p_riff
);
return
(
NULL
);
}
p_riff
->
i_id
=
__GetDWLE
(
p_peek
);
p_riff
->
i_size
=
__GetDWLE
(
p_peek
+
4
);
p_riff
->
i_type
=
(
count
>=
12
)
?
__GetDWLE
(
p_peek
+
8
)
:
0
;
memset
(
&
p_riff
->
i_8bytes
,
0
,
8
);
if
(
count
>=
12
)
{
memcpy
(
&
p_riff
->
i_8bytes
,
p_peek
+
8
,
count
-
8
);
}
__RIFF_TellPos
(
p_input
,
&
p_riff
->
i_pos
);
return
(
p_riff
);
}
/**************************************************
* Va au chunk juste d'apres si il en a encore *
* -1 si erreur , 1 si y'en a plus *
**************************************************/
int
RIFF_NextChunk
(
input_thread_t
*
p_input
,
riffchunk_t
*
p_rifffather
)
{
int
i_len
;
int
i_lenfather
;
riffchunk_t
*
p_riff
;
if
(
(
p_riff
=
RIFF_ReadChunk
(
p_input
)
)
==
NULL
)
{
msg_Err
(
p_input
,
"cannot read chunk"
);
return
(
-
1
);
}
i_len
=
__EVEN
(
p_riff
->
i_size
);
if
(
p_rifffather
!=
NULL
)
{
i_lenfather
=
__EVEN
(
p_rifffather
->
i_size
);
if
(
p_rifffather
->
i_pos
+
i_lenfather
<=
p_riff
->
i_pos
+
i_len
+
8
)
{
msg_Err
(
p_input
,
"next chunk out of bounds"
);
free
(
p_riff
);
return
(
1
);
/* pas dans nos frontiere */
}
}
if
(
__RIFF_SkipBytes
(
p_input
,
i_len
+
8
)
!=
0
)
{
free
(
p_riff
);
msg_Err
(
p_input
,
"cannot go to the next chunk"
);
return
(
-
1
);
}
free
(
p_riff
);
return
(
0
);
}
modules/demux/avi/libioRIFF.h
deleted
100644 → 0
View file @
6cd47c0c
/*****************************************************************************
* libioRIFF.h : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: libioRIFF.h,v 1.3 2002/10/15 00:55:07 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.
*****************************************************************************/
#define MKFOURCC( a, b, c, d ) \
( ((u32)a) | ( ((u32)b) << 8 ) | ( ((u32)c) << 16 ) | ( ((u32)d) << 24 ) )
typedef
struct
riffchunk_s
{
vlc_fourcc_t
i_id
;
u32
i_size
;
vlc_fourcc_t
i_type
;
u32
i_pos
;
data_packet_t
*
p_data
;
u64
i_8bytes
;
/* it's the first 8 bytes after header
used for key frame generation */
}
riffchunk_t
;
int
__RIFF_TellPos
(
input_thread_t
*
p_input
,
u32
*
pos
);
int
__RIFF_SkipBytes
(
input_thread_t
*
p_input
,
int
nb
);
void
RIFF_DeleteChunk
(
input_thread_t
*
p_input
,
riffchunk_t
*
p_chunk
);
riffchunk_t
*
RIFF_ReadChunk
(
input_thread_t
*
p_input
);
int
RIFF_NextChunk
(
input_thread_t
*
p_input
,
riffchunk_t
*
p_rifffather
);
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