2 * Copyright (C) 2012-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/>.
28 #include "_quvi_media_s.h"
30 #include "misc/media.h"
31 #include "misc/slst.h"
33 gpointer
m_media_new(_quvi_t q
, const gchar
*url
)
35 _quvi_media_t qm
= g_new0(struct _quvi_media_s
, 1);
37 qm
->url
.redirect_to
= g_string_new(NULL
);
38 qm
->url
.thumbnail
= g_string_new(NULL
);
39 qm
->url
.input
= g_string_new(url
);
43 qm
->title
= g_string_new(NULL
);
44 qm
->id
= g_string_new(NULL
);
48 static void _stream_free(gpointer p
, gpointer userdata
)
50 _quvi_media_stream_t qms
= (_quvi_media_stream_t
) p
;
55 g_string_free(qms
->container
, TRUE
);
56 qms
->container
= NULL
;
58 g_string_free(qms
->url
, TRUE
);
61 g_string_free(qms
->id
, TRUE
);
64 g_string_free(qms
->video
.encoding
, TRUE
);
65 qms
->video
.encoding
= NULL
;
67 g_string_free(qms
->audio
.encoding
, TRUE
);
68 qms
->audio
.encoding
= NULL
;
74 void m_media_free(_quvi_media_t qm
)
81 m_slist_free_full(qm
->streams
, _stream_free
);
86 g_string_free(qm
->url
.redirect_to
, TRUE
);
87 qm
->url
.redirect_to
= NULL
;
89 g_string_free(qm
->url
.thumbnail
, TRUE
);
90 qm
->url
.thumbnail
= NULL
;
92 g_string_free(qm
->url
.input
, TRUE
);
97 g_string_free(qm
->title
, TRUE
);
100 g_string_free(qm
->id
, TRUE
);
107 /* vim: set ts=2 sw=2 tw=72 expandtab: */