After I did an upgrade of some libraries on my machine including avifile (to
the current CVS version from one a couple months old), I encountered some
very strange behaviour.
Specifically, the codecs I normally use ignored the BitRate settings I was
making.
I figured I'd done something wrong, so I made sure I had the latest codec
dlls from the sites (div3 and div4). I also made sure I didn't have
corrupted sources for avifile. No changes.
Then I started looking deeper. I've generally not looked too deeply into
the inner workings of the avifile code. I've never needed to. :)
When I did, though, I found several things in the plugins/libwin32 tree that
puzzled me. I might simply be missing something and I'm not the best hacker
in the world, either so this might be wrong or misleading, but this is what
I discovered and how I ended up solving my problem locally. Hopefully
someone can tell me what naive thing I've done to cause this and solve it in
a more correct way.
First, the code that was being effectively ignored (excerpted, you can
assume valid values for all variables -- that's the first thing I checked).
const CodecInfo* codecInfo = CodecInfo::match(codec);
Creators::SetCodecAttr(*codecInfo, "BitRate", bitrate);
where codec was fccDIV3. I also tried a variety of others with no
difference in behaviour, though they defaulted to different bandwidths.
I figured something was wrong in the setting of the registry values. I
checked plugins/libwin32/libwin32.cpp.
First I noticed that it's generating keys like
"SOFTWARE\Microsoft\Scrunch\Videodiv3\BitRate". But a quick check in the
dll itself hinted that it wanted something like
"SOFTWARE\Microcrap\Scrunch\Video\BitRate". So I patched the dll to use
"Microsoft" and commented the code that generated the "div3" portion of
"Videodiv3".
I expected at this point that it would work as the keys I was generating on
my request to SetCodecAttr would match the keys being requested by the codec
dll. It didn't.
I figured I'd missed something. So I went back, looking a bit deeper. I
turned tracing on in plugins/libwin32/loader/registry.c (very handy). Then
I noticed that it wasn't "SOFTWARE\Microsoft\Scrunch\Videodiv3" that was
read when the dll is loaded (plugins/libwin32/videocodec/Module.cpp), but
"Software\LinuxLoader\div3" (and the value written into the loaded dll).
I figured this was done for a reason, but I wanted to see if this was it, so
I changed it to what I thought would work: "Software\Microsoft\Scrunch\Videodiv3"
This didn't work either. A bit more tracing later I found the last culprit,
something I'd overlooked: "SOFTWARE" != "Software". But I thought that
registry keys in Win* weren't case-sensitive. One quick final change in
registry.c from strcmp to strcasecmp and it works now.
After all of this (assuming someone's still reading) can someone explain why
none of the registry keys appear to line up? Or am I doing something else
naively wrong?
(And how _do_ you tell opendivx what bandwidth you want through avifile
anyways?)
_______________________________________________
Avifile mailing list
[EMAIL PROTECTED]
http://prak.org/mailman/listinfo/avifile