[sip-comm-dev] ็How to add new Encoding To JMF


#1

I have created the new project to add new h264encoder.I use this code:
boolean result =
                            PlugInManager.addPlugIn(className,
                            ((Codec) instance).getSupportedInputFormats(),
                            ((Codec)
instance).getSupportedOutputFormats(null),
                            PlugInManager.CODEC);

and then I try to get the list of new plugin that add into PlugInManager
with this code:
               Set<String> registeredPlugins1 = new HashSet<String>();
               registeredPlugins1.addAll(PlugInManager.getPlugInList(null,
null, PlugInManager.CODEC));
                for (String string : registeredPlugins1) {
                              System.out.println("registeredPlugins1 : " +
string);
                 }

the result of registeredPlugins1 is
registeredPlugins1 : com.sun.media.codec.video.colorspace.JavaRGBToYUV
registeredPlugins1 : com.sun.media.codec.audio.msadpcm.JavaDecoder
registeredPlugins1 : com.sun.media.codec.video.jpeg.NativeDecoder
registeredPlugins1 : com.ibm.media.codec.audio.gsm.NativeDecoder_ms
registeredPlugins1 : com.ibm.media.codec.audio.gsm.JavaDecoder_ms
registeredPlugins1 : com.ibm.media.codec.audio.ulaw.JavaEncoder
registeredPlugins1 : com.sun.media.codec.video.jpeg.Packetizer
registeredPlugins1 : com.sun.media.codec.video.mpeg.DePacketizer
registeredPlugins1 : com.ibm.media.codec.audio.g723.NativeDecoder
registeredPlugins1 : com.sun.media.codec.audio.ulaw.Packetizer
registeredPlugins1 : com.ibm.media.codec.audio.ima4.JavaDecoder
registeredPlugins1 : com.sun.media.codec.video.cinepak.NativeDecoder
registeredPlugins1 : com.sun.media.codec.audio.mpa.JavaDecoder
registeredPlugins1 : com.sun.media.codec.video.vh263.NativeDecoder
registeredPlugins1 : com.sun.media.codec.audio.rc.RateCvrt
registeredPlugins1 : com.sun.media.codec.video.cinepak.JavaDecoder
registeredPlugins1 : com.sun.media.codec.video.vcm.NativeEncoder
registeredPlugins1 : com.ibm.media.codec.audio.gsm.JavaDecoder
registeredPlugins1 : com.sun.media.codec.audio.mpa.DePacketizer
registeredPlugins1 : com.ibm.media.codec.audio.gsm.JavaEncoder_ms
registeredPlugins1 : com.ibm.media.codec.video.h263.JavaDecoder
registeredPlugins1 : com.sun.media.codec.video.mpeg.Packetizer
registeredPlugins1 : com.sun.media.codec.video.vcm.NativeDecoder
registeredPlugins1 : com.sun.media.codec.audio.ulaw.DePacketizer
registeredPlugins1 :
net.java.sip.communicator.impl.media.codec.video.ImageScaler
registeredPlugins1 : com.ibm.media.codec.audio.ima4.JavaDecoder_ms
registeredPlugins1 : com.ibm.media.codec.audio.PCMToPCM
registeredPlugins1 : com.ibm.media.codec.audio.ulaw.JavaDecoder
registeredPlugins1 : com.sun.media.codec.audio.mpa.Packetizer
registeredPlugins1 : com.ibm.media.codec.audio.gsm.Packetizer
registeredPlugins1 : com.sun.media.codec.audio.mpa.NativeDecoder
registeredPlugins1 :
net.java.sip.communicator.impl.media.codec.video.h264.JNIDecoder
registeredPlugins1 : com.ibm.media.codec.video.mpeg.MpegVideo
registeredPlugins1 : com.sun.media.codec.video.jpeg.NativeEncoder
registeredPlugins1 : com.ibm.media.codec.video.h263.NativeEncoder
registeredPlugins1 : com.ibm.media.codec.audio.g723.NativeEncoder
registeredPlugins1 : com.ibm.media.codec.audio.alaw.JavaDecoder
registeredPlugins1 :
net.java.sip.communicator.impl.media.codec.video.h264.Packetizer
registeredPlugins1 : com.ibm.media.codec.audio.gsm.JavaEncoder
registeredPlugins1 : com.sun.media.codec.video.jpeg.DePacketizer
registeredPlugins1 : com.sun.media.codec.video.h261.NativeDecoder
registeredPlugins1 : com.sun.media.codec.audio.mpa.NativeEncoder
registeredPlugins1 : com.ibm.media.codec.audio.g723.Packetizer
registeredPlugins1 : com.ibm.media.codec.audio.rc.RCModule
registeredPlugins1 : com.sun.media.codec.video.colorspace.YUVToRGB
registeredPlugins1 : com.ibm.media.codec.audio.g723.JavaDecoder
registeredPlugins1 : com.ibm.media.codec.audio.dvi.JavaDecoder
registeredPlugins1 : com.ibm.media.codec.audio.ACMCodec
registeredPlugins1 :
net.java.sip.communicator.impl.media.codec.video.h264.JNIEncoder
registeredPlugins1 : com.ibm.media.codec.audio.gsm.NativeEncoder
registeredPlugins1 : com.ibm.media.codec.audio.ima4.JavaEncoder
registeredPlugins1 : com.ibm.media.codec.audio.ima4.JavaEncoder_ms
registeredPlugins1 : com.ibm.media.codec.audio.gsm.NativeDecoder
registeredPlugins1 : com.sun.media.codec.video.colorspace.JavaRGBConverter
registeredPlugins1 : com.ibm.media.codec.audio.dvi.JavaEncoder

