]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/xvidff.c
remove useless static cm variable
[ffmpeg] / libavcodec / xvidff.c
index d44fedb2c87c1c011ba50e40b253e921389c1857..590fe4b308ca343c499912bf71f3a39d1b79ad34 100644 (file)
@@ -2,18 +2,20 @@
  * Interface to xvidcore for mpeg4 encoding
  * Copyright (c) 2004 Adam Thayer <krevnik@comcast.net>
  *
- * This library is free software; you can redistribute it and/or
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
  *
- * This library is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -27,9 +29,7 @@
 #include <unistd.h>
 #include "common.h"
 #include "avcodec.h"
-#ifdef CONFIG_WIN32
-#include <fcntl.h>
-#endif
+#include "xvid_internal.h"
 
 /**
  * Buffer management macros.
@@ -229,39 +229,7 @@ int ff_xvid_encode_init(AVCodecContext *avctx)  {
         rc2pass2.version = XVID_VERSION;
         rc2pass2.bitrate = avctx->bit_rate;
 
-#ifdef CONFIG_WIN32 /* Ugly work around */
-        {
-           char *tempname;
-
-           tempname = tempnam(".", "xvidff");
-            fd = -1;
-            if( tempname &&
-                (fd = open(tempname, _O_RDWR | _O_BINARY)) != -1 ) {
-                x->twopassfile = av_strdup(tempname);
-#undef free
-                free(tempname);
-#define free please_use_av_free
-                if( x->twopassfile == NULL ) {
-                    av_log(avctx, AV_LOG_ERROR,
-                        "XviD: Cannot allocate 2-pass buffer\n");
-                    return -1;
-                }
-            }
-       }
-#else
-        x->twopassfile = av_malloc(BUFFER_SIZE);
-        if( x->twopassfile == NULL ) {
-            av_log(avctx, AV_LOG_ERROR,
-                "XviD: Cannot allocate 2-pass buffer\n");
-            return -1;
-        }
-        strcpy(x->twopassfile, "/tmp/xvidff.XXXXXX");
-        fd = mkstemp(x->twopassfile);
-        if(fd < 0){
-            strcpy(x->twopassfile, "./xvidff.XXXXXX");
-            fd = mkstemp(x->twopassfile);
-        }
-#endif
+        fd = av_tempfile("xvidff.", &(x->twopassfile));
         if( fd == -1 ) {
             av_log(avctx, AV_LOG_ERROR,
                 "XviD: Cannot write 2-pass pipe\n");
@@ -367,7 +335,8 @@ int ff_xvid_encode_init(AVCodecContext *avctx)  {
     } else {
         /* We are claiming to be XviD */
         x->quicktime_format = 0;
-        avctx->codec_tag = ff_get_fourcc("xvid");
+        if(!avctx->codec_tag)
+            avctx->codec_tag = ff_get_fourcc("xvid");
     }
 
     /* Bframes */
@@ -794,5 +763,6 @@ AVCodec xvid_encoder = {
     sizeof(xvid_context_t),
     ff_xvid_encode_init,
     ff_xvid_encode_frame,
-    ff_xvid_encode_close
+    ff_xvid_encode_close,
+    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1},
 };