didl toevoegingen

This commit is contained in:
2026-07-30 22:32:12 +02:00
parent 83b939b60d
commit 2acd9ac87f
12 changed files with 320 additions and 35 deletions
+45
View File
@@ -0,0 +1,45 @@
#lang scribble/manual
@(require
(for-label
racket/base
(file "../didl-lite.rkt")))
@title{DIDL-Lite Metadata}
@defmodule[(file "../didl-lite.rkt")]
DIDL-Lite describes the resource passed to a renderer. Some renderers only
advertise seeking after the current URI has metadata containing its media
type, duration, and byte-range capability.
@defproc[(didl-lite-audio-item
[uri string?]
[#:protocol-info protocol-info string?]
[#:title title string? "Media"]
[#:duration duration (or/c #f nonnegative-real?) #f]
[#:size size (or/c #f exact-nonnegative-integer?) #f]
[#:id id string? "0"]
[#:parent-id parent-id string? "0"])
string?]{
Returns an XML DIDL-Lite audio-item description. Text and attribute values
are XML-escaped automatically.
The @racket[protocol-info] value must describe the HTTP resource accurately.
For example:
@racketblock[
(didl-lite-audio-item
"http://10.7.3.118:8080/media/test.flac"
#:protocol-info
"http-get:*:audio/flac:DLNA.ORG_OP=01;DLNA.ORG_CI=0"
#:title "Test track"
#:duration 639
#:size 50357462)
]
Use @racket[media-file-server-didl-lite] when the URI was published with this
package; it fills in the protocol information and file size from the actual
publication.
}
+38 -1
View File
@@ -3,6 +3,7 @@
@(require
(for-label
racket/base
(file "../didl-lite.rkt")
(file "../media-file-server.rkt")))
@title{Publishing Media Files}
@@ -77,6 +78,26 @@ Removes the URL mapping. Requests that are already in progress may still
finish.
}
@defproc[(media-file-server-didl-lite
[server media-file-server?]
[url string?]
[#:title title (or/c #f string?) #f]
[#:duration duration (or/c #f nonnegative-real?) #f]
[#:id id string? "0"]
[#:parent-id parent-id string? "0"])
string?]{
Returns DIDL-Lite metadata for a URL previously installed with
@racket[media-file-server-publish!]. The MIME type, file size, and
@tt{DLNA.ORG_OP=01} byte-range capability are taken from the actual
publication. The file name is used as the title when @racket[title] is
@racket[#f].
Pass the result as @racket[#:metadata] or @racket[#:next-metadata] to the
media-renderer functions. Supplying the duration is recommended because some
renderers use it when deciding whether time seeking is available.
}
@defproc[(media-file-server-stop!
[server media-file-server?])
void?]{
@@ -104,10 +125,26 @@ Stops the web server. Repeated calls have no effect.
"C:/muziek/second.flac"
"second.flac"))
(define first-metadata
(media-file-server-didl-lite
files
first-uri
#:title "First track"
#:duration 639))
(define second-metadata
(media-file-server-didl-lite
files
second-uri
#:title "Second track"
#:duration 242))
(media-renderer-play-uri!
renderer
first-uri
#:next-uri second-uri)
#:metadata first-metadata
#:next-uri second-uri
#:next-metadata second-metadata)
]
Keep the URLs published until the renderer has finished reading them.
+9 -2
View File
@@ -3,6 +3,7 @@
@(require
(for-label
racket/base
(file "../media-file-server.rkt")
(file "../media-renderer.rkt")))
@title{Media Renderers}
@@ -80,10 +81,15 @@ included in the UPnP device description.
Sets @racket[uri] as the current resource and starts playback.
Supply DIDL-Lite in @racket[metadata]. Although AVTransport permits an empty
string, some renderers do not enable seeking without resource metadata. Use
@racket[media-file-server-didl-lite] for resources published by this package.
When @racket[next-uri] is supplied, it is installed with
@tt{SetNextAVTransportURI} before playback starts. A supporting renderer can
open and buffer the next resource while the current resource is playing,
allowing a gapless or near-gapless transition.
allowing a gapless or near-gapless transition. Supply matching DIDL-Lite in
@racket[next-metadata].
}
@defproc[(media-renderer-play! [renderer media-renderer?]) any]{
@@ -107,7 +113,8 @@ Reports whether the renderer advertises the optional
Sets the resource that follows the currently playing resource. The action
describes one next resource, not a complete queue. After playback advances to
that resource, call this function again to preload the following track.
that resource, call this function again to preload the following track. Use
metadata that describes @racket[uri], not the current resource.
}
@defproc[(media-renderer-pause! [renderer media-renderer?]) any]
+1
View File
@@ -5,6 +5,7 @@
@include-section["intro.scrbl"]
@include-section["main.scrbl"]
@include-section["didl-lite.scrbl"]
@include-section["media-renderer.scrbl"]
@include-section["media-server.scrbl"]
@include-section["media-file-server.scrbl"]