but when I try to getSupportedFormats from trackControl I found
for (Format format1 : supported) {
                    System.out.println("format " + format1);
}

result is:
format JPEG/RTP
format H263/RTP
format JPEG/RTP
format H263/RTP
format H263/RTP
format H263/RTP
format H263/RTP
format H263/RTP
format H263/RTP

without any encoding h264/rtp so I don't know what important thing I miss
thank for your reply,
kai


#2

Hi,

Have a look at CallSessionImpl.java registerCustomCodecFormats(RTPManager
rtpManager).
There is a method rtpManager.addFormat(format,
MediaUtils.jmfToSdpEncoding(format.getEncoding()));

May be it is the thing you've missed...

···

2009/3/18 kai pk <kai5665@gmail.com>

I have created the new project to add new h264encoder.I use this code:
boolean result =
                            PlugInManager.addPlugIn(className,
                            ((Codec) instance).getSupportedInputFormats(),
                            ((Codec)
instance).getSupportedOutputFormats(null),
                            PlugInManager.CODEC);

and then I try to get the list of new plugin that add into PlugInManager
with this code:
               Set<String> registeredPlugins1 = new HashSet<String>();
               registeredPlugins1.addAll(PlugInManager.getPlugInList(null,
null, PlugInManager.CODEC));
                for (String string : registeredPlugins1) {
                              System.out.println("registeredPlugins1 : " +
string);
                 }

