Java 或 C# 中的 UPnP AV 远程控制
我需要创建某种可以与 UPnP 媒体服务器交互的远程控制。
我读到,UPnP AV 堆栈有类似三个应用程序:媒体服务器、媒体渲染器、控制点。起初,我认为控制点是我想要编程的,但是,在浏览了一些库的文档后,在我看来,控制点仍然想在设备上播放服务器提供的媒体文件,控制点使用外部软件运行(与播放文件本身的媒体渲染器不同)。
我的理解正确还是完全错误?
此外,我找不到任何看起来很容易使用的库。这可能是由于我的技术较差,但我也感觉许多库的文档相当糟糕且不完整。
我不记得我遇到过的所有库,但它们包括经常提到的名称,例如 Cling、Fraunhofer FOKUS 和 CyberLink。我阅读了他们网站上的大部分内容,包括一些文档,但无法真正找到如何按照我想要的方式使用它们。
我只需要可以让我连接到服务器、索引媒体列表的东西,这样我就可以跳到任何曲目,并且唯一能让我播放、停止、暂停、下一个、上一首并控制音量。但是,这些文件应该在服务器端播放。
您知道 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了与 UPnP AV 兼容,软件应用程序或硬件设备必须包含至少一个 UPnP AV 设备(MediaServer、ControlPoint 或 MediaRenderer)及其强制服务。有
应用程序提供多个设备,因此,在实践中可能找不到逻辑分离。通常,视频播放器仅实现用于浏览服务器和下载其内容的 ControlPoint 服务(该内容甚至可以位于另一台服务器上)。
UPnP 定义了一些必须由设备实现的服务(例如,媒体服务器必须提供目录服务)。每个服务都有强制和可选操作(例如,可以通过
Browse
方法浏览DirectoryService)。为了实现您想要的,您的服务器必须实现 UPnP MediaServer(需要浏览其内容)和 UPnP MediaRenderer(需要控制播放)。 UPnP ControlPoint 充当一种远程控制。用于浏览服务器并选择播放文件的服务器。
浏览请求如下所示(ObjectID 0 始终表示树的根):
服务器的响应可能如下所示:
在这种情况下,服务器只有一个视频项(通常,服务器将有多个文件夹)包含许多项目)。 res 元素包含有关资源本身的信息(资源所在位置、必须使用哪种传输协议、mime 类型等)。在您的情况下,服务器甚至可以使用“localhost”作为地址进行应答,从而阻止下载文件。无论如何,服务器的 MediaRenderer 部分应该能够访问它。
就我个人而言,我会推荐 CyberLink for Java。我用它来实现 MediaServer,但它也提供了足够的功能来实现 ControlPoint 或 MediaRenderer。此外,您应该获得 UPnP 开发人员工具,例如 UPnP 开发人员工具(最初是英特尔 UPnP 工具) 或适用于 Linux 的 GUPnP 工具。 GUPnP 还提供了 C 语言的 UPnP 库。这些开发人员工具允许您调用和调试 UPnP 命令,在开发过程中非常方便。另一个有用的资源是 UPnP 联盟的 UPnP 设备描述。
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).
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):
The server answers with a response that could look like this:
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.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.