Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
22nd November 2002, 22:36 | #1 | Link |
Registered User
Join Date: Nov 2001
Location: Reims, France
Posts: 75
|
How does vfw store codec settings
Well I just put my nose in all these vfw things, and I wonder how codec settings work.
I explain : when you call ICCompressorChoose and the user sets up his codec, you get a COMPVAR structure, which, I think, can't handle codec-specific settings. So I suppose that vfw, or maybe the codec itself, stores these settings somewhere, and then retrieve it when it's time to encode ? Does anybody have precision about how it works ?
__________________
Kick me, I'm dumb ! |
23rd November 2002, 00:05 | #2 | Link |
Registered User
Join Date: Jun 2002
Location: Italy
Posts: 35
|
Thank to Int21h...
and if you search the ICGetStateSize in the MSDN help you'll find other samples void SaveCodecParams(const char* filename, COMPVARS* cvar) { LONG lStateSize = 0; void* memState = NULL; FILE* fileState = fopen(filename,"wb"); lStateSize = ICGetStateSize(cvar->hic); memState = malloc(lStateSize); if (ICGetState(cvar->hic, memState, lStateSize) < 0) { _RPTF0(_CRT_WARN,"\tSaveCodecParams\tError ICGetState\n"); return; } fwrite(&cvar->fccHandler, sizeof(cvar->fccHandler), 1, fileState); fwrite(&cvar->lKey, sizeof(cvar->lKey), 1, fileState); fwrite(&cvar->lQ, sizeof(cvar->lQ), 1, fileState); fwrite(&cvar->lDataRate, sizeof(cvar->lDataRate), 1, fileState); fwrite(&lStateSize, sizeof(lStateSize), 1, fileState); fwrite(memState, lStateSize, 1, fileState); free(memState); fclose(fileState); } void LoadCodecParams(void) { int NbPassFile = 0; FILE* fileState; if ((fileState = fopen("M&M Avi 1.par", "r")) != NULL) ReadCodecParam(fileState, pcompvars); // Read 1st pass codec state else ZeroMemory(pcompvars,sizeof(COMPVARS)); if ((fileState = fopen("M&M Avi 2.par", "r")) != NULL) ReadCodecParam(fileState, pcompvars2); // Read 2st pass codec state else ZeroMemory(pcompvars2,sizeof(COMPVARS)); } |
23rd November 2002, 00:06 | #3 | Link |
Registered User
Join Date: Jun 2002
Location: Italy
Posts: 35
|
Thank to Int21h...
and if you search the ICGetStateSize in the MSDN help you'll find other samples void SaveCodecParams(const char* filename, COMPVARS* cvar) { LONG lStateSize = 0; void* memState = NULL; FILE* fileState = fopen(filename,"wb"); lStateSize = ICGetStateSize(cvar->hic); memState = malloc(lStateSize); if (ICGetState(cvar->hic, memState, lStateSize) < 0) { _RPTF0(_CRT_WARN,"\tSaveCodecParams\tError ICGetState\n"); return; } fwrite(&cvar->fccHandler, sizeof(cvar->fccHandler), 1, fileState); fwrite(&cvar->lKey, sizeof(cvar->lKey), 1, fileState); fwrite(&cvar->lQ, sizeof(cvar->lQ), 1, fileState); fwrite(&cvar->lDataRate, sizeof(cvar->lDataRate), 1, fileState); fwrite(&lStateSize, sizeof(lStateSize), 1, fileState); fwrite(memState, lStateSize, 1, fileState); free(memState); fclose(fileState); } void LoadCodecParams(void) { int NbPassFile = 0; FILE* fileState; if ((fileState = fopen("M&M Avi 1.par", "r")) != NULL) ReadCodecParam(fileState, pcompvars); // Read 1st pass codec state else ZeroMemory(pcompvars,sizeof(COMPVARS)); if ((fileState = fopen("M&M Avi 2.par", "r")) != NULL) ReadCodecParam(fileState, pcompvars2); // Read 2st pass codec state else ZeroMemory(pcompvars2,sizeof(COMPVARS)); } M&M |
23rd November 2002, 01:04 | #4 | Link | |
Registered User
Join Date: Oct 2001
Location: FRANCE
Posts: 320
|
Re: How does vfw store codec settings
Quote:
LPVOID lpState; LONG cbState; lpState is a pointer to the codec parameters struct. Each codec has is own struct. //--------------- In the codec there is : typedef struct { int : bitrate; ... } mycodec_params_type; mycodec_params_type codec_params; // ---------------- In the application you could see : compvar.lpState = &codec_params; compvar.cbState = sizeof(mycodec_params); So if you have the source of the codec, like for xvid you can easily retrieve parameters. (look at the CONFIG struct in config.h of the vfw xvid module) But if the codec change, your application will be broken ...
__________________
Regards [Toff] |
|
25th November 2002, 12:14 | #6 | Link |
Registered User
Join Date: Jun 2002
Location: Italy
Posts: 35
|
Online there is the code (1.1 beta) that saves and reloads the plugin settings.
Only it looks like it does not work so well. If you are able to work with save/load of dual pass plugins can you help me ? M&M |
|
|