[MPlayer-dev-eng] running a program with a keystroke - passing playing filename to it

Clément Bœsch ubitux at gmail.com
Tue Dec 21 13:44:25 CET 2010


On Tue, Dec 21, 2010 at 09:33:40AM -0300, Elias Gabriel Amaral da Silva wrote:
[...]
> Also uau suggested that instead of keeping hard-coded environment
> variables (since the list of them could grow), one should expand
> mplayer variables on run parameter, like osd_show_property_text does.

Sounds like the correct thing to do indeed.

> diff --git a/command.c b/command.c
> index b95b750..2f8d189 100644
> --- a/command.c
> +++ b/command.c
> @@ -3375,7 +3375,24 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd)
>          case MP_CMD_RUN:
>  #ifndef __MINGW32__
>              if (!fork()) {
> +                char* media_len = malloc(32);
> +                char* media_pos = malloc(32);
> +
> +                if(mp_property_do("length", M_PROPERTY_TO_STRING,
> +                                  &media_len, mpctx) <= 0 ||
> +                   mp_property_do("time_pos", M_PROPERTY_TO_STRING,
> +                                  &media_pos, mpctx) <= 0) {
> +

Huh? Isn't the allocations useless? If it is needed, are you sure there is
some kind of snprintf with a size limit to 32? And where do you free them?

-- 
Clément B.
Not sent from a jesusPhone.


More information about the MPlayer-dev-eng mailing list