File: shareapi.xml

package info (click to toggle)
libdmapsharing 3.9.13-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,340 kB
  • sloc: ansic: 17,285; sh: 4,782; xml: 556; makefile: 459
file content (64 lines) | stat: -rw-r--r-- 1,678 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="shareapi">
	<refmeta>
		<refentrytitle>Share API</refentrytitle>
		<manvolnum>3</manvolnum>
		<refmiscinfo>Libdmapsharing</refmiscinfo>
	</refmeta>

	<refnamediv>
		<refname>Share API</refname>
		<refpurpose>
			Using the share API
		</refpurpose>
	</refnamediv>

	<refsect1>
		<title>Share API</title>
		<para>
A DmapAvShare (or DmapImageShare) allows a program to share the media
described by its DmapDb object.  The libdmapsharing package also provides
an optional interface, DmapRecordFactory, that can be used in conjunction
with a DmapDb implementation.  The following demonstrates the use of
the share API; it serves up a media database made up of a single record.

		</para>
		<screen>
DmapRecordFactory *factory;
DmapRecord *record;
DmapDb *db;
gboolean ok;
DmapShare *share;
GError *error = NULL;

factory = DMAP_RECORD_FACTORY (my_dmap_av_record_factory_new ());

record  = DMAP_RECORD (dmap_record_factory_create (factory, path_to_media_file, &amp;error));
if (record == NULL) {
	g_error("Error reading record: %s\n", error->messaage);
}

db = DMAP_DB (my_dmap_db_new ());
dmap_db_add (db, record, &amp;error);
g_object_unref (record);

share = DMAP_SHARE(dmap_av_share_new (name, NULL, db, dmap_container_db, NULL);

ok = dmap_share_serve(share, &amp;error);
if (!ok) {
	g_error("Error sharing: %s", error->message);
}

ok = dmap_share_publish(share, &amp;errro);
if (!ok) {
	g_error("Error publishing: %s", error->message);
}

g_main_loop_run(loop);

		</screen>
	</refsect1>
</refentry>