[MPlayer-dev-eng] Multiple -vf-add on the command line (and probably other -list-add)

Adrian Stutz adrian at sttz.ch
Sun Jul 12 16:34:37 CEST 2009


Hello,

I'm under the assumption that it should be possible to use multiple
-vf-add options on the command line. I couldn't find anything stating
the opposite and found various examples using two -vf-add on the
command line.

When using multiple -vf-add however, I occasionally run into the
problem that latter of them are seemingly ignored and that sometimes
reordering or removing unrelated options fixed the issue.

I decided to investigate and traced the problem down to
play_tree_set_param(), where the options are stored on the playtree
and later applied. play_tree_set_param() doesn't actually support
multiple commands with the same name and should overwrite any -vf-add
with the following one.

Though, due to what seems like a bug to me, this is not the case for
the first item in the playtree params list. If an item with the same
name is found at index 0 then it's not overwritten and a second option
with the same name is added. This way it's possible to use two
-vf-add, but only if the first -vf-add is the first param added to the
playtree list - otherwise only one can be used.

i.e.
$mplayer file.mkv -vf-add mirror -vf-add mirror
- results in a non-mirrored image (2 x mirror)

$mplayer file.mkv -af-add bs2b -vf-add mirror -vf-add mirror
- results in a mirrored image (1 x mirror)

Additionally, overwriting doesn't seem to work properly, though I'm
not sure what the reason could be.

$mplayer file.mkv -vf mirror -vf flip
- this works because of the bug above, the overwriting happens at a
later stage (image is flipped)

$mplayer file.mkv -af bs2b -vf mirror -vf flip
- the second -vf option fails to overwrite the first in
play_tree_set_param() and the image is mirrored instead of flipped

Attached is a patch the fixes the check if a match has been found,
though that exposes two problems:
* It's no longer possible to use two -*-add, even if that only worked unreliably
* It more clearly exposes the overwrite bug which I haven't had time
to find a fix for

Which brings me back to the original question: Should it be possible
to use multiple -vf-add? What would be the preferred way to add that
to play_tree_set_param so that multiple of those list options don't
get overwritten (the rest of the list handling seems to handle that
just fine).

Greetings
Adrian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: playtree_found_match_check_fix.patch
Type: text/x-diff
Size: 352 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20090712/866e5b68/attachment.patch>


More information about the MPlayer-dev-eng mailing list