the result of registeredPlugins1 is
registeredPlugins1 : com.sun.media.codec.video.colorspace.JavaRGBToYUV
registeredPlugins1 : com.sun.media.codec.audio.msadpcm.JavaDecoder
registeredPlugins1 : com.sun.media.codec.video.jpeg.NativeDecoder
registeredPlugins1 : com.ibm.media.codec.audio.gsm.NativeDecoder_ms
registeredPlugins1 : com.ibm.media.codec.audio.gsm.JavaDecoder_ms
registeredPlugins1 : com.ibm.media.codec.audio.ulaw.JavaEncoder
registeredPlugins1 : com.sun.media.codec.video.jpeg.Packetizer
registeredPlugins1 : com.sun.media.codec.video.mpeg.DePacketizer
registeredPlugins1 : com.ibm.media.codec.audio.g723.NativeDecoder
registeredPlugins1 : com.sun.media.codec.audio.ulaw.Packetizer
registeredPlugins1 : com.ibm.media.codec.audio.ima4.JavaDecoder
registeredPlugins1 : com.sun.media.codec.video.cinepak.NativeDecoder
registeredPlugins1 : com.sun.media.codec.audio.mpa.JavaDecoder
registeredPlugins1 : com.sun.media.codec.video.vh263.NativeDecoder
registeredPlugins1 : com.sun.media.codec.audio.rc.RateCvrt
registeredPlugins1 : com.sun.media.codec.video.cinepak.JavaDecoder
registeredPlugins1 : com.sun.media.codec.video.vcm.NativeEncoder
registeredPlugins1 : com.ibm.media.codec.audio.gsm.JavaDecoder
registeredPlugins1 : com.sun.media.codec.audio.mpa.DePacketizer
registeredPlugins1 : com.ibm.media.codec.audio.gsm.JavaEncoder_ms
registeredPlugins1 : com.ibm.media.codec.video.h263.JavaDecoder
registeredPlugins1 : com.sun.media.codec.video.mpeg.Packetizer
registeredPlugins1 : com.sun.media.codec.video.vcm.NativeDecoder
registeredPlugins1 : com.sun.media.codec.audio.ulaw.DePacketizer
registeredPlugins1 :
net.java.sip.communicator.impl.media.codec.video.ImageScaler
registeredPlugins1 : com.ibm.media.codec.audio.ima4.JavaDecoder_ms
registeredPlugins1 : com.ibm.media.codec.audio.PCMToPCM
registeredPlugins1 : com.ibm.media.codec.audio.ulaw.JavaDecoder
registeredPlugins1 : com.sun.media.codec.audio.mpa.Packetizer
registeredPlugins1 : com.ibm.media.codec.audio.gsm.Packetizer
registeredPlugins1 : com.sun.media.codec.audio.mpa.NativeDecoder
registeredPlugins1 :
net.java.sip.communicator.impl.media.codec.video.h264.JNIDecoder
registeredPlugins1 : com.ibm.media.codec.video.mpeg.MpegVideo
registeredPlugins1 : com.sun.media.codec.video.jpeg.NativeEncoder
registeredPlugins1 : com.ibm.media.codec.video.h263.NativeEncoder
registeredPlugins1 : com.ibm.media.codec.audio.g723.NativeEncoder
registeredPlugins1 : com.ibm.media.codec.audio.alaw.JavaDecoder
registeredPlugins1 :
net.java.sip.communicator.impl.media.codec.video.h264.Packetizer
registeredPlugins1 : com.ibm.media.codec.audio.gsm.JavaEncoder
registeredPlugins1 : com.sun.media.codec.video.jpeg.DePacketizer
registeredPlugins1 : com.sun.media.codec.video.h261.NativeDecoder
registeredPlugins1 : com.sun.media.codec.audio.mpa.NativeEncoder
registeredPlugins1 : com.ibm.media.codec.audio.g723.Packetizer
registeredPlugins1 : com.ibm.media.codec.audio.rc.RCModule
registeredPlugins1 : com.sun.media.codec.video.colorspace.YUVToRGB
registeredPlugins1 : com.ibm.media.codec.audio.g723.JavaDecoder
registeredPlugins1 : com.ibm.media.codec.audio.dvi.JavaDecoder
registeredPlugins1 : com.ibm.media.codec.audio.ACMCodec
registeredPlugins1 :
net.java.sip.communicator.impl.media.codec.video.h264.JNIEncoder
registeredPlugins1 : com.ibm.media.codec.audio.gsm.NativeEncoder
registeredPlugins1 : com.ibm.media.codec.audio.ima4.JavaEncoder
registeredPlugins1 : com.ibm.media.codec.audio.ima4.JavaEncoder_ms
registeredPlugins1 : com.ibm.media.codec.audio.gsm.NativeDecoder
registeredPlugins1 : com.sun.media.codec.video.colorspace.JavaRGBConverter
registeredPlugins1 : com.ibm.media.codec.audio.dvi.JavaEncoder

