Index: ffmpeg.c =================================================================== --- ffmpeg.c (revisión: 352) +++ ffmpeg.c (copia de trabajo) @@ -36,6 +36,7 @@ # endif /* __GNUC__ */ #endif /* LIBAVCODEC_BUILD > 4680 */ + #if LIBAVFORMAT_BUILD >= 4616 /* The API for av_write_frame changed with FFmpeg version 0.4.9pre1. * It now uses an AVPacket struct instead of direct parameters to the @@ -93,7 +94,7 @@ fd = open(filename, access_flags, 0666); if (fd < 0) { - return -ENOENT; + return AVERROR(ENOENT); } h->priv_data = (void *)(size_t)fd; return 0; @@ -125,59 +126,58 @@ static int file_open(URLContext *h, const char *filename, int flags) { - int access; - int fd; + int access_flags, fd; - av_strstart(filename, "file:", &filename); + av_strstart(filename, "file:", &filename); - if (flags & URL_RDWR) { - access = O_CREAT | O_TRUNC | O_RDWR; - } else if (flags & URL_WRONLY) { - access = O_CREAT | O_TRUNC | O_WRONLY; - } else { - access = O_RDONLY; - } + if (flags & URL_RDWR) { + access_flags = O_CREAT | O_TRUNC | O_RDWR; + } else if (flags & URL_WRONLY) { + access_flags = O_CREAT | O_TRUNC | O_WRONLY; + } else { + access_flags = O_RDONLY; + } #ifdef O_BINARY - access |= O_BINARY; + access_flags |= O_BINARY; #endif - fd = open(filename, access, 0666); - if (fd < 0) - return AVERROR(ENOENT); - h->priv_data = (void *)(size_t)fd; - return 0; + fd = open(filename, access_flags, 0666); + if (fd < 0) + return AVERROR(ENOENT); + h->priv_data = (void *)(size_t)fd; + return 0; } static int file_read(URLContext *h, unsigned char *buf, int size) { - int fd = (size_t)h->priv_data; - return read(fd, buf, size); + int fd = (size_t)h->priv_data; + return read(fd, buf, size); } static int file_write(URLContext *h, unsigned char *buf, int size) { - int fd = (size_t)h->priv_data; - return write(fd, buf, size); + int fd = (size_t)h->priv_data; + return write(fd, buf, size); } static offset_t file_seek(URLContext *h, offset_t pos, int whence) { - int fd = (size_t)h->priv_data; - return lseek(fd, pos, whence); + int fd = (size_t)h->priv_data; + return lseek(fd, pos, whence); } static int file_close(URLContext *h) { - int fd = (size_t)h->priv_data; - return close(fd); + int fd = (size_t)h->priv_data; + return close(fd); } URLProtocol file_protocol = { - "file", - file_open, - file_read, - file_write, - file_seek, - file_close, + "file", + file_open, + file_read, + file_write, + file_seek, + file_close, }; #endif @@ -188,8 +188,14 @@ */ static int mpeg1_write_trailer(AVFormatContext *s) { +#if LIBAVFORMAT_BUILD >= (52<<16) + put_buffer(s->pb, mpeg1_trailer, 4); + put_flush_packet(s->pb); +#else put_buffer(&s->pb, mpeg1_trailer, 4); put_flush_packet(&s->pb); +#endif /* LIBAVFORMAT_BUILD >= (52<<16) */ + return 0; /* success */ } @@ -506,7 +512,7 @@ */ void ffmpeg_cleanups(struct ffmpeg *ffmpeg) { - int i; + unsigned int i; /* close each codec */ if (ffmpeg->video_st) { @@ -541,7 +547,7 @@ /* Closes a video file. */ void ffmpeg_close(struct ffmpeg *ffmpeg) { - int i; + unsigned int i; /* close each codec */ if (ffmpeg->video_st) { @@ -562,7 +568,11 @@ if (!(ffmpeg->oc->oformat->flags & AVFMT_NOFILE)) { /* close the output file */ +#if LIBAVFORMAT_BUILD >= (52<<16) + url_fclose(ffmpeg->oc->pb); +#else url_fclose(&ffmpeg->oc->pb); +#endif /* LIBAVFORMAT_BUILD >= (52<<16) */ } /* free the stream */ Index: ffmpeg.h =================================================================== --- ffmpeg.h (revisión: 352) +++ ffmpeg.h (copia de trabajo) @@ -2,6 +2,7 @@ #define _INCLUDE_FFMPEG_H_ #ifdef HAVE_FFMPEG +#include #include #endif