input_stream: move input_stream_init(), _deinit() to _internal.c
This commit is contained in:
Makefile.am
src
@ -658,6 +658,7 @@ INPUT_SRC = \
|
|||||||
src/input_init.c \
|
src/input_init.c \
|
||||||
src/input_registry.c \
|
src/input_registry.c \
|
||||||
src/input_stream.c \
|
src/input_stream.c \
|
||||||
|
src/input_internal.c src/input_internal.h \
|
||||||
src/input/rewind_input_plugin.c \
|
src/input/rewind_input_plugin.c \
|
||||||
src/input/file_input_plugin.c
|
src/input/file_input_plugin.c
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "archive/bz2_archive_plugin.h"
|
#include "archive/bz2_archive_plugin.h"
|
||||||
#include "archive_api.h"
|
#include "archive_api.h"
|
||||||
|
#include "input_internal.h"
|
||||||
#include "input_plugin.h"
|
#include "input_plugin.h"
|
||||||
#include "refcount.h"
|
#include "refcount.h"
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "archive/iso9660_archive_plugin.h"
|
#include "archive/iso9660_archive_plugin.h"
|
||||||
#include "archive_api.h"
|
#include "archive_api.h"
|
||||||
|
#include "input_internal.h"
|
||||||
#include "input_plugin.h"
|
#include "input_plugin.h"
|
||||||
#include "refcount.h"
|
#include "refcount.h"
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "archive/zzip_archive_plugin.h"
|
#include "archive/zzip_archive_plugin.h"
|
||||||
#include "archive_api.h"
|
#include "archive_api.h"
|
||||||
#include "archive_api.h"
|
#include "archive_api.h"
|
||||||
|
#include "input_internal.h"
|
||||||
#include "input_plugin.h"
|
#include "input_plugin.h"
|
||||||
#include "refcount.h"
|
#include "refcount.h"
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "input/cdio_paranoia_input_plugin.h"
|
#include "input/cdio_paranoia_input_plugin.h"
|
||||||
|
#include "input_internal.h"
|
||||||
#include "input_plugin.h"
|
#include "input_plugin.h"
|
||||||
#include "refcount.h"
|
#include "refcount.h"
|
||||||
#include "pcm_buffer.h"
|
#include "pcm_buffer.h"
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "input/curl_input_plugin.h"
|
#include "input/curl_input_plugin.h"
|
||||||
|
#include "input_internal.h"
|
||||||
#include "input_plugin.h"
|
#include "input_plugin.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "input/despotify_input_plugin.h"
|
#include "input/despotify_input_plugin.h"
|
||||||
|
#include "input_internal.h"
|
||||||
#include "input_plugin.h"
|
#include "input_plugin.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "despotify_utils.h"
|
#include "despotify_utils.h"
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "input/ffmpeg_input_plugin.h"
|
#include "input/ffmpeg_input_plugin.h"
|
||||||
|
#include "input_internal.h"
|
||||||
#include "input_plugin.h"
|
#include "input_plugin.h"
|
||||||
|
|
||||||
#include <libavformat/avio.h>
|
#include <libavformat/avio.h>
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "config.h" /* must be first for large file support */
|
#include "config.h" /* must be first for large file support */
|
||||||
#include "input/file_input_plugin.h"
|
#include "input/file_input_plugin.h"
|
||||||
|
#include "input_internal.h"
|
||||||
#include "input_plugin.h"
|
#include "input_plugin.h"
|
||||||
#include "fd_util.h"
|
#include "fd_util.h"
|
||||||
#include "open.h"
|
#include "open.h"
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "input/mms_input_plugin.h"
|
#include "input/mms_input_plugin.h"
|
||||||
|
#include "input_internal.h"
|
||||||
#include "input_plugin.h"
|
#include "input_plugin.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "input/rewind_input_plugin.h"
|
#include "input/rewind_input_plugin.h"
|
||||||
|
#include "input_internal.h"
|
||||||
#include "input_plugin.h"
|
#include "input_plugin.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "input/soup_input_plugin.h"
|
#include "input/soup_input_plugin.h"
|
||||||
|
#include "input_internal.h"
|
||||||
#include "input_plugin.h"
|
#include "input_plugin.h"
|
||||||
#include "io_thread.h"
|
#include "io_thread.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
42
src/input_internal.c
Normal file
42
src/input_internal.c
Normal 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
35
src/input_internal.h
Normal 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
|
@ -71,26 +71,6 @@ struct input_stream {
|
|||||||
char *mime;
|
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"
|
* Opens a new input stream. You may not access it until the "ready"
|
||||||
* flag is set.
|
* flag is set.
|
||||||
|
Reference in New Issue
Block a user