2 * Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
30 g_printerr("Usage: media [-f<fmt_id,...>] [-v] [-b] [-a] <URL>\n"
32 " -f<arg> Select arg format ID from the available streams,\n"
33 " this may also be a comma-separated list of IDs\n"
34 " -v Enable verbose output (libcurl)\n"
35 " -b Choose the best quality stream\n"
36 " -a Enable autoproxy feature\n");
40 static void dump_stream()
44 quvi_media_get(qm
, QUVI_MEDIA_STREAM_PROPERTY_FORMAT_ID
, &fmt_id
);
45 quvi_media_get(qm
, QUVI_MEDIA_STREAM_PROPERTY_URL
, &url
);
47 g_print("[%s] fmt_id='%s', url='%s'\n", __func__
, fmt_id
, url
);
50 static void dump_streams()
52 while (quvi_media_stream_next(qm
) == QUVI_TRUE
)
56 typedef quvi_callback_status qcs
;
58 gint
main(gint argc
, gchar
**argv
)
60 gboolean best_flag
= FALSE
;
68 setlocale(LC_ALL
, "");
78 if (g_strcmp0("-v", argv
[i
]) == 0)
80 else if (g_strcmp0("-h", argv
[i
]) == 0)
82 else if (g_strcmp0("-a", argv
[i
]) == 0)
84 else if (g_strcmp0("-b", argv
[i
]) == 0)
86 else if (g_str_has_prefix(argv
[i
], "-f") == TRUE
)
88 if (strlen(argv
[i
]) >2)
91 g_printerr("[%s] `-f' ignored, specify format ID\n", __func__
);
100 quvi_set(q
, QUVI_OPTION_CALLBACK_STATUS
, (qcs
) status
);
102 qm
= quvi_media_new(q
, url
);
107 quvi_media_get(qm
, QUVI_MEDIA_PROPERTY_TITLE
, &s
);
108 g_print("[%s] title='%s'\n", __func__
, s
);
110 if (best_flag
== TRUE
)
112 quvi_media_stream_choose_best(qm
);
115 else if (fmt_id
!= NULL
)
117 quvi_media_stream_select(qm
, fmt_id
);
126 g_assert(qm
== NULL
);
132 /* vim: set ts=2 sw=2 tw=72 expandtab: */