Dabbling in AVI files

Now we are talking. This is what the jangle surrounding plug-ins is all about. The avi extension stands for Audio Video Interleave. That means it can conveniently play sound and show screenful of video at the same time. That does sound rather splashy, but following is the code for it. Before going further, make sure you do this:

#include<afxwin.h> #include "npapi.h" #include "npupp.h" #include "vfw.h" char a[100]; char c[100]; class yyy:public CWnd { public: void OnLButtonDown(UINT, CPoint p) { HWND h; h = MCIWndCreate(this->GetSafeHwnd(), AfxGetInstanceHandle(), WS_CHILD | WS_CAPTION | WS_VISIBLE | MCIWNDF_SHOWPOS | MCIWNDF_SHOWNAME, c); } DECLARE_MESSAGE_MAP() }; BEGIN_MESSAGE_MAP(yyy, CWnd) ON_WM_LBUTTONDOWN() END_MESSAGE_MAP() yyy *b; CWinApp q; short _stdcall NP_Initialize(NPNetscapeFuncs *p) { MessageBox(0, "in initialize", "in initialize", 0); return 0; } short aa(char *p, NPP i, unsigned short m, short c, char * n[], char *v[], NPSavedData *s) { MessageBox(0, "in aa", "hi", 0); return 0; } short bb(NPP i, NPWindow *w) { MessageBox(0, "in bb", "hi", 0); if (b == 0 && w->window) { b = new yyy; b->SubclassWindow( (HWND)w->window ); } return 0; } short cc(NPP i, char * p, NPStream *s, NPBool a, unsigned short *b) { MessageBox(0, "in cc", "hi", 0); *b = NP_ASFILE; return 0; } long dd(NPP i, NPStream *s) { MessageBox(0, "in dd", "hi", 0); return 0xffffff; } long ee(NPP i, NPStream *s, long o, long l, void *b) { return l; } void ff(NPP i, NPStream *s, const char *f) { strcpy(c, f); MessageBox(0, c, f,0); } short _stdcall NP_GetEntryPoints(NPPluginFuncs *p) { MessageBox(0, "in get entry points", "in get entry points", 0); p->newp = aa; p->setwindow = bb; p->newstream = cc; p->writeready = dd; p->write = ee; p->asfile = ff; return 0; } short _stdcall NP_Shutdown() { MessageBox(0, "in shutdown", "in shutdown", 0); return 0; }


The names that got lost

It took us a mouthful of gall to confront the alleged 'samples'. After scraping the innards of Netscape and yanking some meaning out of the hairy plug-in samples, we gave their spectacularly unsanitary code a thorough scrubbing. In the process, some grime (or rather some function names) got laundered. If you are not inordinately fond of jargon, this section is not for you. Nevertheless, here are some functions names as they liked to call them and as we fancy calling them...
The names that got lost
Their names Our names
NPP_New aa()
NPP_NewStream bb()
NPP_WriteReady cc()
NPP_Write dd()
NPP_StreamAsFile ee()
NPP_SetWindow ff()


Weak in the knees already? How about multiple embed statements ? Just speed to the next topic or pull up to see a real-life avi plug-in designed by some of our Netscape-diehards.

Got something that you are dying to tell someone but have no one to turn to? Well, this is not an agony column, but should you have any problems with Netscape plug-ins, help is just a click away...

Need a coffee break? Stop by our Java page and take a sip of the brand spanking new, sizzlin' beverage, the steam from which is wafting over the world!

Swivel round to Vijay Mukhi's Technology Cornucopia


Please note that this document really likes the Netscape browser


Vijay Mukhi's Computer Institute
B-13, Everest Building, Tardeo, Bombay 400 034, India.
http://www.vijaymukhi.com
e-mail : vmukhi@giasbm01.vsnl.net.in