Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
aa0acfb9
Commit
aa0acfb9
authored
Feb 24, 2003
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* wav: proper seek handling. (wav file readable over http).
parent
be878a26
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
95 additions
and
71 deletions
+95
-71
modules/demux/wav/wav.c
modules/demux/wav/wav.c
+87
-62
modules/demux/wav/wav.h
modules/demux/wav/wav.h
+8
-9
No files found.
modules/demux/wav/wav.c
View file @
aa0acfb9
...
...
@@ -2,7 +2,7 @@
* wav.c : wav file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: wav.c,v 1.1
0 2003/01/25 16:58:35
fenrir Exp $
* $Id: wav.c,v 1.1
1 2003/02/24 09:18:07
fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -84,68 +84,93 @@ static off_t TellAbsolute( input_thread_t *p_input )
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
i_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
(
i_pos
);
}
static
int
SeekAbsolute
(
input_thread_t
*
p_input
,
off_t
i_pos
)
{
off_t
i_filepos
;
if
(
i_pos
>=
p_input
->
stream
.
p_selected_area
->
i_size
)
{
// return( 0 );
}
i_filepos
=
TellAbsolute
(
p_input
);
if
(
i_pos
!=
i_filepos
)
{
p_input
->
pf_seek
(
p_input
,
i_pos
);
input_AccessReinit
(
p_input
);
}
return
(
1
);
}
static
int
SkipBytes
(
input_thread_t
*
p_input
,
int
i_skip
)
{
return
(
SeekAbsolute
(
p_input
,
TellAbsolute
(
p_input
)
+
i_skip
)
);
}
/* return 1 if success, 0 if fail */
static
int
ReadData
(
input_thread_t
*
p_input
,
uint8_t
*
p_buff
,
int
i_size
)
{
data_packet_t
*
p_data
;
int
i_read
;
int
i_count
=
0
;
if
(
!
i_size
)
{
return
(
1
);
return
(
0
);
}
do
{
int
i_read
;
i_read
=
input_SplitBuffer
(
p_input
,
&
p_data
,
__MIN
(
i_size
,
1024
)
);
if
(
i_read
<=
0
)
{
return
(
0
);
return
(
i_count
);
}
memcpy
(
p_buff
,
p_data
->
p_payload_start
,
i_read
);
input_DeletePacket
(
p_input
->
p_method_data
,
p_data
);
p_buff
+=
i_read
;
i_size
-=
i_read
;
i_count
+=
i_read
;
}
while
(
i_size
);
return
(
1
);
return
(
i_count
);
}
static
int
SeekAbsolute
(
input_thread_t
*
p_input
,
off_t
i_pos
)
{
int
i_skip
;
#if 0
if( i_pos >= p_input->stream.p_selected_area->i_size )
{
return( 0 );
}
#endif
i_skip
=
i_pos
-
TellAbsolute
(
p_input
);
if
(
i_skip
==
0
)
{
return
(
VLC_SUCCESS
);
}
if
(
i_skip
<
0
&&
!
p_input
->
stream
.
b_seekable
)
{
return
(
VLC_EGENERIC
);
}
else
if
(
!
p_input
->
stream
.
b_seekable
||
(
i_skip
>
0
&&
i_skip
<
1024
&&
p_input
->
stream
.
i_method
!=
INPUT_METHOD_FILE
)
)
{
while
(
i_skip
>
0
)
{
uint8_t
dummy
[
1024
];
int
i_read
;
i_read
=
ReadData
(
p_input
,
dummy
,
__MIN
(
i_skip
,
1024
)
);
if
(
i_read
<=
0
)
{
return
(
VLC_EGENERIC
);
}
i_skip
-=
i_read
;
}
return
(
VLC_SUCCESS
);
}
else
{
input_AccessReinit
(
p_input
);
p_input
->
pf_seek
(
p_input
,
i_pos
);
}
}
static
int
SkipBytes
(
input_thread_t
*
p_input
,
int
i_skip
)
{
return
(
SeekAbsolute
(
p_input
,
TellAbsolute
(
p_input
)
+
i_skip
)
);
}
static
int
ReadPES
(
input_thread_t
*
p_input
,
pes_packet_t
**
pp_pes
,
...
...
modules/demux/wav/wav.h
View file @
aa0acfb9
...
...
@@ -2,7 +2,7 @@
* wav.h : wav file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: wav.h,v 1.
2 2002/11/28 16:32:29
fenrir Exp $
* $Id: wav.h,v 1.
3 2003/02/24 09:18:07
fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -38,7 +38,7 @@ struct demux_sys_t
WAVEFORMATEX
*
p_wf
;
off_t
i_data_pos
;
u
64
i_data_size
;
u
int64_t
i_data_size
;
/* Two case:
- we have an internal demux(pcm)
...
...
@@ -56,7 +56,6 @@ struct demux_sys_t
WAVEFORMATEX
*
p_wf
,
pes_packet_t
**
pp_pes
,
mtime_t
*
pi_length
);
};
...
...
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