]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/libxvidff.c
Properly initialize x264_picture_t in libx264.
[ffmpeg] / libavcodec / libxvidff.c
index 314945961bc851e07005fa7a735981a1fcbf9d04..2a404cd5f952e84d0d1842a9b614806630f089dd 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 /**
- * @file xvidmpeg4.c
+ * @file
  * Interface to xvidcore for MPEG-4 compliant encoding.
  * @author Adam Thayer (krevnik@comcast.net)
  */
@@ -28,6 +28,7 @@
 #include <xvid.h>
 #include <unistd.h>
 #include "avcodec.h"
+#include "libavutil/intreadwrite.h"
 #include "libxvid_internal.h"
 
 /**
@@ -81,7 +82,7 @@ void xvid_correct_framerate(AVCodecContext *avctx);
  * @param avctx AVCodecContext pointer to context
  * @return Returns 0 on success, -1 on failure
  */
-av_cold int ff_xvid_encode_init(AVCodecContext *avctx)  {
+static av_cold int xvid_encode_init(AVCodecContext *avctx)  {
     int xerr, i;
     int xvid_flags = avctx->flags;
     struct xvid_context *x = avctx->priv_data;
@@ -166,9 +167,9 @@ av_cold int ff_xvid_encode_init(AVCodecContext *avctx)  {
     xvid_gbl_init.version = XVID_VERSION;
     xvid_gbl_init.debug = 0;
 
-#ifdef ARCH_PPC
+#if ARCH_PPC
     /* Xvid's PPC support is borked, use libavcodec to detect */
-#ifdef HAVE_ALTIVEC
+#if HAVE_ALTIVEC
     if( has_altivec() ) {
         xvid_gbl_init.cpu_flags = XVID_CPU_FORCE | XVID_CPU_ALTIVEC;
     } else
@@ -335,7 +336,7 @@ av_cold int ff_xvid_encode_init(AVCodecContext *avctx)  {
         /* We are claiming to be Xvid */
         x->quicktime_format = 0;
         if(!avctx->codec_tag)
-            avctx->codec_tag = ff_get_fourcc("xvid");
+            avctx->codec_tag = AV_RL32("xvid");
     }
 
     /* Bframes */
@@ -366,7 +367,7 @@ av_cold int ff_xvid_encode_init(AVCodecContext *avctx)  {
  * @param data Pointer to AVFrame of unencoded frame
  * @return Returns 0 on success, -1 on failure
  */
-int ff_xvid_encode_frame(AVCodecContext *avctx,
+static int xvid_encode_frame(AVCodecContext *avctx,
                          unsigned char *frame, int buf_size, void *data) {
     int xerr, i;
     char *tmp;
@@ -474,13 +475,13 @@ int ff_xvid_encode_frame(AVCodecContext *avctx,
  * @param avctx AVCodecContext pointer to context
  * @return Returns 0, success guaranteed
  */
-av_cold int ff_xvid_encode_close(AVCodecContext *avctx) {
+static av_cold int xvid_encode_close(AVCodecContext *avctx) {
     struct xvid_context *x = avctx->priv_data;
 
     xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL);
 
     if( avctx->extradata != NULL )
-        av_free(avctx->extradata);
+        av_freep(&avctx->extradata);
     if( x->twopassbuffer != NULL ) {
         av_free(x->twopassbuffer);
         av_free(x->old_twopassbuffer);
@@ -557,7 +558,7 @@ void xvid_correct_framerate(AVCodecContext *avctx) {
     frate = avctx->time_base.den;
     fbase = avctx->time_base.num;
 
-    gcd = ff_gcd(frate, fbase);
+    gcd = av_gcd(frate, fbase);
     if( gcd > 1 ) {
         frate /= gcd;
         fbase /= gcd;
@@ -579,7 +580,7 @@ void xvid_correct_framerate(AVCodecContext *avctx) {
     } else
         est_fbase = 1;
 
-    gcd = ff_gcd(est_frate, est_fbase);
+    gcd = av_gcd(est_frate, est_fbase);
     if( gcd > 1 ) {
         est_frate /= gcd;
         est_fbase /= gcd;
@@ -768,12 +769,12 @@ int xvid_ff_2pass(void *ref, int cmd, void *p1, void *p2) {
  */
 AVCodec libxvid_encoder = {
     "libxvid",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_XVID,
+    AVMEDIA_TYPE_VIDEO,
+    CODEC_ID_MPEG4,
     sizeof(struct xvid_context),
-    ff_xvid_encode_init,
-    ff_xvid_encode_frame,
-    ff_xvid_encode_close,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+    xvid_encode_init,
+    xvid_encode_frame,
+    xvid_encode_close,
+    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("libxvidcore MPEG-4 part 2"),
 };