Crate dlna_dmr

Crate dlna_dmr 

Source
Expand description

§dlna-dmr library crate

If you are reading this, you are reading the documentation for the dlna-dmr library crate. For the cli, kindly refer to the README file.

§Overview

This crate provides a framework for building a Digital Media Renderer (DMR). It only provides the functionality of accepting commands from a Digital Media Controller (DMC), and how to handle them will be left to you to implement.

§Usage

To build your DMR, you’ll first need to implement the HTTPServer trait, which describes how to handle various commands:

use dlna_dmr::HTTPServer;

struct MyDMR {}

impl HTTPServer for MyDMR {
  // Refer to the documentation of `HTTPServer` on how to implement.
}

Then, you simply implement the DMR trait:

use dlna_dmr::{DMR, HTTPServer};
impl DMR for MyDMR {}

To start your DMR, call the method DMR::run with an option:

use dlna_dmr::{DMR, DMROptions, HTTPServer};
use std::sync::Arc;

    // Instantiate `MyDMR`
    let dmr = MyDMR {};
    let dmr = Box::leak(Box::new(dmr));
    // Use default config (Refer to documentation of `DMROptions` on configuration)
    let options = DMROptions::default();
    // Running the DMR until Ctrl-C is pressed.
    dmr.run(Arc::new(options)).await.unwrap();

Modules§

xml
Module for deserializing and extracting information from XML messages.

Structs§

DMROptions
Options for a DMR instance.

Traits§

DMR
A trait for DMR instances.
HTTPServer
A trait for handling HTTP requests for a DLNA DMR (Digital Media Renderer).

Type Aliases§

Response
Type alias for http::Response whose body type defaults to Body, the most common body type used with axum.