[FFmpeg-devel] [PATCH v9] lavf: palettized QuickTime video in Matroska

Nicolas George george at nsup.org
Mon Dec 28 12:07:38 CET 2015


L'octidi 8 nivôse, an CCXXIV, Mats Peterson a écrit :
> Michael, he's talking about the OLD patch that was never applied. My patch
> has been written from scratch, more or less. I did borrowed some palette
> loops from mov.c, but I have also attributed the previous authors at the top
> of qtpalette.c properly.

I must say, I find this hunk from 7973603:

+        if (matroska->has_palette) {
+            uint8_t *pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
+            if (!pal) {
+                av_log(matroska->ctx, AV_LOG_ERROR, "Cannot append palette to packet\n");
+            } else {
+                memcpy(pal, matroska->palette, AVPALETTE_SIZE);
+            }
+            matroska->has_palette = 0;
+        }

looks quite similar to this hunk from
https://trac.ffmpeg.org/attachment/ticket/5071/patchmkvmov.diff :

+        if (matroska->pal) {
+            uint8_t *pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
+            if (!pal) {
+                av_log(matroska->ctx, AV_LOG_ERROR, "Cannot append palette to packet\n");
+            } else {
+                memcpy(pal, matroska->pal, AVPALETTE_SIZE);
+            }
+            av_freep(&matroska->pal);
+        }

Especially the use of if/else for error, and actually ignoring the error,
instead of the most common (and more correct, but the rest of the code
ignores error too) "if...return AVERROR(ENOMEM)".

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151228/02f09204/attachment.sig>


More information about the ffmpeg-devel mailing list