mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-10 10:04:23 +00:00
tag: add convenience API to handle creative commons licenses
Based on liblicense's RDF files. API: GstTagLicenseFlags API: gst_tag_get_licenses() API: gst_tag_get_license_flags() API: gst_tag_get_license_nick() API: gst_tag_get_license_title() API: gst_tag_get_license_version() API: gst_tag_get_license_description() API: gst_tag_get_license_jurisdiction() https://bugzilla.gnome.org/show_bug.cgi?id=646868
This commit is contained in:
parent
fa3e246866
commit
c4bab487e7
5 changed files with 1088 additions and 4 deletions
|
@ -7,14 +7,19 @@ libgsttaginclude_HEADERS = \
|
|||
lib_LTLIBRARIES = libgsttag-@GST_MAJORMINOR@.la
|
||||
|
||||
libgsttag_@GST_MAJORMINOR@_la_SOURCES = \
|
||||
gstvorbistag.c gstid3tag.c gstxmptag.c gstexiftag.c \
|
||||
lang.c tags.c gsttagdemux.c gsttagmux.c gsttageditingprivate.c xmpwriter.c
|
||||
libgsttag_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
|
||||
gstvorbistag.c gstid3tag.c gstxmptag.c gstexiftag.c \
|
||||
lang.c licenses.c tags.c gsttagdemux.c gsttagmux.c \
|
||||
gsttageditingprivate.c xmpwriter.c
|
||||
|
||||
libgsttag_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
|
||||
$(GST_BASE_CFLAGS) $(GST_CFLAGS) \
|
||||
-DLICENSE_TRANSLATIONS_PATH=\"$(pkgdatadir)/license-translations.dict\"
|
||||
libgsttag_@GST_MAJORMINOR@_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(LIBM)
|
||||
libgsttag_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
|
||||
|
||||
# lang-tables.dat contains generated static data and is included by lang.c
|
||||
EXTRA_DIST = lang-tables.dat
|
||||
# licenses-tables.dat contains generated data and is included by licenses.c
|
||||
EXTRA_DIST = lang-tables.dat licenses-tables.dat
|
||||
|
||||
noinst_HEADERS = gsttageditingprivate.h
|
||||
|
||||
|
@ -81,6 +86,15 @@ endif
|
|||
|
||||
noinst_PROGRAMS = $(ISO_CODE_PROGS)
|
||||
|
||||
#if USE_NLS
|
||||
# Yes, this is not great, but it's only an implementation detail. The
|
||||
# translations come from an external source here, so we don't want the
|
||||
# strings retranslated, but also we don't want to create 30 1kB .mo files,
|
||||
# so just do something for now, we can change it later if someone really cares.
|
||||
licensetransdir = $(pkgdatadir)
|
||||
licensetrans_DATA = $(builddir)/license-translations.dict
|
||||
#endif
|
||||
|
||||
Android.mk: Makefile.am
|
||||
androgenizer -:PROJECT libgsttag -:SHARED libgsttag-@GST_MAJORMINOR@ \
|
||||
-:TAGS eng debug \
|
||||
|
|
BIN
gst-libs/gst/tag/license-translations.dict
Normal file
BIN
gst-libs/gst/tag/license-translations.dict
Normal file
Binary file not shown.
467
gst-libs/gst/tag/licenses-tables.dat
Normal file
467
gst-libs/gst/tag/licenses-tables.dat
Normal file
|
@ -0,0 +1,467 @@
|
|||
/* created by mklicensestables.c */
|
||||
static const struct {
|
||||
/* jurisdictions in addition to the generic version, bitfield */
|
||||
const guint64 jurisdictions;
|
||||
const GstTagLicenseFlags flags;
|
||||
/* the bit after http://creativecommons.org/licenses/ */
|
||||
const gchar ref[18];
|
||||
gint16 title_idx; /* index in string table */
|
||||
gint16 desc_idx; /* index in string table */
|
||||
} licenses[] = {
|
||||
/* 0 http://creativecommons.org/licenses/GPL/2.0/ */
|
||||
{ 0x8000000000000000, 0x02000d07, "GPL/2.0/", 0, -1 },
|
||||
/* 1 http://creativecommons.org/licenses/LGPL/2.1/ */
|
||||
{ 0x8000000000000000, 0x02000d07, "LGPL/2.1/", 4, -1 },
|
||||
/* 2 http://creativecommons.org/licenses/by-nc-nd/2.0/
|
||||
* 2 http://creativecommons.org/licenses/by-nc-nd/2.0/at/
|
||||
* 2 http://creativecommons.org/licenses/by-nc-nd/2.0/au/
|
||||
* 2 http://creativecommons.org/licenses/by-nc-nd/2.0/be/
|
||||
* 2 http://creativecommons.org/licenses/by-nc-nd/2.0/br/
|
||||
* 2 http://creativecommons.org/licenses/by-nc-nd/2.0/ca/
|
||||
* 2 http://creativecommons.org/licenses/by-nc-nd/2.0/cl/
|
||||
* 2 http://creativecommons.org/licenses/by-nc-nd/2.0/de/
|
||||
* 2 http://creativecommons.org/licenses/by-nc-nd/2.0/es/
|
||||
* 2 http://creativecommons.org/licenses/by-nc-nd/2.0/fr/
|
||||
* 2 http://creativecommons.org/licenses/by-nc-nd/2.0/hr/
|
||||
* 2 http://creativecommons.org/licenses/by-nc-nd/2.0/it/
|
||||
* 2 http://creativecommons.org/licenses/by-nc-nd/2.0/kr/
|
||||
* 2 http://creativecommons.org/licenses/by-nc-nd/2.0/nl/
|
||||
* 2 http://creativecommons.org/licenses/by-nc-nd/2.0/pl/
|
||||
* 2 http://creativecommons.org/licenses/by-nc-nd/2.0/tw/
|
||||
* 2 http://creativecommons.org/licenses/by-nc-nd/2.0/uk/
|
||||
* 2 http://creativecommons.org/licenses/by-nc-nd/2.0/za/
|
||||
* 2 http://creativecommons.org/licenses/by-nd-nc/2.0/jp/ */
|
||||
{ 0x8000002c2871a96e, 0x01010303, "by-nc-nd/2.0/", 9, -1 },
|
||||
/* 3 http://creativecommons.org/licenses/by-nc-nd/2.1/au/ */
|
||||
{ 0x0000000000000004, 0x01010303, "by-nc-nd/2.1/", 9, -1 },
|
||||
/* 4 http://creativecommons.org/licenses/by-nc-nd/2.1/es/ */
|
||||
{ 0x0000000000002000, 0x01010303, "by-nc-nd/2.1/", 9, -1 },
|
||||
/* 5 http://creativecommons.org/licenses/by-nc-nd/2.1/jp/ */
|
||||
{ 0x0000000000200000, 0x01010303, "by-nc-nd/2.1/", 9, -1 },
|
||||
/* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/ar/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/au/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/bg/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/br/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/ca/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/ch/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/cn/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/co/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/dk/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/es/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/hr/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/hu/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/il/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/in/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/it/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/mk/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/mt/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/mx/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/my/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/nl/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/pe/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/pl/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/pt/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/scotland/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/se/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/si/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/tw/
|
||||
* 6 http://creativecommons.org/licenses/by-nc-nd/2.5/za/ */
|
||||
{ 0x80000027ff9f36f5, 0x01010303, "by-nc-nd/2.5/", 9, -1 },
|
||||
/* 7 http://creativecommons.org/licenses/by-nc-nd/3.0/
|
||||
* 7 http://creativecommons.org/licenses/by-nc-nd/3.0/us/ */
|
||||
{ 0x8000001000000000, 0x01010303, "by-nc-nd/3.0/", 9, -1 },
|
||||
/* 8 http://creativecommons.org/licenses/by-nc-sa/1.0/
|
||||
* 8 http://creativecommons.org/licenses/by-nc-sa/1.0/fi/
|
||||
* 8 http://creativecommons.org/licenses/by-nc-sa/1.0/il/
|
||||
* 8 http://creativecommons.org/licenses/by-nc-sa/1.0/nl/ */
|
||||
{ 0x8000000008044000, 0x01010707, "by-nc-sa/1.0/", 44, -1 },
|
||||
/* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/
|
||||
* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/at/
|
||||
* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/au/
|
||||
* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/be/
|
||||
* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/br/
|
||||
* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/ca/
|
||||
* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/cl/
|
||||
* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/de/
|
||||
* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/es/
|
||||
* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/fr/
|
||||
* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/hr/
|
||||
* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/it/
|
||||
* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/jp/
|
||||
* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/kr/
|
||||
* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/nl/
|
||||
* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/pl/
|
||||
* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/tw/
|
||||
* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/uk/
|
||||
* 9 http://creativecommons.org/licenses/by-nc-sa/2.0/za/ */
|
||||
{ 0x8000002c2871a96e, 0x01010707, "by-nc-sa/2.0/", 44, -1 },
|
||||
/* 10 http://creativecommons.org/licenses/by-nc-sa/2.1/au/ */
|
||||
{ 0x0000000000000004, 0x01010707, "by-nc-sa/2.1/", 44, -1 },
|
||||
/* 11 http://creativecommons.org/licenses/by-nc-sa/2.1/es/ */
|
||||
{ 0x0000000000002000, 0x01010707, "by-nc-sa/2.1/", 44, -1 },
|
||||
/* 12 http://creativecommons.org/licenses/by-nc-sa/2.1/jp/ */
|
||||
{ 0x0000000000200000, 0x01010707, "by-nc-sa/2.1/", 44, -1 },
|
||||
/* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/ar/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/au/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/bg/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/br/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/ca/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/ch/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/cn/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/co/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/dk/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/es/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/hr/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/hu/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/il/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/in/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/it/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/mk/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/mt/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/mx/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/my/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/nl/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/pe/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/pl/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/pt/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/se/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/si/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/tw/
|
||||
* 13 http://creativecommons.org/licenses/by-nc-sa/2.5/za/ */
|
||||
{ 0x800000277f9f36f5, 0x01010707, "by-nc-sa/2.5/", 44, -1 },
|
||||
/* 14 http://creativecommons.org/licenses/by-nc-sa/2.5/scotland/ */
|
||||
{ 0x0000000080000000, 0x01010703, "by-nc-sa/2.5/", 44, -1 },
|
||||
/* 15 http://creativecommons.org/licenses/by-nc-sa/3.0/
|
||||
* 15 http://creativecommons.org/licenses/by-nc-sa/3.0/us/ */
|
||||
{ 0x8000001000000000, 0x01010707, "by-nc-sa/3.0/", 44, -1 },
|
||||
/* 16 http://creativecommons.org/licenses/by-nc/1.0/
|
||||
* 16 http://creativecommons.org/licenses/by-nc/1.0/fi/
|
||||
* 16 http://creativecommons.org/licenses/by-nc/1.0/il/
|
||||
* 16 http://creativecommons.org/licenses/by-nc/1.0/nl/ */
|
||||
{ 0x8000000008044000, 0x01010307, "by-nc/1.0/", 81, -1 },
|
||||
/* 17 http://creativecommons.org/licenses/by-nc/2.0/
|
||||
* 17 http://creativecommons.org/licenses/by-nc/2.0/at/
|
||||
* 17 http://creativecommons.org/licenses/by-nc/2.0/au/
|
||||
* 17 http://creativecommons.org/licenses/by-nc/2.0/be/
|
||||
* 17 http://creativecommons.org/licenses/by-nc/2.0/br/
|
||||
* 17 http://creativecommons.org/licenses/by-nc/2.0/ca/
|
||||
* 17 http://creativecommons.org/licenses/by-nc/2.0/cl/
|
||||
* 17 http://creativecommons.org/licenses/by-nc/2.0/de/
|
||||
* 17 http://creativecommons.org/licenses/by-nc/2.0/es/
|
||||
* 17 http://creativecommons.org/licenses/by-nc/2.0/fr/
|
||||
* 17 http://creativecommons.org/licenses/by-nc/2.0/hr/
|
||||
* 17 http://creativecommons.org/licenses/by-nc/2.0/it/
|
||||
* 17 http://creativecommons.org/licenses/by-nc/2.0/jp/
|
||||
* 17 http://creativecommons.org/licenses/by-nc/2.0/kr/
|
||||
* 17 http://creativecommons.org/licenses/by-nc/2.0/nl/
|
||||
* 17 http://creativecommons.org/licenses/by-nc/2.0/pl/
|
||||
* 17 http://creativecommons.org/licenses/by-nc/2.0/tw/
|
||||
* 17 http://creativecommons.org/licenses/by-nc/2.0/uk/
|
||||
* 17 http://creativecommons.org/licenses/by-nc/2.0/za/ */
|
||||
{ 0x8000002c2871a96e, 0x01010307, "by-nc/2.0/", 81, -1 },
|
||||
/* 18 http://creativecommons.org/licenses/by-nc/2.1/au/ */
|
||||
{ 0x0000000000000004, 0x01010307, "by-nc/2.1/", 81, -1 },
|
||||
/* 19 http://creativecommons.org/licenses/by-nc/2.1/es/ */
|
||||
{ 0x0000000000002000, 0x01010307, "by-nc/2.1/", 81, -1 },
|
||||
/* 20 http://creativecommons.org/licenses/by-nc/2.1/jp/ */
|
||||
{ 0x0000000000200000, 0x01010307, "by-nc/2.1/", 81, -1 },
|
||||
/* 21 http://creativecommons.org/licenses/by-nc/2.5/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/ar/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/au/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/bg/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/br/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/ca/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/ch/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/cn/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/co/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/dk/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/es/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/hr/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/hu/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/il/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/in/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/it/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/mk/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/mt/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/mx/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/my/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/nl/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/pe/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/pl/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/pt/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/se/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/si/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/tw/
|
||||
* 21 http://creativecommons.org/licenses/by-nc/2.5/za/ */
|
||||
{ 0x800000277f9f36f5, 0x01010307, "by-nc/2.5/", 81, -1 },
|
||||
/* 22 http://creativecommons.org/licenses/by-nc/2.5/scotland/ */
|
||||
{ 0x0000000080000000, 0x01010303, "by-nc/2.5/", 81, -1 },
|
||||
/* 23 http://creativecommons.org/licenses/by-nc/3.0/
|
||||
* 23 http://creativecommons.org/licenses/by-nc/3.0/us/ */
|
||||
{ 0x8000001000000000, 0x01010307, "by-nc/3.0/", 81, -1 },
|
||||
/* 24 http://creativecommons.org/licenses/by-nd-nc/1.0/
|
||||
* 24 http://creativecommons.org/licenses/by-nd-nc/1.0/fi/
|
||||
* 24 http://creativecommons.org/licenses/by-nd-nc/1.0/il/
|
||||
* 24 http://creativecommons.org/licenses/by-nd-nc/1.0/nl/ */
|
||||
{ 0x8000000008044000, 0x01010303, "by-nd-nc/1.0/", 107, -1 },
|
||||
/* 25 http://creativecommons.org/licenses/by-nd-nc/2.0/jp/ */
|
||||
{ 0x0000000000200000, 0x01010303, "by-nd-nc/2.0/", 107, -1 },
|
||||
/* 26 http://creativecommons.org/licenses/by-nd/1.0/
|
||||
* 26 http://creativecommons.org/licenses/by-nd/1.0/fi/
|
||||
* 26 http://creativecommons.org/licenses/by-nd/1.0/il/
|
||||
* 26 http://creativecommons.org/licenses/by-nd/1.0/nl/ */
|
||||
{ 0x8000000008044000, 0x01000303, "by-nd/1.0/", 142, -1 },
|
||||
/* 27 http://creativecommons.org/licenses/by-nd/2.0/
|
||||
* 27 http://creativecommons.org/licenses/by-nd/2.0/at/
|
||||
* 27 http://creativecommons.org/licenses/by-nd/2.0/au/
|
||||
* 27 http://creativecommons.org/licenses/by-nd/2.0/be/
|
||||
* 27 http://creativecommons.org/licenses/by-nd/2.0/br/
|
||||
* 27 http://creativecommons.org/licenses/by-nd/2.0/ca/
|
||||
* 27 http://creativecommons.org/licenses/by-nd/2.0/cl/
|
||||
* 27 http://creativecommons.org/licenses/by-nd/2.0/de/
|
||||
* 27 http://creativecommons.org/licenses/by-nd/2.0/es/
|
||||
* 27 http://creativecommons.org/licenses/by-nd/2.0/fr/
|
||||
* 27 http://creativecommons.org/licenses/by-nd/2.0/hr/
|
||||
* 27 http://creativecommons.org/licenses/by-nd/2.0/it/
|
||||
* 27 http://creativecommons.org/licenses/by-nd/2.0/jp/
|
||||
* 27 http://creativecommons.org/licenses/by-nd/2.0/kr/
|
||||
* 27 http://creativecommons.org/licenses/by-nd/2.0/nl/
|
||||
* 27 http://creativecommons.org/licenses/by-nd/2.0/pl/
|
||||
* 27 http://creativecommons.org/licenses/by-nd/2.0/tw/
|
||||
* 27 http://creativecommons.org/licenses/by-nd/2.0/uk/
|
||||
* 27 http://creativecommons.org/licenses/by-nd/2.0/za/ */
|
||||
{ 0x8000002c2871a96e, 0x01000303, "by-nd/2.0/", 142, -1 },
|
||||
/* 28 http://creativecommons.org/licenses/by-nd/2.1/au/ */
|
||||
{ 0x0000000000000004, 0x01000303, "by-nd/2.1/", 142, -1 },
|
||||
/* 29 http://creativecommons.org/licenses/by-nd/2.1/es/ */
|
||||
{ 0x0000000000002000, 0x01000303, "by-nd/2.1/", 142, -1 },
|
||||
/* 30 http://creativecommons.org/licenses/by-nd/2.1/jp/ */
|
||||
{ 0x0000000000200000, 0x01000303, "by-nd/2.1/", 142, -1 },
|
||||
/* 31 http://creativecommons.org/licenses/by-nd/2.5/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/ar/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/au/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/bg/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/br/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/ca/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/ch/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/cn/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/co/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/dk/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/es/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/hr/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/hu/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/il/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/in/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/it/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/mk/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/mt/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/mx/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/my/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/nl/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/pe/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/pl/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/pt/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/scotland/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/se/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/si/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/tw/
|
||||
* 31 http://creativecommons.org/licenses/by-nd/2.5/za/ */
|
||||
{ 0x80000027ff9f36f5, 0x01000303, "by-nd/2.5/", 142, -1 },
|
||||
/* 32 http://creativecommons.org/licenses/by-nd/3.0/
|
||||
* 32 http://creativecommons.org/licenses/by-nd/3.0/us/ */
|
||||
{ 0x8000001000000000, 0x01000303, "by-nd/3.0/", 142, -1 },
|
||||
/* 33 http://creativecommons.org/licenses/by-sa/1.0/
|
||||
* 33 http://creativecommons.org/licenses/by-sa/1.0/fi/
|
||||
* 33 http://creativecommons.org/licenses/by-sa/1.0/il/
|
||||
* 33 http://creativecommons.org/licenses/by-sa/1.0/nl/ */
|
||||
{ 0x8000000008044000, 0x01000707, "by-sa/1.0/", 163, -1 },
|
||||
/* 34 http://creativecommons.org/licenses/by-sa/2.0/
|
||||
* 34 http://creativecommons.org/licenses/by-sa/2.0/at/
|
||||
* 34 http://creativecommons.org/licenses/by-sa/2.0/au/
|
||||
* 34 http://creativecommons.org/licenses/by-sa/2.0/be/
|
||||
* 34 http://creativecommons.org/licenses/by-sa/2.0/br/
|
||||
* 34 http://creativecommons.org/licenses/by-sa/2.0/ca/
|
||||
* 34 http://creativecommons.org/licenses/by-sa/2.0/cl/
|
||||
* 34 http://creativecommons.org/licenses/by-sa/2.0/de/
|
||||
* 34 http://creativecommons.org/licenses/by-sa/2.0/es/
|
||||
* 34 http://creativecommons.org/licenses/by-sa/2.0/fr/
|
||||
* 34 http://creativecommons.org/licenses/by-sa/2.0/hr/
|
||||
* 34 http://creativecommons.org/licenses/by-sa/2.0/it/
|
||||
* 34 http://creativecommons.org/licenses/by-sa/2.0/jp/
|
||||
* 34 http://creativecommons.org/licenses/by-sa/2.0/kr/
|
||||
* 34 http://creativecommons.org/licenses/by-sa/2.0/nl/
|
||||
* 34 http://creativecommons.org/licenses/by-sa/2.0/pl/
|
||||
* 34 http://creativecommons.org/licenses/by-sa/2.0/tw/
|
||||
* 34 http://creativecommons.org/licenses/by-sa/2.0/uk/
|
||||
* 34 http://creativecommons.org/licenses/by-sa/2.0/za/ */
|
||||
{ 0x8000002c2871a96e, 0x01000707, "by-sa/2.0/", 163, -1 },
|
||||
/* 35 http://creativecommons.org/licenses/by-sa/2.1/au/ */
|
||||
{ 0x0000000000000004, 0x01000707, "by-sa/2.1/", 163, -1 },
|
||||
/* 36 http://creativecommons.org/licenses/by-sa/2.1/es/ */
|
||||
{ 0x0000000000002000, 0x01000707, "by-sa/2.1/", 163, -1 },
|
||||
/* 37 http://creativecommons.org/licenses/by-sa/2.1/jp/ */
|
||||
{ 0x0000000000200000, 0x01000707, "by-sa/2.1/", 163, -1 },
|
||||
/* 38 http://creativecommons.org/licenses/by-sa/2.5/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/ar/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/au/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/bg/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/br/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/ca/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/ch/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/cn/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/co/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/dk/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/es/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/hr/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/hu/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/il/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/in/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/it/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/mk/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/mt/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/mx/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/my/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/nl/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/pe/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/pl/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/pt/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/se/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/si/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/tw/
|
||||
* 38 http://creativecommons.org/licenses/by-sa/2.5/za/ */
|
||||
{ 0x800000277f9f36f5, 0x01000707, "by-sa/2.5/", 163, -1 },
|
||||
/* 39 http://creativecommons.org/licenses/by-sa/2.5/scotland/ */
|
||||
{ 0x0000000080000000, 0x01000703, "by-sa/2.5/", 163, -1 },
|
||||
/* 40 http://creativecommons.org/licenses/by-sa/3.0/
|
||||
* 40 http://creativecommons.org/licenses/by-sa/3.0/us/ */
|
||||
{ 0x8000001000000000, 0x01000707, "by-sa/3.0/", 163, -1 },
|
||||
/* 41 http://creativecommons.org/licenses/by/1.0/
|
||||
* 41 http://creativecommons.org/licenses/by/1.0/fi/
|
||||
* 41 http://creativecommons.org/licenses/by/1.0/il/
|
||||
* 41 http://creativecommons.org/licenses/by/1.0/nl/ */
|
||||
{ 0x8000000008044000, 0x01000307, "by/1.0/", 186, 198 },
|
||||
/* 42 http://creativecommons.org/licenses/by/2.0/
|
||||
* 42 http://creativecommons.org/licenses/by/2.0/at/
|
||||
* 42 http://creativecommons.org/licenses/by/2.0/au/
|
||||
* 42 http://creativecommons.org/licenses/by/2.0/be/
|
||||
* 42 http://creativecommons.org/licenses/by/2.0/br/
|
||||
* 42 http://creativecommons.org/licenses/by/2.0/ca/
|
||||
* 42 http://creativecommons.org/licenses/by/2.0/cl/
|
||||
* 42 http://creativecommons.org/licenses/by/2.0/de/
|
||||
* 42 http://creativecommons.org/licenses/by/2.0/es/
|
||||
* 42 http://creativecommons.org/licenses/by/2.0/fr/
|
||||
* 42 http://creativecommons.org/licenses/by/2.0/hr/
|
||||
* 42 http://creativecommons.org/licenses/by/2.0/it/
|
||||
* 42 http://creativecommons.org/licenses/by/2.0/jp/
|
||||
* 42 http://creativecommons.org/licenses/by/2.0/kr/
|
||||
* 42 http://creativecommons.org/licenses/by/2.0/nl/
|
||||
* 42 http://creativecommons.org/licenses/by/2.0/pl/
|
||||
* 42 http://creativecommons.org/licenses/by/2.0/tw/
|
||||
* 42 http://creativecommons.org/licenses/by/2.0/uk/
|
||||
* 42 http://creativecommons.org/licenses/by/2.0/za/ */
|
||||
{ 0x8000002c2871a96e, 0x01000307, "by/2.0/", 186, 198 },
|
||||
/* 43 http://creativecommons.org/licenses/by/2.1/au/ */
|
||||
{ 0x0000000000000004, 0x01000307, "by/2.1/", 186, 198 },
|
||||
/* 44 http://creativecommons.org/licenses/by/2.1/es/ */
|
||||
{ 0x0000000000002000, 0x01000307, "by/2.1/", 186, 198 },
|
||||
/* 45 http://creativecommons.org/licenses/by/2.1/jp/ */
|
||||
{ 0x0000000000200000, 0x01000307, "by/2.1/", 186, 198 },
|
||||
/* 46 http://creativecommons.org/licenses/by/2.5/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/ar/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/au/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/bg/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/br/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/ca/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/ch/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/cn/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/co/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/dk/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/es/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/hr/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/hu/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/il/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/in/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/it/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/mk/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/mt/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/mx/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/my/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/nl/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/pe/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/pl/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/pt/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/se/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/si/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/tw/
|
||||
* 46 http://creativecommons.org/licenses/by/2.5/za/ */
|
||||
{ 0x800000277f9f36f5, 0x01000307, "by/2.5/", 186, 198 },
|
||||
/* 47 http://creativecommons.org/licenses/by/2.5/scotland/ */
|
||||
{ 0x0000000080000000, 0x01000303, "by/2.5/", 186, 198 },
|
||||
/* 48 http://creativecommons.org/licenses/by/3.0/
|
||||
* 48 http://creativecommons.org/licenses/by/3.0/us/ */
|
||||
{ 0x8000001000000000, 0x01000307, "by/3.0/", 186, 198 },
|
||||
/* 49 http://creativecommons.org/licenses/devnations/2.0/ */
|
||||
{ 0x8000000000000000, 0x01020107, "devnations/2.0/", 277, -1 },
|
||||
/* 50 http://creativecommons.org/licenses/nc-sa/1.0/
|
||||
* 50 http://creativecommons.org/licenses/nc-sa/1.0/fi/
|
||||
* 50 http://creativecommons.org/licenses/nc-sa/1.0/nl/ */
|
||||
{ 0x8000000008004000, 0x01010507, "nc-sa/1.0/", 296, -1 },
|
||||
/* 51 http://creativecommons.org/licenses/nc-sa/2.0/jp/ */
|
||||
{ 0x0000000000200000, 0x01010507, "nc-sa/2.0/", 296, -1 },
|
||||
/* 52 http://creativecommons.org/licenses/nc-sampling+/1.0/
|
||||
* 52 http://creativecommons.org/licenses/nc-sampling+/1.0/tw/ */
|
||||
{ 0x8000000400000000, 0x01010307, "nc-sampling+/1.0/", 321, -1 },
|
||||
/* 53 http://creativecommons.org/licenses/nc/1.0/
|
||||
* 53 http://creativecommons.org/licenses/nc/1.0/fi/
|
||||
* 53 http://creativecommons.org/licenses/nc/1.0/nl/ */
|
||||
{ 0x8000000008004000, 0x01010107, "nc/1.0/", 349, 363 },
|
||||
/* 54 http://creativecommons.org/licenses/nc/2.0/jp/ */
|
||||
{ 0x0000000000200000, 0x01010107, "nc/2.0/", 349, 363 },
|
||||
/* 55 http://creativecommons.org/licenses/nd-nc/1.0/
|
||||
* 55 http://creativecommons.org/licenses/nd-nc/1.0/fi/
|
||||
* 55 http://creativecommons.org/licenses/nd-nc/1.0/nl/ */
|
||||
{ 0x8000000008004000, 0x01010103, "nd-nc/1.0/", 547, -1 },
|
||||
/* 56 http://creativecommons.org/licenses/nd-nc/2.0/jp/ */
|
||||
{ 0x0000000000200000, 0x01010103, "nd-nc/2.0/", 547, -1 },
|
||||
/* 57 http://creativecommons.org/licenses/nd/1.0/
|
||||
* 57 http://creativecommons.org/licenses/nd/1.0/fi/
|
||||
* 57 http://creativecommons.org/licenses/nd/1.0/nl/ */
|
||||
{ 0x8000000008004000, 0x01000103, "nd/1.0/", 570, 579 },
|
||||
/* 58 http://creativecommons.org/licenses/nd/2.0/jp/ */
|
||||
{ 0x0000000000200000, 0x01000103, "nd/2.0/", 570, 579 },
|
||||
/* 59 http://creativecommons.org/licenses/publicdomain/ */
|
||||
{ 0x8000000000000000, 0x00000007, "publicdomain/", 712, -1 },
|
||||
/* 60 http://creativecommons.org/licenses/sa/1.0/
|
||||
* 60 http://creativecommons.org/licenses/sa/1.0/fi/
|
||||
* 60 http://creativecommons.org/licenses/sa/1.0/nl/ */
|
||||
{ 0x8000000008004000, 0x01000507, "sa/1.0/", 726, 737 },
|
||||
/* 61 http://creativecommons.org/licenses/sa/2.0/jp/ */
|
||||
{ 0x0000000000200000, 0x01000507, "sa/2.0/", 726, 737 },
|
||||
/* 62 http://creativecommons.org/licenses/sampling+/1.0/
|
||||
* 62 http://creativecommons.org/licenses/sampling+/1.0/br/
|
||||
* 62 http://creativecommons.org/licenses/sampling+/1.0/de/
|
||||
* 62 http://creativecommons.org/licenses/sampling+/1.0/tw/ */
|
||||
{ 0x8000000400000820, 0x0100030d, "sampling+/1.0/", 889, -1 },
|
||||
/* 63 http://creativecommons.org/licenses/sampling/1.0/
|
||||
* 63 http://creativecommons.org/licenses/sampling/1.0/br/
|
||||
* 63 http://creativecommons.org/licenses/sampling/1.0/tw/ */
|
||||
{ 0x8000000400000020, 0x01000305, "sampling/1.0/", 903, -1 },
|
||||
};
|
||||
|
||||
static const gchar license_strings[] =
|
||||
"GPL\000LGPL\000Attribution-NonCommercial-NoDerivs\000Attribution-NonComme"
|
||||
"rcial-ShareAlike\000Attribution-NonCommercial\000Attribution-NoDerivs-Non"
|
||||
"Commercial\000Attribution-NoDerivs\000Attribution-ShareAlike\000Attributi"
|
||||
"on\000You must attribute the work in the manner specified by the author o"
|
||||
"r licensor.\000Developing Nations\000NonCommercial-ShareAlike\000NonComme"
|
||||
"rcial Sampling Plus\000NonCommercial\000The licensor permits others to co"
|
||||
"py, distribute and transmit the work. In return, licensees may not use th"
|
||||
"e work for commercial purposes \342\200\224 unless they get the licensor'"
|
||||
"s permission.\000NoDerivs-NonCommercial\000NoDerivs\000The licensor permi"
|
||||
"ts others to copy, distribute and transmit only unaltered copies of the w"
|
||||
"ork \342\200\224 not derivative works based on it.\000Public Domain\000Sh"
|
||||
"areAlike\000The licensor permits others to distribute derivative works on"
|
||||
"ly under the same license or one compatible with the one that governs the"
|
||||
" licensor's work.\000Sampling Plus\000Sampling";
|
526
gst-libs/gst/tag/licenses.c
Normal file
526
gst-libs/gst/tag/licenses.c
Normal file
|
@ -0,0 +1,526 @@
|
|||
/* GStreamer media licenses utility functions
|
||||
* Copyright (C) 2011 Tim-Philipp Müller <tim centricular net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:gsttaglicenses
|
||||
* @short_description: utility functions for Creative Commons licenses
|
||||
* @see_also: #GstTagList
|
||||
*
|
||||
* <refsect2>
|
||||
* <para>
|
||||
* Provides information about Creative Commons media licenses, which are
|
||||
* often expressed in media files as a license URI in tags. Also useful
|
||||
* for applications creating media files, in case the user wants to license
|
||||
* the content under a Creative Commons license.
|
||||
* </para>
|
||||
* </refsect2>
|
||||
*/
|
||||
|
||||
/* FIXME: add API to check obsolete-ness / replace-by */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "tag.h"
|
||||
#include "licenses-tables.dat"
|
||||
|
||||
#ifndef GST_DISABLE_GST_DEBUG
|
||||
|
||||
#define GST_CAT_DEFAULT ensure_debug_category()
|
||||
|
||||
static GstDebugCategory *
|
||||
ensure_debug_category (void)
|
||||
{
|
||||
static gsize cat_gonce = 0;
|
||||
|
||||
if (g_once_init_enter (&cat_gonce)) {
|
||||
gsize cat_done;
|
||||
|
||||
cat_done = (gsize) _gst_debug_category_new ("tag-licenses", 0,
|
||||
"GstTag licenses");
|
||||
|
||||
g_once_init_leave (&cat_gonce, cat_done);
|
||||
}
|
||||
|
||||
return (GstDebugCategory *) cat_gonce;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define ensure_debug_category() /* NOOP */
|
||||
|
||||
#endif /* GST_DISABLE_GST_DEBUG */
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Translations
|
||||
* ------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
static GVariant *
|
||||
gst_tag_get_license_translations_dictionary (void)
|
||||
{
|
||||
static gsize var_gonce = 0;
|
||||
|
||||
if (g_once_init_enter (&var_gonce)) {
|
||||
const gchar *dict_path;
|
||||
GVariant *var = NULL;
|
||||
GError *err = NULL;
|
||||
gchar *data;
|
||||
gsize len;
|
||||
|
||||
/* for gst-uninstalled */
|
||||
dict_path = g_getenv ("GST_TAG_LICENSE_TRANSLATIONS_DICT");
|
||||
|
||||
if (dict_path == NULL)
|
||||
dict_path = LICENSE_TRANSLATIONS_PATH;
|
||||
|
||||
GST_INFO ("Loading license translations from '%s'", dict_path);
|
||||
if (g_file_get_contents (dict_path, &data, &len, &err)) {
|
||||
var = g_variant_new_from_data (G_VARIANT_TYPE ("a{sa{ss}}"), data, len,
|
||||
TRUE, (GDestroyNotify) g_free, data);
|
||||
} else {
|
||||
GST_WARNING ("Could not load translation dictionary %s", err->message);
|
||||
g_error_free (err);
|
||||
var = g_variant_new_array (G_VARIANT_TYPE ("{sa{ss}}"), NULL, 0);
|
||||
}
|
||||
|
||||
g_once_init_leave (&var_gonce, (gsize) var);
|
||||
}
|
||||
|
||||
return (GVariant *) var_gonce;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
static gboolean
|
||||
gst_variant_lookup_string_value (GVariant * dict, const gchar * lang,
|
||||
const gchar ** translation)
|
||||
{
|
||||
GVariant *trans;
|
||||
|
||||
trans = g_variant_lookup_value (dict, lang, G_VARIANT_TYPE ("s"));
|
||||
if (trans == NULL)
|
||||
return FALSE;
|
||||
|
||||
*translation = g_variant_get_string (trans, NULL);
|
||||
/* string will stay valid */
|
||||
g_variant_unref (trans);
|
||||
GST_TRACE ("Result: '%s' for language '%s'", *translation, lang);
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const gchar *
|
||||
gst_license_str_translate (const gchar * s)
|
||||
{
|
||||
#ifdef ENABLE_NLS
|
||||
GVariant *v, *dict, *trans;
|
||||
|
||||
v = gst_tag_get_license_translations_dictionary ();
|
||||
g_assert (v != NULL);
|
||||
|
||||
dict = g_variant_lookup_value (v, s, G_VARIANT_TYPE ("a{ss}"));
|
||||
if (dict != NULL) {
|
||||
const gchar *const *lang;
|
||||
const gchar *env_lang;
|
||||
|
||||
/* for unit tests */
|
||||
if ((env_lang = g_getenv ("GST_TAG_LICENSE_TRANSLATIONS_LANG"))) {
|
||||
if (gst_variant_lookup_string_value (dict, env_lang, &s))
|
||||
GST_TRACE ("Result: '%s' for forced language '%s'", s, env_lang);
|
||||
goto beach;
|
||||
}
|
||||
|
||||
lang = g_get_language_names ();
|
||||
while (lang != NULL && *lang != NULL) {
|
||||
GST_TRACE ("Looking up '%s' for language '%s'", s, *lang);
|
||||
trans = g_variant_lookup_value (dict, *lang, G_VARIANT_TYPE ("s"));
|
||||
|
||||
if (trans != NULL) {
|
||||
s = g_variant_get_string (trans, NULL);
|
||||
/* s will stay valid */
|
||||
g_variant_unref (trans);
|
||||
GST_TRACE ("Result: '%s'", s);
|
||||
break;
|
||||
}
|
||||
|
||||
GST_TRACE ("No result for '%s' for language '%s'", s, *lang);
|
||||
++lang;
|
||||
}
|
||||
|
||||
beach:
|
||||
|
||||
g_variant_unref (dict);
|
||||
} else {
|
||||
GST_WARNING ("No dict for string '%s'", s);
|
||||
}
|
||||
#endif
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* License handling
|
||||
* ------------------------------------------------------------------------- */
|
||||
|
||||
#define CC_LICENSE_REF_PREFIX "http://creativecommons.org/licenses/"
|
||||
|
||||
/* is this license 'generic' (and a base for any of the supported
|
||||
* jurisdictions), or jurisdiction-specific only? */
|
||||
#define JURISDICTION_GENERIC (G_GUINT64_CONSTANT (1) << 63)
|
||||
|
||||
static const gchar jurisdictions[] =
|
||||
"ar\000at\000au\000be\000bg\000br\000ca\000ch\000cl\000cn\000co\000de\000"
|
||||
"dk\000es\000fi\000fr\000hr\000hu\000il\000in\000it\000jp\000kr\000mk\000"
|
||||
"mt\000mx\000my\000nl\000pe\000pl\000pt\000scotland\000se\000si\000tw\000"
|
||||
"uk\000us\000za";
|
||||
|
||||
/**
|
||||
* gst_tag_get_licenses:
|
||||
*
|
||||
* Returns a list of known license references (in form of URIs). This is
|
||||
* useful for UIs to build a list of available licenses for tagging purposes
|
||||
* (e.g. to tag an audio track appropriately in a video or audio editor, or
|
||||
* an image in a camera application).
|
||||
*
|
||||
* Returns: NULL-terminated array of license strings. Free with g_strfreev()
|
||||
* when no longer needed.
|
||||
*
|
||||
* Since: 0.10.36
|
||||
*/
|
||||
gchar **
|
||||
gst_tag_get_licenses (void)
|
||||
{
|
||||
GPtrArray *arr;
|
||||
int i;
|
||||
|
||||
arr = g_ptr_array_new ();
|
||||
for (i = 0; i < G_N_ELEMENTS (licenses); ++i) {
|
||||
const gchar *jurs;
|
||||
gboolean is_generic;
|
||||
guint64 jbits;
|
||||
gchar *ref;
|
||||
|
||||
jbits = licenses[i].jurisdictions;
|
||||
is_generic = (jbits & JURISDICTION_GENERIC) != 0;
|
||||
if (is_generic) {
|
||||
ref = g_strconcat (CC_LICENSE_REF_PREFIX, licenses[i].ref, NULL);
|
||||
GST_LOG ("Adding %2d %s (generic)", i, ref);
|
||||
g_ptr_array_add (arr, ref);
|
||||
jbits &= ~JURISDICTION_GENERIC;
|
||||
}
|
||||
|
||||
jurs = jurisdictions;
|
||||
while (jbits != 0) {
|
||||
if ((jbits & 1)) {
|
||||
ref = g_strconcat (CC_LICENSE_REF_PREFIX, licenses[i].ref, jurs, "/",
|
||||
NULL);
|
||||
GST_LOG ("Adding %2d %s (%s: %s)", i, ref,
|
||||
(is_generic) ? "derived" : "specific", jurs);
|
||||
g_ptr_array_add (arr, ref);
|
||||
}
|
||||
g_assert (jurs < (jurisdictions + sizeof (jurisdictions)));
|
||||
jurs += strlen (jurs) + 1;
|
||||
jbits >>= 1;
|
||||
}
|
||||
}
|
||||
g_ptr_array_add (arr, NULL);
|
||||
return (gchar **) g_ptr_array_free (arr, FALSE);
|
||||
}
|
||||
|
||||
static gint
|
||||
gst_tag_get_license_idx (const gchar * license_ref, const gchar ** jurisdiction)
|
||||
{
|
||||
const gchar *ref, *jur_suffix;
|
||||
int i;
|
||||
|
||||
GST_TRACE ("Looking up '%s'", license_ref);
|
||||
|
||||
if (!g_str_has_prefix (license_ref, CC_LICENSE_REF_PREFIX)) {
|
||||
GST_WARNING ("unknown license prefix in ref '%s'", license_ref);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (jurisdiction != NULL)
|
||||
*jurisdiction = NULL;
|
||||
|
||||
ref = license_ref + sizeof (CC_LICENSE_REF_PREFIX) - 1;
|
||||
for (i = 0; i < G_N_ELEMENTS (licenses); ++i) {
|
||||
guint64 jbits = licenses[i].jurisdictions;
|
||||
const gchar *jurs, *lref = licenses[i].ref;
|
||||
gsize lref_len = strlen (lref);
|
||||
|
||||
/* table should have "foo/bar/" with trailing slash */
|
||||
g_assert (lref[lref_len - 1] == '/');
|
||||
|
||||
if ((jbits & JURISDICTION_GENERIC)) {
|
||||
GST_TRACE ("[%2d] %s checking generic match", i, licenses[i].ref);
|
||||
|
||||
/* exact match? */
|
||||
if (strcmp (ref, lref) == 0)
|
||||
return i;
|
||||
|
||||
/* exact match but without the trailing slash in ref? */
|
||||
if (strncmp (ref, lref, lref_len - 1) == 0 && ref[lref_len - 1] == '\0')
|
||||
return i;
|
||||
}
|
||||
|
||||
if (!g_str_has_prefix (ref, lref))
|
||||
continue;
|
||||
|
||||
GST_TRACE ("[%2d] %s checking jurisdictions", i, licenses[i].ref);
|
||||
|
||||
jbits &= ~JURISDICTION_GENERIC;
|
||||
|
||||
jur_suffix = ref + lref_len;
|
||||
if (*jur_suffix == '\0')
|
||||
continue;
|
||||
|
||||
jurs = jurisdictions;
|
||||
while (jbits != 0) {
|
||||
guint jur_len = strlen (jurs);
|
||||
|
||||
if ((jbits & 1)) {
|
||||
if (strncmp (jur_suffix, jurs, jur_len) == 0 &&
|
||||
(jur_suffix[jur_len] == '\0' || jur_suffix[jur_len] == '/')) {
|
||||
GST_LOG ("matched %s to %s with jurisdiction %s (idx %d)",
|
||||
license_ref, licenses[i].ref, jurs, i);
|
||||
if (jurisdiction != NULL)
|
||||
*jurisdiction = jurs;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
g_assert (jurs < (jurisdictions + sizeof (jurisdictions)));
|
||||
jurs += jur_len + 1;
|
||||
jbits >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
GST_WARNING ("unhandled license ref '%s'", license_ref);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_tag_get_license_flags:
|
||||
* @license_ref: a license reference string in form of a URI,
|
||||
* e.g. "http://creativecommons.org/licenses/by-nc-nd/2.0/"
|
||||
*
|
||||
* Get the flags of a license, which describe most of the features of
|
||||
* a license in their most general form.
|
||||
*
|
||||
* Returns: the flags of the license, or 0 if the license is unknown
|
||||
*
|
||||
* Since: 0.10.36
|
||||
*/
|
||||
GstTagLicenseFlags
|
||||
gst_tag_get_license_flags (const gchar * license_ref)
|
||||
{
|
||||
int idx;
|
||||
|
||||
g_return_val_if_fail (license_ref != NULL, 0);
|
||||
|
||||
idx = gst_tag_get_license_idx (license_ref, NULL);
|
||||
return (idx < 0) ? 0 : licenses[idx].flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_tag_get_license_nick:
|
||||
* @license_ref: a license reference string in form of a URI,
|
||||
* e.g. "http://creativecommons.org/licenses/by-nc-nd/2.0/"
|
||||
*
|
||||
* Get the nick name of a license, which is a short (untranslated) string
|
||||
* such as e.g. "CC BY-NC-ND 2.0 UK".
|
||||
*
|
||||
* Returns: the nick name of the license, or NULL if the license is unknown
|
||||
*
|
||||
* Since: 0.10.36
|
||||
*/
|
||||
const gchar *
|
||||
gst_tag_get_license_nick (const gchar * license_ref)
|
||||
{
|
||||
GstTagLicenseFlags flags;
|
||||
const gchar *creator_prefix, *res;
|
||||
gchar *nick, *c;
|
||||
|
||||
g_return_val_if_fail (license_ref != NULL, NULL);
|
||||
|
||||
flags = gst_tag_get_license_flags (license_ref);
|
||||
|
||||
if ((flags & GST_TAG_LICENSE_CREATIVE_COMMONS_LICENSE)) {
|
||||
creator_prefix = "CC ";
|
||||
} else if ((flags & GST_TAG_LICENSE_FREE_SOFTWARE_FOUNDATION_LICENSE)) {
|
||||
creator_prefix = "FSF ";
|
||||
} else if (g_str_has_suffix (license_ref, "publicdomain/")) {
|
||||
creator_prefix = "";
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
nick = g_strdup_printf ("%s%s", creator_prefix,
|
||||
license_ref + sizeof (CC_LICENSE_REF_PREFIX) - 1);
|
||||
g_strdelimit (nick, "/", ' ');
|
||||
g_strchomp (nick);
|
||||
for (c = nick; *c != '\0'; ++c)
|
||||
*c = g_ascii_toupper (*c);
|
||||
|
||||
GST_LOG ("%s => nick %s", license_ref, nick);
|
||||
res = g_intern_string (nick); /* for convenience */
|
||||
g_free (nick);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_tag_get_license_title:
|
||||
* @license_ref: a license reference string in form of a URI,
|
||||
* e.g. "http://creativecommons.org/licenses/by-nc-nd/2.0/"
|
||||
*
|
||||
* Get the title of a license, which is a short translated description
|
||||
* of the license's features (generally not very pretty though).
|
||||
*
|
||||
* Returns: the title of the license, or NULL if the license is unknown or
|
||||
* no title is available.
|
||||
*
|
||||
* Since: 0.10.36
|
||||
*/
|
||||
const gchar *
|
||||
gst_tag_get_license_title (const gchar * license_ref)
|
||||
{
|
||||
int idx;
|
||||
|
||||
g_return_val_if_fail (license_ref != NULL, NULL);
|
||||
|
||||
idx = gst_tag_get_license_idx (license_ref, NULL);
|
||||
|
||||
if (idx < 0 || licenses[idx].title_idx < 0)
|
||||
return NULL;
|
||||
|
||||
return gst_license_str_translate (&license_strings[licenses[idx].title_idx]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_tag_get_license_description:
|
||||
* @license_ref: a license reference string in form of a URI,
|
||||
* e.g. "http://creativecommons.org/licenses/by-nc-nd/2.0/"
|
||||
*
|
||||
* Get the description of a license, which is a translated description
|
||||
* of the license's main features.
|
||||
*
|
||||
* Returns: the description of the license, or NULL if the license is unknown
|
||||
* or a description is not available.
|
||||
*
|
||||
* Since: 0.10.36
|
||||
*/
|
||||
const gchar *
|
||||
gst_tag_get_license_description (const gchar * license_ref)
|
||||
{
|
||||
int idx;
|
||||
|
||||
g_return_val_if_fail (license_ref != NULL, NULL);
|
||||
|
||||
idx = gst_tag_get_license_idx (license_ref, NULL);
|
||||
|
||||
if (idx < 0 || licenses[idx].desc_idx < 0)
|
||||
return NULL;
|
||||
|
||||
return gst_license_str_translate (&license_strings[licenses[idx].desc_idx]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_tag_get_license_jurisdiction:
|
||||
* @license_ref: a license reference string in form of a URI,
|
||||
* e.g. "http://creativecommons.org/licenses/by-nc-nd/2.0/"
|
||||
*
|
||||
* Get the jurisdiction code of a license. This is usually a two-letter
|
||||
* ISO 3166-1 alpha-2 code, but there is also the special case of Scotland,
|
||||
* for which no code exists and which is thus represented as "scotland".
|
||||
*
|
||||
* Known jurisdictions: ar, at, au, be, bg, br, ca, ch, cl, cn, co, de,
|
||||
* dk, es, fi, fr, hr, hu, il, in, it, jp, kr, mk, mt, mx, my, nl, pe, pl,
|
||||
* pt, scotland, se, si, tw, uk, us, za.
|
||||
*
|
||||
* Returns: the jurisdiction code of the license, or NULL if the license is
|
||||
* unknown or is not specific to a particular jurisdiction.
|
||||
*
|
||||
* Since: 0.10.36
|
||||
*/
|
||||
const gchar *
|
||||
gst_tag_get_license_jurisdiction (const gchar * license_ref)
|
||||
{
|
||||
const gchar *jurisdiction;
|
||||
int idx;
|
||||
|
||||
g_return_val_if_fail (license_ref != NULL, NULL);
|
||||
|
||||
idx = gst_tag_get_license_idx (license_ref, &jurisdiction);
|
||||
return (idx < 0) ? NULL : jurisdiction;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_tag_get_license_version:
|
||||
* @license_ref: a license reference string in form of a URI,
|
||||
* e.g. "http://creativecommons.org/licenses/by-nc-nd/2.0/"
|
||||
*
|
||||
* Get the version of a license.
|
||||
*
|
||||
* Returns: the version of the license, or NULL if the license is not known or
|
||||
* has no version
|
||||
*
|
||||
* Since: 0.10.36
|
||||
*/
|
||||
const gchar *
|
||||
gst_tag_get_license_version (const gchar * license_ref)
|
||||
{
|
||||
int idx;
|
||||
|
||||
g_return_val_if_fail (license_ref != NULL, NULL);
|
||||
|
||||
idx = gst_tag_get_license_idx (license_ref, NULL);
|
||||
if (idx < 0)
|
||||
return NULL;
|
||||
|
||||
#define LICENSE_FLAG_CC_OR_FSF \
|
||||
(GST_TAG_LICENSE_CREATIVE_COMMONS_LICENSE|\
|
||||
GST_TAG_LICENSE_FREE_SOFTWARE_FOUNDATION_LICENSE)
|
||||
|
||||
/* e.g. publicdomain isn't versioned */
|
||||
if (!(licenses[idx].flags & LICENSE_FLAG_CC_OR_FSF))
|
||||
return NULL;
|
||||
|
||||
/* KISS for now... */
|
||||
if (strstr (licenses[idx].ref, "/1.0/"))
|
||||
return "1.0";
|
||||
else if (strstr (licenses[idx].ref, "/2.0/"))
|
||||
return "2.0";
|
||||
else if (strstr (licenses[idx].ref, "/2.1/"))
|
||||
return "2.1";
|
||||
else if (strstr (licenses[idx].ref, "/2.5/"))
|
||||
return "2.5";
|
||||
else if (strstr (licenses[idx].ref, "/3.0/"))
|
||||
return "3.0";
|
||||
|
||||
GST_ERROR ("Could not determine version for ref '%s'", license_ref);
|
||||
return NULL;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
||||
* Copyright (C) 2006-2011 Tim-Philipp Müller <tim centricular net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
|
@ -544,6 +545,82 @@ const gchar * gst_tag_get_language_code_iso_639_2T (const gchar * lang_code);
|
|||
#define gst_tag_get_language_code(lang_code) \
|
||||
gst_tag_get_language_code_iso_639_1(lang_code)
|
||||
|
||||
|
||||
/* functions to deal with (mostly) Creative Commons licenses */
|
||||
|
||||
/**
|
||||
* GstTagLicenseFlags:
|
||||
* @GST_TAG_LICENSE_PERMITS_REPRODUCTION: making multiple copies
|
||||
* is allowed
|
||||
* @GST_TAG_LICENSE_PERMITS_DISTRIBUTION: distribution, public display
|
||||
* and public performance are allowed
|
||||
* @GST_TAG_LICENSE_PERMITS_DERIVATIVE_WORKS: distribution of derivative
|
||||
* works is allowed
|
||||
* @GST_TAG_LICENSE_PERMITS_SHARING: commercial derivatives are allowed,
|
||||
* but only non-commercial distribution is allowed
|
||||
* @GST_TAG_LICENSE_REQUIRES_NOTICE: copyright and license notices
|
||||
* must be kept intact
|
||||
* @GST_TAG_LICENSE_REQUIRES_ATTRIBUTION: credit must be given to
|
||||
* copyright holder and/or author
|
||||
* @GST_TAG_LICENSE_REQUIRES_SHARE_ALIKE: derivative works must be
|
||||
* licensed under the same terms or compatible terms as the original work
|
||||
* @GST_TAG_LICENSE_REQUIRES_SOURCE_CODE: source code (the preferred
|
||||
* form for making modifications) must be provided when exercising some
|
||||
* rights granted by the license
|
||||
* @GST_TAG_LICENSE_REQUIRES_COPYLEFT: derivative and combined works
|
||||
* must be licensed under specified terms, similar to those of the original
|
||||
* work
|
||||
* @GST_TAG_LICENSE_REQUIRES_LESSER_COPYLEFT: derivative works must be
|
||||
* licensed under specified terms, with at least the same conditions as
|
||||
* the original work; combinations with the work may be licensed under
|
||||
* different terms
|
||||
* @GST_TAG_LICENSE_PROHIBITS_COMMERCIAL_USE: exercising rights for
|
||||
* commercial purposes is prohibited
|
||||
* @GST_TAG_LICENSE_PROHIBITS_HIGH_INCOME_NATION_USE: use in a
|
||||
* non-developing country is prohibited
|
||||
* @GST_TAG_LICENSE_CREATIVE_COMMONS_LICENSE: this license was created
|
||||
* by the Creative Commons project
|
||||
* @GST_TAG_LICENSE_FREE_SOFTWARE_FOUNDATION_LICENSE: this license was
|
||||
* created by the Free Software Foundation (FSF)
|
||||
*
|
||||
* See http://creativecommons.org/ns for more information.
|
||||
*
|
||||
* Since: 0.10.36
|
||||
*/
|
||||
typedef enum {
|
||||
GST_TAG_LICENSE_PERMITS_REPRODUCTION = (1 << 0),
|
||||
GST_TAG_LICENSE_PERMITS_DISTRIBUTION = (1 << 1),
|
||||
GST_TAG_LICENSE_PERMITS_DERIVATIVE_WORKS = (1 << 2),
|
||||
GST_TAG_LICENSE_PERMITS_SHARING = (1 << 3),
|
||||
|
||||
GST_TAG_LICENSE_REQUIRES_NOTICE = (1 << 8),
|
||||
GST_TAG_LICENSE_REQUIRES_ATTRIBUTION = (1 << 9),
|
||||
GST_TAG_LICENSE_REQUIRES_SHARE_ALIKE = (1 << 10),
|
||||
GST_TAG_LICENSE_REQUIRES_SOURCE_CODE = (1 << 11),
|
||||
GST_TAG_LICENSE_REQUIRES_COPYLEFT = (1 << 12),
|
||||
GST_TAG_LICENSE_REQUIRES_LESSER_COPYLEFT = (1 << 13),
|
||||
|
||||
GST_TAG_LICENSE_PROHIBITS_COMMERCIAL_USE = (1 << 16),
|
||||
GST_TAG_LICENSE_PROHIBITS_HIGH_INCOME_NATION_USE = (1 << 17),
|
||||
|
||||
GST_TAG_LICENSE_CREATIVE_COMMONS_LICENSE = (1 << 24),
|
||||
GST_TAG_LICENSE_FREE_SOFTWARE_FOUNDATION_LICENSE = (1 << 25)
|
||||
} GstTagLicenseFlags;
|
||||
|
||||
gchar ** gst_tag_get_licenses (void);
|
||||
|
||||
GstTagLicenseFlags gst_tag_get_license_flags (const gchar * license_ref);
|
||||
|
||||
const gchar * gst_tag_get_license_nick (const gchar * license_ref);
|
||||
|
||||
const gchar * gst_tag_get_license_title (const gchar * license_ref);
|
||||
|
||||
const gchar * gst_tag_get_license_version (const gchar * license_ref);
|
||||
|
||||
const gchar * gst_tag_get_license_description (const gchar * license_ref);
|
||||
|
||||
const gchar * gst_tag_get_license_jurisdiction (const gchar * license_ref);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_TAG_TAG_H__ */
|
||||
|
|
Loading…
Reference in a new issue