[FFmpeg-cvslog] r24137 - in trunk/libavcodec: Makefile libxvidff.c
mru
subversion
Fri Jul 9 12:53:30 CEST 2010
Author: mru
Date: Fri Jul 9 12:53:30 2010
New Revision: 24137
Log:
Allow using libxvid RC without enabling encoding wrapper
Modified:
trunk/libavcodec/Makefile
trunk/libavcodec/libxvidff.c
Modified: trunk/libavcodec/Makefile
==============================================================================
--- trunk/libavcodec/Makefile Fri Jul 9 03:16:42 2010 (r24136)
+++ trunk/libavcodec/Makefile Fri Jul 9 12:53:30 2010 (r24137)
@@ -544,7 +544,7 @@ OBJS-$(CONFIG_LIBVORBIS_ENCODER)
OBJS-$(CONFIG_LIBVPX_DECODER) += libvpxdec.o
OBJS-$(CONFIG_LIBVPX_ENCODER) += libvpxenc.o
OBJS-$(CONFIG_LIBX264_ENCODER) += libx264.o
-OBJS-$(CONFIG_LIBXVID_ENCODER) += libxvidff.o libxvid_rc.o
+OBJS-$(CONFIG_LIBXVID) += libxvidff.o libxvid_rc.o
# parsers
OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \
Modified: trunk/libavcodec/libxvidff.c
==============================================================================
--- trunk/libavcodec/libxvidff.c Fri Jul 9 03:16:42 2010 (r24136)
+++ trunk/libavcodec/libxvidff.c Fri Jul 9 12:53:30 2010 (r24137)
@@ -80,6 +80,44 @@ int xvid_strip_vol_header(AVCodecContext
int xvid_ff_2pass(void *ref, int opt, void *p1, void *p2);
void xvid_correct_framerate(AVCodecContext *avctx);
+/* Wrapper to work around the lack of mkstemp() on mingw/cygin.
+ * Also, tries to create file in /tmp first, if possible.
+ * *prefix can be a character constant; *filename will be allocated internally.
+ * @return file descriptor of opened file (or -1 on error)
+ * and opened file name in **filename. */
+int ff_tempfile(char *prefix, char **filename) {
+ int fd=-1;
+#if !HAVE_MKSTEMP
+ *filename = tempnam(".", prefix);
+#else
+ size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */
+ *filename = av_malloc(len);
+#endif
+ /* -----common section-----*/
+ if (*filename == NULL) {
+ av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n");
+ return -1;
+ }
+#if !HAVE_MKSTEMP
+ fd = open(*filename, O_RDWR | O_BINARY | O_CREAT, 0444);
+#else
+ snprintf(*filename, len, "/tmp/%sXXXXXX", prefix);
+ fd = mkstemp(*filename);
+ if (fd < 0) {
+ snprintf(*filename, len, "./%sXXXXXX", prefix);
+ fd = mkstemp(*filename);
+ }
+#endif
+ /* -----common section-----*/
+ if (fd < 0) {
+ av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot open temporary file %s\n", *filename);
+ return -1;
+ }
+ return fd; /* success */
+}
+
+#if CONFIG_LIBXVID_ENCODER
+
/**
* Create the private context for the encoder.
* All buffers are allocated, settings are loaded from the user,
@@ -770,42 +808,6 @@ int xvid_ff_2pass(void *ref, int cmd, vo
}
}
-/* Wrapper to work around the lack of mkstemp() on mingw/cygin.
- * Also, tries to create file in /tmp first, if possible.
- * *prefix can be a character constant; *filename will be allocated internally.
- * @return file descriptor of opened file (or -1 on error)
- * and opened file name in **filename. */
-int ff_tempfile(char *prefix, char **filename) {
- int fd=-1;
-#if !HAVE_MKSTEMP
- *filename = tempnam(".", prefix);
-#else
- size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */
- *filename = av_malloc(len);
-#endif
- /* -----common section-----*/
- if (*filename == NULL) {
- av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n");
- return -1;
- }
-#if !HAVE_MKSTEMP
- fd = open(*filename, O_RDWR | O_BINARY | O_CREAT, 0444);
-#else
- snprintf(*filename, len, "/tmp/%sXXXXXX", prefix);
- fd = mkstemp(*filename);
- if (fd < 0) {
- snprintf(*filename, len, "./%sXXXXXX", prefix);
- fd = mkstemp(*filename);
- }
-#endif
- /* -----common section-----*/
- if (fd < 0) {
- av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot open temporary file %s\n", *filename);
- return -1;
- }
- return fd; /* success */
-}
-
/**
* Xvid codec definition for libavcodec.
*/
@@ -820,3 +822,5 @@ AVCodec libxvid_encoder = {
.pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
.long_name= NULL_IF_CONFIG_SMALL("libxvidcore MPEG-4 part 2"),
};
+
+#endif /* CONFIG_LIBXVID_ENCODER */
More information about the ffmpeg-cvslog
mailing list