Log in

View Full Version : Forcing AVISource to use a specific decoder


stickboy
5th April 2004, 10:55
It's been suggested (http://forum.doom9.org/showthread.php?s=&threadid=71482&perpage=20&pagenumber=1#post462485) that it might be useful if people could force AVISource/et al. to use a specific decoder.

I made some changes to avi_source.cpp and source.cpp to add optional fourCC parameters to AVISource/AVIFileSource/OpenDMLSource/SegmentedAVISource. I modified AVISource::LocateVideoCodec to take a fourCC value as an argument, to try that fourCC value with AttemptCodecNegotiation, and to fall back to the file's original fourCC value if the requested one fails.

A few other changes I made while I was at it:
changed the AVISource mode values to enumeration constants instead of hard-coded ints
updated the copyright date in Versionavi_source.zip (http://www.avisynth.org/stickboy/tmp/avi_source.zip) contains modified source.cpp and avi_source.cpp files.

(Edit: Oops, meant to say "Version", not "MessageClip".)

stickboy
5th April 2004, 19:35
Oops, what I had originally wouldn't have worked with the raw YUY2/YV12/RGB32/RGB24 formats that AviSynth can handle directly. I also changed my mind about falling back to the file's original fourCC value; if people explicitly choose a decoder, they should be confident that they're getting it, and if not, they need to be informed with an error. Otherwise, they could make a typo and accidentally get the wrong decoder.

I updated avi_source.zip (http://www.avisynth.org/stickboy/tmp/avi_source.zip).

sh0dan
6th April 2004, 10:02
Thanks - I'll look through it!

Currently the Sourceforge CVS seems to be down, so I can't do a diff right now. But I'll return when I've looked at it.

(Seems like a very good addition, though).

sh0dan
6th April 2004, 17:13
The diff looked very good (the number -> enum change was also a good idea).

Changes committed!

dandragonrage
29th April 2004, 10:33
This is great to make sure that XVID decodes XviD files. But when XviD refuses to let DivX decode DivX files, I get corruption. The FourCC is already DIVX so specifying a FourCC here doesn't help. Aside from bitching to the XviD guys (I have reported this to no response), is there something else you guys can do, or does Windows only allow you to choose by FourCC?

mf
29th April 2004, 11:20
@dandragonrage
I think the FourCC stickboy has allowed us to be changed is the handler FourCC, instead of the format FourCC. If that is not the case, I would like to put up a feature request that AVISource can change both the format FCC and the handler FCC (same as VDub).

dandragonrage
29th April 2004, 11:54
XviD and DivX both use DIVX for their FourCC. XviD uses XVID for the description FourCC but that isn't used. So the problem is that XviD keeps insisting on decoding the FourCC DIVX without my permission. This results in corruption when decoding DivX files. I don't think that that is something that can be rectified by using FourCC. Perhaps I am don't have the whole story, though. In fact, I'm kind of hoping that I'm wrong and that it can actually be done ;)

mf
29th April 2004, 12:12
You are again describing that XviD has taken over the FccHandler for DIVX FCCs. Re-read my post above.

SoonUDie
29th April 2004, 12:14
dandragonrage, I haven't had such a problem with XviD - the decoder allows you to choose which FourCCs it decodes, and once I delect DivX, the DivX decoder is correctly loaded for DivX files. Are you saying that XviD is still decoding some of your DivX files even after you've done this?

Also, is there any advantage to using Avisource() with a specified FourCC as opposed to using DirectShowSource() with a .grf file (which allows for much better customization, I assume)?

dandragonrage
29th April 2004, 12:33
The reason I don't like to use DirectShowSource is that it'll go thru frames normally for a bit and then it will flash back and forth between the correct frame and an incorrect one. I can't explain it too well so I'll see if I can get a clip now.

Edit: I can't seem to get it to happen again. Weird. I don't remember which script was doing it, though. The only thing I've done since then is update FFDShow from 4-18 to 4-24....