需求

最近很多做HiFi路由器/音响路由器的朋友在问,HiFi路由器的系统该用什么来实现是比较合适的,路由器要能修改的,只能找开源的OpenWRT之类的系统,而要实现音视频投屏,则只能找DLNA相关的插件(要不就是自己写,估计没多少人会这么干)

有了这个系统做支撑,剩下的就在这个基础上做二次开发,就能将HiFi路由器固件层面的东西实现了,剩下的就是去魔改硬件,硬件类的网上就有大把资料了。

官方网站

英文原版本介绍: https://wiki.openwrt.org/doc/uci/minidlna

MiniDLNA 功能介绍

MiniDLNA 是一款轻量级 DLNA/UPnP 媒体服务器。MiniDNLA 守护进程为网络上的客户端提供媒体文件(音乐、图片和视频)。

安装

1
2
opkg update
opkg install minidlna

第一个指令更新 第二个指令是安装minidlna

配置

编辑文件:/etc/minidlna.conf 或 /etc/config/minidlna.conf 或 /tmp/minidlna.conf 取决于您的 miniDLNA 版本

配置内容

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#------------------------------------------------------#
# port for HTTP (descriptions, SOAP, media transfer) traffic
#------------------------------------------------------#
port=8200

#------------------------------------------------------#
# network interfaces to serve, comma delimited
#------------------------------------------------------#
network_interface=br-lan

#------------------------------------------------------#
# set this to the directory you want scanned.
# * if have multiple directories, you can have multiple media_dir= lines
# * if you want to restrict a media_dir to a specific content type, you
#   can prepend the type, followed by a comma, to the directory:
#   + "A" for audio  (eg. media_dir=A,/home/jmaggard/Music)
#   + "V" for video  (eg. media_dir=V,/home/jmaggard/Videos)
#   + "P" for images (eg. media_dir=P,/home/jmaggard/Pictures)
#------------------------------------------------------#
# Directory of media is depend on your storage
#------------------------------------------------------#
media_dir=A,/mnt/sda1/music
media_dir=P,/mnt/sda1/picture
media_dir=V,/mnt/sda1/video
#------------------------------------------------------#
# set this if you want to customize the name that shows up on your clients
#------------------------------------------------------#
friendly_name=My DLNA Server

#------------------------------------------------------#
# set this if you would like to specify the directory where you want MiniDLNA to store its database and album art cache
#------------------------------------------------------#
db_dir=/mnt/sda1/minidlna/db

#------------------------------------------------------#
# set this if you would like to specify the directory where you want MiniDLNA to store its log file
#------------------------------------------------------#
log_dir=/mnt/sda1/minidlna/log

#------------------------------------------------------#
# this should be a list of file names to check for when searching for album art
# note: names should be delimited with a forward slash ("/")
#------------------------------------------------------#
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg

#------------------------------------------------------#
# set this to no to disable inotify monitoring to automatically discover new files
# note: the default is yes
#------------------------------------------------------#
inotify=yes

#------------------------------------------------------#
# set this to yes to enable support for streaming .jpg and .mp3 files to a TiVo supporting HMO
#------------------------------------------------------#
enable_tivo=no

#------------------------------------------------------#
# set this to strictly adhere to DLNA standards.
# * This will allow server-side downscaling of very large JPEG images,
#   which may hurt JPEG serving performance on (at least) Sony DLNA products.
#------------------------------------------------------#
strict_dlna=no

#------------------------------------------------------#
# default presentation url is http address on port 80
#------------------------------------------------------#
presentation_url=http://192.168.1.1:8200/

#------------------------------------------------------#
# notify interval in seconds. default is 895 seconds.
#------------------------------------------------------#
notify_interval=900

#------------------------------------------------------#
# serial and model number the daemon will report to clients
# in its XML description
#------------------------------------------------------#
serial=12345678
model_number=1

#------------------------------------------------------#
# specify the path to the MiniSSDPd socket
#------------------------------------------------------#
#minissdpdsocket=/var/run/minissdpd.sock

#------------------------------------------------------#
# use different container as root of the tree
# possible values:
#   + "." - use standard container (this is the default)
#   + "B" - "Browse Directory"
#   + "M" - "Music"
#   + "V" - "Video"
#   + "P" - "Pictures"
# if you specify "B" and client device is audio-only then "Music/Folders" will be used as root
#------------------------------------------------------#
#root_container=.

配置 (uci)

配置文件:/etc/config/minidlna

1
vi /etc/config/minidlna

配置内容:

重启服务

1
/etc/init.d/minidlna enable

启动服务

1
/etc/init.d/minidlna start

需要修改路由器的UI界面,投屏协议兼容性,以及磁盘存储配置的可以加我微信 haoke386