GNOME Bugzilla – Bug 113537
xvid mega-patch
Last modified: 2005-08-15 01:29:52 UTC
The changes are building up in my tree so i better put this in bugzilla. There are two parts to this patch (so far): 1. Add convert to the src pad so downstream elements (like avimux) can query the FPS. 2. Split the caps nego into two phases since each pad can be ready or not ready independently.
Created attachment 16738 [details] [review] caps & FPS for xvid
Concerning the convert() function: why? What's the use of it? I mean, it's interesting if other elements can query these kind of properties, but: * bitrates are generally not constant (VBR) * fps queries should be forwarded to elements upstream For the other one, what's the use of changing capsnego from how it's normally done in encoder/decoder elements? Can you explain why it's needed?
Forward FPS requests upstream? Good idea! Ignore that part of my patch. Concerning the caps nego, i start running a decode pipeline as below. (Actually i am programming in C, but i will write in gst-launch syntax because it's easier to explain what i'm doing.) filesrc location=/local/aleader/original/Star_Wars_1.mpg ! mpegdemux name=demux demux.video_00 { queue name=vdemux_q ! mpeg2dec ! fakesink } demux.audio_00 ! mad ! fakesink Then i do a seek (via an index), unlink the fakesinks, and link the outputs to the encode part of the pipeline so it looks like this: ./gst-launch { avimux name=mux ! filesink location=/tmp/test.avi } filesrc location=/local/aleader/original/Star_Wars_1.mpg ! mpegdemux name=demux demux.video_00 ! { queue name=vdemux_q ! mpeg2dec ! xvidenc ! queue name=vmux_q ! mux.video_00 } demux.audio_00 ! mad ! lame ! queue name=audio_q ! mux.audio_00 This is where the caps nego fails because half of the pipeline is PAUSED and half is NULL. For example, the sink pad of xvidenc can do caps nego but the src pad can't because that part of the pipeline is in the NULL state. So when the sink pad does nego, it works but then it tries to setup the src pad at the same time so it actually REJECTs and the scheduler gives up. So we need to nego each pad independently and return DELAYED if the peer pad isn't ready yet. (i make an assumption here that caps nego isn't possible when both elements are in the NULL state. Maybe we should blame the scheduler instead of the caps nego.)
Created attachment 17044 [details] [review] similar patch for divxenc
Conceptually, i think these patches are needed. However, do not simply apply them. i suspect there is a reference counting problem lurking (and i don't understand how to debug it yet). So check these patches carefully before committing.
I'm trying to think of why you'd want this and I can somehow see why... I just don't think this is the right solution, but that's just because I'm weird, I guess... My brain is currently telling me that the right way to do it is to add a _getcaps() function to the src pad (instead of a _link() function) which returns variable or fixed caps (width/height) based on whether the sink pad is linked or not. The capsnego system will then take care of the rest. What do you think?
Dunno for sure, but that's probably a better solution.
Adding the PATCH keyword and upgrading the priority level to High because of the attached patches.
The new caps system implements all this. I'm closing this. Joshua, if you find anything not working in re-negotiation, please open a new bug. The current HEAD CVS should allow renego in all elements.