but when I try to getSupportedFormats from trackControl I found
for (Format format1 : supported) {
                    System.out.println("format " + format1);
}

result is:
format JPEG/RTP
format H263/RTP
format JPEG/RTP
format H263/RTP
format H263/RTP
format H263/RTP
format H263/RTP
format H263/RTP
format H263/RTP

without any encoding h264/rtp so I don't know what important thing I miss
thank for your reply,
kai


#3

I already add it with this code :
javax.media.Format format = new VideoFormat(Constants.H264_RTP);
rtpMgrs[i].addFormat(format, 99);

but it not work
I think this code not involve with the supported formats that I get from
trackControl of the datasouce
and I try to run SipCommunicator program it can get the supported H264
format without call registerCustomCodecFormats method before.

Before now, my code can run with successful get H264/RTP format but after I
do something it not work at all with the same code.
The thing that I do (not sure)
1.copy and paste *.jar
2.copy and paste dll library

after this code not work I redo the samething that I remember

and at that time (my code run with successful) I copy the project to
another computer to run it but it cannot get h264/rtp format although that
project as same as project in my computer
maybe some problem with the library (jmf.properties, *.jar, *.dll) or
something moreover the code but I don't have any idea about it.

···

On Wed, Mar 18, 2009 at 4:21 PM, Alexander Kazeko <alexandr.temp@gmail.com>wrote:

Hi,

Have a look at CallSessionImpl.java registerCustomCodecFormats(RTPManager
rtpManager).
There is a method rtpManager.addFormat(format,
MediaUtils.jmfToSdpEncoding(format.getEncoding()));

May be it is the thing you've missed...

2009/3/18 kai pk <kai5665@gmail.com>

I have created the new project to add new h264encoder.I use this code:

boolean result =
                            PlugInManager.addPlugIn(className,
                            ((Codec) instance).getSupportedInputFormats(),
                            ((Codec)
instance).getSupportedOutputFormats(null),
                            PlugInManager.CODEC);

and then I try to get the list of new plugin that add into PlugInManager
with this code:
               Set<String> registeredPlugins1 = new HashSet<String>();
               registeredPlugins1.addAll(PlugInManager.getPlugInList(null,
null, PlugInManager.CODEC));
                for (String string : registeredPlugins1) {
                              System.out.println("registeredPlugins1 : " +
string);
                 }

