Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Thomas Daede
Vorbis tools
Commits
e8015967
Commit
e8015967
authored
Nov 07, 2001
by
Michael Smith
Browse files
Patch (from Warren Spits) to make chained files work correctly again.
svn path=/trunk/vorbis-tools/; revision=2305
parent
3636ce15
Changes
2
Hide whitespace changes
Inline
Side-by-side
vorbiscomment/vcedit.c
View file @
e8015967
...
...
@@ -6,7 +6,7 @@
*
* Comment editing backend, suitable for use by nice frontend interfaces.
*
* last modified: $Id: vcedit.c,v 1.1
4
2001/1
0/18 10:28:17
msmith Exp $
* last modified: $Id: vcedit.c,v 1.1
5
2001/1
1/07 12:45:03
msmith Exp $
*/
#include <stdio.h>
...
...
@@ -140,10 +140,9 @@ static int _blocksize(vcedit_state *s, ogg_packet *p)
return
ret
;
}
static
int
_fetch_next_packet
(
vcedit_state
*
s
,
ogg_packet
*
p
)
static
int
_fetch_next_packet
(
vcedit_state
*
s
,
ogg_packet
*
p
,
ogg_page
*
page
)
{
int
result
;
ogg_page
og
;
char
*
buffer
;
int
bytes
;
...
...
@@ -153,7 +152,9 @@ static int _fetch_next_packet(vcedit_state *s, ogg_packet *p)
return
1
;
else
{
while
(
ogg_sync_pageout
(
s
->
oy
,
&
og
)
<=
0
)
if
(
s
->
eosin
)
return
0
;
while
(
ogg_sync_pageout
(
s
->
oy
,
page
)
<=
0
)
{
buffer
=
ogg_sync_buffer
(
s
->
oy
,
CHUNKSIZE
);
bytes
=
s
->
read
(
buffer
,
1
,
CHUNKSIZE
,
s
->
in
);
...
...
@@ -161,9 +162,17 @@ static int _fetch_next_packet(vcedit_state *s, ogg_packet *p)
if
(
bytes
==
0
)
return
0
;
}
if
(
ogg_page_eos
(
page
))
s
->
eosin
=
1
;
else
if
(
ogg_page_serialno
(
page
)
!=
s
->
serial
)
{
s
->
eosin
=
1
;
s
->
extrapage
=
1
;
return
0
;
}
ogg_stream_pagein
(
s
->
os
,
&
og
);
return
_fetch_next_packet
(
s
,
p
);
ogg_stream_pagein
(
s
->
os
,
page
);
return
_fetch_next_packet
(
s
,
p
,
page
);
}
}
...
...
@@ -299,14 +308,17 @@ int vcedit_write(vcedit_state *state, void *out)
ogg_packet
header_comments
;
ogg_packet
header_codebooks
;
ogg_page
ogout
;
ogg_page
ogout
,
ogin
;
ogg_packet
op
;
ogg_int64_t
granpos
=
0
;
int
result
;
char
*
buffer
;
int
bytes
,
eosin
=
0
;
int
bytes
;
int
needflush
=
0
,
needout
=
0
;
state
->
eosin
=
0
;
state
->
extrapage
=
0
;
header_main
.
bytes
=
state
->
mainlen
;
header_main
.
packet
=
state
->
mainbuf
;
header_main
.
b_o_s
=
1
;
...
...
@@ -337,7 +349,7 @@ int vcedit_write(vcedit_state *state, void *out)
goto
cleanup
;
}
while
(
_fetch_next_packet
(
state
,
&
op
))
while
(
_fetch_next_packet
(
state
,
&
op
,
&
ogin
))
{
int
size
;
size
=
_blocksize
(
state
,
&
op
);
...
...
@@ -407,8 +419,18 @@ int vcedit_write(vcedit_state *state, void *out)
/* Done with this, now */
vorbis_info_clear
(
&
state
->
vi
);
eosin
=
0
;
/* clear it, because not all paths to here do */
while
(
!
eosin
)
/* We reached eos, not eof */
if
(
state
->
extrapage
)
{
if
(
state
->
write
(
ogin
.
header
,
1
,
ogin
.
header_len
,
out
)
!=
(
size_t
)
ogin
.
header_len
)
goto
cleanup
;
if
(
state
->
write
(
ogin
.
body
,
1
,
ogin
.
body_len
,
out
)
!=
(
size_t
)
ogin
.
body_len
)
goto
cleanup
;
}
state
->
eosin
=
0
;
/* clear it, because not all paths to here do */
while
(
!
state
->
eosin
)
/* We reached eos, not eof */
{
/* We copy the rest of the stream (other logical streams)
* through, a page at a time. */
...
...
@@ -435,7 +457,7 @@ int vcedit_write(vcedit_state *state, void *out)
ogg_sync_wrote
(
state
->
oy
,
bytes
);
if
(
bytes
==
0
)
{
eosin
=
1
;
state
->
eosin
=
1
;
break
;
}
}
...
...
@@ -449,7 +471,7 @@ cleanup:
free
(
state
->
bookbuf
);
vcedit_clear_internals
(
state
);
if
(
!
eosin
)
if
(
!
state
->
eosin
)
{
state
->
lasterror
=
"Error writing stream to output. "
...
...
vorbiscomment/vcedit.h
View file @
e8015967
...
...
@@ -41,6 +41,8 @@ typedef struct {
char
*
lasterror
;
char
*
vendor
;
int
prevW
;
int
extrapage
;
int
eosin
;
}
vcedit_state
;
extern
vcedit_state
*
vcedit_new_state
(
void
);
...
...
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