[MPlayer-users] Self-executing

The Wanderer inverseparadox at comcast.net
Sat May 24 14:33:20 CEST 2008


Evgeniy Stepanov wrote:

> On Saturday 24 May 2008 04:14:50 The Wanderer wrote:
>> Evgeniy Stepanov wrote:

>>> Why not? Just append the movie to mplayer binary and run it on
>>> itself with an appropriate -sb option.
>> 
>> Because you also need to include the "glue" code to do the running,
>> which would also need to be prepended to the rest, and which would
>> need to contain both the offset for the beginning of the MPlayer
>> binary (which binary would, potentially, need to be extracted into
>> a separate file in order to be able to be run...) and the offset
>> for the beginning of the movie, both of which will be dependent on
>> the total size of the glue code itself - and unless you're writing
>> in ASM, producing a final binary of a predictable size (even given
>> a consistent environment and compiler and so forth) is not
>> necessarily trivial.
>> 
>> Might not be impossible, but it looks complicated enough that I for
>> one wouldn't want to promise to be able to do it, much less if
>> tempfiles were not an option.
> 
> You don't need any "glue" code, mplayer itself can do all you need.

Not 'as shipped', it can't - and the the OP did say he is not a
programmer. In principle I can see how the patch you provided should be
able to do what is needed.

> I have not checked this in Windows, but here in linux this patch
> works perfectly well. At least with mkv demuxer, others seem to have
> problems with -sb.
> 
> The magic constant is the offset of video in the resulting binary, it
> could be anything larger then the mplayer binary size. Changing it
> does not change the size of the binary, so you will need to recompile
> mplayer just once to get it right.

I didn't think of doing it that way - the "pad out the binary to get a
consistent offset" approach, trading size for ease of implementation.
Wouldn't you then need some additional tool, applied
post-compilation-time, to pad the binary out to that offset? (Trivial
enough in Linux, but given that the OP mentioned wanting an EXE I
suspect he's running Windows.)

-- 
       The Wanderer

Warning: Simply because I argue an issue does not mean I agree with any
side of it.

Secrecy is the beginning of tyranny.



More information about the MPlayer-users mailing list