~ubuntu-branches/ubuntu/wily/mpv/wily

« back to all changes in this revision

Viewing changes to mpvcore/parser-mpcmd.c

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2013-10-16 12:38:59 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20131016123859-wj70wr6n3mzimx3e
Tags: 0.2.0-1
* New upstream release
* Install sample configuration files as examples
* Enable Lua scripting support
* Remove copyright for talloc (not used anymore)
* Update installed docs list
* Update 01_spelling.patch
* Enable VAAPI support

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
    return false;
111
111
}
112
112
 
113
 
static bool parse_flag(bstr name, bstr f)
114
 
{
115
 
    struct m_option opt = {NULL, NULL, CONF_TYPE_FLAG, 0, 0, 1, NULL};
116
 
    int val = 0;
117
 
    m_option_parse(&opt, name, f, &val);
118
 
    return !!val;
119
 
}
120
 
 
121
113
// returns M_OPT_... error code
122
114
int m_config_parse_mp_command_line(m_config_t *config, struct playlist *files,
123
115
                                   int argc, char **argv)
124
116
{
 
117
    struct MPOpts *opts = config->optstruct;
125
118
    int ret = M_OPT_UNKNOWN;
126
119
    int mode = 0;
127
120
    struct playlist_entry *local_start = NULL;
128
 
    bool shuffle = false;
129
121
 
130
122
    int local_params_count = 0;
131
123
    struct playlist_param *local_params = 0;
190
182
                mode = GLOBAL;
191
183
                m_config_restore_backups(config);
192
184
                local_start = NULL;
193
 
                shuffle = false;
194
 
                continue;
195
 
            }
196
 
 
197
 
            if (bstrcmp0(p.arg, "shuffle") == 0) {
198
 
                shuffle = parse_flag(p.arg, p.param);
199
 
                continue;
200
 
            }
201
 
            if (bstrcmp0(p.arg, "no-shuffle") == 0) {
202
 
                shuffle = false;
203
185
                continue;
204
186
            }
205
187
 
206
188
            if (bstrcmp0(p.arg, "playlist") == 0) {
207
189
                // append the playlist to the local args
208
190
                char *param0 = bstrdup0(NULL, p.param);
209
 
                struct playlist *pl = playlist_parse_file(param0);
 
191
                struct playlist *pl = playlist_parse_file(param0, opts);
210
192
                talloc_free(param0);
211
193
                if (!pl) {
212
194
                    mp_tmsg(MSGT_CFGPARSER, MSGL_FATAL,
274
256
        goto err_out;
275
257
    }
276
258
 
277
 
    if (shuffle)
278
 
        playlist_shuffle(files);
279
 
 
280
259
    ret = 0; // success
281
260
 
282
261
err_out: