~ubuntu-dev/mplayer/ubuntu-feisty

« back to all changes in this revision

Viewing changes to libavformat/gif.c

  • Committer: William Grant
  • Date: 2007-02-03 03:16:07 UTC
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: william.grant@ubuntu.org.au-20070203031607-08gc2ompbz6spt9i
Update to 1.0rc1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * Animated GIF encoder
3
3
 * Copyright (c) 2000 Fabrice Bellard.
4
4
 *
5
 
 * This library is free software; you can redistribute it and/or
 
5
 * This file is part of FFmpeg.
 
6
 *
 
7
 * FFmpeg is free software; you can redistribute it and/or
6
8
 * modify it under the terms of the GNU Lesser General Public
7
9
 * License as published by the Free Software Foundation; either
8
 
 * version 2 of the License, or (at your option) any later version.
 
10
 * version 2.1 of the License, or (at your option) any later version.
9
11
 *
10
 
 * This library is distributed in the hope that it will be useful,
 
12
 * FFmpeg is distributed in the hope that it will be useful,
11
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
15
 * Lesser General Public License for more details.
14
16
 *
15
17
 * You should have received a copy of the GNU Lesser General Public
16
 
 * License along with this library; if not, write to the Free Software
 
18
 * License along with FFmpeg; if not, write to the Free Software
17
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
20
 */
19
21
 
113
115
    unsigned int bit_buf;
114
116
    int bit_cnt;
115
117
 
116
 
#ifdef STATS
117
 
    st_out_bit_counts[st_current_index] += n;
118
 
#endif
119
118
    //    printf("put_bits=%d %x\n", n, value);
120
119
    assert(n == 32 || value < (1U << n));
121
120
 
187
186
 
188
187
    /* the global palette */
189
188
    if (!palette) {
190
 
        put_buffer(pb, (unsigned char *)gif_clut, 216*3);
 
189
        put_buffer(pb, (const unsigned char *)gif_clut, 216*3);
191
190
        for(i=0;i<((256-216)*3);i++)
192
191
            put_byte(pb, 0);
193
192
    } else {
342
341
//        rate = video_enc->time_base.den;
343
342
    }
344
343
 
345
 
    /* XXX: is it allowed ? seems to work so far... */
346
 
    video_enc->pix_fmt = PIX_FMT_RGB24;
 
344
    if (video_enc->pix_fmt != PIX_FMT_RGB24) {
 
345
        av_log(s, AV_LOG_ERROR, "ERROR: gif only handles the rgb24 pixel format. Use -pix_fmt rgb24.\n");
 
346
        return AVERROR_IO;
 
347
    }
347
348
 
348
349
    gif_image_write_header(pb, width, height, loop_count, NULL);
349
350
 
417
418
    return 0;
418
419
}
419
420
 
420
 
static AVOutputFormat gif_oformat = {
 
421
AVOutputFormat gif_muxer = {
421
422
    "gif",
422
423
    "GIF Animation",
423
424
    "image/gif",
429
430
    gif_write_packet,
430
431
    gif_write_trailer,
431
432
};
432
 
 
433
 
extern AVInputFormat gif_iformat;
434
 
 
435
 
int gif_init(void)
436
 
{
437
 
    av_register_output_format(&gif_oformat);
438
 
    av_register_input_format(&gif_iformat);
439
 
    return 0;
440
 
}