Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
libdmapsharing
Commits
bc48137f
Commit
bc48137f
authored
Aug 22, 2009
by
W. Michael Petullo
Browse files
Work on dns_sd mDNS backend.
parent
831f3516
Changes
22
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
bc48137f
22 August 2009 W. Michael Petullo <mike@flyn.org>
* Work on dns_sd mDNS backend.
* Make autogen.sh work with MacPorts.
17 August 2009 W. Michael Petullo <mike@flyn.org>
* Update tests to include dmap.h.
* Ensure values g_free'd before set in D[AP]APRecord's
set_properties.
* Add dmap-mdns-publisher.h back to installed headers.
16 August 2009 W. Michael Petullo <mike@flyn.org>
* Add finalize function for TestDAAPRecord and TestDPAPRecord.
15 August 2009 W. Michael Petullo <mike@flyn.org>
* Documentation.
...
...
TODO
View file @
bc48137f
cc1: warnings being treated as errors
daap-connection.c: In function 'daap_connection_build_message':
/usr/include/glib-2.0/glib/gthread.h:344: error: dereferencing pointer '_SOUP_METHOD_GET.21' does break strict-aliasing rules
daap-connection.c:96: note: initialized from here
Ensure client test catches newly shared files?
Do transcode based on client?
...
...
@@ -127,7 +122,5 @@ See FIXME's in dmap-share.c, daap-share.c and dpap-share.c.
Comment purpose of each source file and describe interfaces, using test
programs as examples.
Submit as a GNOME or Freedesktop project (google "gnome new module").
Allow both DPAP and DAAP sharing in one process (using two threads
instead of two processes).
autogen.sh
View file @
bc48137f
...
...
@@ -4,7 +4,7 @@ gtkdocize || exit 1
aclocal
-I
m4
||
exit
1
autoconf
||
exit
1
autoheader
||
exit
1
libtoolize
--force
||
exit
1
libtoolize
--force
||
g
libtoolize
--force
||
exit
1
automake
-a
||
exit
1
./configure
$*
||
exit
1
...
...
configure.ac
View file @
bc48137f
AC_INIT(libdmapsharing, 1.9.0.1
1
)
AC_INIT(libdmapsharing, 1.9.0.1
2
)
dnl when going to/from release please set the nano (fourth number) right !
dnl releases only do Wall, cvs and prerelease does Werror too
AS_VERSION(libdmapsharing, LIBDMAPSHARING, 1, 9, 0, 1
1
, LIBDMAPSHARING_CVS="no", LIBDMAPSHARING_CVS="yes")
AS_VERSION(libdmapsharing, LIBDMAPSHARING, 1, 9, 0, 1
2
, LIBDMAPSHARING_CVS="no", LIBDMAPSHARING_CVS="yes")
AM_INIT_AUTOMAKE
...
...
libdmapsharing/Makefile.am
View file @
bc48137f
...
...
@@ -66,6 +66,7 @@ libdmapsharinginclude_HEADERS = \
dmap-container-record.h
\
dmap-db.h
\
dmap-mdns-browser.h
\
dmap-mdns-publisher.h
\
dmap-record.h
\
dmap-record-factory.h
\
dmap-share.h
\
...
...
@@ -78,7 +79,6 @@ noinst_HEADERS = \
dmap-config.h
\
dmap-md5.h
\
dmap-mdns-avahi.h
\
dmap-mdns-publisher.h
\
dmap-structure.h
\
dmap-utils.h
\
g-gst-input-stream.h
\
...
...
libdmapsharing/daap-share.c
View file @
bc48137f
...
...
@@ -482,6 +482,7 @@ send_chunked_file (SoupServer *server, SoupMessage *message, DAAPRecord *record,
g_warning
(
"Couldn't open %s: %s."
,
location
,
error
->
message
);
g_error_free
(
error
);
soup_message_set_status
(
message
,
SOUP_STATUS_INTERNAL_SERVER_ERROR
);
g_free
(
cd
);
return
;
}
...
...
@@ -498,11 +499,18 @@ send_chunked_file (SoupServer *server, SoupMessage *message, DAAPRecord *record,
cd
->
stream
=
stream
;
}
if
(
cd
->
stream
==
NULL
)
{
g_warning
(
"Could not set up input stream"
);
g_free
(
cd
);
return
;
}
if
(
offset
!=
0
)
{
if
(
g_seekable_seek
(
G_SEEKABLE
(
cd
->
stream
),
offset
,
G_SEEK_SET
,
NULL
,
&
error
)
==
FALSE
)
{
g_warning
(
"Error seeking: %s."
,
error
->
message
);
g_input_stream_close
(
cd
->
stream
,
NULL
,
NULL
);
soup_message_set_status
(
message
,
SOUP_STATUS_INTERNAL_SERVER_ERROR
);
g_free
(
cd
);
return
;
}
filesize
-=
offset
;
...
...
@@ -553,6 +561,7 @@ send_chunked_file (SoupServer *server, SoupMessage *message, DAAPRecord *record,
g_signal_connect
(
message
,
"wrote_headers"
,
G_CALLBACK
(
write_next_chunk
),
cd
);
g_signal_connect
(
message
,
"wrote_chunk"
,
G_CALLBACK
(
write_next_chunk
),
cd
);
g_signal_connect
(
message
,
"finished"
,
G_CALLBACK
(
chunked_message_finished
),
cd
);
/* NOTE: cd g_free'd by chunked_message_finished(). */
}
static
void
...
...
libdmapsharing/dmap-mdns-publisher-dnssd.c
View file @
bc48137f
...
...
@@ -21,6 +21,7 @@
#include
<stdio.h>
#include
<glib.h>
#include
<dns_sd.h>
#include
<arpa/inet.h>
#include
"dmap-mdns-publisher.h"
...
...
@@ -30,11 +31,19 @@ struct DmapMdnsPublisherPrivate
{
DNSServiceRef
sdref
;
char
*
name
;
guint
port
;
guint
16
port
;
char
*
type_of_service
;
gboolean
password_required
;
};
enum
{
PUBLISHED
,
NAME_COLLISION
,
LAST_SIGNAL
};
static
guint
signals
[
LAST_SIGNAL
]
=
{
0
,
};
G_DEFINE_TYPE
(
DmapMdnsPublisher
,
dmap_mdns_publisher
,
G_TYPE_OBJECT
)
static
gpointer
publisher_object
=
NULL
;
...
...
@@ -133,30 +142,39 @@ dmap_mdns_publisher_publish (DmapMdnsPublisher *publisher,
gboolean
password_required
,
GError
**
error
)
{
if
(
DNSServiceRegister
(
&
publisher
->
priv
->
sdref
,
int
dns_err
;
publisher_set_name_internal
(
publisher
,
name
,
NULL
);
publisher_set_port_internal
(
publisher
,
port
,
NULL
);
publisher_set_type_of_service_internal
(
publisher
,
type_of_service
,
NULL
);
publisher_set_password_required_internal
(
publisher
,
password_required
,
NULL
);
g_warning
(
"%s %s %d"
,
publisher
->
priv
->
name
,
publisher
->
priv
->
type_of_service
,
publisher
->
priv
->
port
);
if
((
dns_err
=
DNSServiceRegister
(
&
publisher
->
priv
->
sdref
,
0
,
0
,
publisher
->
priv
->
name
,
publisher
->
priv
->
type_of_service
,
name
,
type_of_service
,
NULL
,
NULL
,
publisher
->
priv
->
port
,
//port,
(
uint16_t
)
htons
(
3689
),
0
,
NULL
,
NULL
,
NULL
)
!=
kDNSServiceErr_NoError
)
{
NULL
)
)
!=
kDNSServiceErr_NoError
)
{
g_set_error
(
error
,
DMAP_MDNS_PUBLISHER_ERROR
,
DMAP_MDNS_PUBLISHER_ERROR_FAILED
,
"%s"
,
"Error publishing via DNSSD"
);
"%s: %d"
,
"Error publishing via DNSSD"
,
dns_err
);
if
(
dns_err
==
kDNSServiceErr_NameConflict
)
{
g_signal_emit
(
publisher
,
signals
[
NAME_COLLISION
],
0
,
publisher
->
priv
->
name
);
}
return
FALSE
;
}
publisher_set_name_internal
(
publisher
,
name
,
NULL
);
publisher_set_port_internal
(
publisher
,
port
,
NULL
);
publisher_set_type_of_service_internal
(
publisher
,
type_of_service
,
NULL
);
publisher_set_password_required_internal
(
publisher
,
password_required
,
NULL
);
g_signal_emit
(
publisher
,
signals
[
PUBLISHED
],
0
,
publisher
->
priv
->
name
);
return
TRUE
;
}
...
...
@@ -223,6 +241,27 @@ dmap_mdns_publisher_class_init (DmapMdnsPublisherClass *klass)
object_class
->
get_property
=
dmap_mdns_publisher_get_property
;
object_class
->
set_property
=
dmap_mdns_publisher_set_property
;
signals
[
PUBLISHED
]
=
g_signal_new
(
"published"
,
G_TYPE_FROM_CLASS
(
object_class
),
G_SIGNAL_RUN_LAST
,
G_STRUCT_OFFSET
(
DmapMdnsPublisherClass
,
published
),
NULL
,
NULL
,
g_cclosure_marshal_VOID__STRING
,
G_TYPE_NONE
,
1
,
G_TYPE_STRING
);
signals
[
NAME_COLLISION
]
=
g_signal_new
(
"name-collision"
,
G_TYPE_FROM_CLASS
(
object_class
),
G_SIGNAL_RUN_LAST
,
G_STRUCT_OFFSET
(
DmapMdnsPublisherClass
,
name_collision
),
NULL
,
NULL
,
g_cclosure_marshal_VOID__STRING
,
G_TYPE_NONE
,
1
,
G_TYPE_STRING
);
g_type_class_add_private
(
klass
,
sizeof
(
DmapMdnsPublisherPrivate
));
}
...
...
libdmapsharing/dmap.h
View file @
bc48137f
...
...
@@ -9,6 +9,7 @@
#include
<libdmapsharing/dmap-container-record.h>
#include
<libdmapsharing/dmap-db.h>
#include
<libdmapsharing/dmap-mdns-browser.h>
#include
<libdmapsharing/dmap-mdns-publisher.h>
#include
<libdmapsharing/dmap-record.h>
#include
<libdmapsharing/dmap-record-factory.h>
#include
<libdmapsharing/dmap-share.h>
...
...
libdmapsharing/g-gst-mp3-input-stream.c
View file @
bc48137f
...
...
@@ -78,10 +78,19 @@ GInputStream* g_gst_mp3_input_stream_new (GInputStream *src_stream)
stream
->
priv
->
pipeline
=
gst_pipeline_new
(
"pipeline"
);
stream
->
priv
->
src
=
gst_element_factory_make
(
"giostreamsrc"
,
"src"
);
g_assert
(
GST_IS_ELEMENT
(
stream
->
priv
->
src
));
stream
->
priv
->
decode
=
gst_element_factory_make
(
"decodebin"
,
"decode"
);
g_assert
(
GST_IS_ELEMENT
(
stream
->
priv
->
decode
));
stream
->
priv
->
convert
=
gst_element_factory_make
(
"audioconvert"
,
"convert"
);
g_assert
(
GST_IS_ELEMENT
(
stream
->
priv
->
convert
));
stream
->
priv
->
encode
=
gst_element_factory_make
(
"lame"
,
"encode"
);
g_assert
(
GST_IS_ELEMENT
(
stream
->
priv
->
encode
));
stream
->
priv
->
sink
=
gst_element_factory_make
(
"appsink"
,
"sink"
);
g_assert
(
GST_IS_ELEMENT
(
stream
->
priv
->
sink
));
gst_bin_add_many
(
GST_BIN
(
stream
->
priv
->
pipeline
),
stream
->
priv
->
src
,
...
...
libdmapsharing/g-gst-wav-input-stream.c
View file @
bc48137f
...
...
@@ -82,8 +82,14 @@ GInputStream* g_gst_wav_input_stream_new (GInputStream *src_stream)
stream
->
priv
->
pipeline
=
gst_pipeline_new
(
"pipeline"
);
stream
->
priv
->
src
=
gst_element_factory_make
(
"giostreamsrc"
,
"src"
);
g_assert
(
GST_IS_ELEMENT
(
stream
->
priv
->
src
));
stream
->
priv
->
decode
=
gst_element_factory_make
(
"decodebin"
,
"decode"
);
g_assert
(
GST_IS_ELEMENT
(
stream
->
priv
->
decode
));
stream
->
priv
->
convert
=
gst_element_factory_make
(
"audioconvert"
,
"convert"
);
g_assert
(
GST_IS_ELEMENT
(
stream
->
priv
->
convert
));
/* Roku clients support a subset of the WAV format. */
stream
->
priv
->
filter
=
gst_caps_new_simple
(
"audio/x-raw-int"
,
"channels"
,
G_TYPE_INT
,
2
,
...
...
@@ -91,7 +97,10 @@ GInputStream* g_gst_wav_input_stream_new (GInputStream *src_stream)
"depth"
,
G_TYPE_INT
,
16
,
NULL
);
stream
->
priv
->
encode
=
gst_element_factory_make
(
"wavenc"
,
"encode"
);
g_assert
(
GST_IS_ELEMENT
(
stream
->
priv
->
encode
));
stream
->
priv
->
sink
=
gst_element_factory_make
(
"appsink"
,
"sink"
);
g_assert
(
GST_IS_ELEMENT
(
stream
->
priv
->
sink
));
gst_bin_add_many
(
GST_BIN
(
stream
->
priv
->
pipeline
),
stream
->
priv
->
src
,
...
...
tests/test-daap-record-factory.h
View file @
bc48137f
...
...
@@ -21,7 +21,7 @@
#ifndef __TEST_DAAP_RECORD_FACTORY
#define __TEST_DAAP_RECORD_FACTORY
#include
<libdmapsharing/dmap
-record-factory
.h>
#include
<libdmapsharing/dmap.h>
G_BEGIN_DECLS
...
...
tests/test-daap-record.c
View file @
bc48137f
...
...
@@ -28,6 +28,7 @@ struct TestDAAPRecordPrivate {
char
*
location
;
char
*
title
;
char
*
format
;
char
*
real_format
;
char
*
album
;
char
*
artist
;
gulong
bitrate
;
...
...
@@ -72,24 +73,33 @@ test_daap_record_set_property (GObject *object,
switch
(
prop_id
)
{
case
PROP_LOCATION
:
/* FIXME: should I free location first? */
g_free
(
record
->
priv
->
location
);
record
->
priv
->
location
=
g_value_dup_string
(
value
);
break
;
case
PROP_TITLE
:
g_free
(
record
->
priv
->
title
);
record
->
priv
->
title
=
g_value_dup_string
(
value
);
break
;
case
PROP_ALBUM
:
g_free
(
record
->
priv
->
album
);
record
->
priv
->
album
=
g_value_dup_string
(
value
);
break
;
case
PROP_ARTIST
:
g_free
(
record
->
priv
->
artist
);
record
->
priv
->
artist
=
g_value_dup_string
(
value
);
break
;
case
PROP_GENRE
:
g_free
(
record
->
priv
->
genre
);
record
->
priv
->
genre
=
g_value_dup_string
(
value
);
break
;
case
PROP_FORMAT
:
g_free
(
record
->
priv
->
format
);
record
->
priv
->
format
=
g_value_dup_string
(
value
);
break
;
case
PROP_REAL_FORMAT
:
g_free
(
record
->
priv
->
real_format
);
record
->
priv
->
real_format
=
g_value_dup_string
(
value
);
break
;
case
PROP_RATING
:
record
->
priv
->
rating
=
g_value_get_int
(
value
);
break
;
...
...
tests/test-daap-record.h
View file @
bc48137f
...
...
@@ -21,7 +21,7 @@
#ifndef __TEST_DAAP_RECORD
#define __TEST_DAAP_RECORD
#include
<libdmapsharing/d
a
ap
-record
.h>
#include
<libdmapsharing/d
m
ap.h>
G_BEGIN_DECLS
...
...
tests/test-dmap-client.c
View file @
bc48137f
...
...
@@ -21,14 +21,12 @@
#include
<stdio.h>
#include
<stdlib.h>
#include
<libdmapsharing/dmap.h>
#include
"test-dmap-db.h"
#include
"test-daap-record-factory.h"
#include
"test-dpap-record-factory.h"
#include
<libdmapsharing/daap-connection.h>
#include
<libdmapsharing/dpap-connection.h>
#include
<libdmapsharing/dmap-mdns-browser.h>
enum
{
DAAP
,
DPAP
...
...
tests/test-dmap-container-db.h
View file @
bc48137f
...
...
@@ -21,7 +21,7 @@
#ifndef __TEST_DMAP_CONTAINER_DB
#define __TEST_DMAP_CONTAINER_DB
#include
<libdmapsharing/dmap
-container-db
.h>
#include
<libdmapsharing/dmap.h>
G_BEGIN_DECLS
...
...
tests/test-dmap-container-record.c
View file @
bc48137f
...
...
@@ -20,8 +20,46 @@
#include
"test-dmap-container-record.h"
enum
{
PROP_0
,
PROP_NAME
};
static
DMAPDb
*
entries
=
NULL
;
static
void
test_dmap_container_record_set_property
(
GObject
*
object
,
guint
prop_id
,
const
GValue
*
value
,
GParamSpec
*
pspec
)
{
switch
(
prop_id
)
{
case
PROP_NAME
:
/* NOTE: do nothing; test name is always the same. */
break
;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID
(
object
,
prop_id
,
pspec
);
break
;
}
}
static
void
test_dmap_container_record_get_property
(
GObject
*
object
,
guint
prop_id
,
GValue
*
value
,
GParamSpec
*
pspec
)
{
switch
(
prop_id
)
{
case
PROP_NAME
:
g_value_set_string
(
value
,
"Test"
);
break
;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID
(
object
,
prop_id
,
pspec
);
break
;
}
}
gint
test_dmap_container_record_get_id
(
DMAPContainerRecord
*
record
)
{
...
...
@@ -56,6 +94,12 @@ test_dmap_container_record_init (TestDMAPContainerRecord *record)
static
void
test_dmap_container_record_class_init
(
TestDMAPContainerRecordClass
*
klass
)
{
GObjectClass
*
gobject_class
=
G_OBJECT_CLASS
(
klass
);
gobject_class
->
set_property
=
test_dmap_container_record_set_property
;
gobject_class
->
get_property
=
test_dmap_container_record_get_property
;
g_object_class_override_property
(
gobject_class
,
PROP_NAME
,
"name"
);
}
static
void
...
...
tests/test-dmap-container-record.h
View file @
bc48137f
...
...
@@ -21,7 +21,7 @@
#ifndef __TEST_DMAP_CONTAINER_RECORD
#define __TEST_DMAP_CONTAINER_RECORD
#include
<libdmapsharing/dmap
-container-record
.h>
#include
<libdmapsharing/dmap.h>
#include
"test-dmap-db.h"
...
...
tests/test-dmap-db.h
View file @
bc48137f
...
...
@@ -21,7 +21,7 @@
#ifndef __TEST_DMAP_DB
#define __TEST_DMAP_DB
#include
<libdmapsharing/dmap
-db
.h>
#include
<libdmapsharing/dmap.h>
G_BEGIN_DECLS
...
...
tests/test-dmap-server.c
View file @
bc48137f
...
...
@@ -23,9 +23,7 @@
#include
<string.h>
#include
<glib.h>
#include
<libdmapsharing/dmap-mdns-browser.h>
#include
<libdmapsharing/daap-share.h>
#include
<libdmapsharing/dpap-share.h>
#include
<libdmapsharing/dmap.h>
#include
"test-dmap-container-record.h"
#include
"test-daap-record.h"
...
...
@@ -58,8 +56,11 @@ static void
create_share
(
guint
conn_type
)
{
char
*
name
=
dmap_sharing_default_share_name
();
DMAPContainerRecord
*
dmap_container_record
=
DMAP_CONTAINER_RECORD
(
test_dmap_container_record_new
());
DMAPContainerDb
*
dmap_container_db
=
DMAP_CONTAINER_DB
(
test_dmap_container_db_new
(
dmap_container_record
));
DMAPContainerRecord
*
dmap_container_record
=
\
DMAP_CONTAINER_RECORD
(
test_dmap_container_record_new
());
DMAPContainerDb
*
dmap_container_db
=
\
DMAP_CONTAINER_DB
(
test_dmap_container_db_new
(
dmap_container_record
));
DMAPRecordFactory
*
factory
;
DMAPRecord
*
record
;
DMAPShare
*
share
;
...
...
@@ -80,9 +81,17 @@ create_share (guint conn_type)
g_warning
(
"initialize DAAP sharing"
);
if
(
conn_type
==
DAAP
)
{
share
=
DMAP_SHARE
(
daap_share_new
(
name
,
NULL
,
db
,
dmap_container_db
,
NULL
));
share
=
DMAP_SHARE
(
daap_share_new
(
name
,
NULL
,
db
,
dmap_container_db
,
NULL
));
}
else
{
share
=
DMAP_SHARE
(
dpap_share_new
(
name
,
NULL
,
db
,
dmap_container_db
,
NULL
));
share
=
DMAP_SHARE
(
dpap_share_new
(
name
,
NULL
,
db
,
dmap_container_db
,
NULL
));
}
g_free
(
name
);
...
...
tests/test-dpap-record-factory.h
View file @
bc48137f
...
...
@@ -21,7 +21,7 @@
#ifndef __TEST_DPAP_RECORD_FACTORY
#define __TEST_DPAP_RECORD_FACTORY
#include
<libdmapsharing/dmap
-record-factory
.h>
#include
<libdmapsharing/dmap.h>
G_BEGIN_DECLS
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment