Java 或 C# 中的 UPnP AV 远程控制

发布于 2024-11-05 05:37:01 字数 567 浏览 1 评论 0原文

我需要创建某种可以与 UPnP 媒体服务器交互的远程控制。

我读到,UPnP AV 堆栈有类似三个应用程序:媒体服务器、媒体渲染器、控制点。起初,我认为控制点是我想要编程的,但是,在浏览了一些库的文档后,在我看来,控制点仍然想在设备上播放服务器提供的媒体文件,控制点使用外部软件运行(与播放文件本身的媒体渲染器不同)。

我的理解正确还是完全错误?

此外,我找不到任何看起来很容易使用的库。这可能是由于我的技术较差,但我也感觉许多库的文档相当糟糕且不完整。

我不记得我遇到过的所有库,但它们包括经常提到的名称,例如 Cling、Fraunhofer FOKUS 和 Cyber​​Link。我阅读了他们网站上的大部分内容,包括一些文档,但无法真正找到如何按照我想要的方式使用它们。

我只需要可以让我连接到服务器、索引媒体列表的东西,这样我就可以跳到任何曲目,并且唯一能让我播放、停止、暂停、下一个、上一首并控制音量。但是,这些文件应该在服务器端播放

您知道 Java 或 C# 中有这样伟大的事情吗? 预先非常感谢。 :)

I need to create some kind of remote control that can interact with a UPnP media server.

I've read that there are kind of like three applications for the UPnP AV stack: media server, media renderer, control point. At first, I thought that a control point is what I want to program, however, after skimming through the docs of a few libraries, it appears to me that a control point still wants to play the media files the server provides on the very device, the control point runs on, using external software (unlike the media renderer, that plays the files itself).

Have I understood this correctly or am I totally wrong?

Furthermore, I couldn't find any library, that seemed easy enough to use. This is probably due to my poor skills but I also have the feeling that the documentation of many libraries is rather bad and incomplete.

I don't remember all the libraries I came across, but they included often mentioned names such as Cling, Fraunhofer FOKUS and CyberLink. I read most of the stuff on their websites including some docs and couldn't really find out how I could use them the way I want to.

I'd simply need something that lets me connect to a server, index the media listings so I can jump to whatever track and the only give me the possibility to play, stop, pause, next, prev and control the volume. The files however should be played back serverside.

Do you know of any such great thing for Java or C#?
Thanks a lot in advance. :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

多彩岁月 2024-11-12 05:37:01

一开始我以为是一个控件
点是我想要编程的,
然而,浏览完之后
一些库的文档,似乎
我认为控制点仍然想要
播放服务器上的媒体文件
在该设备上提供
控制点运行,使用外部
软件(与媒体渲染器不同,
播放文件本身)。

为了与 UPnP AV 兼容,软件应用程序或硬件设备必须包含至少一个 UPnP AV 设备(MediaServer、ControlPoint 或 MediaRenderer)及其强制服务。有
应用程序提供多个设备,因此,在实践中可能找不到逻辑分离。通常,视频播放器仅实现用于浏览服务器和下载其内容的 ControlPoint 服务(该内容甚至可以位于另一台服务器上)。

我只需要一些能让我
连接到服务器,索引媒体
列表,这样我就可以跳到任何内容
轨道和唯一给我
可以播放、停止、暂停、
接下来,上一个并控制音量。这
但应该播放文件
服务器端。

UPnP 定义了一些必须由设备实现的服务(例如,媒体服务器必须提供目录服务)。每个服务都有强制和可选操作(例如,可以通过Browse 方法浏览DirectoryService)。
为了实现您想要的,您的服务器必须实现 UPnP MediaServer(需要浏览其内容)和 UPnP MediaRenderer(需要控制播放)。 UPnP ControlPoint 充当一种远程控制。用于浏览服务器并选择播放文件的服务器。

浏览请求如下所示(ObjectID 0 始终表示树的根):

<Browse xmlns:u =" urn:schemas-upnp-org:service:ContentDirectory:1 ">
<ObjectID>0</ObjectID>
<Filter></Filter>
<RequestedCount>0</RequestedCount>
<StartingIndex >0</StartingIndex>
<SortCriteria ></ SortCriteria>
<BrowseFlag> BrowseDirectChildren </BrowseFlag >
</u:Browse>

服务器的响应可能如下所示:

