「DLNA」の編集履歴(バックアップ)一覧はこちら
「DLNA」(2011/01/16 (日) 22:01:47) の最新版変更点
追加された行は緑色になります。
削除された行は赤色になります。
Setup DLNA server on NAS
- Target NAS: NAS-01G
- ppc-linux
Server
- MediaTomb
- MiniDLNA
Cross Compile Environment
http://www.pages.drexel.edu/~sg64/stuff/cross-compile.htm
- Directories
$HOME/cross-compile/$TARGET/usr/bin
$HOME/cross-compile/$TARGET/install/module-X.Y.Z
$HOME/cross-compile/$TARGET/build/module-X.Y.Z
$HOME/cross-compile/$TARGET/usr/src/module-X.Y.Z
- General Setup
export TARGET=powerpc-linux
export PREFIX=$HOME/cross-compile/$TARGET/install
export PATH=$HOME/cross-compile/$TARGET/usr/bin:$PATH
export CC=$TARGET-gcc
echo "Cross Compile Envirnment for $TARGET"
- binutils-2.21
./configure --target=$TARGET --prefix=$PREFIX/binutils-2.21 \
--enable-shared \
--disable-nls #native language support. This is for i18n \
- runtime環境のコピー
runtime/lib/libc.so 等を修正 pthread関係もある。
GROUP ( libc.so.6 libc_nonshared.a )
- gcc-4.1.2 (gcc-core-4.1.2)
./configure --target=$TARGET --prefix=$PREFIX/gcc-4.1.2 \
--enable-shared \
--disable-nls \
--with-as=/home/hideo/cross-compile/powerpc-linux/usr/bin/powerpc-linux-as \
--with-ld=/home/hideo/cross-compile/powerpc-linux/usr/bin/powerpc-linux-ld \
--with-headers=$HOME/runtime/include \
--with-libs=$HOME/runtime/lib \
--enable-language=c,c++
----
- libexif
./configure --target=$TARGET --prefix=$PREFIX/libexif-0.6.20 \
--host=$TARGET \
--disable-nls
- libjpeg
./configure --host=$TARGET --prefix=$PREFIX/jpeg-8b
- zlib
./configure --prefix=$PREFIX/zlib-1.2.5
- libid3tag
./configure --host=$TARGET --prefix=$PREFIX/libid3tag-0.15.1b
- libogg-1.2.2
./configure --host=$TARGET --prefix=$PREFIX/libogg-1.2.2
- libFLAC
./configure --host=$TARGET --prefix=$PREFIX/flac-1.2.1 \
--disable-cpplibs
- libvorbis
./configure --host=$TARGET --prefix=$PREFIX/libvorbis
- sqlite3
./configure --host=$TARGET --prefix=$PREFIX/sqlite-autoconf-3070400
- libavformat (the ffmpeg libraries)
./configure --arch=$TARGET --prefix=$PREFIX/ffmpeg-0.6.1 \
--enable-shared \
--enable-nonfree \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-avdevice \
--disable-avcodec \
--disable-swscale \
--disable-altivec
- libuuid
- minidlna
sendfileがNAS-01Gのカーネルに実装されていないので、read writeを用いて自分で実装する必要がある。
http://www.man7.org/tlpi/code/online/dist/sockets/sendfile.c.html
void
send_file(struct upnphttp * h, int sendfd, off_t offset, off_t end_offset)
{
off_t orig;
char buf[MAX_BUFFER_SIZE];
size_t toRead, numRead, numSent, totSent;
if (offset != NULL) {
/* Save current file offset and set offset to value in '*offset' */
orig = lseek(sendfd, 0, SEEK_CUR);
if (orig == -1)
return -1;
if (lseek(sendfd, offset, SEEK_SET) == -1)
return -1;
}
totSent = 0;
while (end_offset > 0) {
toRead = end_offset < MAX_BUFFER_SIZE ? end_offset : MAX_BUFFER_SIZE;
numRead = read(sendfd, buf, toRead);
if (numRead == -1)
return -1;
if (numRead == 0)
break; /* EOF */
numSent = write(h->socket, buf, numRead);
if (numSent == -1)
return -1;
if (numSent == 0) /* Should never happen */
DPRINTF(E_ERROR, L_HTTP, "sendfile: write() transferred 0 bytes");
end_offset -= numSent;
totSent += numSent;
}
if (offset != NULL) {
/* Return updated file offset in '*offset', and reset the file offset
to the value it had when we were called. */
offset = lseek(sendfd, 0, SEEK_CUR);
if (offset == -1)
return -1;
if (lseek(sendfd, orig, SEEK_SET) == -1)
return -1;
}
}
----
- sqlite-autoconf-3070400
./configure --host=$TARGET --prefix=$PREFIX/sqlite-autoconf-3070400
- flac-1.2.1
./configure --host=$TARGET --prefix=$PREFIX
cd flac-1.2.1/src/libFLAC
make all
make insatll
libFLACだけが必要なのでライブラリだけコンパイルしてインストール
- ffmpeg-0.6.1
unset CFLAGS
./configure --prefix=$PREFIX --enable-cross-compile --cc=$CC \
--arch=ppc --target-os=linux \
--enable-nonfree \
--disable-altivec --disable-mmx --disable-iwmmxt --disable-armv5te --disable-armv6 --disable-asm \
--disable-stripping
cd libavformat
make all
make install
cd
make all
make install
cd
make all
make install
libsだけが必要なのでライブラリだけコンパイルしてインストール
Setup DLNA server on NAS
- Target NAS: NAS-01G
- ppc-linux
Server
- MediaTomb
- MiniDLNA
Cross Compile Environment
http://www.pages.drexel.edu/~sg64/stuff/cross-compile.htm
- Directories
$HOME/cross-compile/$TARGET/usr/bin
$HOME/cross-compile/$TARGET/install/module-X.Y.Z
$HOME/cross-compile/$TARGET/build/module-X.Y.Z
$HOME/cross-compile/$TARGET/usr/src/module-X.Y.Z
- General Setup
export TARGET=powerpc-linux
export PREFIX=$HOME/cross-compile/$TARGET/install
export PATH=$HOME/cross-compile/$TARGET/usr/bin:$PATH
export CC=$TARGET-gcc
echo "Cross Compile Envirnment for $TARGET"
- binutils-2.21
./configure --target=$TARGET --prefix=$PREFIX/binutils-2.21 \
--enable-shared \
--disable-nls #native language support. This is for i18n \
- runtime環境のコピー
runtime/lib/libc.so 等を修正 pthread関係もある。
GROUP ( libc.so.6 libc_nonshared.a )
- gcc-4.1.2 (gcc-core-4.1.2)
./configure --target=$TARGET --prefix=$PREFIX/gcc-4.1.2 \
--enable-shared \
--disable-nls \
--with-as=/home/hideo/cross-compile/powerpc-linux/usr/bin/powerpc-linux-as \
--with-ld=/home/hideo/cross-compile/powerpc-linux/usr/bin/powerpc-linux-ld \
--with-headers=$HOME/runtime/include \
--with-libs=$HOME/runtime/lib \
--enable-language=c,c++
----
- libexif
./configure --target=$TARGET --prefix=$PREFIX/libexif-0.6.20 \
--host=$TARGET \
--disable-nls
- libjpeg
./configure --host=$TARGET --prefix=$PREFIX/jpeg-8b
- zlib
./configure --prefix=$PREFIX/zlib-1.2.5
- libid3tag
./configure --host=$TARGET --prefix=$PREFIX/libid3tag-0.15.1b
- libogg-1.2.2
./configure --host=$TARGET --prefix=$PREFIX/libogg-1.2.2
- libFLAC
./configure --host=$TARGET --prefix=$PREFIX/flac-1.2.1 \
--disable-cpplibs
- libvorbis
./configure --host=$TARGET --prefix=$PREFIX/libvorbis
- sqlite3
./configure --host=$TARGET --prefix=$PREFIX/sqlite-autoconf-3070400
runtime環境でライブラリのパスを修正していないと、正しいライブラリとリンクしてくれないので注意
- libavformat (the ffmpeg libraries)
./configure --arch=$TARGET --prefix=$PREFIX/ffmpeg-0.6.1 \
--enable-shared \
--enable-nonfree \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-avdevice \
--disable-avcodec \
--disable-swscale \
--disable-altivec
- libuuid
- minidlna
sendfileがNAS-01Gのカーネルに実装されていないので、read writeを用いて自分で実装する必要がある。
http://www.man7.org/tlpi/code/online/dist/sockets/sendfile.c.html
void
send_file(struct upnphttp * h, int sendfd, off_t offset, off_t end_offset)
{
off_t orig;
char buf[MAX_BUFFER_SIZE];
size_t toRead, numRead, numSent, totSent;
if (offset != NULL) {
/* Save current file offset and set offset to value in '*offset' */
orig = lseek(sendfd, 0, SEEK_CUR);
if (orig == -1)
return -1;
if (lseek(sendfd, offset, SEEK_SET) == -1)
return -1;
}
totSent = 0;
while (end_offset > 0) {
toRead = end_offset < MAX_BUFFER_SIZE ? end_offset : MAX_BUFFER_SIZE;
numRead = read(sendfd, buf, toRead);
if (numRead == -1)
return -1;
if (numRead == 0)
break; /* EOF */
numSent = write(h->socket, buf, numRead);
if (numSent == -1)
return -1;
if (numSent == 0) /* Should never happen */
DPRINTF(E_ERROR, L_HTTP, "sendfile: write() transferred 0 bytes");
end_offset -= numSent;
totSent += numSent;
}
if (offset != NULL) {
/* Return updated file offset in '*offset', and reset the file offset
to the value it had when we were called. */
offset = lseek(sendfd, 0, SEEK_CUR);
if (offset == -1)
return -1;
if (lseek(sendfd, orig, SEEK_SET) == -1)
return -1;
}
}