Unified · Split
| @@ -104,22 +104,6 @@ static int gif_write_header(AVFormatContext *s) · 103 unmodified lines | ||
| 104 | 104 | return 0; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | −/* TODO: move below */ | |
| 108 | −static int flush_packet(AVFormatContext *s, AVPacket *pkt); | |
| 109 | − | |
| 110 | −static int gif_write_packet(AVFormatContext *s, AVPacket *pkt) | |
| 111 | −{ | |
| 112 | − GIFContext *gif = s->priv_data; | |
| 113 | − | |
| 114 | − if (!gif->prev_pkt) { | |
| 115 | − gif->prev_pkt = av_malloc(sizeof(*gif->prev_pkt)); | |
| 116 | − if (!gif->prev_pkt) | |
| 117 | − return AVERROR(ENOMEM); | |
| 118 | − return av_copy_packet(gif->prev_pkt, pkt); | |
| 119 | − } | |
| 120 | − return flush_packet(s, pkt); | |
| 121 | −} | |
| 122 | − | |
| 123 | 107 | static int flush_packet(AVFormatContext *s, AVPacket *new) |
| 124 | 108 | { |
| 125 | 109 | GIFContext *gif = s->priv_data; |
| @@ -174,6 +158,19 @@ static int flush_packet(AVFormatContext *s, AVPacket *new) · 48 unmodified lines | ||
| 174 | 158 | return 0; |
| 175 | 159 | } |
| 176 | 160 | |
| 161 | +static int gif_write_packet(AVFormatContext *s, AVPacket *pkt) | |
| 162 | +{ | |
| 163 | + GIFContext *gif = s->priv_data; | |
| 164 | + | |
| 165 | + if (!gif->prev_pkt) { | |
| 166 | + gif->prev_pkt = av_malloc(sizeof(*gif->prev_pkt)); | |
| 167 | + if (!gif->prev_pkt) | |
| 168 | + return AVERROR(ENOMEM); | |
| 169 | + return av_copy_packet(gif->prev_pkt, pkt); | |
| 170 | + } | |
| 171 | + return flush_packet(s, pkt); | |
| 172 | +} | |
| 173 | + | |
| 177 | 174 | static int gif_write_trailer(AVFormatContext *s) |
| 178 | 175 | { |
| 179 | 176 | GIFContext *gif = s->priv_data; |