<DIDL-Lite>
<item id="1" parentID ="0" restricted ="1">
<upnp:class>object.item.videoItem </upnp:class>
<dc:title>Video file</dc:title>
<upnp:artist>John Doe</upnp:artist>
<upnp:genre>Action</ upnp:genre>
<upnp:director>John Doe Jr.</upnp:director>
<res protocolInfo="http-get:*:video/mpeg:*" resolution ="352x288">
http://10.20.30.40:12345/ExportContent?id=1
</res>
</item>
</DIDL-Lite >

在这种情况下,服务器只有一个视频项(通常,服务器将有多个文件夹)包含许多项目)。 res 元素包含有关资源本身的信息(资源所在位置、必须使用哪种传输协议、mime 类型等)。在您的情况下,服务器甚至可以使用“localhost”作为地址进行应答,从而阻止下载文件。无论如何,服务器的 MediaRenderer 部分应该能够访问它。

我不记得我使用过的所有库
遇到过,但他们经常包括
提到了诸如 Cling 之类的名字,
弗劳恩霍夫 FOKUS 和讯连科技。

就我个人而言,我会推荐 Cyber​​Link for Java。我用它来实现 MediaServer,但它也提供了足够的功能来实现 ControlPoint 或 MediaRenderer。此外,您应该获得 UPnP 开发人员工具,例如 UPnP 开发人员工具(最初是英特尔 UPnP 工具) 适用于 Linux 的 GUPnP 工具。 GUPnP 还提供了 C 语言的 UPnP 库。这些开发人员工具允许您调用和调试 UPnP 命令,在开发过程中非常方便。另一个有用的资源是 UPnP 联盟的 UPnP 设备描述

At first, I thought that a control
point is what I want to program,
however, after skimming through the
docs of a few libraries, it appears to
me that a control point still wants to
play the media files the server
provides on the very device, the
control point runs on, using external
software (unlike the media renderer,
that plays the files itself).

To be compatible with UPnP AV, software applications or hardware devices have to include at least one UPnP AV device (MediaServer, ControlPoint or MediaRenderer) and its mandatory services. There are
applications providing several devices, thus, the logical separation may not be found in practice. Often, video players only implement the ControlPoint services for browsing a server and downloading its content (the content could be located even on another server).

I'd simply need something that lets me
connect to a server, index the media
listings so I can jump to whatever
track and the only give me the
possibility to play, stop, pause,
next, prev and control the volume. The
files however should be played back
serverside.

UPnP defines several Services that have to be implemented by a device (e.g., a MediaServer has to provide a DirectoryService). Every service has mandatory and optional actions (e.g., a DirectoryService can be browsed via the Browse method).
To achieve what you want, your server has to implement a UPnP MediaServer (needed for browsing its content) and a UPnP MediaRenderer (needed to control the playback). A UPnP ControlPoint acts as a kind of remote control. It is used to browse the server and select the server for playing back files.

A browse request looks like this (ObjectID 0 always denotes the root of the tree):

<Browse xmlns:u =" urn:schemas-upnp-org:service:ContentDirectory:1 ">
<ObjectID>0</ObjectID>
<Filter></Filter>
<RequestedCount>0</RequestedCount>
<StartingIndex >0</StartingIndex>
<SortCriteria ></ SortCriteria>
<BrowseFlag> BrowseDirectChildren </BrowseFlag >
</u:Browse>

The server answers with a response that could look like this:

<DIDL-Lite>
<item id="1" parentID ="0" restricted ="1">
<upnp:class>object.item.videoItem </upnp:class>
<dc:title>Video file</dc:title>
<upnp:artist>John Doe</upnp:artist>
<upnp:genre>Action</ upnp:genre>
<upnp:director>John Doe Jr.</upnp:director>
<res protocolInfo="http-get:*:video/mpeg:*" resolution ="352x288">
http://10.20.30.40:12345/ExportContent?id=1
</res>
</item>
</DIDL-Lite >

In this case, the server only has one video item (usually, the server will have several folders containing many items). The res element contains information about the resource itself (where it is located, which transport protocol has to be used, the mime type,...). In your case, the server could even answer with "localhost" as address, preventing downloading the file. The MediaRenderer part of your server should be able to access it anyway.

I don't remember all the libraries I
came across, but they included often
mentioned names such as Cling,
Fraunhofer FOKUS and CyberLink.

Personally, I would recommend CyberLink for Java. I used it to implement a MediaServer, however it offers enough to implement a ControlPoint or MediaRenderer too. Additionally, you should get a UPnP developer tool such as Developer tools for UPnP (originally Intel UPnP tools) or the GUPnP tools for Linux. GUPnP also provides a UPnP library for C. These developer tools allow you to invoke and debug UPnP commands and come very handy during development. Another useful resource are the UPnP device descriptions from the UPnP consortium.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文