Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
c2a23830
Commit
c2a23830
authored
Nov 09, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
be sure to flush the metadata on song change
git-svn-id:
https://svn.musicpd.org/mpd/trunk@2556
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
fb7de941
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
39 deletions
+47
-39
audioOutput_shout.c
src/audioOutputs/audioOutput_shout.c
+47
-39
No files found.
src/audioOutputs/audioOutput_shout.c
View file @
c2a23830
...
@@ -44,6 +44,7 @@ static int shoutInitCount = 0;
...
@@ -44,6 +44,7 @@ static int shoutInitCount = 0;
typedef
struct
_ShoutData
{
typedef
struct
_ShoutData
{
shout_t
*
shoutConn
;
shout_t
*
shoutConn
;
int
shoutError
;
ogg_stream_state
os
;
ogg_stream_state
os
;
ogg_page
og
;
ogg_page
og
;
...
@@ -251,7 +252,43 @@ static int myShout_initDriver(AudioOutput * audioOutput, ConfigParam * param) {
...
@@ -251,7 +252,43 @@ static int myShout_initDriver(AudioOutput * audioOutput, ConfigParam * param) {
return
0
;
return
0
;
}
}
/*static void finishEncoder(ShoutData * sd) {
static
int
myShout_handleError
(
ShoutData
*
sd
,
int
err
)
{
switch
(
err
)
{
case
SHOUTERR_SUCCESS
:
break
;
case
SHOUTERR_UNCONNECTED
:
case
SHOUTERR_SOCKET
:
ERROR
(
"Lost shout connection to %s:%i
\n
"
,
shout_get_host
(
sd
->
shoutConn
),
shout_get_port
(
sd
->
shoutConn
));
sd
->
shoutError
=
1
;
return
-
1
;
default:
ERROR
(
"shout: connection to %s:%i error : %s
\n
"
,
shout_get_host
(
sd
->
shoutConn
),
shout_get_port
(
sd
->
shoutConn
),
shout_get_error
(
sd
->
shoutConn
));
sd
->
shoutError
=
1
;
return
-
1
;
}
return
0
;
}
static
int
write_page
(
ShoutData
*
sd
)
{
int
err
=
0
;
/*DEBUG("shout_delay: %i\n", shout_delay(sd->shoutConn));*/
shout_sync
(
sd
->
shoutConn
);
err
=
shout_send
(
sd
->
shoutConn
,
sd
->
og
.
header
,
sd
->
og
.
header_len
);
if
(
myShout_handleError
(
sd
,
err
)
<
0
)
return
-
1
;
err
=
shout_send
(
sd
->
shoutConn
,
sd
->
og
.
body
,
sd
->
og
.
body_len
);
if
(
myShout_handleError
(
sd
,
err
)
<
0
)
return
-
1
;
return
0
;
}
static
void
finishEncoder
(
ShoutData
*
sd
)
{
vorbis_analysis_wrote
(
&
sd
->
vd
,
0
);
vorbis_analysis_wrote
(
&
sd
->
vd
,
0
);
while
(
vorbis_analysis_blockout
(
&
sd
->
vd
,
&
sd
->
vb
)
==
1
)
{
while
(
vorbis_analysis_blockout
(
&
sd
->
vd
,
&
sd
->
vb
)
==
1
)
{
...
@@ -263,13 +300,15 @@ static int myShout_initDriver(AudioOutput * audioOutput, ConfigParam * param) {
...
@@ -263,13 +300,15 @@ static int myShout_initDriver(AudioOutput * audioOutput, ConfigParam * param) {
}
}
}
}
static
void
flushEncoder(ShoutData * sd) {
static
int
flushEncoder
(
ShoutData
*
sd
)
{
while(1 == ogg_stream_pageout(&sd->os, &sd->og)
);
return
!
(
ogg_stream_pageout
(
&
sd
->
os
,
&
sd
->
og
)
<=
0
);
}
*/
}
static
void
clearEncoder
(
ShoutData
*
sd
)
{
static
void
clearEncoder
(
ShoutData
*
sd
)
{
/*finishEncoder(sd);
finishEncoder
(
sd
);
flushEncoder(sd);*/
while
(
1
==
flushEncoder
(
sd
))
{
if
(
!
sd
->
shoutError
)
write_page
(
sd
);
}
vorbis_comment_clear
(
&
sd
->
vc
);
vorbis_comment_clear
(
&
sd
->
vc
);
ogg_stream_clear
(
&
sd
->
os
);
ogg_stream_clear
(
&
sd
->
os
);
...
@@ -311,39 +350,6 @@ static void myShout_closeDevice(AudioOutput * audioOutput) {
...
@@ -311,39 +350,6 @@ static void myShout_closeDevice(AudioOutput * audioOutput) {
audioOutput
->
open
=
0
;
audioOutput
->
open
=
0
;
}
}
static
int
myShout_handleError
(
ShoutData
*
sd
,
int
err
)
{
switch
(
err
)
{
case
SHOUTERR_SUCCESS
:
break
;
case
SHOUTERR_UNCONNECTED
:
case
SHOUTERR_SOCKET
:
ERROR
(
"Lost shout connection to %s:%i
\n
"
,
shout_get_host
(
sd
->
shoutConn
),
shout_get_port
(
sd
->
shoutConn
));
return
-
1
;
default:
ERROR
(
"shout: connection to %s:%i error : %s
\n
"
,
shout_get_host
(
sd
->
shoutConn
),
shout_get_port
(
sd
->
shoutConn
),
shout_get_error
(
sd
->
shoutConn
));
return
-
1
;
}
return
0
;
}
static
int
write_page
(
ShoutData
*
sd
)
{
int
err
=
0
;
shout_sync
(
sd
->
shoutConn
);
err
=
shout_send
(
sd
->
shoutConn
,
sd
->
og
.
header
,
sd
->
og
.
header_len
);
if
(
myShout_handleError
(
sd
,
err
)
<
0
)
return
-
1
;
err
=
shout_send
(
sd
->
shoutConn
,
sd
->
og
.
body
,
sd
->
og
.
body_len
);
if
(
myShout_handleError
(
sd
,
err
)
<
0
)
return
-
1
;
return
0
;
}
#define addTag(name, value) { \
#define addTag(name, value) { \
if(value) vorbis_comment_add_tag(&(sd->vc), name, value); \
if(value) vorbis_comment_add_tag(&(sd->vc), name, value); \
}
}
...
@@ -420,6 +426,8 @@ static int myShout_openShoutConn(AudioOutput * audioOutput) {
...
@@ -420,6 +426,8 @@ static int myShout_openShoutConn(AudioOutput * audioOutput) {
return
-
1
;
return
-
1
;
}
}
sd
->
shoutError
=
0
;
copyTagToVorbisComment
(
sd
);
copyTagToVorbisComment
(
sd
);
vorbis_analysis_headerout
(
&
(
sd
->
vd
),
&
(
sd
->
vc
),
&
(
sd
->
header_main
),
vorbis_analysis_headerout
(
&
(
sd
->
vd
),
&
(
sd
->
vc
),
&
(
sd
->
header_main
),
...
...
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