[FFmpeg-cvslog] cmdutils: Read errno before av_log() as the callback from av_log() might affect errno

2014-10-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Sat Oct 25 
13:17:26 2014 +0200| [2fc970a6b84504f54883a25482de466b49b11fd8] | committer: 
Michael Niedermayer

cmdutils: Read errno before av_log() as the callback from av_log() might affect 
errno

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2fc970a6b84504f54883a25482de466b49b11fd8
---

 cmdutils.c |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/cmdutils.c b/cmdutils.c
index 7353dd5..46bfcca 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -959,9 +959,10 @@ static int init_report(const char *env)
 
 report_file = fopen(filename.str, w);
 if (!report_file) {
+int ret = AVERROR(errno);
 av_log(NULL, AV_LOG_ERROR, Failed to open report \%s\: %s\n,
filename.str, strerror(errno));
-return AVERROR(errno);
+return ret;
 }
 av_log_set_callback(log_callback_report);
 av_log(NULL, AV_LOG_INFO,
@@ -1863,17 +1864,19 @@ int cmdutils_read_file(const char *filename, char 
**bufptr, size_t *size)
 FILE *f = av_fopen_utf8(filename, rb);
 
 if (!f) {
+ret = AVERROR(errno);
 av_log(NULL, AV_LOG_ERROR, Cannot read file '%s': %s\n, filename,
strerror(errno));
-return AVERROR(errno);
+return ret;
 }
 fseek(f, 0, SEEK_END);
 *size = ftell(f);
 fseek(f, 0, SEEK_SET);
 if (*size == (size_t)-1) {
+ret = AVERROR(errno);
 av_log(NULL, AV_LOG_ERROR, IO error: %s\n, strerror(errno));
 fclose(f);
-return AVERROR(errno);
+return ret;
 }
 *bufptr = av_malloc(*size + 1);
 if (!*bufptr) {
@@ -1885,9 +1888,9 @@ int cmdutils_read_file(const char *filename, char 
**bufptr, size_t *size)
 if (ret  *size) {
 av_free(*bufptr);
 if (ferror(f)) {
+ret = AVERROR(errno);
 av_log(NULL, AV_LOG_ERROR, Error while reading file '%s': %s\n,
filename, strerror(errno));
-ret = AVERROR(errno);
 } else
 ret = AVERROR_EOF;
 } else {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avdeviece: Read errno before av_log() as the callback from av_log() might affect errno

2014-10-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Sat Oct 25 
13:19:10 2014 +0200| [a63096953559ab40b09e125056d2a86bf6a354bb] | committer: 
Michael Niedermayer

avdeviece: Read errno before av_log() as the callback from av_log() might 
affect errno

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a63096953559ab40b09e125056d2a86bf6a354bb
---

 libavdevice/caca.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavdevice/caca.c b/libavdevice/caca.c
index a118064..ff54940 100644
--- a/libavdevice/caca.c
+++ b/libavdevice/caca.c
@@ -135,8 +135,8 @@ static int caca_write_header(AVFormatContext *s)
 
 c-canvas = caca_create_canvas(c-window_width, c-window_height);
 if (!c-canvas) {
-av_log(s, AV_LOG_ERROR, Failed to create canvas\n);
 ret = AVERROR(errno);
+av_log(s, AV_LOG_ERROR, Failed to create canvas\n);
 goto fail;
 }
 
@@ -145,8 +145,8 @@ static int caca_write_header(AVFormatContext *s)
bpp / 8 * encctx-width,
0xff, 0x00ff00, 0xff, 0);
 if (!c-dither) {
-av_log(s, AV_LOG_ERROR, Failed to create dither\n);
 ret =  AVERROR(errno);
+av_log(s, AV_LOG_ERROR, Failed to create dither\n);
 goto fail;
 }
 
@@ -164,9 +164,9 @@ static int caca_write_header(AVFormatContext *s)
 
 c-display = caca_create_display_with_driver(c-canvas, c-driver);
 if (!c-display) {
+ret = AVERROR(errno);
 av_log(s, AV_LOG_ERROR, Failed to create display\n);
 list_drivers(c);
-ret = AVERROR(errno);
 goto fail;
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec: Read errno before av_log() as the callback from av_log() might affect errno

2014-10-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Sat Oct 25 
13:18:47 2014 +0200| [dd5c2fe17727cba76122ee9a4cfc1ad07a2dd099] | committer: 
Michael Niedermayer

avcodec: Read errno before av_log() as the callback from av_log() might affect 
errno

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dd5c2fe17727cba76122ee9a4cfc1ad07a2dd099
---

 libavcodec/libxvid_rc.c |3 ++-
 libavcodec/utils.c  |4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/libxvid_rc.c b/libavcodec/libxvid_rc.c
index 4ee4d82..f92bef1 100644
--- a/libavcodec/libxvid_rc.c
+++ b/libavcodec/libxvid_rc.c
@@ -68,10 +68,11 @@ av_cold int ff_xvid_rate_control_init(MpegEncContext *s)
  (rce-header_bits + rce-mv_bits + 7) / 8);
 
 if (write(fd, tmp, strlen(tmp))  0) {
+int ret = AVERROR(errno);
 av_log(NULL, AV_LOG_ERROR, Error %s writing 2pass logfile\n, 
strerror(errno));
 av_free(tmp_name);
 close(fd);
-return AVERROR(errno);
+return ret;
 }
 }
 
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 4ef2ac6..b6ae1c0 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1664,9 +1664,9 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
 #if CONFIG_ICONV
 iconv_t cd = iconv_open(UTF-8, avctx-sub_charenc);
 if (cd == (iconv_t)-1) {
+ret = AVERROR(errno);
 av_log(avctx, AV_LOG_ERROR, Unable to open iconv 
context 
with input character encoding \%s\\n, 
avctx-sub_charenc);
-ret = AVERROR(errno);
 goto free_and_end;
 }
 iconv_close(cd);
@@ -2649,10 +2649,10 @@ static int recode_subtitle(AVCodecContext *avctx,
 if (iconv(cd, inb, inl, outb, outl) == (size_t)-1 ||
 iconv(cd, NULL, NULL, outb, outl) == (size_t)-1 ||
 outl = outpkt-size || inl != 0) {
+ret = FFMIN(AVERROR(errno), -1);
 av_log(avctx, AV_LOG_ERROR, Unable to recode subtitle event \%s\ 
from %s to UTF-8\n, inpkt-data, avctx-sub_charenc);
 av_free_packet(tmp);
-ret = AVERROR(errno);
 goto end;
 }
 outpkt-size -= outl;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avfilter: Read errno before av_log() as the callback from av_log() might affect errno

2014-10-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Sat Oct 25 
13:19:41 2014 +0200| [0d96d44c4fa526582500718254ac9e19f984c6a5] | committer: 
Michael Niedermayer

avfilter: Read errno before av_log() as the callback from av_log() might affect 
errno

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0d96d44c4fa526582500718254ac9e19f984c6a5
---

 libavfilter/vf_vidstabdetect.c|3 ++-
 libavfilter/vf_vidstabtransform.c |3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_vidstabdetect.c b/libavfilter/vf_vidstabdetect.c
index bf067af..1df6f74 100644
--- a/libavfilter/vf_vidstabdetect.c
+++ b/libavfilter/vf_vidstabdetect.c
@@ -176,8 +176,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 return AVERROR(AVERROR_EXTERNAL);
 } else {
 if (vsWriteToFile(md, sd-f, localmotions) != VS_OK) {
+int ret = AVERROR(errno);
 av_log(ctx, AV_LOG_ERROR, cannot write to transform file);
-return AVERROR(errno);
+return ret;
 }
 vs_vector_del(localmotions);
 }
diff --git a/libavfilter/vf_vidstabtransform.c 
b/libavfilter/vf_vidstabtransform.c
index 1bd43ff..9db6a46 100644
--- a/libavfilter/vf_vidstabtransform.c
+++ b/libavfilter/vf_vidstabtransform.c
@@ -208,8 +208,9 @@ static int config_input(AVFilterLink *inlink)
 
 f = fopen(tc-input, r);
 if (!f) {
+int ret = AVERROR(errno);
 av_log(ctx, AV_LOG_ERROR, cannot open input file %s\n, tc-input);
-return AVERROR(errno);
+return ret;
 } else {
 VSManyLocalMotions mlms;
 if (vsReadLocalMotionsFile(f, mlms) == VS_OK) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat: Print error message on failure of ff_rename()

2014-10-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Sat Oct 25 
13:04:18 2014 +0200| [92d366f6abf85ebff5f0562894c8f94ebe80f114] | committer: 
Michael Niedermayer

avformat: Print error message on failure of ff_rename()

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=92d366f6abf85ebff5f0562894c8f94ebe80f114
---

 libavformat/hdsenc.c |6 +++---
 libavformat/internal.h   |   12 
 libavformat/smoothstreamingenc.c |4 ++--
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c
index faa32c7..98106f4 100644
--- a/libavformat/hdsenc.c
+++ b/libavformat/hdsenc.c
@@ -204,7 +204,7 @@ static int write_manifest(AVFormatContext *s, int final)
 avio_printf(out, /manifest\n);
 avio_flush(out);
 avio_close(out);
-return ff_rename(temp_filename, filename);
+return ff_rename(temp_filename, filename, s);
 }
 
 static void update_size(AVIOContext *out, int64_t pos)
@@ -285,7 +285,7 @@ static int write_abst(AVFormatContext *s, OutputStream *os, 
int final)
 update_size(out, afrt_pos);
 update_size(out, 0);
 avio_close(out);
-return ff_rename(temp_filename, filename);
+return ff_rename(temp_filename, filename, s);
 }
 
 static int init_file(AVFormatContext *s, OutputStream *os, int64_t start_ts)
