Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
422dbd4a
Commit
422dbd4a
authored
Nov 27, 2002
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cinepak: fix a bug (bad frame gathering), pointed by sam.
parent
968cc6bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
54 deletions
+59
-54
modules/codec/cinepak/cinepak.c
modules/codec/cinepak/cinepak.c
+53
-51
modules/codec/cinepak/cinepak.h
modules/codec/cinepak/cinepak.h
+6
-3
No files found.
modules/codec/cinepak/cinepak.c
View file @
422dbd4a
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* cinepak.c: cinepak video decoder
* cinepak.c: cinepak video decoder
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* Copyright (C) 1999-2001 VideoLAN
* $Id: cinepak.c,v 1.
6 2002/10/27 16:58:14 gbazin
Exp $
* $Id: cinepak.c,v 1.
7 2002/11/27 13:17:27 fenrir
Exp $
*
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
*
...
@@ -156,60 +156,37 @@ static inline u32 GetDWBE( u8 *p_buff )
...
@@ -156,60 +156,37 @@ static inline u32 GetDWBE( u8 *p_buff )
if( p ) free( p )
if( p ) free( p )
static
inline
void
__GetFrame
(
videodec_thread_t
*
p_vdec
)
static
void
GetPESData
(
u8
*
p_buf
,
int
i_max
,
pes_packet_t
*
p_pes
)
{
{
pes_packet_t
*
p_pes
;
int
i_copy
;
data_packet_t
*
p_data
;
int
i_count
;
byte_t
*
p_buffer
;
data_packet_t
*
p_data
;
input_ExtractPES
(
p_vdec
->
p_fifo
,
&
p_pes
);
i_count
=
0
;
if
(
!
p_pes
)
p_data
=
p_pes
->
p_first
;
while
(
p_data
!=
NULL
&&
i_count
<
i_max
)
{
{
p_vdec
->
p_framedata
=
NULL
;
return
;
}
p_vdec
->
i_pts
=
p_pes
->
i_pts
;
i_copy
=
__MIN
(
p_data
->
p_payload_end
-
p_data
->
p_payload_start
,
i_max
-
i_count
);
while
(
(
!
p_pes
->
i_nb_data
)
||
(
!
p_pes
->
i_pes_size
)
)
if
(
i_copy
>
0
)
{
input_DeletePES
(
p_vdec
->
p_fifo
->
p_packets_mgt
,
p_pes
);
input_ExtractPES
(
p_vdec
->
p_fifo
,
&
p_pes
);
if
(
!
p_pes
)
{
{
p_vdec
->
p_framedata
=
NULL
;
memcpy
(
p_buf
,
return
;
p_data
->
p_payload_start
,
i_copy
);
}
}
}
p_vdec
->
i_framesize
=
p_pes
->
i_pes_size
;
if
(
p_pes
->
i_nb_data
==
1
)
{
p_vdec
->
p_framedata
=
p_pes
->
p_first
->
p_payload_start
;
return
;
}
/* get a buffer and gather all data packet */
p_vdec
->
p_framedata
=
p_buffer
=
malloc
(
p_pes
->
i_pes_size
);
p_data
=
p_pes
->
p_first
;
do
{
p_vdec
->
p_fifo
->
p_vlc
->
pf_memcpy
(
p_buffer
,
p_data
->
p_payload_start
,
p_data
->
p_payload_end
-
p_data
->
p_payload_start
);
p_buffer
+=
p_data
->
p_payload_end
-
p_data
->
p_payload_start
;
p_data
=
p_data
->
p_next
;
}
while
(
p_data
);
input_DeletePES
(
p_vdec
->
p_fifo
->
p_packets_mgt
,
p_pes
);
}
static
inline
void
__NextFrame
(
videodec_thread_t
*
p_vdec
)
p_data
=
p_data
->
p_next
;
{
i_count
+=
i_copy
;
pes_packet_t
*
p_pes
;
p_buf
+=
i_copy
;
}
input_ExtractPES
(
p_vdec
->
p_fifo
,
&
p_pes
);
if
(
i_count
<
i_max
)
if
(
p_pes
&&
(
p_pes
->
i_nb_data
!=
1
)
)
{
{
free
(
p_vdec
->
p_framedata
);
/* FIXME keep this buffer */
memset
(
p_buf
,
0
,
i_max
-
i_count
);
}
}
input_DeletePES
(
p_vdec
->
p_fifo
->
p_packets_mgt
,
p_pes
);
}
}
static
int
cinepak_CheckVout
(
vout_thread_t
*
p_vout
,
static
int
cinepak_CheckVout
(
vout_thread_t
*
p_vout
,
...
@@ -819,23 +796,48 @@ static int InitThread( videodec_thread_t *p_vdec )
...
@@ -819,23 +796,48 @@ static int InitThread( videodec_thread_t *p_vdec )
*****************************************************************************/
*****************************************************************************/
static
void
DecodeThread
(
videodec_thread_t
*
p_vdec
)
static
void
DecodeThread
(
videodec_thread_t
*
p_vdec
)
{
{
pes_packet_t
*
p_pes
;
int
i_frame_size
;
int
i_status
;
int
i_status
;
int
i_plane
;
int
i_plane
;
u8
*
p_dst
,
*
p_src
;
u8
*
p_dst
,
*
p_src
;
picture_t
*
p_pic
;
/* videolan picture */
picture_t
*
p_pic
;
/* videolan picture */
__GetFrame
(
p_vdec
);
do
{
input_ExtractPES
(
p_vdec
->
p_fifo
,
&
p_pes
);
if
(
!
p_pes
)
{
p_vdec
->
p_fifo
->
b_error
=
1
;
return
;
}
p_vdec
->
i_pts
=
p_pes
->
i_pts
;
i_frame_size
=
p_pes
->
i_pes_size
;
if
(
i_frame_size
>
0
)
{
if
(
p_vdec
->
i_buffer
<
i_frame_size
+
16
)
{
FREE
(
p_vdec
->
p_buffer
);
p_vdec
->
p_buffer
=
malloc
(
i_frame_size
+
16
);
p_vdec
->
i_buffer
=
i_frame_size
+
16
;
}
GetPESData
(
p_vdec
->
p_buffer
,
p_vdec
->
i_buffer
,
p_pes
);
}
input_DeletePES
(
p_vdec
->
p_fifo
->
p_packets_mgt
,
p_pes
);
}
while
(
i_frame_size
<=
0
);
i_status
=
cinepak_decode_frame
(
p_vdec
->
p_context
,
i_status
=
cinepak_decode_frame
(
p_vdec
->
p_context
,
p_vdec
->
i_framesize
,
i_frame_size
,
p_vdec
->
p_framedata
);
p_vdec
->
p_buffer
);
__NextFrame
(
p_vdec
);
if
(
i_status
<
0
)
if
(
i_status
<
0
)
{
{
msg_Warn
(
p_vdec
->
p_fifo
,
"cannot decode one frame (%d bytes)"
,
msg_Warn
(
p_vdec
->
p_fifo
,
"cannot decode one frame (%d bytes)"
,
p_vdec
->
i_frame
size
);
i_frame_
size
);
return
;
return
;
}
}
...
...
modules/codec/cinepak/cinepak.h
View file @
422dbd4a
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* cinepak.h: Cinepak video decoder
* cinepak.h: Cinepak video decoder
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* Copyright (C) 2001 VideoLAN
* $Id: cinepak.h,v 1.
1 2002/08/04 17:23:42 sam
Exp $
* $Id: cinepak.h,v 1.
2 2002/11/27 13:17:27 fenrir
Exp $
*
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
*
...
@@ -62,6 +62,9 @@ typedef struct videodec_thread_s
...
@@ -62,6 +62,9 @@ typedef struct videodec_thread_s
/* private */
/* private */
mtime_t
i_pts
;
mtime_t
i_pts
;
int
i_framesize
;
u8
*
p_buffer
;
/* buffer for gather pes */
\
byte_t
*
p_framedata
;
int
i_buffer
;
/* size of allocated p_framedata */
// int i_framesize;
// byte_t *p_framedata;
}
videodec_thread_t
;
}
videodec_thread_t
;
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