~ubuntu-branches/ubuntu/trusty/mpd/trusty

« back to all changes in this revision

Viewing changes to test/run_output.c

  • Committer: Bazaar Package Importer
  • Author(s): Angel Abad
  • Date: 2011-02-02 12:26:30 UTC
  • mfrom: (1.5.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20110202122630-bdyx8w4k94doz4fs
Tags: 0.16.1-1ubuntu1
* Merge from debian unstable. Remaining changes:
  - debian/control:
    + Don't build-depend on libmikmod2-dev (Debian bug #510675).
    + Move avahi-daemon from Suggests field to Recommends field.
  - debian/mpd.init.d:
    + Read mpd user from mpd.conf.
  - debian/control, debian/rules:
    + Add libmp3lame-dev to the build dependencies and enable lame.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2003-2009 The Music Player Daemon Project
 
2
 * Copyright (C) 2003-2010 The Music Player Daemon Project
3
3
 * http://www.musicpd.org
4
4
 *
5
5
 * This program is free software; you can redistribute it and/or modify
17
17
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
18
 */
19
19
 
 
20
#include "config.h"
20
21
#include "output_plugin.h"
21
22
#include "output_internal.h"
22
23
#include "output_control.h"
23
24
#include "conf.h"
24
25
#include "audio_parser.h"
 
26
#include "filter_registry.h"
 
27
#include "pcm_convert.h"
 
28
#include "event_pipe.h"
 
29
#include "idle.h"
 
30
#include "playlist.h"
 
31
#include "stdbin.h"
25
32
 
26
33
#include <glib.h>
27
34
 
29
36
#include <string.h>
30
37
#include <unistd.h>
31
38
 
 
39
struct playlist g_playlist;
 
40
 
 
41
void
 
42
idle_add(G_GNUC_UNUSED unsigned flags)
 
43
{
 
44
}
 
45
 
 
46
void
 
47
event_pipe_emit(G_GNUC_UNUSED enum pipe_event event)
 
48
{
 
49
}
 
50
 
32
51
void pcm_convert_init(G_GNUC_UNUSED struct pcm_convert_state *state)
33
52
{
34
53
}
35
54
 
36
 
void notify_init(G_GNUC_UNUSED struct notify *notify)
37
 
{
 
55
void pcm_convert_deinit(G_GNUC_UNUSED struct pcm_convert_state *state)
 
56
{
 
57
}
 
58
 
 
59
const void *
 
60
pcm_convert(G_GNUC_UNUSED struct pcm_convert_state *state,
 
61
            G_GNUC_UNUSED const struct audio_format *src_format,
 
62
            G_GNUC_UNUSED const void *src, G_GNUC_UNUSED size_t src_size,
 
63
            G_GNUC_UNUSED const struct audio_format *dest_format,
 
64
            G_GNUC_UNUSED size_t *dest_size_r,
 
65
            GError **error_r)
 
66
{
 
67
        g_set_error(error_r, pcm_convert_quark(), 0,
 
68
                    "Not implemented");
 
69
        return NULL;
 
70
}
 
71
 
 
72
const struct filter_plugin *
 
73
filter_plugin_by_name(G_GNUC_UNUSED const char *name)
 
74
{
 
75
        assert(false);
 
76
        return NULL;
38
77
}
39
78
 
40
79
static const struct config_param *
77
116
int main(int argc, char **argv)
78
117
{
79
118
        struct audio_output ao;
80
 
        struct audio_format audio_format = {
81
 
                .sample_rate = 44100,
82
 
                .bits = 16,
83
 
                .channels = 2,
84
 
        };
 
119
        struct audio_format audio_format;
 
120
        struct audio_format_string af_string;
85
121
        bool success;
86
122
        GError *error = NULL;
87
123
        char buffer[4096];
93
129
                return 1;
94
130
        }
95
131
 
 
132
        audio_format_init(&audio_format, 44100, SAMPLE_FORMAT_S16, 2);
 
133
 
96
134
        g_thread_init(NULL);
97
135
 
98
136
        /* read configuration file (mpd.conf) */
99
137
 
100
138
        config_global_init();
101
 
        config_read_file(argv[1]);
 
139
        success = config_read_file(argv[1], &error);
 
140
        if (!success) {
 
141
                g_printerr("%s:", error->message);
 
142
                g_error_free(error);
 
143
                return 1;
 
144
        }
102
145
 
103
146
        /* initialize the audio output */
104
147
 
108
151
        /* parse the audio format */
109
152
 
110
153
        if (argc > 3) {
111
 
                success = audio_format_parse(&audio_format, argv[3], &error);
 
154
                success = audio_format_parse(&audio_format, argv[3],
 
155
                                             false, &error);
112
156
                if (!success) {
113
157
                        g_printerr("Failed to parse audio format: %s\n",
114
158
                                   error->message);
127
171
                return 1;
128
172
        }
129
173
 
130
 
        g_printerr("audio_format=%u:%u:%u\n", audio_format.sample_rate,
131
 
                   audio_format.bits, audio_format.channels);
 
174
        g_printerr("audio_format=%s\n",
 
175
                   audio_format_to_string(&audio_format, &af_string));
132
176
 
133
177
        frame_size = audio_format_frame_size(&audio_format);
134
178