查看: 5247|回复: 0
收起左侧

[中级教程] 如何打造轻量级局域网视频共享---DLNA服务器minidlna

2015-5-2 11:10:12 | 显示全部楼层 |阅读模式
本帖最后由 vanabel 于 2015-5-2 11:16 编辑

原教程发布于:Raspiberry Pi安装minidlna1.1.4并支持rmvb

首选参考1编译安装1.1.4.
1. 卸载掉1.0.24
  1. sudo apt-get purge minidlna -y
  2. sudo apt-get remove minidlna
  3. sudo apt-get autoremove -y2
复制代码

2. 添加源:
  1. echo "deb-src <a target="_blank" href="http://archive.raspbian.org/raspbian">http://archive.raspbian.org/raspbian</a> wheezy main contrib non-free" | sudo tee -a /etc/apt/sources.list
复制代码

并更新源:
  1. sudo apt-get update
复制代码

3. 安装编译环境依赖包:
  1. sudo apt-get build-dep minidlna -y
复制代码

你也可以手动安装:
  1. sudo apt-get install libjpeg-dev libsqlite3-dev libexif-dev libid3tag0-dev libvorbis-dev libflac-dev -y
复制代码


4. 下载minidlna1.1.4源码:
  1. wget <a target="_blank" href="http://sourceforge.net/projects/minidlna/files/minidlna/1.1.4/minidlna-1.1.4.tar.gz">http://sourceforge.net/projects/ ... nidlna-1.1.4.tar.gz</a>
复制代码

并解压:
  1. tar -xvf minidlna-1.1.4.tar.gz
复制代码

然后切换到目录:
  1. cd minidlna-1.1.4
复制代码


5. 编辑源码使得支持rmvb, 主要修改的地方有23
  1. diff -ur minidlna-1.1.4/metadata.c minidlna-1.1.4-usr/metadata.c
  2. --- minidlna-1.1.4/metadata.c   2014-08-27 05:09:22.000000000 +0800
  3. +++ minidlna-1.1.4-usr/metadata.c       2015-05-02 08:11:35.278306437 +0800
  4. @@ -841,6 +841,12 @@
  5.                         xasprintf(&m.mime, "video/x-matroska");
  6.                 else if( strcmp(ctx->iformat->name, "flv") == 0 )
  7.                         xasprintf(&m.mime, "video/x-flv");
  8. +               //add by user to support rmvb
  9. +               //from http://blog.csdn.net/Haven200/article/details/43039261
  10. +               else if( strcmp(ctx->iformat->name, "rm") == 0 )
  11. +                       xasprintf(&m.mime, "video/x-pn-realvideo");
  12. +               else if( strcmp(ctx->iformat->name, "rmvb") == 0 )
  13. +                       xasprintf(&m.mime, "video/x-pn-realvideo");
  14.                 if( m.mime )
  15.                         goto video_no_dlna;
  16. diff -ur minidlna-1.1.4/upnpglobalvars.h minidlna-1.1.4-usr/upnpglobalvars.h
  17. --- minidlna-1.1.4/upnpglobalvars.h     2014-08-27 05:09:22.000000000 +0800
  18. +++ minidlna-1.1.4-usr/upnpglobalvars.h 2015-05-02 08:15:07.937072539 +0800
  19. @@ -169,7 +169,8 @@
  20.         "http-get:*:audio/mp4:*," \
  21.         "http-get:*:audio/x-wav:*," \
  22.         "http-get:*:audio/x-flac:*," \
  23. -       "http-get:*:application/ogg:*"
  24. +       "http-get:*:application/ogg:*,"\
  25. +  "http-get:*:video/x-pn-realvideo:*"

  26. #define DLNA_FLAG_DLNA_V1_5      0x00100000
  27. #define DLNA_FLAG_HTTP_STALLING  0x00200000
  28. diff -ur minidlna-1.1.4/utils.c minidlna-1.1.4-usr/utils.c
  29. --- minidlna-1.1.4/utils.c      2014-08-27 05:09:22.000000000 +0800
  30. +++ minidlna-1.1.4-usr/utils.c  2015-05-02 08:03:17.031201433 +0800
  31. @@ -381,6 +381,7 @@
  32.                 ends_with(file, ".m2t") || ends_with(file, ".mkv")   ||
  33.                 ends_with(file, ".vob") || ends_with(file, ".ts")    ||
  34.                 ends_with(file, ".flv") || ends_with(file, ".xvid")  ||
  35. +               ends_with(file, ".rm")  || ends_with(file, ".rmvb")  ||
  36. #ifdef TIVO_SUPPORT
  37.                 ends_with(file, ".TiVo") ||
  38. #endif
复制代码
安装
  1. sudo apt-get install autoconf automake autopoint
复制代码

并执行
  1. ./autogen.sh
复制代码
然后配置编译环境:
  1. ./configure –disable-nls
复制代码

7. 编译并安装:
  1. make && sudo make install
复制代码

8. 复制minidlna配置文件:
  1. sudo cp minidlna.conf /etc/
复制代码

并编辑
  1. sudo vim /etc/minidlna.conf
复制代码

修改
  1. media_dir=/home/pi/downloads/Torrent_complete
  2. # Names the DLNA server
  3. friendly_name=RasPi Media Server
  4. # Tells the DLNA to update the library when there are changes
  5. inotify=yes
复制代码


这里我们把所有媒体都放到了media_dir, 请对应修改. inotify表示是否刷新新文件
9. 开启服务:
  1. sudo service minidlna start
复制代码

10. 开机自启动:
  1. sudo cp linux/minidlna.init.d.script /etc/init.d/minidlna
  2. sudo chmod 755 /etc/init.d/minidlna
  3. sudo update-rc.d minidlna defaults
复制代码




参考文献


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

热点推荐

关注我们,了解更多

官方微信

服务时间:10:00-16:00

13714503811

公司地址:深圳市龙岗区南湾街道东门头路8号

Copyright © 2012-2020 Powered by 树莓派论坛 2019.4  粤ICP备15075382号-1
快速回复 返回列表 返回顶部