2 * Copyright (C) 2013 Toni Gundogdu <legatvs@gmail.com>
4 * This file is part of libquvi <http://quvi.sourceforge.net/>.
6 * This library is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU Affero General Public
8 * License as published by the Free Software Foundation, either
9 * version 3 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General
17 * Public License along with this library. If not, see
18 * <http://www.gnu.org/licenses/>.
21 /** @file subtitle_lang_get.c */
30 #include "_quvi_subtitle_s.h"
32 static QuviError
_get(_quvi_subtitle_lang_t qsl
,
33 const QuviSubtitleLangProperty n
, ...)
43 type
= QUVI_SUBTITLE_PROPERTY_TYPE_MASK
& (gint
) n
;
52 case QUVI_MEDIA_PROPERTY_TYPE_STRING
:
53 sp
= va_arg(arg
, gchar
**);
55 rc
= QUVI_ERROR_INVALID_ARG
;
58 case QUVI_MEDIA_PROPERTY_TYPE_LONG
:
59 lp
= va_arg(arg
, glong
*);
61 rc
= QUVI_ERROR_INVALID_ARG
;
64 case QUVI_MEDIA_PROPERTY_TYPE_DOUBLE
:
65 dp
= va_arg(arg
, gdouble
*);
67 rc
= QUVI_ERROR_INVALID_ARG
;
71 rc
= QUVI_ERROR_INVALID_ARG
;
82 * NOTE: Advances to the first item in the 'language' list if the
83 * current pointer is still set to NULL.
86 case QUVI_SUBTITLE_LANG_PROPERTY_TRANSLATED
:
87 *sp
= qsl
->translated
->str
;
90 case QUVI_SUBTITLE_LANG_PROPERTY_ORIGINAL
:
91 *sp
= qsl
->original
->str
;
94 case QUVI_SUBTITLE_LANG_PROPERTY_CODE
:
98 case QUVI_SUBTITLE_LANG_PROPERTY_URL
:
102 case QUVI_SUBTITLE_LANG_PROPERTY_ID
:
107 rc
= QUVI_ERROR_INVALID_ARG
;
113 /** @brief Return a subtitle property
114 @sa @ref parse_subtitle
117 void quvi_subtitle_lang_get(quvi_subtitle_lang_t handle
,
118 QuviSubtitleLangProperty n
, ...)
120 _quvi_subtitle_lang_t qsl
;
125 /* If G_DISABLE_CHECKS is defined then the check is not performed. */
126 g_return_if_fail(handle
!= NULL
);
129 p
= va_arg(arg
, gpointer
);
132 qsl
= (_quvi_subtitle_lang_t
) handle
;
133 q
= qsl
->handle
.quvi
;
135 q
->status
.rc
= _get(qsl
, n
, p
);
138 /* vim: set ts=2 sw=2 tw=72 expandtab: */