]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/gif.c
rtpenc_mpegts: Free the right ->pb in the error path in the init function
[ffmpeg] / libavformat / gif.c
index f11b267033530ec91cb22da95f0922fbfe337ec0..ddec778d829cf6642592adf7958b32c40737917d 100644 (file)
@@ -2,6 +2,8 @@
  * Animated GIF muxer
  * Copyright (c) 2000 Fabrice Bellard
  *
+ * first version by Francois Revol <revol@free.fr>
+ *
  * This file is part of Libav.
  *
  * Libav is free software; you can redistribute it and/or
@@ -20,8 +22,6 @@
  */
 
 /*
- * First version by Francois Revol revol@free.fr
- *
  * Features and limitations:
  * - currently no compression is performed,
  *   in fact the size of the data is 9/8 the size of the image in 8bpp
@@ -58,7 +58,7 @@
  * (byte 19) in the app_header */
 #define GIF_ADD_APP_HEADER // required to enable looping of animated gif
 
-typedef struct {
+typedef struct rgb_triplet {
     unsigned char r;
     unsigned char g;
     unsigned char b;
@@ -223,7 +223,7 @@ static int gif_image_write_image(AVIOContext *pb,
         put_bits(&p, 9, 0x0100); /* clear code */
 
         for (i = (left < GIF_CHUNKS) ? left : GIF_CHUNKS; i; i--) {
-            if (pix_fmt == PIX_FMT_RGB24) {
+            if (pix_fmt == AV_PIX_FMT_RGB24) {
                 v    = gif_clut_index(ptr[0], ptr[1], ptr[2]);
                 ptr += 3;
             } else {
@@ -253,7 +253,7 @@ static int gif_image_write_image(AVIOContext *pb,
     return 0;
 }
 
-typedef struct {
+typedef struct GIFContext {
     AVClass *class;         /** Class for private options. */
     int64_t time, file_time;
     uint8_t buffer[100]; /* data chunks */
@@ -290,7 +290,7 @@ static int gif_write_header(AVFormatContext *s)
 //        rate = video_enc->time_base.den;
     }
 
-    if (video_enc->pix_fmt != PIX_FMT_RGB24) {
+    if (video_enc->pix_fmt != AV_PIX_FMT_RGB24) {
         av_log(s, AV_LOG_ERROR,
                "ERROR: gif only handles the rgb24 pixel format. Use -pix_fmt rgb24.\n");
         return AVERROR(EIO);
@@ -327,9 +327,8 @@ static int gif_write_video(AVFormatContext *s, AVCodecContext *enc,
     avio_w8(pb, 0x00);
 
     gif_image_write_image(pb, 0, 0, enc->width, enc->height,
-                          buf, enc->width * 3, PIX_FMT_RGB24);
+                          buf, enc->width * 3, AV_PIX_FMT_RGB24);
 
-    avio_flush(s->pb);
     return 0;
 }