OLD | NEW |
1 /* | 1 /* |
2 * Interface to xvidcore for mpeg4 encoding | 2 * Interface to xvidcore for mpeg4 encoding |
3 * Copyright (c) 2004 Adam Thayer <krevnik@comcast.net> | 3 * Copyright (c) 2004 Adam Thayer <krevnik@comcast.net> |
4 * | 4 * |
5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
6 * | 6 * |
7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 void xvid_correct_framerate(AVCodecContext *avctx); | 75 void xvid_correct_framerate(AVCodecContext *avctx); |
76 | 76 |
77 /** | 77 /** |
78 * Creates the private context for the encoder. | 78 * Creates the private context for the encoder. |
79 * All buffers are allocated, settings are loaded from the user, | 79 * All buffers are allocated, settings are loaded from the user, |
80 * and the encoder context created. | 80 * and the encoder context created. |
81 * | 81 * |
82 * @param avctx AVCodecContext pointer to context | 82 * @param avctx AVCodecContext pointer to context |
83 * @return Returns 0 on success, -1 on failure | 83 * @return Returns 0 on success, -1 on failure |
84 */ | 84 */ |
85 av_cold int ff_xvid_encode_init(AVCodecContext *avctx) { | 85 static av_cold int xvid_encode_init(AVCodecContext *avctx) { |
86 int xerr, i; | 86 int xerr, i; |
87 int xvid_flags = avctx->flags; | 87 int xvid_flags = avctx->flags; |
88 struct xvid_context *x = avctx->priv_data; | 88 struct xvid_context *x = avctx->priv_data; |
89 uint16_t *intra, *inter; | 89 uint16_t *intra, *inter; |
90 int fd; | 90 int fd; |
91 | 91 |
92 xvid_plugin_single_t single; | 92 xvid_plugin_single_t single; |
93 struct xvid_ff_pass1 rc2pass1; | 93 struct xvid_ff_pass1 rc2pass1; |
94 xvid_plugin_2pass2_t rc2pass2; | 94 xvid_plugin_2pass2_t rc2pass2; |
95 xvid_gbl_init_t xvid_gbl_init; | 95 xvid_gbl_init_t xvid_gbl_init; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 | 360 |
361 /** | 361 /** |
362 * Encodes a single frame. | 362 * Encodes a single frame. |
363 * | 363 * |
364 * @param avctx AVCodecContext pointer to context | 364 * @param avctx AVCodecContext pointer to context |
365 * @param frame Pointer to encoded frame buffer | 365 * @param frame Pointer to encoded frame buffer |
366 * @param buf_size Size of encoded frame buffer | 366 * @param buf_size Size of encoded frame buffer |
367 * @param data Pointer to AVFrame of unencoded frame | 367 * @param data Pointer to AVFrame of unencoded frame |
368 * @return Returns 0 on success, -1 on failure | 368 * @return Returns 0 on success, -1 on failure |
369 */ | 369 */ |
370 int ff_xvid_encode_frame(AVCodecContext *avctx, | 370 static int xvid_encode_frame(AVCodecContext *avctx, |
371 unsigned char *frame, int buf_size, void *data) { | 371 unsigned char *frame, int buf_size, void *data) { |
372 int xerr, i; | 372 int xerr, i; |
373 char *tmp; | 373 char *tmp; |
374 struct xvid_context *x = avctx->priv_data; | 374 struct xvid_context *x = avctx->priv_data; |
375 AVFrame *picture = data; | 375 AVFrame *picture = data; |
376 AVFrame *p = &(x->encoded_picture); | 376 AVFrame *p = &(x->encoded_picture); |
377 | 377 |
378 xvid_enc_frame_t xvid_enc_frame; | 378 xvid_enc_frame_t xvid_enc_frame; |
379 xvid_enc_stats_t xvid_enc_stats; | 379 xvid_enc_stats_t xvid_enc_stats; |
380 | 380 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 } | 468 } |
469 } | 469 } |
470 | 470 |
471 /** | 471 /** |
472 * Destroys the private context for the encoder. | 472 * Destroys the private context for the encoder. |
473 * All buffers are freed, and the Xvid encoder context is destroyed. | 473 * All buffers are freed, and the Xvid encoder context is destroyed. |
474 * | 474 * |
475 * @param avctx AVCodecContext pointer to context | 475 * @param avctx AVCodecContext pointer to context |
476 * @return Returns 0, success guaranteed | 476 * @return Returns 0, success guaranteed |
477 */ | 477 */ |
478 av_cold int ff_xvid_encode_close(AVCodecContext *avctx) { | 478 static av_cold int xvid_encode_close(AVCodecContext *avctx) { |
479 struct xvid_context *x = avctx->priv_data; | 479 struct xvid_context *x = avctx->priv_data; |
480 | 480 |
481 xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL); | 481 xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL); |
482 | 482 |
483 if( avctx->extradata != NULL ) | 483 if( avctx->extradata != NULL ) |
484 av_free(avctx->extradata); | 484 av_free(avctx->extradata); |
485 if( x->twopassbuffer != NULL ) { | 485 if( x->twopassbuffer != NULL ) { |
486 av_free(x->twopassbuffer); | 486 av_free(x->twopassbuffer); |
487 av_free(x->old_twopassbuffer); | 487 av_free(x->old_twopassbuffer); |
488 } | 488 } |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 } | 765 } |
766 | 766 |
767 /** | 767 /** |
768 * Xvid codec definition for libavcodec. | 768 * Xvid codec definition for libavcodec. |
769 */ | 769 */ |
770 AVCodec libxvid_encoder = { | 770 AVCodec libxvid_encoder = { |
771 "libxvid", | 771 "libxvid", |
772 CODEC_TYPE_VIDEO, | 772 CODEC_TYPE_VIDEO, |
773 CODEC_ID_XVID, | 773 CODEC_ID_XVID, |
774 sizeof(struct xvid_context), | 774 sizeof(struct xvid_context), |
775 ff_xvid_encode_init, | 775 xvid_encode_init, |
776 ff_xvid_encode_frame, | 776 xvid_encode_frame, |
777 ff_xvid_encode_close, | 777 xvid_encode_close, |
778 .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, | 778 .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, |
779 .long_name= NULL_IF_CONFIG_SMALL("libxvidcore MPEG-4 part 2"), | 779 .long_name= NULL_IF_CONFIG_SMALL("libxvidcore MPEG-4 part 2"), |
780 }; | 780 }; |
OLD | NEW |