PDA

View Full Version : Working visualC++ nsv sample code here!


Smelter
22nd February 2007, 02:23
This sample was written using Visual Studio.net 2003 with the NSV lib provided by ultravox.aol.com

It opens an existing nsv file. unpackets each frame, creates a new nsv file, and repackets the bits without header or metadata. (file will be smaller).

The file plays.

A pre built .exe is included.

You need a small file named Iran.nsv to feed the bitstream_in.
small because I dont know how large the bitstream can get. A real app would add as recieved from the net or add as requested by the unpacketer/packer.



This is a decent starting place for writing demuxers/ recompressors/ stand-alone players/ active X / yadda yadda.

Mixers! Picture in picture! Multi bitrate out! Multi casting to DNAS server arrays!

wildex999
22nd February 2007, 11:03
I am at final stage of ALPHA of my lib now, should be able to do the same as you did.

I have also sucessfully been able to decompress X264 video into grayscale pictures, withsout using annything else than my lib and buildt in LibavCodec,(Meaning no ffdshow etc.)

Will release it today or tomorrow, wirting a smal documentation and example atm.

Annyway, good job on that you wrote =P Can't check out the code before i get home =(

slavas
22nd February 2007, 14:39
re: lavc
which "platform" did you use compiling lavc linux/mingw or maybe vs ?


btw lavc supports VP codecs too

Smelter
27th February 2007, 00:03
Untested Reference Culled from the MSDN

The purpose is to get a pointer to the function that creates the appropriate dec/enc. by enumerating all nsvdec_* or nsvenc_ files and attempt to create a decoder/encoder. If the return is NULL the conversion is not possible. See SDK notes. This function only looks for a single .dll



typedef UINT (CALLBACK* LPFNDLLFUNC1)(DWORD,UINT);
...

HINSTANCE hDLL; // Handle to DLL
LPFNDLLFUNC1 Decoder ; // Function pointer
DWORD dwParam1;
UINT uParam2, uReturnVal;

hDLL = LoadLibrary("nsvdec_vp6.dll");
if (hDLL != NULL)
{
Decoder = (LPFNDLLFUNC1)GetProcAddress(hDLL,"CreateVideoDecoder");
if (!Decoder)
{
// Its the wrong format audio/video/encoder/decoder
FreeLibrary(hDLL);
return SOME_ERROR_CODE;
}
else
{
// call the function to return a decoder object.

IVideoDecoder *IVC = Decoder(w, h, framerate, type, *flip);// some formats are top down vs bottem up

// test for null on IVC befor using it. if null it is wrong subtype- vp3/ x264 if not null
// use the decoder

int outlength=IVC->decode ( need_kf , * in , in_len , ** out , * out_type , * is_kf )

//Plug the memory leaks
IVC->Release();
FreeLibrary( hDll);


}
}


Download the codec SDK to examine all available dll functions.