[MPlayer-dev-eng] [PATCH] EDL changes: loadfile and adjust pts functionality
Reynaldo H. Verdejo Pinochet
reynaldo at opendot.cl
Thu Sep 2 01:26:49 CEST 2010
Hi Vlad
On Wed, Sep 01, 2010 at 04:04:38PM -0400, Vlad Seryakov wrote:
>
> On Sep 1, 2010, at 1:57 PM, Reynaldo H. Verdejo Pinochet wrote:
>
> [..]
> >> + edl_filename = strdup(cmd->args[0].v.s);
> >> + edl_loadfile();
> >> + break;
> >> + }
> >
> > if(cmd->id == MP_CMD_EDL_LOADFILE)?
> >
> > Also, I keep thinking checking for NULL in the malloced strdup
> > returning pointer an terminating if out of mem might be wise,
> > it certainly wouldn't hurt but I dunno what others might say.
> >
> In case of NULL it will not just load any edl file which is not fatal but i added error message to detect such cases.
> New patch attached
Sure. It been a failed memory allocation makes it worth
checking for though.
> ===================================================================
> --- mplayer.c (revision 32011)
> +++ mplayer.c (working copy)
> @@ -2611,6 +2611,13 @@
> }
> }
>
> +static void edl_loadfile(void)
> +{
> + if (edl_filename) {
> + if (edl_records) {
> + free_edl(edl_records);
> + }
Pointless {}
> [...]
> if (edl_output_filename) {
> if (edl_fd) fclose(edl_fd);
> if ((edl_fd = fopen(edl_output_filename, "w")) == NULL)
> @@ -3971,6 +3975,13 @@
> int brk_cmd = 0;
> while( !brk_cmd && (cmd = mp_input_get_cmd(0,0,0)) != NULL) {
> brk_cmd = run_command(mpctx, cmd);
> + if (cmd->id == MP_CMD_EDL_LOADFILE) {
> + if (edl_filename) free(edl_filename);
> + edl_filename = strdup(cmd->args[0].v.s);
> + if (!edl_filename) {
> + mp_msg(MSGT_CPLAYER, MSGL_ERR, "cannot allocate memory for EDL file name: %s", cmd->args[0].v.s);
Should be translatable and start with uppercase..
Keep up the good work.
--
Reynaldo
More information about the MPlayer-dev-eng
mailing list