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
3f2ac49d
Commit
3f2ac49d
authored
Apr 18, 2014
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: avi: align reads for uncompressed bmp (fix #6387, #4518, #9552)
parent
421a5229
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
1 deletion
+39
-1
modules/demux/avi/avi.c
modules/demux/avi/avi.c
+39
-1
No files found.
modules/demux/avi/avi.c
View file @
3f2ac49d
...
...
@@ -145,6 +145,8 @@ typedef struct
int
i_scale
;
unsigned
int
i_samplesize
;
unsigned
int
i_width_bytes
;
es_out_id_t
*
p_es
;
int
i_dv_audio_rate
;
...
...
@@ -522,11 +524,18 @@ static int Open( vlc_object_t * p_this )
}
}
tk
->
i_samplesize
=
0
;
fmt
.
video
.
i_width
=
p_vids
->
p_bih
->
biWidth
;
fmt
.
video
.
i_height
=
p_vids
->
p_bih
->
biHeight
;
fmt
.
video
.
i_bits_per_pixel
=
p_vids
->
p_bih
->
biBitCount
;
fmt
.
video
.
i_frame_rate
=
tk
->
i_rate
;
fmt
.
video
.
i_frame_rate_base
=
tk
->
i_scale
;
if
(
p_vids
->
p_bih
->
biCompression
==
0x00
)
tk
->
i_width_bytes
=
p_vids
->
p_bih
->
biWidth
*
(
p_vids
->
p_bih
->
biBitCount
>>
3
);
else
tk
->
i_width_bytes
=
0
;
avi_chunk_vprp_t
*
p_vprp
=
AVI_ChunkFind
(
p_strl
,
AVIFOURCC_vprp
,
0
);
if
(
p_vprp
)
{
...
...
@@ -789,6 +798,35 @@ static void Close ( vlc_object_t * p_this )
free
(
p_sys
);
}
/*****************************************************************************
* ReadFrame: Reads frame, using stride if necessary
*****************************************************************************/
block_t
*
ReadFrame
(
demux_t
*
p_demux
,
const
avi_track_t
*
tk
,
const
int
i_size
)
{
block_t
*
p_frame
=
stream_Block
(
p_demux
->
s
,
i_size
);
if
(
!
p_frame
||
!
tk
->
i_width_bytes
)
/* There's no stride */
return
p_frame
;
const
unsigned
int
i_stride_bytes
=
(((
(
tk
->
i_width_bytes
<<
3
)
+
31
)
&
~
31
)
>>
3
);
const
uint8_t
*
p_end
=
p_frame
->
p_buffer
+
p_frame
->
i_buffer
;
const
uint8_t
*
p_src
=
p_frame
->
p_buffer
+
i_stride_bytes
;
uint8_t
*
p_dst
=
p_frame
->
p_buffer
+
tk
->
i_width_bytes
;
p_frame
->
i_buffer
=
tk
->
i_width_bytes
;
if
(
tk
->
i_idxposb
==
0
)
p_frame
->
i_buffer
+=
8
;
while
(
p_src
+
i_stride_bytes
<
p_end
)
{
memmove
(
p_dst
,
p_src
,
tk
->
i_width_bytes
);
p_src
+=
i_stride_bytes
;
p_dst
+=
tk
->
i_width_bytes
;
p_frame
->
i_buffer
+=
tk
->
i_width_bytes
;
}
return
p_frame
;
}
/*****************************************************************************
* Demux_Seekable: reads and demuxes data packets for stream seekable
*****************************************************************************
...
...
@@ -1072,7 +1110,7 @@ static int Demux_Seekable( demux_t *p_demux )
i_size
+=
8
;
/* need to read and skip header */
}
if
(
(
p_frame
=
stream_Block
(
p_demux
->
s
,
__EVEN
(
i_size
)
)
)
==
NULL
)
if
(
(
p_frame
=
ReadFrame
(
p_demux
,
tk
,
__EVEN
(
i_size
)
)
)
==
NULL
)
{
msg_Warn
(
p_demux
,
"failed reading data"
);
tk
->
b_eof
=
false
;
...
...
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