2010年5月31日 星期一

Broadcom Crystal HD for Linux

1.Compile procdure

unzip crystalhd_linux_20091229.zip


cd crystalhd

cd driver/linux

fromdos ./*
autoconf

$ ./configure
checking for ld... ld
configure: creating ./config.status
config.status: creating ./Makefile

$ make
make -C /lib/modules/2.6.32-22-generic/build SUBDIRS=/home/steve/crystalhd/driver/linux modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-22-generic'
  CC [M]  /home/steve/crystalhd/driver/linux/crystalhd_lnx.o
  CC [M]  /home/steve/crystalhd/driver/linux/crystalhd_misc.o
  CC [M]  /home/steve/crystalhd/driver/linux/crystalhd_cmds.o
  CC [M]  /home/steve/crystalhd/driver/linux/crystalhd_hw.o
  LD [M]  /home/steve/crystalhd/driver/linux/crystalhd.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/steve/crystalhd/driver/linux/crystalhd.mod.o
  LD [M]  /home/steve/crystalhd/driver/linux/crystalhd.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-22-generic'

$chmod 755 bcm_70012_dev.sh bcm_70012_run.sh

$ sudo make install
[sudo] password for steve:
install -d /lib/modules/2.6.32-22-generic/kernel/drivers/video/broadcom
install -m 0644 crystalhd.ko /lib/modules/2.6.32-22-generic/kernel/drivers/video/broadcom
/sbin/depmod -a

cd ../../linux_lib/libcrystalhd

fromdos ./*

$ make
OBJFILES = libcrystalhd_if.o libcrystalhd_int_if.o libcrystalhd_fwcmds.o libcrystalhd_priv.o libcrystalhd_fwdiag_if.o
SRCFILES = libcrystalhd_if.cpp libcrystalhd_int_if.cpp libcrystalhd_fwcmds.cpp libcrystalhd_priv.cpp libcrystalhd_fwdiag_if.cpp
LNM = libcrystalhd.so.1.0 libcrystalhd.so.1
g++  -D__LINUX_USER__ -I./ -I/usr/include -I../../include -I../../include/link -g -Wall -fPIC -shared  -c -o libcrystalhd_if.o libcrystalhd_if.cpp
libcrystalhd_if.cpp: In function ‘BC_STATUS DtsProcInput(void*, uint8_t*, uint32_t, uint64_t, BOOL)’:
libcrystalhd_if.cpp:1340: warning: format not a string literal and no format arguments
libcrystalhd_if.cpp:1346: warning: format not a string literal and no format arguments
libcrystalhd_if.cpp:1366: warning: format not a string literal and no format arguments
g++  -D__LINUX_USER__ -I./ -I/usr/include -I../../include -I../../include/link -g -Wall -fPIC -shared  -c -o libcrystalhd_int_if.o libcrystalhd_int_if.cpp
g++  -D__LINUX_USER__ -I./ -I/usr/include -I../../include -I../../include/link -g -Wall -fPIC -shared  -c -o libcrystalhd_fwcmds.o libcrystalhd_fwcmds.cpp
g++  -D__LINUX_USER__ -I./ -I/usr/include -I../../include -I../../include/link -g -Wall -fPIC -shared  -c -o libcrystalhd_priv.o libcrystalhd_priv.cpp
libcrystalhd_priv.cpp: In function ‘BC_STATUS DtsDeleteMdataPool(DTS_LIB_CONTEXT*)’:
libcrystalhd_priv.cpp:579: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 2 has type ‘uintptr_t’
g++  -D__LINUX_USER__ -I./ -I/usr/include -I../../include -I../../include/link -g -Wall -fPIC -shared  -c -o libcrystalhd_fwdiag_if.o libcrystalhd_fwdiag_if.cpp
g++ -D__LINUX_USER__ -I./ -I/usr/include -I../../include -I../../include/link -g -Wall -fPIC -shared -Wl,-soname,libcrystalhd.so.1 -o libcrystalhd.so.1.0 libcrystalhd_if.o libcrystalhd_int_if.o libcrystalhd_fwcmds.o libcrystalhd_priv.o libcrystalhd_fwdiag_if.o
ln -sf libcrystalhd.so.1.0 libcrystalhd.so
ln -sf libcrystalhd.so.1.0 libcrystalhd.so.1

$ chmod 755 ln-libcrystalhd.sh

$ sudo make install
install -m 755 libcrystalhd.so.1.0 /usr/lib
(cd /usr/lib; ln -sf libcrystalhd.so.1.0 libcrystalhd.so)
(cd /usr/lib; ln -sf libcrystalhd.so.1.0 libcrystalhd.so.1)

cd ../../filters/gst/gst-plugin

fromdos ./*

chmod 755 autogen.sh autoregen.sh gst-autogen.sh

Fix src/Makefile.am
Change this line
INCLUDES += -I$(ROOTDIR)/linux_lib/ldil
to
INCLUDES += -I$(ROOTDIR)/linux_lib/libcrystalhd

Change this line
BCMDEC_LDFLAGS = -L$(ROOTDIR)/linux_lib/ldil -lcrystalhd
to
BCMDEC_LDFLAGS = -L$(ROOTDIR)/linux_lib/libcrystalhd -lcrystalhd

Modify src/decif.h
Change this line
#include "bc_ldil_if.h"
to
#include "libcrystalhd_if.h"

$ ./autogen.sh
+ check for build tools
  checking for autoconf >= 2.52 ... found 2.65, ok.
  checking for automake >= 1.7 ... found 1.11.1, ok.
  checking for libtoolize >= 1.5.0 ... found 2.2.6b, ok.
  checking for pkg-config >= 0.8.0 ... found 0.22, ok.
+ checking for autogen.sh options
  This autogen script will automatically run ./configure as:
  ./configure --enable-maintainer-mode --enable-debug
  To pass any additional options, please specify them on the ./autogen.sh
  command line.
+ running aclocal -I m4/ ...
+ running libtoolize --copy --force...
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
+ running autoheader ...
+ running autoconf ...
+ running automake -a -c...
+ running configure ...
  ./configure default flags: --enable-maintainer-mode --enable-debug
...
...

$make

$sudo make install

2.Run test program

$ cd crystalhd/driver/linux
$ sudo ./bcm_70012_run.sh
[sudo] password for steve:
Stopping Broadcom Crystal HD (BCM70012) Module
Broadcom Crystal HD (BCM70012) Module loaded

$ cd ../../examples
$ ./hellobcm
starting up
Running DIL (0.9.25) Version
Mdata Pool Created...
DtsSetupHardware: DtsPushAuthFwToLink
DtsGetFirmwareFiles:Ctx->FwBinFile is /lib/firmware/bcmFilePlayFw.bin
DtsSetupHardware: Success
ADD buffs
ADD buffs
ADD buffs
ADD buffs
ADD buffs
ADD buffs
ADD buffs
ADD buffs
DbgOptions=b0000025
try calls done
file opened successfully
Input Buffer: 0x9339b20
Aligned Input Buffer: 0x9339b20, Offset = 0
Y Buffer: 0xb532f008
FormatCh: Width: 1920 Height: 1080 Res:e
Dtsprocout:update stats
Format Change Detected. Flags: 0x00030004
New Format
----------------------------------
    TimeStamp: 0
    Picture Number: 0
    Width: 1920
    Height: 1080
    Chroma: 0x420
    Pulldown: 9
    Flags: 0x00000000
    Frame Rate/Res: 14
    Aspect Ratio: 1
    Color Primaries: 2
    MetaData: 0
    Session Number: 0
    TimeStamp: 0
    Custom Aspect: 0
    Frames to Drop: 0
    H264 Valid Fields: 0x00000000
DtsProcOutput: Failed to copy out buffs.. f
I/O Transfer Error.
Invalid PIB received. Skipping picture. Flags: 0x00000004
Received Output. Bytes In: 262144, Y: 1038720, UV: 0, Number: 3, H: 1080, W: 1920, Flags: 0x00020004
Received Output. Bytes In: 327680, Y: 1038720, UV: 0, Number: 4, H: 1080, W: 1920, Flags: 0x00020004
Received Output. Bytes In: 393216, Y: 1038720, UV: 0, Number: 5, H: 1080, W: 1920, Flags: 0x00020004
...
...
...

3.XBMC support

Download XBMC source code and enable CrystalHD support then build.
It works great ...

PS : Do not get xbmc form apt...

4.Gstreamer plug-in
The Crystal HD gstreamer plug-in is bcmdec
In fact, it's not work ...

$ gst-launch playbin2 uri=file:///home/steve/video.mp4
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Running DIL (0.9.25) Version
Mdata Pool Created...
DtsSetupHardware: DtsPushAuthFwToLink
DtsGetFirmwareFiles:Ctx->FwBinFile is /lib/firmware/bcmFilePlayFw.bin
DtsSetupHardware: Success
OPEN success

Then nothing happen ...

依據以下的link做修改, Crystal HD gstreamer plug-in works
http://git.wilsonet.com/crystalhd.git/?a=blobdiff;f=filters/gst/gst-plugin/src/gstbcmdec.c;h=c321e27bba831bf99197f75454e7dde8ec36d78a;hp=1fd2eccc23d753d047b20bc076377ebcb57c4838;hb=1f293c968e5ab8dad3ad0c3ceefa91cbb1bcce63;hpb=a8e27b2203eb2c1f0266176f5c70d8c5b6102c76

totem 播放mp4 h.264 with Crystal HD works






沒有留言:

張貼留言