[FFmpeg-devel] [PATCH] id3v2enc: chapter support

Michael Niedermayer michaelni at gmx.at
Fri May 10 20:28:08 CEST 2013


On Fri, May 10, 2013 at 06:15:37PM +0000, Paul B Mahol wrote:
> On 5/10/13, Michael Niedermayer <michaelni at gmx.at> wrote:
> > On Thu, May 09, 2013 at 04:26:49PM +0000, Paul B Mahol wrote:
> >> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> >> ---
> >>  libavformat/id3v2enc.c | 84
> >> ++++++++++++++++++++++++++++++++++++++++++--------
> >>  1 file changed, 71 insertions(+), 13 deletions(-)
> >>
> 
> [...]
> 
> >
> > char name[123] would be simpler, not needing the error check and free
> 
> I really do not see how that would by any simpler...

maybe iam missing something but

+    name = av_asprintf("ch%d", id);
+    if (!name) {
+        av_free(dyn_buf);
+        return AVERROR(ENOMEM);
+    }
[...]
+    id3->len += avio_put_str(dyn_bc, name);
[...]
+    av_free(name);

vs.
just

snprintf(name, 122, "ch%d", id);
id3->len += avio_put_str(dyn_bc, name);



[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130510/0045646c/attachment.asc>


More information about the ffmpeg-devel mailing list