input_stream: move input_stream_init(), _deinit() to _internal.c

This commit is contained in:
Max Kellermann 2011-09-14 22:01:55 +02:00
parent c344d63fb3
commit dd33317f45
15 changed files with 89 additions and 20 deletions

View File

@ -658,6 +658,7 @@ INPUT_SRC = \
src/input_init.c \
src/input_registry.c \
src/input_stream.c \
src/input_internal.c src/input_internal.h \
src/input/rewind_input_plugin.c \
src/input/file_input_plugin.c

View File

@ -24,6 +24,7 @@
#include "config.h"
#include "archive/bz2_archive_plugin.h"
#include "archive_api.h"
#include "input_internal.h"
#include "input_plugin.h"
#include "refcount.h"

View File

@ -24,6 +24,7 @@
#include "config.h"
#include "archive/iso9660_archive_plugin.h"
#include "archive_api.h"
#include "input_internal.h"
#include "input_plugin.h"
#include "refcount.h"

View File

@ -25,6 +25,7 @@
#include "archive/zzip_archive_plugin.h"
#include "archive_api.h"
#include "archive_api.h"
#include "input_internal.h"
#include "input_plugin.h"
#include "refcount.h"

View File

@ -23,6 +23,7 @@
#include "config.h"
#include "input/cdio_paranoia_input_plugin.h"
#include "input_internal.h"
#include "input_plugin.h"
#include "refcount.h"
#include "pcm_buffer.h"

View File

@ -19,6 +19,7 @@
#include "config.h"
#include "input/curl_input_plugin.h"
#include "input_internal.h"
#include "input_plugin.h"
#include "conf.h"
#include "tag.h"

View File

@ -19,6 +19,7 @@
#include "config.h"
#include "input/despotify_input_plugin.h"
#include "input_internal.h"
#include "input_plugin.h"
#include "tag.h"
#include "despotify_utils.h"

View File

@ -19,6 +19,7 @@
#include "config.h"
#include "input/ffmpeg_input_plugin.h"
#include "input_internal.h"
#include "input_plugin.h"
#include <libavformat/avio.h>

View File

@ -19,6 +19,7 @@
#include "config.h" /* must be first for large file support */
#include "input/file_input_plugin.h"
#include "input_internal.h"
#include "input_plugin.h"
#include "fd_util.h"
#include "open.h"

View File

@ -19,6 +19,7 @@
#include "config.h"
#include "input/mms_input_plugin.h"
#include "input_internal.h"
#include "input_plugin.h"
#include <glib.h>

View File

@ -19,6 +19,7 @@
#include "config.h"
#include "input/rewind_input_plugin.h"
#include "input_internal.h"
#include "input_plugin.h"
#include "tag.h"

View File

@ -19,6 +19,7 @@
#include "config.h"
#include "input/soup_input_plugin.h"
#include "input_internal.h"
#include "input_plugin.h"
#include "io_thread.h"
#include "conf.h"

42
src/input_internal.c Normal file
View File

@ -0,0 +1,42 @@
/*
* Copyright (C) 2003-2011 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "input_internal.h"
#include "input_stream.h"
void
input_stream_init(struct input_stream *is, const struct input_plugin *plugin,
const char *uri)
{
is->plugin = plugin;
is->uri = g_strdup(uri);
is->ready = false;
is->seekable = false;
is->size = -1;
is->offset = 0;
is->mime = NULL;
}
void
input_stream_deinit(struct input_stream *is)
{
g_free(is->uri);
g_free(is->mime);
}

35
src/input_internal.h Normal file
View File

@ -0,0 +1,35 @@
/*
* Copyright (C) 2003-2011 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_INPUT_INTERNAL_H
#define MPD_INPUT_INTERNAL_H
#include "check.h"
struct input_stream;
struct input_plugin;
void
input_stream_init(struct input_stream *is, const struct input_plugin *plugin,
const char *uri);
void
input_stream_deinit(struct input_stream *is);
#endif

View File

@ -71,26 +71,6 @@ struct input_stream {
char *mime;
};
static inline void
input_stream_init(struct input_stream *is, const struct input_plugin *plugin,
const char *uri)
{
is->plugin = plugin;
is->uri = g_strdup(uri);
is->ready = false;
is->seekable = false;
is->size = -1;
is->offset = 0;
is->mime = NULL;
}
static inline void
input_stream_deinit(struct input_stream *is)
{
g_free(is->uri);
g_free(is->mime);
}
/**
* Opens a new input stream. You may not access it until the "ready"
* flag is set.