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
52226f31
Commit
52226f31
authored
Nov 21, 2003
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* avi: use block instead of PES every where.
parent
bfeea8d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
90 deletions
+26
-90
modules/demux/avi/avi.c
modules/demux/avi/avi.c
+26
-90
No files found.
modules/demux/avi/avi.c
View file @
52226f31
...
...
@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: avi.c,v 1.7
2 2003/11/21 00:38:01 gbazin
Exp $
* $Id: avi.c,v 1.7
3 2003/11/21 15:51:32 fenrir
Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -85,7 +85,7 @@ static int AVI_GetKeyFlag ( vlc_fourcc_t , uint8_t * );
static
int
AVI_PacketGetHeader
(
input_thread_t
*
,
avi_packet_t
*
p_pk
);
static
int
AVI_PacketNext
(
input_thread_t
*
);
static
int
AVI_PacketRead
(
input_thread_t
*
,
avi_packet_t
*
,
pes_packet
_t
**
);
static
int
AVI_PacketRead
(
input_thread_t
*
,
avi_packet_t
*
,
block
_t
**
);
static
int
AVI_PacketSearch
(
input_thread_t
*
);
static
void
AVI_IndexLoad
(
input_thread_t
*
);
...
...
@@ -557,7 +557,7 @@ static int Demux_Seekable( input_thread_t *p_input )
{
avi_track_t
*
tk
;
vlc_bool_t
b_done
;
pes_packet_t
*
p_pes
;
block_t
*
p_frame
;
off_t
i_pos
;
unsigned
int
i
;
size_t
i_size
;
...
...
@@ -700,7 +700,7 @@ static int Demux_Seekable( input_thread_t *p_input )
i_size
+=
8
;
/* need to read and skip header */
}
if
(
(
p_
pes
=
stream_PesPacket
(
p_input
->
s
,
__EVEN
(
i_size
)
)
)
==
NULL
)
if
(
(
p_
frame
=
stream_Block
(
p_input
->
s
,
__EVEN
(
i_size
)
)
)
==
NULL
)
{
msg_Warn
(
p_input
,
"failled reading data"
);
tk
->
b_activated
=
VLC_FALSE
;
...
...
@@ -709,25 +709,15 @@ static int Demux_Seekable( input_thread_t *p_input )
}
if
(
i_size
%
2
)
/* read was padded on word boundary */
{
p_pes
->
p_last
->
p_payload_end
--
;
p_pes
->
i_pes_size
--
;
p_frame
->
i_buffer
--
;
}
/* skip header */
if
(
tk
->
i_idxposb
==
0
)
{
p_
pes
->
p_first
->
p_payload_start
+=
8
;
p_
pes
->
i_pes_size
-=
8
;
p_
frame
->
p_buffer
+=
8
;
p_
frame
->
i_buffer
-=
8
;
}
p_pes
->
i_pts
=
AVI_GetPTS
(
tk
);
#if 0
/* fix pts for audio: ie pts sould be for the first byte of the first frame */
if( tk->i_samplesize == 1 )
{
AVI_FixPTS( p_stream, p_pes );
}
#endif
p_frame
->
i_pts
=
AVI_GetPTS
(
tk
);
/* read data */
if
(
tk
->
i_samplesize
)
...
...
@@ -768,19 +758,19 @@ static int Demux_Seekable( input_thread_t *p_input )
b_stream
=
VLC_TRUE
;
/* at least one read succeed */
p_
pes
->
i_dts
=
p_
pes
->
i_pts
=
p_
frame
->
i_dts
=
p_
frame
->
i_pts
=
input_ClockGetTS
(
p_input
,
p_input
->
stream
.
p_selected_program
,
p_
pes
->
i_pts
*
9
/
100
);
p_pes
->
i_rate
=
p_input
->
stream
.
control
.
i_rate
;
p_
frame
->
i_pts
*
9
/
100
);
//
p_pes->i_rate = p_input->stream.control.i_rate;
if
(
b_play_audio
||
tk
->
i_cat
!=
AUDIO_ES
)
{
es_out_Send
PES
(
p_input
->
p_es_out
,
tk
->
p_es
,
p_pes
);
es_out_Send
(
p_input
->
p_es_out
,
tk
->
p_es
,
p_frame
);
}
else
{
input_DeletePES
(
p_input
->
p_method_data
,
p_pes
);
block_Release
(
p_frame
);
}
}
}
...
...
@@ -890,19 +880,19 @@ static int Demux_UnSeekable( input_thread_t *p_input )
AVI_GetPTS
(
p_stream_master
)
)
<
600
*
1000
)
{
/* load it and send to decoder */
pes_packet_t
*
p_pes
;
if
(
AVI_PacketRead
(
p_input
,
&
avi_pk
,
&
p_
pes
)
||
!
p_pes
)
block_t
*
p_frame
;
if
(
AVI_PacketRead
(
p_input
,
&
avi_pk
,
&
p_
frame
)
||
p_frame
==
NULL
)
{
return
(
-
1
);
}
p_
pes
->
i_dts
=
p_pes
->
i_pts
=
input_ClockGetTS
(
p_input
,
p_
frame
->
i_dts
=
p_frame
->
i_pts
=
input_ClockGetTS
(
p_input
,
p_input
->
stream
.
p_selected_program
,
AVI_GetPTS
(
p_stream
)
*
9
/
100
);
p_pes
->
i_rate
=
p_input
->
stream
.
control
.
i_rate
;
es_out_Send
PES
(
p_input
->
p_es_out
,
p_stream
->
p_es
,
p_pes
);
//
p_pes->i_rate = p_input->stream.control.i_rate;
es_out_Send
(
p_input
->
p_es_out
,
p_stream
->
p_es
,
p_frame
);
}
else
{
...
...
@@ -1222,59 +1212,6 @@ static mtime_t AVI_GetPTS( avi_track_t *tk )
}
}
#if 0
static void AVI_FixPTS( avi_track_t *p_stream, pes_packet_t *p_pes )
{
data_packet_t *p_data;
uint8_t *p;
int i_pos = 0;
switch( p_stream->i_fourcc )
{
case VLC_FOURCC( 'm', 'p', 'g', 'a' ):
p_data = p_pes->p_first;
while( p_data )
{
p = p_data->p_payload_start;
while( p < p_data->p_payload_end - 2 )
{
if( p[0] == 0xff && ( p[1]&0xe0) == 0xe0 )
{
mtime_t i_diff = AVI_GetDPTS( p_stream, i_pos );
p_pes->i_dts += i_diff;
p_pes->i_pts += i_diff;
return;
}
p++; i_pos++;
}
p_data = p_data->p_next;
}
return;
case VLC_FOURCC( 'a', '5', '2', ' ' ):
p_data = p_pes->p_first;
while( p_data )
{
p = p_data->p_payload_start;
while( p < p_data->p_payload_end - 2 )
{
if( p[0] == 0x0b && p[1] == 0x77 )
{
mtime_t i_diff = AVI_GetDPTS( p_stream, i_pos );
p_pes->i_dts += i_diff;
p_pes->i_pts += i_diff;
}
p++; i_pos++;
}
p_data = p_data->p_next;
}
return;
default:
/* we can't fix :( */
return;
}
}
#endif
static
int
AVI_StreamChunkFind
(
input_thread_t
*
p_input
,
unsigned
int
i_stream
)
{
...
...
@@ -1714,23 +1651,22 @@ static int AVI_PacketNext( input_thread_t *p_input )
}
static
int
AVI_PacketRead
(
input_thread_t
*
p_input
,
avi_packet_t
*
p_pk
,
pes_packet_t
**
pp_pes
)
block_t
**
pp_frame
)
{
size_t
i_size
;
i_size
=
__EVEN
(
p_pk
->
i_size
+
8
);
if
(
(
*
pp_
pes
=
stream_PesPacket
(
p_input
->
s
,
i_size
)
)
==
NULL
)
if
(
(
*
pp_
frame
=
stream_Block
(
p_input
->
s
,
i_size
)
)
==
NULL
)
{
return
VLC_EGENERIC
;
}
(
*
pp_
pes
)
->
p_first
->
p_payload_start
+=
8
;
(
*
pp_
pes
)
->
i_pes_size
-=
8
;
(
*
pp_
frame
)
->
p_buffer
+=
8
;
(
*
pp_
frame
)
->
i_buffer
-=
8
;
if
(
i_size
!=
p_pk
->
i_size
+
8
)
{
(
*
pp_pes
)
->
p_last
->
p_payload_end
--
;
(
*
pp_pes
)
->
i_pes_size
--
;
(
*
pp_frame
)
->
i_buffer
--
;
}
return
VLC_SUCCESS
;
...
...
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