input_stream: rename struct to InputStream
This commit is contained in:
@@ -85,11 +85,10 @@ decoder_seek_error(gcc_unused Decoder &decoder)
|
||||
|
||||
size_t
|
||||
decoder_read(gcc_unused Decoder *decoder,
|
||||
struct input_stream *is,
|
||||
InputStream &is,
|
||||
void *buffer, size_t length)
|
||||
{
|
||||
Error error;
|
||||
return is->LockRead(buffer, length, error);
|
||||
return is.LockRead(buffer, length, IgnoreError());
|
||||
}
|
||||
|
||||
void
|
||||
@@ -100,7 +99,7 @@ decoder_timestamp(gcc_unused Decoder &decoder,
|
||||
|
||||
DecoderCommand
|
||||
decoder_data(gcc_unused Decoder &decoder,
|
||||
gcc_unused struct input_stream *is,
|
||||
gcc_unused InputStream *is,
|
||||
const void *data, size_t datalen,
|
||||
gcc_unused uint16_t kbit_rate)
|
||||
{
|
||||
@@ -110,7 +109,7 @@ decoder_data(gcc_unused Decoder &decoder,
|
||||
|
||||
DecoderCommand
|
||||
decoder_tag(gcc_unused Decoder &decoder,
|
||||
gcc_unused struct input_stream *is,
|
||||
gcc_unused InputStream *is,
|
||||
gcc_unused Tag &&tag)
|
||||
{
|
||||
return DecoderCommand::NONE;
|
||||
@@ -143,7 +142,7 @@ decoder_mixramp(gcc_unused Decoder &decoder,
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *uri;
|
||||
struct input_stream *is = NULL;
|
||||
InputStream *is = NULL;
|
||||
Song *song;
|
||||
|
||||
if (argc != 3) {
|
||||
@@ -192,12 +191,12 @@ int main(int argc, char **argv)
|
||||
if (playlist == NULL) {
|
||||
/* open the stream and wait until it becomes ready */
|
||||
|
||||
is = input_stream::Open(uri, mutex, cond, error);
|
||||
is = InputStream::Open(uri, mutex, cond, error);
|
||||
if (is == NULL) {
|
||||
if (error.IsDefined())
|
||||
LogError(error);
|
||||
else
|
||||
g_printerr("input_stream::Open() failed\n");
|
||||
g_printerr("InputStream::Open() failed\n");
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -205,7 +204,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* open the playlist */
|
||||
|
||||
playlist = playlist_list_open_stream(is, uri);
|
||||
playlist = playlist_list_open_stream(*is, uri);
|
||||
if (playlist == NULL) {
|
||||
is->Close();
|
||||
g_printerr("Failed to open playlist\n");
|
||||
|
@@ -57,46 +57,45 @@ dump_text_file(TextInputStream &is)
|
||||
}
|
||||
|
||||
static int
|
||||
dump_input_stream(struct input_stream *is)
|
||||
dump_input_stream(InputStream &is)
|
||||
{
|
||||
Error error;
|
||||
|
||||
is->Lock();
|
||||
is.Lock();
|
||||
|
||||
/* wait until the stream becomes ready */
|
||||
|
||||
is->WaitReady();
|
||||
is.WaitReady();
|
||||
|
||||
if (!is->Check(error)) {
|
||||
if (!is.Check(error)) {
|
||||
LogError(error);
|
||||
is->Unlock();
|
||||
is.Unlock();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* read data and tags from the stream */
|
||||
|
||||
is->Unlock();
|
||||
is.Unlock();
|
||||
{
|
||||
TextInputStream tis(is);
|
||||
dump_text_file(tis);
|
||||
}
|
||||
|
||||
is->Lock();
|
||||
is.Lock();
|
||||
|
||||
if (!is->Check(error)) {
|
||||
if (!is.Check(error)) {
|
||||
LogError(error);
|
||||
is->Unlock();
|
||||
is.Unlock();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
is->Unlock();
|
||||
is.Unlock();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct input_stream *is;
|
||||
int ret;
|
||||
|
||||
if (argc != 2) {
|
||||
@@ -134,9 +133,9 @@ int main(int argc, char **argv)
|
||||
Mutex mutex;
|
||||
Cond cond;
|
||||
|
||||
is = input_stream::Open(argv[1], mutex, cond, error);
|
||||
InputStream *is = InputStream::Open(argv[1], mutex, cond, error);
|
||||
if (is != NULL) {
|
||||
ret = dump_input_stream(is);
|
||||
ret = dump_input_stream(*is);
|
||||
is->Close();
|
||||
} else {
|
||||
if (error.IsDefined())
|
||||
|
@@ -73,11 +73,10 @@ decoder_seek_error(gcc_unused Decoder &decoder)
|
||||
|
||||
size_t
|
||||
decoder_read(gcc_unused Decoder *decoder,
|
||||
struct input_stream *is,
|
||||
InputStream &is,
|
||||
void *buffer, size_t length)
|
||||
{
|
||||
Error error;
|
||||
return is->LockRead(buffer, length, error);
|
||||
return is.LockRead(buffer, length, IgnoreError());
|
||||
}
|
||||
|
||||
void
|
||||
@@ -88,7 +87,7 @@ decoder_timestamp(gcc_unused Decoder &decoder,
|
||||
|
||||
DecoderCommand
|
||||
decoder_data(gcc_unused Decoder &decoder,
|
||||
gcc_unused struct input_stream *is,
|
||||
gcc_unused InputStream *is,
|
||||
const void *data, size_t datalen,
|
||||
gcc_unused uint16_t kbit_rate)
|
||||
{
|
||||
@@ -98,7 +97,7 @@ decoder_data(gcc_unused Decoder &decoder,
|
||||
|
||||
DecoderCommand
|
||||
decoder_tag(gcc_unused Decoder &decoder,
|
||||
gcc_unused struct input_stream *is,
|
||||
gcc_unused InputStream *is,
|
||||
gcc_unused Tag &&tag)
|
||||
{
|
||||
return DecoderCommand::NONE;
|
||||
@@ -189,8 +188,8 @@ int main(int argc, char **argv)
|
||||
Mutex mutex;
|
||||
Cond cond;
|
||||
|
||||
input_stream *is = input_stream::Open(path, mutex, cond,
|
||||
error);
|
||||
InputStream *is = InputStream::Open(path, mutex, cond,
|
||||
error);
|
||||
if (is == NULL) {
|
||||
g_printerr("Failed to open %s: %s\n",
|
||||
path, error.GetMessage());
|
||||
|
@@ -94,10 +94,10 @@ decoder_seek_error(gcc_unused Decoder &decoder)
|
||||
|
||||
size_t
|
||||
decoder_read(gcc_unused Decoder *decoder,
|
||||
struct input_stream *is,
|
||||
InputStream &is,
|
||||
void *buffer, size_t length)
|
||||
{
|
||||
return is->LockRead(buffer, length, IgnoreError());
|
||||
return is.LockRead(buffer, length, IgnoreError());
|
||||
}
|
||||
|
||||
void
|
||||
@@ -108,7 +108,7 @@ decoder_timestamp(gcc_unused Decoder &decoder,
|
||||
|
||||
DecoderCommand
|
||||
decoder_data(gcc_unused Decoder &decoder,
|
||||
gcc_unused struct input_stream *is,
|
||||
gcc_unused InputStream *is,
|
||||
const void *data, size_t datalen,
|
||||
gcc_unused uint16_t kbit_rate)
|
||||
{
|
||||
@@ -118,7 +118,7 @@ decoder_data(gcc_unused Decoder &decoder,
|
||||
|
||||
DecoderCommand
|
||||
decoder_tag(gcc_unused Decoder &decoder,
|
||||
gcc_unused struct input_stream *is,
|
||||
gcc_unused InputStream *is,
|
||||
gcc_unused Tag &&tag)
|
||||
{
|
||||
return DecoderCommand::NONE;
|
||||
@@ -192,13 +192,13 @@ int main(int argc, char **argv)
|
||||
Mutex mutex;
|
||||
Cond cond;
|
||||
|
||||
input_stream *is =
|
||||
input_stream::Open(decoder.uri, mutex, cond, error);
|
||||
InputStream *is =
|
||||
InputStream::Open(decoder.uri, mutex, cond, error);
|
||||
if (is == NULL) {
|
||||
if (error.IsDefined())
|
||||
LogError(error);
|
||||
else
|
||||
g_printerr("input_stream::Open() failed\n");
|
||||
g_printerr("InputStream::Open() failed\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ my_log_func(const gchar *log_domain, gcc_unused GLogLevelFlags log_level,
|
||||
}
|
||||
|
||||
static int
|
||||
dump_input_stream(struct input_stream *is)
|
||||
dump_input_stream(InputStream *is)
|
||||
{
|
||||
Error error;
|
||||
char buffer[4096];
|
||||
@@ -110,7 +110,7 @@ dump_input_stream(struct input_stream *is)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Error error;
|
||||
struct input_stream *is;
|
||||
InputStream *is;
|
||||
int ret;
|
||||
|
||||
if (argc != 2) {
|
||||
@@ -147,7 +147,7 @@ int main(int argc, char **argv)
|
||||
Mutex mutex;
|
||||
Cond cond;
|
||||
|
||||
is = input_stream::Open(argv[1], mutex, cond, error);
|
||||
is = InputStream::Open(argv[1], mutex, cond, error);
|
||||
if (is != NULL) {
|
||||
ret = dump_input_stream(is);
|
||||
is->Close();
|
||||
|
Reference in New Issue
Block a user