@@ -480,7 +480,7 @@ static int hds_flush(AVFormatContext *s, OutputStream *os, 
int final,
 
 snprintf(target_filename, sizeof(target_filename),
  %s/stream%dSeg1-Frag%d, s-filename, index, os-fragment_index);
-ret = ff_rename(os-temp_filename, target_filename);
+ret = ff_rename(os-temp_filename, target_filename, s);
 if (ret  0)
 return ret;
 add_fragment(os, target_filename, os-frag_start_ts, end_ts - 
os-frag_start_ts);
diff --git a/libavformat/internal.h b/libavformat/internal.h
index d2aab30..f7a79dd 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -378,11 +378,15 @@ int ff_generate_avci_extradata(AVStream *st);
  * @param newpath destination path
  * @return0 or AVERROR on failure
  */
-static inline int ff_rename(const char *oldpath, const char *newpath)
+static inline int ff_rename(const char *oldpath, const char *newpath, void 
*logctx)
 {
-if (rename(oldpath, newpath) == -1)
-return AVERROR(errno);
-return 0;
+int ret = 0;
+if (rename(oldpath, newpath) == -1) {
+ret = AVERROR(errno);
+if (logctx)
+av_log(logctx, AV_LOG_ERROR, failed to rename file %s to %s\n, 
oldpath, newpath);
+}
+return ret;
 }
 
 /**
diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c
index fa9984a..51a8f6f 100644
--- a/libavformat/smoothstreamingenc.c
+++ b/libavformat/smoothstreamingenc.c
@@ -283,7 +283,7 @@ static int write_manifest(AVFormatContext *s, int final)
 avio_printf(out, /SmoothStreamingMedia\n);
 avio_flush(out);
 avio_close(out);
-return ff_rename(temp_filename, filename);
+return ff_rename(temp_filename, filename, s);
 }
 
 static int ism_write_header(AVFormatContext *s)
@@ -540,7 +540,7 @@ static int ism_flush(AVFormatContext *s, int final)
 snprintf(header_filename, sizeof(header_filename), 
%s/FragmentInfo(%s=%PRIu64), os-dirname, os-stream_type_tag, start_ts);
 snprintf(target_filename, sizeof(target_filename), 
%s/Fragments(%s=%PRIu64), os-dirname, os-stream_type_tag, start_ts);
 copy_moof(s, filename, header_filename, moof_size);
-ret = ff_rename(filename, target_filename);
+ret = ff_rename(filename, target_filename, s);
 if (ret  0)
 break;
 add_fragment(os, target_filename, header_filename, start_ts, duration,

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/hdsenc: Read errno before av_log() as the callback from av_log() might affect errno

2014-10-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Sat Oct 25 
13:20:23 2014 +0200| [af03ba9aa205ed8b38146a85e4bf6396ac767b1d] | committer: 
Michael Niedermayer

avformat/hdsenc: Read errno before av_log() as the callback from av_log() might 
affect errno

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=af03ba9aa205ed8b38146a85e4bf6396ac767b1d
---

 libavformat/hdsenc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c
index 98106f4..eec9bb8 100644
--- a/libavformat/hdsenc.c
+++ b/libavformat/hdsenc.c
@@ -322,8 +322,8 @@ static int hds_write_header(AVFormatContext *s)
 AVOutputFormat *oformat;
 
 if (mkdir(s-filename, 0777) == -1  errno != EEXIST) {
-av_log(s, AV_LOG_ERROR , Failed to create directory %s\n, 
s-filename);
 ret = AVERROR(errno);
+av_log(s, AV_LOG_ERROR , Failed to create directory %s\n, 
s-filename);
 goto fail;
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] tools/ffhash: read errno before calling functions which might change it

2014-10-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Sat Oct 25 
16:12:16 2014 +0200| [39a7ded22df3f0bae46706800da6eeede744c14f] | committer: 
Michael Niedermayer

tools/ffhash: read errno before calling functions which might change it

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=39a7ded22df3f0bae46706800da6eeede744c14f
---

 tools/ffhash.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/ffhash.c b/tools/ffhash.c
index a9f71c2..6942527 100644
--- a/tools/ffhash.c
+++ b/tools/ffhash.c
@@ -94,9 +94,10 @@ static int check(char *file)
 for (;;) {
 int size = read(fd, buffer, SIZE);
 if (size  0) {
+int err = errno;
 close(fd);
 finish();
-printf(+READ-FAILED: %s, strerror(errno));
+printf(+READ-FAILED: %s, strerror(err));
 ret = 2;
 goto end;
 } else if(!size)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat: Read errno before av_log() as the callback from av_log() might affect errno

2014-10-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Sat Oct 25 
13:48:56 2014 +0200| [e7513e1286ca1b747485f950b0e1c93612b6736c] | committer: 
Michael Niedermayer

avformat: Read errno before av_log() as the callback from av_log() might affect 
errno

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e7513e1286ca1b747485f950b0e1c93612b6736c
---

 libavformat/libsmbclient.c   |   15 ++-
 libavformat/smoothstreamingenc.c |2 +-
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/libavformat/libsmbclient.c b/libavformat/libsmbclient.c
index 892d2db..8290d75 100644
--- a/libavformat/libsmbclient.c
+++ b/libavformat/libsmbclient.c
@@ -50,12 +50,14 @@ static av_cold int libsmbc_connect(URLContext *h)
 
 libsmbc-ctx = smbc_new_context();
 if (!libsmbc-ctx) {
+int ret = AVERROR(errno);
 av_log(h, AV_LOG_ERROR, Cannot create context: %s.\n, 
strerror(errno));
-return AVERROR(errno);
+return ret;
 }
 if (!smbc_init_context(libsmbc-ctx)) {
+int ret = AVERROR(errno);
 av_log(h, AV_LOG_ERROR, Cannot initialize context: %s.\n, 
strerror(errno));
-return AVERROR(errno);
+return ret;
 }
 smbc_set_context(libsmbc-ctx);
 
@@ -68,8 +70,9 @@ static av_cold int libsmbc_connect(URLContext *h)
 smbc_setWorkgroup(libsmbc-ctx, libsmbc-workgroup);
 
 if (smbc_init(NULL, 0)  0) {
+int ret = AVERROR(errno);
 av_log(h, AV_LOG_ERROR, Initialization failed: %s\n, 
strerror(errno));
-return AVERROR(errno);
+return ret;
 }
 return 0;
 }
@@ -157,8 +160,9 @@ static int libsmbc_read(URLContext *h, unsigned char *buf, 
int size)
 int bytes_read;
 
 if ((bytes_read = smbc_read(libsmbc-fd, buf, size))  0) {
+int ret = AVERROR(errno);
 av_log(h, AV_LOG_ERROR, Read error: %s\n, strerror(errno));
-return AVERROR(errno);
+return ret;
 }
 
 return bytes_read;
@@ -170,8 +174,9 @@ static int libsmbc_write(URLContext *h, const unsigned char 
*buf, int size)
 int bytes_written;
 
 if ((bytes_written = smbc_write(libsmbc-fd, buf, size))  0) {
+int ret = AVERROR(errno);
 av_log(h, AV_LOG_ERROR, Write error: %s\n, strerror(errno));
-return AVERROR(errno);
+return ret;
 }
 
 return bytes_written;
diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c
index 51a8f6f..d6cdf90 100644
--- a/libavformat/smoothstreamingenc.c
+++ b/libavformat/smoothstreamingenc.c
@@ -293,8 +293,8 @@ static int ism_write_header(AVFormatContext *s)
 AVOutputFormat *oformat;
 
 if (mkdir(s-filename, 0777) == -1  errno != EEXIST) {
-av_log(s, AV_LOG_ERROR, mkdir failed\n);
 ret = AVERROR(errno);
+av_log(s, AV_LOG_ERROR, mkdir failed\n);
 goto fail;
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/rtpdec_asf: Use av_find_input_format() instead of directly linking to the demuxer

2014-10-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Sat Oct 25 
16:28:03 2014 +0200| [2ce10542570d8be7a74a94cb03b2f182e2cb5ff8] | committer: 
Michael Niedermayer

avformat/rtpdec_asf: Use av_find_input_format() instead of directly linking to 
the demuxer

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2ce10542570d8be7a74a94cb03b2f182e2cb5ff8
---

 libavformat/rtpdec_asf.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c
index 8fd2e24..44c0a24 100644
--- a/libavformat/rtpdec_asf.c
+++ b/libavformat/rtpdec_asf.c
@@ -103,6 +103,8 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char 
*p)
 AVDictionary *opts = NULL;
 int len = strlen(p) * 6 / 8;
 char *buf = av_mallocz(len);
+AVInputFormat *iformat;
+
 av_base64_decode(buf, p, len);
 
 if (rtp_asf_fix_header(buf, len)  0)
@@ -112,6 +114,8 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char 
*p)
 if (rt-asf_ctx) {
 avformat_close_input(rt-asf_ctx);
 }
+if (!(iformat = av_find_input_format(asf)))
+return AVERROR_DEMUXER_NOT_FOUND;
 if (!(rt-asf_ctx = avformat_alloc_context()))
 return AVERROR(ENOMEM);
 rt-asf_ctx-pb  = pb;
@@ -122,7 +126,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char 
*p)
 return ret;
 }
 
-ret = avformat_open_input(rt-asf_ctx, , ff_asf_demuxer, opts);
+ret = avformat_open_input(rt-asf_ctx, , iformat, opts);
 av_dict_free(opts);
 if (ret  0)
 return ret;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] dv: better split weight tables assignment

2014-10-25 Thread Christophe Gisquet
ffmpeg | branch: master | Christophe Gisquet christophe.gisq...@gmail.com | 
Sat Oct 25 11:19:20 2014 +| [eacf2e8eb35c3a18cfeddd2aa0ac787949dc7f94] | 
committer: Michael Niedermayer

dv: better split weight tables assignment

This is a mostly cosmetical patch in preparation for the following.

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eacf2e8eb35c3a18cfeddd2aa0ac787949dc7f94
---

 libavcodec/dv.c |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index 4b23f2a..e1e5dd9 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -186,7 +186,6 @@ int ff_dv_init_dynamic_tables(DVVideoContext *ctx, const 
AVDVProfile *d)
 {
 int j, i, c, s, p;
 uint32_t *factor1, *factor2;
-const int *iweight1, *iweight2;
 
 p = i = 0;
 for (c = 0; c  d-n_difchan; c++) {
@@ -206,14 +205,15 @@ int ff_dv_init_dynamic_tables(DVVideoContext *ctx, const 
AVDVProfile *d)
 
 factor1 = ctx-idct_factor[0];
 factor2 = ctx-idct_factor[DV_PROFILE_IS_HD(d) ? 4096 : 2816];
-if (d-height == 720) {
-iweight1 = ff_dv_iweight_720_y[0];
-iweight2 = ff_dv_iweight_720_c[0];
-} else {
-iweight1 = ff_dv_iweight_1080_y[0];
-iweight2 = ff_dv_iweight_1080_c[0];
-}
 if (DV_PROFILE_IS_HD(d)) {
+const int *iweight1, *iweight2;
+if (d-height == 720) {
+iweight1 = ff_dv_iweight_720_y[0];
+iweight2 = ff_dv_iweight_720_c[0];
+} else {
+iweight1 = ff_dv_iweight_1080_y[0];
+iweight2 = ff_dv_iweight_1080_c[0];
+}
 for (c = 0; c  4; c++) {
 for (s = 0; s  16; s++) {
 for (i = 0; i  64; i++) {
@@ -223,7 +223,7 @@ int ff_dv_init_dynamic_tables(DVVideoContext *ctx, const 
AVDVProfile *d)
 }
 }
 } else {
-iweight1 = ff_dv_iweight_88[0];
+const int *iweight1 = ff_dv_iweight_88[0];
 for (j = 0; j  2; j++, iweight1 = ff_dv_iweight_248[0]) {
 for (s = 0; s  22; s++) {
 for (i = c = 0; c  4; c++) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] dv: use smaller type for weight tables

2014-10-25 Thread Christophe Gisquet
ffmpeg | branch: master | Christophe Gisquet christophe.gisq...@gmail.com | 
Sat Oct 25 11:19:21 2014 +| [80b29c2d0c0bade061f39672fb64924ea6bf3213] | 
committer: Michael Niedermayer

dv: use smaller type for weight tables

Reviewed-by: Reimar Döffinger reimar.doeffin...@gmx.de
Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=80b29c2d0c0bade061f39672fb64924ea6bf3213
---

 libavcodec/dv.c |4 ++--
 libavcodec/dvdata.c |   12 ++--
 libavcodec/dvdata.h |   12 ++--
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index e1e5dd9..1f04861 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -206,7 +206,7 @@ int ff_dv_init_dynamic_tables(DVVideoContext *ctx, const 
AVDVProfile *d)
 factor1 = ctx-idct_factor[0];
 factor2 = ctx-idct_factor[DV_PROFILE_IS_HD(d) ? 4096 : 2816];
 if (DV_PROFILE_IS_HD(d)) {
-const int *iweight1, *iweight2;
+const uint16_t *iweight1, *iweight2;
 if (d-height == 720) {
 iweight1 = ff_dv_iweight_720_y[0];
 iweight2 = ff_dv_iweight_720_c[0];
@@ -223,7 +223,7 @@ int ff_dv_init_dynamic_tables(DVVideoContext *ctx, const 
AVDVProfile *d)
 }
 }
 } else {
-const int *iweight1 = ff_dv_iweight_88[0];
+const uint16_t *iweight1 = ff_dv_iweight_88[0];
 for (j = 0; j  2; j++, iweight1 = ff_dv_iweight_248[0]) {
 for (s = 0; s  22; s++) {
 for (i = c = 0; c  4; c++) {
diff --git a/libavcodec/dvdata.c b/libavcodec/dvdata.c
index 85cba53..007976e 100644
--- a/libavcodec/dvdata.c
+++ b/libavcodec/dvdata.c
@@ -69,7 +69,7 @@ const uint8_t ff_dv_quant_shifts[22][4] = {
 
 const uint8_t ff_dv_quant_offset[4] = { 6, 3, 0, 1 };
 
-const int ff_dv_iweight_88[64] = {
+const uint16_t ff_dv_iweight_88[64] = {
 32768, 16710, 16710, 17735, 17015, 17735, 18197, 18079,
 18079, 18197, 18725, 18559, 19196, 18559, 18725, 19284,
 19108, 19692, 19692, 19108, 19284, 21400, 19645, 20262,
@@ -79,7 +79,7 @@ const int ff_dv_iweight_88[64] = {
 24600, 25267, 24457, 22672, 24457, 25267, 25971, 25191,
 25191, 25971, 26715, 27962, 26715, 29642, 29642, 31536,
 };
-const int ff_dv_iweight_248[64] = {
+const uint16_t ff_dv_iweight_248[64] = {
 32768, 17735, 16710, 18079, 18725, 21400, 17735, 19196,
 19108, 21845, 16384, 17735, 18725, 21400, 16710, 18079,
 20262, 23173, 18197, 19692, 18725, 20262, 20815, 23764,
@@ -93,7 +93,7 @@ const int ff_dv_iweight_248[64] = {
 /**
  * The inverse DV100 weights are actually just the spec weights (zig-zagged).
  */
-const int ff_dv_iweight_1080_y[64] = {
+const uint16_t ff_dv_iweight_1080_y[64] = {
 128,  16,  16,  17,  17,  17,  18,  18,
  18,  18,  18,  18,  19,  18,  18,  19,
  19,  19,  19,  19,  19,  42,  38,  40,
@@ -103,7 +103,7 @@ const int ff_dv_iweight_1080_y[64] = {
  48,  49,  48,  44,  48,  49, 101,  98,
  98, 101, 104, 109, 104, 116, 116, 123,
 };
-const int ff_dv_iweight_1080_c[64] = {
+const uint16_t ff_dv_iweight_1080_c[64] = {
 128,  16,  16,  17,  17,  17,  25,  25,
  25,  25,  26,  25,  26,  25,  26,  26,
  26,  27,  27,  26,  26,  42,  38,  40,
@@ -113,7 +113,7 @@ const int ff_dv_iweight_1080_c[64] = {
  96, 197, 191, 177, 191, 197, 203, 197,
 197, 203, 209, 219, 209, 232, 232, 246,
 };
-const int ff_dv_iweight_720_y[64] = {
+const uint16_t ff_dv_iweight_720_y[64] = {
 128,  16,  16,  17,  17,  17,  18,  18,
  18,  18,  18,  18,  19,  18,  18,  19,
  19,  19,  19,  19,  19,  42,  38,  40,
@@ -123,7 +123,7 @@ const int ff_dv_iweight_720_y[64] = {
  96,  98,  96,  88,  96,  98, 202, 196,
 196, 202, 208, 218, 208, 232, 232, 246,
 };
-const int ff_dv_iweight_720_c[64] = {
+const uint16_t ff_dv_iweight_720_c[64] = {
 128,  24,  24,  26,  26,  26,  36,  36,
  36,  36,  36,  36,  38,  36,  36,  38,
  38,  38,  38,  38,  38,  84,  76,  80,
diff --git a/libavcodec/dvdata.h b/libavcodec/dvdata.h
index 0932d3a..3c4da44 100644
--- a/libavcodec/dvdata.h
+++ b/libavcodec/dvdata.h
@@ -26,12 +26,12 @@ extern const uint8_t ff_dv_zigzag248_direct[64];
 extern const uint8_t ff_dv_quant_shifts[22][4];
 extern const uint8_t ff_dv_quant_offset[4];
 
-extern const int ff_dv_iweight_88[64];
-extern const int ff_dv_iweight_248[64];
-extern const int ff_dv_iweight_1080_y[64];
-extern const int ff_dv_iweight_1080_c[64];
-extern const int ff_dv_iweight_720_y[64];
-extern const int ff_dv_iweight_720_c[64];
+extern const uint16_t ff_dv_iweight_88[64];
+extern const uint16_t ff_dv_iweight_248[64];
+extern const uint16_t ff_dv_iweight_1080_y[64];
+extern const uint16_t ff_dv_iweight_1080_c[64];
+extern const uint16_t ff_dv_iweight_720_y[64];
+extern const uint16_t ff_dv_iweight_720_c[64];
 
 #define NB_DV_VLC 409
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org

[FFmpeg-cvslog] doc/fftools-common-opts: document -devices option

2014-10-25 Thread Lukasz Marek
ffmpeg | branch: master | Lukasz Marek lukasz.m.lu...@gmail.com | Fri Oct 24 
23:31:03 2014 +0200| [1cff9085898c3e0d305e8159860b68b1f97b7ea9] | committer: 
Lukasz Marek

doc/fftools-common-opts: document -devices option

Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1cff9085898c3e0d305e8159860b68b1f97b7ea9
---

 doc/fftools-common-opts.texi |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi
index 7b6afba..299b9de 100644
--- a/doc/fftools-common-opts.texi
+++ b/doc/fftools-common-opts.texi
@@ -103,7 +103,10 @@ Print detailed information about the filter name 
@var{filter_name}. Use the
 Show version.
 
 @item -formats
-Show available formats.
+Show available formats (including devices).
+
+@item -devices
+Show available devices.
 
 @item -codecs
 Show all codecs known to libavcodec.

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] opts: add list device sources/sinks options

2014-10-25 Thread Lukasz Marek
ffmpeg | branch: master | Lukasz Marek lukasz.m.lu...@gmail.com | Thu Aug  7 
00:45:26 2014 +0200| [5f558198502001c7f26601352b979738e2e16b42] | committer: 
Lukasz Marek

opts: add list device sources/sinks options

Allows to list sources/sinks of the devices that implement
that functionality.

Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5f558198502001c7f26601352b979738e2e16b42
---

 cmdutils.c   |  181 ++
 cmdutils.h   |   14 
 cmdutils_common_opts.h   |6 ++
 doc/fftools-common-opts.texi |   16 
 4 files changed, 217 insertions(+)

diff --git a/cmdutils.c b/cmdutils.c
index 46bfcca..b777396 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -2055,3 +2055,184 @@ void *grow_array(void *array, int elem_size, int *size, 
int new_size)
 }
 return array;
 }
+
+#if CONFIG_AVDEVICE
+static int print_device_sources(AVInputFormat *fmt, AVDictionary *opts)
+{
+int ret, i;
+AVFormatContext *dev = NULL;
+AVDeviceInfoList *device_list = NULL;
+AVDictionary *tmp_opts = NULL;
+
+if (!fmt || !fmt-priv_class  || 
!AV_IS_INPUT_DEVICE(fmt-priv_class-category))
+return AVERROR(EINVAL);
+
+printf(Audo-detected sources for %s:\n, fmt-name);
+if (!fmt-get_device_list) {
+ret = AVERROR(ENOSYS);
+printf(Cannot list sources. Not implemented.\n);
+goto fail;
+}
+
+/* TODO: avformat_open_input calls read_header callback which is not 
necessary.
+ Function like avformat_alloc_output_context2 for input could be 
helpful here. */
+av_dict_copy(tmp_opts, opts, 0);
+if ((ret = avformat_open_input(dev, NULL, fmt, tmp_opts))  0) {
+printf(Cannot open device: %s.\n, fmt-name);
+goto fail;
+}
+
+if ((ret = avdevice_list_devices(dev, device_list))  0) {
+printf(Cannot list sources.\n);
+goto fail;
+}
+
+for (i = 0; i  device_list-nb_devices; i++) {
+printf(%s %s [%s]\n, device_list-default_device == i ? * :  ,
+   device_list-devices[i]-device_name, 
device_list-devices[i]-device_description);
+}
+
+  fail:
+av_dict_free(tmp_opts);
+avdevice_free_list_devices(device_list);
+avformat_close_input(dev);
+return ret;
+}
+
+static int print_device_sinks(AVOutputFormat *fmt, AVDictionary *opts)
+{
+int ret, i;
+AVFormatContext *dev = NULL;
+AVDeviceInfoList *device_list = NULL;
+AVDictionary *tmp_opts = NULL;
+
+if (!fmt || !fmt-priv_class  || 
!AV_IS_OUTPUT_DEVICE(fmt-priv_class-category))
+return AVERROR(EINVAL);
+
+printf(Audo-detected sinks for %s:\n, fmt-name);
+if (!fmt-get_device_list) {
+ret = AVERROR(ENOSYS);
+printf(Cannot list sinks. Not implemented.\n);
+goto fail;
+}
+
+if ((ret = avformat_alloc_output_context2(dev, fmt, NULL, NULL))  0) {
+printf(Cannot open device: %s.\n, fmt-name);
+goto fail;
+}
+av_dict_copy(tmp_opts, opts, 0);
+av_opt_set_dict2(dev, tmp_opts, AV_OPT_SEARCH_CHILDREN);
+
+if ((ret = avdevice_list_devices(dev, device_list))  0) {
+printf(Cannot list sinks.\n);
+goto fail;
+}
+
+for (i = 0; i  device_list-nb_devices; i++) {
+printf(%s %s [%s]\n, device_list-default_device == i ? * :  ,
+   device_list-devices[i]-device_name, 
device_list-devices[i]-device_description);
+}
+
+  fail:
+av_dict_free(tmp_opts);
+avdevice_free_list_devices(device_list);
+avformat_free_context(dev);
+return ret;
+}
+
+static int show_sinks_sources_parse_arg(const char *arg, char **dev, 
AVDictionary **opts)
+{
+int ret;
+if (arg) {
+char *opts_str = NULL;
+av_assert0(dev  opts);
+*dev = av_strdup(arg);
+if (!*dev)
+return AVERROR(ENOMEM);
+if ((opts_str = strchr(*dev, ','))) {
+*(opts_str++) = '\0';
+if (opts_str[0]  ((ret = av_dict_parse_string(opts, opts_str, 
=, :, 0))  0)) {
+av_freep(dev);
+return ret;
+}
+}
+} else
+printf(\nDevice name is not provided.\n
+You can pass devicename[,opt1=val1[,opt2=val2...]] as an 
argument.\n\n);
+return 0;
+}
+
+int show_sources(void *optctx, const char *opt, const char *arg)
+{
+AVInputFormat *fmt = NULL;
+char *dev = NULL;
+AVDictionary *opts = NULL;
+int ret = 0;
+int error_level = av_log_get_level();
+
+av_log_set_level(AV_LOG_ERROR);
+
+if ((ret = show_sinks_sources_parse_arg(arg, dev, opts))  0)
+goto fail;
+
+do {
+fmt = av_input_audio_device_next(fmt);
+if (fmt) {
+if (!strcmp(fmt-name, lavfi))
+continue; //it's pointless to probe lavfi
+if (dev  strcmp(fmt-name, dev))
+continue;
+print_device_sources(fmt, opts);
+ 

[FFmpeg-cvslog] lavd/avfoundation: Add support for screen capturing.

2014-10-25 Thread Thilo Borgmann
ffmpeg | branch: master | Thilo Borgmann thilo.borgm...@mail.de | Sat Oct 25 
17:02:28 2014 +0200| [a6555f88aaf0730e64240136fb19d8effb3a0738] | committer: 
Michael Niedermayer

lavd/avfoundation: Add support for screen capturing.

Patch based on pull-request by Joseph Benden j...@benden.us

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a6555f88aaf0730e64240136fb19d8effb3a0738
---

 configure  |2 +-
 libavdevice/avfoundation.m |   70 +++-
 2 files changed, 57 insertions(+), 15 deletions(-)

diff --git a/configure b/configure
index 3e181aa..3eb1aa0 100755
--- a/configure
+++ b/configure
@@ -2452,7 +2452,7 @@ xwma_demuxer_select=riffdec
 # indevs / outdevs
 alsa_indev_deps=alsa_asoundlib_h snd_pcm_htimestamp
 alsa_outdev_deps=alsa_asoundlib_h
-avfoundation_indev_extralibs=-framework CoreVideo -framework Foundation 
-framework AVFoundation -framework CoreMedia
+avfoundation_indev_extralibs=-framework CoreVideo -framework Foundation 
-framework AVFoundation -framework CoreMedia -framework CoreGraphics
 avfoundation_indev_select=avfoundation
 bktr_indev_deps_any=dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h 
dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h
 caca_outdev_deps=libcaca
diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index 8c00a0e..75c62ed 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -99,6 +99,8 @@ typedef struct
 char*video_filename;
 char*audio_filename;
 
+int num_video_devices;
+
 int audio_channels;
 int audio_bits_per_sample;
 int audio_float;
@@ -264,16 +266,22 @@ static int add_video_device(AVFormatContext *s, 
AVCaptureDevice *video_device)
 {
 AVFContext *ctx = (AVFContext*)s-priv_data;
 NSError *error  = nil;
-AVCaptureDeviceInput* capture_dev_input = [[[AVCaptureDeviceInput alloc] 
initWithDevice:video_device error:error] autorelease];
+AVCaptureInput* capture_input = nil;
+
+if (ctx-video_device_index  ctx-num_video_devices) {
+capture_input = (AVCaptureInput*) [[[AVCaptureDeviceInput alloc] 
initWithDevice:video_device error:error] autorelease];
+} else {
+capture_input = (AVCaptureInput*) video_device;
+}
 
-if (!capture_dev_input) {
+if (!capture_input) {
 av_log(s, AV_LOG_ERROR, Failed to create AV capture input device: 
%s\n,
[[error localizedDescription] UTF8String]);
 return 1;
 }
 
-if ([ctx-capture_session canAddInput:capture_dev_input]) {
-[ctx-capture_session addInput:capture_dev_input];
+if ([ctx-capture_session canAddInput:capture_input]) {
+[ctx-capture_session addInput:capture_input];
 } else {
 av_log(s, AV_LOG_ERROR, can't add video input to capture session\n);
 return 1;
@@ -522,19 +530,32 @@ static int avf_read_header(AVFormatContext *s)
 AVFContext *ctx = (AVFContext*)s-priv_data;
 ctx-first_pts  = av_gettime();
 ctx-first_audio_pts= av_gettime();
+uint32_t num_screens= 0;
 
 pthread_mutex_init(ctx-frame_lock, NULL);
 pthread_cond_init(ctx-frame_wait_cond, NULL);
 
+CGGetActiveDisplayList(0, NULL, num_screens);
+
 // List devices if requested
 if (ctx-list_devices) {
 av_log(ctx, AV_LOG_INFO, AVFoundation video devices:\n);
 NSArray *devices = [AVCaptureDevice 
devicesWithMediaType:AVMediaTypeVideo];
+int index = 0;
 for (AVCaptureDevice *device in devices) {
 const char *name = [[device localizedName] UTF8String];
-int index  = [devices indexOfObject:device];
+index= [devices indexOfObject:device];
 av_log(ctx, AV_LOG_INFO, [%d] %s\n, index, name);
+index++;
 }
+if (num_screens  0) {
+CGDirectDisplayID screens[num_screens];
+CGGetActiveDisplayList(num_screens, screens, num_screens);
+for (int i = 0; i  num_screens; i++) {
+av_log(ctx, AV_LOG_INFO, [%d] Capture screen %d\n, index + 
i, i);
+}
+}
+
 av_log(ctx, AV_LOG_INFO, AVFoundation audio devices:\n);
 devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeAudio];
 for (AVCaptureDevice *device in devices) {
@@ -549,6 +570,9 @@ static int avf_read_header(AVFormatContext *s)
 AVCaptureDevice *video_device = nil;
 AVCaptureDevice *audio_device = nil;
 
+NSArray *video_devices = [AVCaptureDevice 
devicesWithMediaType:AVMediaTypeVideo];
+ctx-num_video_devices = [video_devices count];
+
 // parse input filename for video and audio device
 parse_device_name(s);
 
@@ -561,25 +585,39 @@ static int avf_read_header(AVFormatContext *s)
 }
 
 if (ctx-video_device_index = 0) {
-NSArray *devices = [AVCaptureDevice 

[FFmpeg-cvslog] lavu: Provide fallbacks for gmtime_r and localtime_r

2014-10-25 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö mar...@martin.st | Fri Oct 24 
10:33:19 2014 +0300| [3f8f1c6ff24ee858eb5b0bf47ef6d4605299a87e] | committer: 
Martin Storsjö

lavu: Provide fallbacks for gmtime_r and localtime_r

This allows writing most code as if they always are is available.

These are ok to use from other libraries even though it's not a
public header, since they only provide an inline declaration, and
doesn't add an actual dependency on lavu internals. (This can be
considered more a build system compatibility fallback than a
libavutil feature.)

Signed-off-by: Martin Storsjö mar...@martin.st

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3f8f1c6ff24ee858eb5b0bf47ef6d4605299a87e
---

 configure |2 ++
 libavutil/time_internal.h |   47 +
 2 files changed, 49 insertions(+)

diff --git a/configure b/configure
index a82bef7..f53332d 100755
--- a/configure
+++ b/configure
@@ -1453,6 +1453,7 @@ SYSTEM_FUNCS=
 getservbyport
 GetSystemTimeAsFileTime
 gettimeofday
+gmtime_r
 inet_aton
 isatty
 jack_port_get_latency_range
@@ -4062,6 +4063,7 @@ check_func  gethrtime
 check_func  getopt
 check_func  getrusage
 check_func  gettimeofday
+check_func  gmtime_r
 check_func  isatty
 check_func  localtime_r
 check_func  mach_absolute_time
diff --git a/libavutil/time_internal.h b/libavutil/time_internal.h
new file mode 100644
index 000..829fefb
--- /dev/null
+++ b/libavutil/time_internal.h
@@ -0,0 +1,47 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav 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.1 of the License, or (at your option) any later version.
+ *
+ * Libav 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 Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_TIME_INTERNAL_H
+#define AVUTIL_TIME_INTERNAL_H
+
+#include time.h
+#include config.h
+
+#if !HAVE_GMTIME_R
+static inline struct tm *gmtime_r(const time_t* clock, struct tm *result)
+{
+struct tm *ptr = gmtime(clock);
+if (!ptr)
+return NULL;
+*result = *ptr;
+return result;
+}
+#endif
+
+#if !HAVE_LOCALTIME_R
+static inline struct tm *localtime_r(const time_t* clock, struct tm *result)
+{
+struct tm *ptr = localtime(clock);
+if (!ptr)
+return NULL;
+*result = *ptr;
+return result;
+}
+#endif
+
+#endif /* AVUTIL_TIME_INTERNAL_H */

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit '6b9b42cc5576e1819ad1e29d98940066fd14b2d6'

2014-10-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Sun Oct 26 
03:12:37 2014 +0100| [4360c6ff610cce5ef0fc844c1e0616aea0204f7e] | committer: 
Michael Niedermayer

Merge commit '6b9b42cc5576e1819ad1e29d98940066fd14b2d6'

* commit '6b9b42cc5576e1819ad1e29d98940066fd14b2d6':
  drawtext: Remove the ifdef for localtime_r

Conflicts:
libavfilter/vf_drawtext.c

Merged-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4360c6ff610cce5ef0fc844c1e0616aea0204f7e
---



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] drawtext: Remove the ifdef for localtime_r

2014-10-25 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö mar...@martin.st | Fri Oct 24 
10:59:34 2014 +0300| [6b9b42cc5576e1819ad1e29d98940066fd14b2d6] | committer: 
Martin Storsjö

drawtext: Remove the ifdef for localtime_r

If it isn't available in the system, we've got a fallback to
the normal localtime function, so normal code can assume it is
available as long as time_internal.h is included.

Signed-off-by: Martin Storsjö mar...@martin.st

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6b9b42cc5576e1819ad1e29d98940066fd14b2d6
---

 libavfilter/vf_drawtext.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index d954fdf..54a8847 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -47,6 +47,7 @@
 #include libavutil/random_seed.h
 #include libavutil/parseutils.h
 #include libavutil/pixdesc.h
+#include libavutil/time_internal.h
 #include libavutil/tree.h
 #include libavutil/lfg.h
 #include avfilter.h
@@ -535,8 +536,6 @@ static int dtext_prepare_text(AVFilterContext *ctx)
 Glyph dummy = { 0 };
 int width  = ctx-inputs[0]-w;
 int height = ctx-inputs[0]-h;
-
-#if HAVE_LOCALTIME_R
 time_t now = time(0);
 struct tm ltime;
 uint8_t *buf = s-expanded_text;
@@ -558,7 +557,6 @@ static int dtext_prepare_text(AVFilterContext *ctx)
 return AVERROR(ENOMEM);
 text = s-expanded_text = buf;
 s-expanded_text_size = buf_size;
-#endif
 
 if ((len = strlen(text))  s-nb_positions) {
 FT_Vector *p = av_realloc(s-positions,

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit 'ed6dad3737bf7bb2d5e9fa9511dfdb44806010e8'

2014-10-25 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Sun Oct 26 
03:22:28 2014 +0100| [abaa41b6426c862232977527e783a571fb62645e] | committer: 
Michael Niedermayer

Merge commit 'ed6dad3737bf7bb2d5e9fa9511dfdb44806010e8'

* commit 'ed6dad3737bf7bb2d5e9fa9511dfdb44806010e8':
  lavf: Implement ff_brktimegm using gmtime_r

Merged-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=abaa41b6426c862232977527e783a571fb62645e
---



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog