文章摘要:
在高清横行的年代里,rmvb格式基本即将退出历史的舞台,所以原生的minidlna不支持rmvb文件格式,也是天经地义的,但是由于历史遗留问题,毕竟其曾经也红火了那么多年,所以目前仍有一些存量视频存在的事实,而且目前大部分播放器都兼容rmvb格式;
对于minidlna来说,解决的方法之一就是修改文件扩展名即可(怎么有一种windows的感觉呢?);
另一种方法就是修改源码,将rmvb文件格式添加入支持列表,即本文提供的方法。


操作系统:Debian 8
软件版本:minidlna 1.1.6


修改metadata.c

// 大约841行处
else if( strncmp(ctx->iformatctx->name, "matroska", 8) == 0 )
    xasprintf(&m.mime, "video/x-matroska");
else if( strcmp(ctx->iformatctx->name, "flv") == 0 )
    xasprintf(&m.mime, "video/x-flv");

// ---- 添加以下代码 ----
else if( strcmp(ctx->iformat->name, "rm") == 0 )
    xasprintf(&m.mime, "video/x-pn-realvideo");
else if( strcmp(ctx->iformat->name, "rmvb") == 0 )
    xasprintf(&m.mime, "video/x-pn-realvideo");
// ---- 添加代码结束 ----

修改upnpglobalvars.h

// 大约169行处,添加下边一行
"http-get:*:video/x-pn-realvideo:*,"  \
"http-get:*:application/ogg:*"

修改utils.c

// 大约381行处  
ends_with(file, ".m2t") || ends_with(file, ".mkv")   ||  
ends_with(file, ".vob") || ends_with(file, ".ts")    ||  
ends_with(file, ".flv") || ends_with(file, ".xvid")  || 

//---- 添加以下代码 ----  
ends_with(file, ".rm")  || ends_with(file, ".rmvb")  ||  
//---- 添加代码结束 ----  

重新编译安装即可;


移植好的版本:

https://github.com/chun912/minidlna.git