the result of registeredPlugins1 is
registeredPlugins1 : com.sun.media.codec.video.colorspace.JavaRGBToYUV
registeredPlugins1 : com.sun.media.codec.audio.msadpcm.JavaDecoder
registeredPlugins1 : com.sun.media.codec.video.jpeg.NativeDecoder
registeredPlugins1 : com.ibm.media.codec.audio.gsm.NativeDecoder_ms
registeredPlugins1 : com.ibm.media.codec.audio.gsm.JavaDecoder_ms
registeredPlugins1 : com.ibm.media.codec.audio.ulaw.JavaEncoder
registeredPlugins1 : com.sun.media.codec.video.jpeg.Packetizer
registeredPlugins1 : com.sun.media.codec.video.mpeg.DePacketizer
registeredPlugins1 : com.ibm.media.codec.audio.g723.NativeDecoder
registeredPlugins1 : com.sun.media.codec.audio.ulaw.Packetizer
registeredPlugins1 : com.ibm.media.codec.audio.ima4.JavaDecoder
registeredPlugins1 : com.sun.media.codec.video.cinepak.NativeDecoder
registeredPlugins1 : com.sun.media.codec.audio.mpa.JavaDecoder
registeredPlugins1 : com.sun.media.codec.video.vh263.NativeDecoder
registeredPlugins1 : com.sun.media.codec.audio.rc.RateCvrt
registeredPlugins1 : com.sun.media.codec.video.cinepak.JavaDecoder
registeredPlugins1 : com.sun.media.codec.video.vcm.NativeEncoder
registeredPlugins1 : com.ibm.media.codec.audio.gsm.JavaDecoder
registeredPlugins1 : com.sun.media.codec.audio.mpa.DePacketizer
registeredPlugins1 : com.ibm.media.codec.audio.gsm.JavaEncoder_ms
registeredPlugins1 : com.ibm.media.codec.video.h263.JavaDecoder
registeredPlugins1 : com.sun.media.codec.video.mpeg.Packetizer
registeredPlugins1 : com.sun.media.codec.video.vcm.NativeDecoder
registeredPlugins1 : com.sun.media.codec.audio.ulaw.DePacketizer
registeredPlugins1 :
net.java.sip.communicator.impl.media.codec.video.ImageScaler
registeredPlugins1 : com.ibm.media.codec.audio.ima4.JavaDecoder_ms
registeredPlugins1 : com.ibm.media.codec.audio.PCMToPCM
registeredPlugins1 : com.ibm.media.codec.audio.ulaw.JavaDecoder
registeredPlugins1 : com.sun.media.codec.audio.mpa.Packetizer
registeredPlugins1 : com.ibm.media.codec.audio.gsm.Packetizer
registeredPlugins1 : com.sun.media.codec.audio.mpa.NativeDecoder
registeredPlugins1 :
net.java.sip.communicator.impl.media.codec.video.h264.JNIDecoder
registeredPlugins1 : com.ibm.media.codec.video.mpeg.MpegVideo
registeredPlugins1 : com.sun.media.codec.video.jpeg.NativeEncoder
registeredPlugins1 : com.ibm.media.codec.video.h263.NativeEncoder
registeredPlugins1 : com.ibm.media.codec.audio.g723.NativeEncoder
registeredPlugins1 : com.ibm.media.codec.audio.alaw.JavaDecoder
registeredPlugins1 :
net.java.sip.communicator.impl.media.codec.video.h264.Packetizer
registeredPlugins1 : com.ibm.media.codec.audio.gsm.JavaEncoder
registeredPlugins1 : com.sun.media.codec.video.jpeg.DePacketizer
registeredPlugins1 : com.sun.media.codec.video.h261.NativeDecoder
registeredPlugins1 : com.sun.media.codec.audio.mpa.NativeEncoder
registeredPlugins1 : com.ibm.media.codec.audio.g723.Packetizer
registeredPlugins1 : com.ibm.media.codec.audio.rc.RCModule
registeredPlugins1 : com.sun.media.codec.video.colorspace.YUVToRGB
registeredPlugins1 : com.ibm.media.codec.audio.g723.JavaDecoder
registeredPlugins1 : com.ibm.media.codec.audio.dvi.JavaDecoder
registeredPlugins1 : com.ibm.media.codec.audio.ACMCodec
registeredPlugins1 :
net.java.sip.communicator.impl.media.codec.video.h264.JNIEncoder
registeredPlugins1 : com.ibm.media.codec.audio.gsm.NativeEncoder
registeredPlugins1 : com.ibm.media.codec.audio.ima4.JavaEncoder
registeredPlugins1 : com.ibm.media.codec.audio.ima4.JavaEncoder_ms
registeredPlugins1 : com.ibm.media.codec.audio.gsm.NativeDecoder
registeredPlugins1 : com.sun.media.codec.video.colorspace.JavaRGBConverter
registeredPlugins1 : com.ibm.media.codec.audio.dvi.JavaEncoder

but when I try to getSupportedFormats from trackControl I found
for (Format format1 : supported) {
                    System.out.println("format " + format1);
}

result is:
format JPEG/RTP
format H263/RTP
format JPEG/RTP
format H263/RTP
format H263/RTP
format H263/RTP
format H263/RTP
format H263/RTP
format H263/RTP

without any encoding h264/rtp so I don't know what important thing I miss
thank for your reply,
kai