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
829b71f3
Commit
829b71f3
authored
Dec 19, 2001
by
Stan Seibert
Browse files
Warning fix on ogginfo
More mutex unlock checks svn path=/trunk/vorbis-tools/; revision=2841
parent
82d809ff
Changes
3
Hide whitespace changes
Inline
Side-by-side
ogg123/ao_interface.c
deleted
100644 → 0
View file @
82d809ff
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include "ogg123.h"
devices_t
*
append_device
(
devices_t
*
devices_list
,
int
driver_id
,
ao_option
*
options
,
char
*
filename
)
{
devices_t
*
head
=
devices_list
;
if
(
devices_list
!=
NULL
)
{
while
(
devices_list
->
next_device
!=
NULL
)
devices_list
=
devices_list
->
next_device
;
devices_list
=
devices_list
->
next_device
=
malloc
(
sizeof
(
devices_t
));
}
else
{
head
=
devices_list
=
(
devices_t
*
)
malloc
(
sizeof
(
devices_t
));
}
devices_list
->
driver_id
=
driver_id
;
devices_list
->
options
=
options
;
devices_list
->
filename
=
filename
;
devices_list
->
device
=
NULL
;
devices_list
->
next_device
=
NULL
;
return
devices_list
;
}
void
devices_write
(
void
*
ptr
,
size_t
size
,
devices_t
*
d
)
{
while
(
d
!=
NULL
)
{
ao_play
(
d
->
device
,
ptr
,
size
);
d
=
d
->
next_device
;
}
}
int
add_option
(
ao_option
**
op_h
,
const
char
*
optstring
)
{
char
*
key
,
*
value
;
int
result
;
key
=
strdup
(
optstring
);
if
(
key
==
NULL
)
return
0
;
value
=
strchr
(
key
,
':'
);
if
(
value
==
NULL
)
{
free
(
key
);
return
0
;
}
/* split by replacing the separator with a null */
*
value
++
=
'\0'
;
result
=
ao_append_option
(
op_h
,
key
,
value
);
free
(
key
);
return
(
result
);
}
ogg123/buffer.c
View file @
829b71f3
...
...
@@ -11,7 +11,7 @@
* *
********************************************************************
last mod: $Id: buffer.c,v 1.
9
2001/12/19 0
2:52:53
volsung Exp $
last mod: $Id: buffer.c,v 1.
10
2001/12/19 0
3:47:40
volsung Exp $
********************************************************************/
...
...
@@ -94,6 +94,14 @@ void buffer_thread_cleanup (void *arg)
}
void
buffer_mutex_unlock
(
void
*
arg
)
{
buf_t
*
buf
=
(
buf_t
*
)
arg
;
UNLOCK_MUTEX
(
buf
->
mutex
);
}
action_t
*
malloc_action
(
action_func_t
action_func
,
void
*
action_arg
)
{
action_t
*
action
;
...
...
@@ -270,6 +278,8 @@ void submit_data_chunk (buf_t *buf, char *data, size_t size)
DEBUG
(
"Enter submit_data_chunk, size %d"
,
size
);
pthread_cleanup_push
(
buffer_mutex_unlock
,
buf
);
/* Put the data into the buffer as space is made available */
while
(
size
>
0
)
{
...
...
@@ -318,6 +328,8 @@ void submit_data_chunk (buf_t *buf, char *data, size_t size)
UNLOCK_MUTEX
(
buf
->
mutex
);
}
pthread_cleanup_pop
(
0
);
DEBUG
(
"Exit submit_data_chunk"
);
}
...
...
@@ -437,9 +449,13 @@ void buffer_thread_pause (buf_t *buf)
{
DEBUG
(
"Pausing playback thread"
);
pthread_cleanup_push
(
buffer_mutex_unlock
,
buf
);
LOCK_MUTEX
(
buf
->
mutex
);
buf
->
paused
=
1
;
UNLOCK_MUTEX
(
buf
->
mutex
);
pthread_cleanup_pop
(
0
);
}
...
...
@@ -447,10 +463,14 @@ void buffer_thread_unpause (buf_t *buf)
{
DEBUG
(
"Unpausing playback thread"
);
pthread_cleanup_push
(
buffer_mutex_unlock
,
buf
);
LOCK_MUTEX
(
buf
->
mutex
);
buf
->
paused
=
0
;
COND_SIGNAL
(
buf
->
playback_cond
);
UNLOCK_MUTEX
(
buf
->
mutex
);
pthread_cleanup_pop
(
0
);
}
...
...
@@ -488,6 +508,8 @@ size_t buffer_get_data (buf_t *buf, char *data, long nbytes)
DEBUG
(
"Enter buffer_get_data"
);
pthread_cleanup_push
(
buffer_mutex_unlock
,
buf
);
LOCK_MUTEX
(
buf
->
mutex
);
/* Put the data into the buffer as space is made available */
...
...
@@ -536,6 +558,8 @@ size_t buffer_get_data (buf_t *buf, char *data, long nbytes)
}
UNLOCK_MUTEX
(
buf
->
mutex
);
pthread_cleanup_pop
(
0
);
pthread_testcancel
();
...
...
@@ -548,21 +572,29 @@ void buffer_mark_eos (buf_t *buf)
{
DEBUG
(
"buffer_mark_eos"
);
pthread_cleanup_push
(
buffer_mutex_unlock
,
buf
);
LOCK_MUTEX
(
buf
->
mutex
);
buf
->
eos
=
1
;
buf
->
prebuffering
=
0
;
COND_SIGNAL
(
buf
->
playback_cond
);
UNLOCK_MUTEX
(
buf
->
mutex
);
pthread_cleanup_pop
(
0
);
}
void
buffer_abort_write
(
buf_t
*
buf
)
{
DEBUG
(
"buffer_mark_eos"
);
pthread_cleanup_push
(
buffer_mutex_unlock
,
buf
);
LOCK_MUTEX
(
buf
->
mutex
);
buf
->
abort_write
=
1
;
COND_SIGNAL
(
buf
->
write_cond
);
UNLOCK_MUTEX
(
buf
->
mutex
);
pthread_cleanup_pop
(
0
);
}
...
...
@@ -575,6 +607,8 @@ void buffer_action_now (buf_t *buf, action_func_t action_func,
action
=
malloc_action
(
action_func
,
action_arg
);
pthread_cleanup_push
(
buffer_mutex_unlock
,
buf
);
LOCK_MUTEX
(
buf
->
mutex
);
action
->
position
=
buf
->
position
;
...
...
@@ -584,6 +618,8 @@ void buffer_action_now (buf_t *buf, action_func_t action_func,
buf
->
actions
=
action
;
UNLOCK_MUTEX
(
buf
->
mutex
);
pthread_cleanup_pop
(
0
);
}
...
...
@@ -594,6 +630,8 @@ void buffer_insert_action_at_end (buf_t *buf, action_func_t action_func,
action
=
malloc_action
(
action_func
,
action_arg
);
pthread_cleanup_push
(
buffer_mutex_unlock
,
buf
);
LOCK_MUTEX
(
buf
->
mutex
);
/* Stick after the last item in the buffer */
...
...
@@ -602,6 +640,8 @@ void buffer_insert_action_at_end (buf_t *buf, action_func_t action_func,
in_order_add_action
(
&
buf
->
actions
,
action
,
INSERT
);
UNLOCK_MUTEX
(
buf
->
mutex
);
pthread_cleanup_pop
(
0
);
}
...
...
@@ -612,6 +652,8 @@ void buffer_append_action_at_end (buf_t *buf, action_func_t action_func,
action
=
malloc_action
(
action_func
,
action_arg
);
pthread_cleanup_push
(
buffer_mutex_unlock
,
buf
);
LOCK_MUTEX
(
buf
->
mutex
);
/* Stick after the last item in the buffer */
...
...
@@ -620,6 +662,8 @@ void buffer_append_action_at_end (buf_t *buf, action_func_t action_func,
in_order_add_action
(
&
buf
->
actions
,
action
,
APPEND
);
UNLOCK_MUTEX
(
buf
->
mutex
);
pthread_cleanup_pop
(
0
);
}
...
...
@@ -630,6 +674,8 @@ void buffer_insert_action_at (buf_t *buf, action_func_t action_func,
action
=
malloc_action
(
action_func
,
action_arg
);
pthread_cleanup_push
(
buffer_mutex_unlock
,
buf
);
LOCK_MUTEX
(
buf
->
mutex
);
action
->
position
=
position
;
...
...
@@ -637,6 +683,8 @@ void buffer_insert_action_at (buf_t *buf, action_func_t action_func,
in_order_add_action
(
&
buf
->
actions
,
action
,
INSERT
);
UNLOCK_MUTEX
(
buf
->
mutex
);
pthread_cleanup_pop
(
0
);
}
...
...
@@ -647,13 +695,17 @@ void buffer_append_action_at (buf_t *buf, action_func_t action_func,
action
=
malloc_action
(
action_func
,
action_arg
);
pthread_cleanup_push
(
buffer_mutex_unlock
,
buf
);
LOCK_MUTEX
(
buf
->
mutex
);
action
->
position
=
position
;
in_order_add_action
(
&
buf
->
actions
,
action
,
APPEND
);
UNLOCK_MUTEX
(
buf
->
mutex
);
UNLOCK_MUTEX
(
buf
->
mutex
);
pthread_cleanup_pop
(
0
);
}
...
...
@@ -664,6 +716,8 @@ void buffer_wait_for_empty (buf_t *buf)
int
empty
=
0
;
DEBUG
(
"Enter buffer_wait_for_empty"
);
pthread_cleanup_push
(
buffer_mutex_unlock
,
buf
);
LOCK_MUTEX
(
buf
->
mutex
);
while
(
!
empty
)
{
...
...
@@ -676,6 +730,8 @@ void buffer_wait_for_empty (buf_t *buf)
}
UNLOCK_MUTEX
(
buf
->
mutex
);
pthread_cleanup_pop
(
0
);
DEBUG
(
"Exit buffer_wait_for_empty"
);
}
...
...
@@ -689,6 +745,8 @@ long buffer_full (buf_t *buf)
buffer_stats_t
*
buffer_statistics
(
buf_t
*
buf
)
{
buffer_stats_t
*
stats
;
pthread_cleanup_push
(
buffer_mutex_unlock
,
buf
);
LOCK_MUTEX
(
buf
->
mutex
);
...
...
@@ -702,6 +760,8 @@ buffer_stats_t *buffer_statistics (buf_t *buf)
UNLOCK_MUTEX
(
buf
->
mutex
);
pthread_cleanup_pop
(
0
);
return
stats
;
}
...
...
ogginfo/ogginfo.c
View file @
829b71f3
...
...
@@ -46,7 +46,7 @@ void calc_playtime(double playtime, long *playmin, long *playsec)
void
print_header_info
(
vorbis_comment
*
vc
,
vorbis_info
*
vi
)
{
int
rc
,
i
;
int
i
;
for
(
i
=
0
;
i
<
vc
->
comments
;
i
++
)
{
printf
(
"%s
\n
"
,
vc
->
user_comments
[
i
]);
...
...
@@ -102,7 +102,6 @@ int test_header (FILE *fp, ogg_sync_state *oy, ogg_stream_state *os,
ogg_packet
op
;
/* one raw packet of data for decode */
char
*
buffer
;
int
bytes
;
int
eos
=
0
;
int
i
;
/* grab some data at the head of the stream. We want the first page
...
...
@@ -304,7 +303,7 @@ int dointegritycheck(char *filename)
/* Output test results */
if
(
header_state
==
1
)
{
printf
(
"
\n
serial=%d
\n
"
,
serialno
);
printf
(
"
\n
serial=%
l
d
\n
"
,
serialno
);
printf
(
"header_integrity=pass
\n
"
);
print_header_info
(
&
vc
,
&
vi
);
}
else
...
...
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