Re: modifying vdubmod
Cyrius <[email protected]>
| Newsgroups | gmane.comp.video.vdubmod.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi --- suxen_drol <[email protected]> wrote: > hi, > > ive been having a look through vdubmod source code > as i'd like to modify > the code such to greater enhance xvid's vfw gui. can > you help me with a > couple of questions, or pass this mail onto the > other vdubmod chaps. Also make sure to look at the latest sources (1.5.x) that are in the VirtualDubMod15 module :) (the VirtualDub module contains the 'old' 1.4.13 code) :) > basically i want to do two things: > > 1.) add a "shortcut key" within the main vdub window > which automatically > brings up the configuration dialog of the currently > selected codec. > (as opposed to pressing CTRL-C, then clicking on the > "Configure" button). > > Q: how is the "currently selected codec" stored > within vdub? does vdub > just store the fccHandler within COMPVAR, and when > encoding begins does > it iterate through the list of available codecs and > then open the codec. > OR, does it DRV_OPEN the selected codec store the > handle somewhere. As far as I could see VirtualDub 'ICOpen' it and stores a pointer to the opened codec (HIC) in g_Vcompression.hic (so the HIC field of the COMPVARS structure). So an 'ICConfigure' should work with this pointer. Note that g_Vcompression.hic is NULL if no compressor has been selected. However it isn't NULL if you selected a compressor and changed the video mode to 'Direct stream copy' after. (in this case you get a VirtualDub warning because you chose a compressor but want a Direct stream copy). You can test if you are in 'Direct stream copy' mode with 'if(g_dubOpts.video.mode==DubVideoOptions::M_NONE)'. Nb : the code I saw had a checking before : if(!(g_Vcompression.dwFlags & ICMF_COMPVARS_VALID)) { memset(&g_Vcompression, 0, sizeof g_Vcompression); g_Vcompression.dwFlags |= ICMF_COMPVARS_VALID; g_Vcompression.lQ = 10000; } g_Vcompression.cbSize = sizeof(COMPVARS); > 2.) prior to poping up the > codec-configuarion-dialog, i want to send the > codec some information about current encoding > session. namely: > > a) image dimensions: width, height > b) framerate: either in increment, base pair, or > floating point > c) "active viewing frame" minus "the start frame > offset" > > *: about this time last year, avery and myself > discussed ways > in which to extend the vfw api without breaking > existing codecs. this > was for bframes support, but i dropped the concept > in favor of the divx > 0x7f hack. since avery wrote code for the vfwext, it > might as well put > it to use. Yeah I saw a part of code (in VideoSequenceCompressor) that would query for extended options in the case of using the XviD codec, and that would test if the codec actually output a valid compressed frame or a 'dummy' one. This part is of course put in a '#if 0 ... #endif'. > Q: Where is the video dimensions (after filtering) > stored? > Q: Where is the video framerate (after filtering) > stored? I found some information in Dubber::InitOutputFile() : EXTERN FilterSystem filters; VBitmap *outputBitmap; if (opt->video.mode >= DubVideoOptions::M_FULL) outputBitmap = filters.OutputBitmap(); else outputBitmap = filters.InputBitmap(); The width, height of the image is then outputBitmap->w, outputBitmap->h For the framerate it's a bit more complicated because a lot of things are taken into account (you forced a framerate, you asked to make video and audio the same length, you use frame decimation, ...) The best seems to do as VirtualDub and call the 'InitStreamValuesStatic(vInfo, ...)' function (defined in Duc.cpp) the first argument will then be filled with the correct framerate (vInfo.frameRate). Nb : VirtualDub however still do this after calling the function : if (opt->video.mode >= DubVideoOptions::M_FULL && opt->video.fInvTelecine) vInfo.frameRate = vInfo.frameRate * VDFraction(4, 5); > Q: How do i obtain the currently selected frame? I > noticed PositionControl.cpp > updates the " Frame %i (%i:%i:%i...)" at the bottom > of the screen by > querying the slider control, and > g_dubOpts.video.lStartOffsetMS seems > to store the start frame offset.?? Seems like the way to get the current frame index (starting from 0) is to send a message : LONG lSample = SendDlgItemMessage(g_hWnd, IDC_POSITION, PCM_GETPOS, 0, 0); Note that this will return the frame index taking into account parts you may have cut in the clip. To get the absolute frame index for the original clip you have to do : if(inputSubset) lSample = inputSubset->lookupFrame(lSample); g_dubOpts.video.lStartOffsetMS contains the starting offset in ms when you selected only a part of the clip. If the part you selected start on the first frame then g_dubOpts.video.lStartOffsetMS equals 0, otherwise it equals the time position of the first frame you have in your selection. Hope this will help you a bit :) Best regards Cyrius PS : I CC the answer to the -devel list in case other people may need those information. __________________________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo http://search.yahoo.com ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf