[FFmpeg-devel] [PATCH] h264: avoid unnecessary calls to get_format

2015-03-31 Thread Rainer Hochecker
---
 libavcodec/h264_slice.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 80d27e5..9477650 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1417,7 +1417,8 @@ int ff_h264_decode_slice_header(H264Context *h, 
H264Context *h0)
  || h-mb_width  != h-sps.mb_width
  || h-mb_height != h-sps.mb_height * (2 - 
h-sps.frame_mbs_only_flag)
 ));
-if (non_j_pixfmt(h0-avctx-pix_fmt) != non_j_pixfmt(get_pixel_format(h0, 
0)))
+if (h0-avctx-pix_fmt == AV_PIX_FMT_NONE
+|| (non_j_pixfmt(h0-avctx-pix_fmt) != 
non_j_pixfmt(get_pixel_format(h0, 0
 must_reinit = 1;
 
 if (first_slice  av_cmp_q(h-sps.sar, h-avctx-sample_aspect_ratio))
-- 
2.1.0

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


[FFmpeg-devel] [PATCH]Support more audio in Hikvision recordings

2015-03-31 Thread Carl Eugen Hoyos
Hi!

Attached patch fixes audio in a cctv recording a user uploaded.

Please comment, Carl Eugen
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index a0b5738..af47652 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -501,6 +501,9 @@ redo:
 goto found;
 }
 
+if (m-imkh_cctv)
+request_probe = 25;
+
 es_type = m-psm_es_type[startcode  0xff];
 if (es_type == STREAM_TYPE_VIDEO_MPEG1) {
 codec_id = AV_CODEC_ID_MPEG2VIDEO;
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avfilter/vf_detelecine: Fix uninitialized array index error

2015-03-31 Thread Himangi Saraogi
---
Fixes the defect CID 1292301.

 libavfilter/vf_detelecine.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/libavfilter/vf_detelecine.c b/libavfilter/vf_detelecine.c
index 218a8c8..8ad7ae3 100644
--- a/libavfilter/vf_detelecine.c
+++ b/libavfilter/vf_detelecine.c
@@ -265,12 +265,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*inpicref)
 out = 1;
 } else if (len == 1) {
 // fill in the EARLIER field from the new pic
-av_image_copy_plane(s-frame-data[i] + s-frame-linesize[i] 
* s-first_field,
-s-frame-linesize[i] * 2,
-inpicref-data[i] + inpicref-linesize[i] 
* s-first_field,
-inpicref-linesize[i] * 2,
-s-stride[i],
-(s-planeheight[i] - s-first_field + 1) / 
2);
+for (i = 0; i  s-nb_planes; i++) {
+av_image_copy_plane(s-frame-data[i] +
+s-frame-linesize[i] * s-first_field,
+s-frame-linesize[i] * 2,
+inpicref-data[i] +
+inpicref-linesize[i] * s-first_field,
+inpicref-linesize[i] * 2, 
s-stride[i],
+(s-planeheight[i] - s-first_field + 
1) / 2);
+ }
+
 // TODO: not sure about the other field
 
 len--;
-- 
1.9.1

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


[FFmpeg-devel] [PATCH] avformat/http: Fix null check on allocated value

2015-03-31 Thread Himangi Saraogi
---
This probably fixes CID 1292299 as well.

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

diff --git a/libavformat/http.c b/libavformat/http.c
index da3c9be..45533e4 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -495,7 +495,7 @@ static int cookie_string(AVDictionary *dict, char **cookies)
 e = NULL;
 if (*cookies) av_free(*cookies);
 *cookies = av_malloc(len);
-if (!cookies) return AVERROR(ENOMEM);
+if (!*cookies) return AVERROR(ENOMEM);
 *cookies[0] = '\0';
 
 // write out the cookies
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH] avformat/http: Fix null check on allocated value

2015-03-31 Thread Michael Niedermayer
On Tue, Mar 31, 2015 at 12:53:25PM +0530, Himangi Saraogi wrote:
 ---
 This probably fixes CID 1292299 as well.
 
  libavformat/http.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

applied

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_detelecine: Fix uninitialized array index error

2015-03-31 Thread Michael Niedermayer
On Tue, Mar 31, 2015 at 12:43:46PM +0530, Himangi Saraogi wrote:
 ---
 Fixes the defect CID 1292301.
 
  libavfilter/vf_detelecine.c | 16 ++--
  1 file changed, 10 insertions(+), 6 deletions(-)

applied

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] h264: avoid unnecessary calls to get_format

2015-03-31 Thread Michael Niedermayer
On Tue, Mar 31, 2015 at 08:27:01AM +0200, Rainer Hochecker wrote:
 ---
  libavcodec/h264_slice.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

applied

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
100% positive feedback - All either got their money back or didnt complain
Best seller ever, very honest - Seller refunded buyer after failed scam


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] vf_drawtext: add support for setting box border width

2015-03-31 Thread Michael Niedermayer
On Tue, Mar 31, 2015 at 12:52:47AM +0200, Marton Balint wrote:
 Signed-off-by: Marton Balint c...@passwd.hu
 ---
  doc/filters.texi  | 4 
  libavfilter/vf_drawtext.c | 5 -
  2 files changed, 8 insertions(+), 1 deletion(-)

applied

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 3/4] apng: Add a basic APNG encoder

2015-03-31 Thread Donny Yang
Signed-off-by: Donny Yang w...@kota.moe
---
 configure  |   1 +
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   2 +-
 libavcodec/pngenc.c| 151 +
 4 files changed, 144 insertions(+), 11 deletions(-)

diff --git a/configure b/configure
index 392946a..bc59271 100755
--- a/configure
+++ b/configure
@@ -2099,6 +2099,7 @@ amv_decoder_select=sp5x_decoder exif
 amv_encoder_select=aandcttables jpegtables mpegvideoenc
 ape_decoder_select=bswapdsp llauddsp
 apng_decoder_select=zlib
+apng_encoder_select=huffyuvencdsp zlib
 asv1_decoder_select=blockdsp bswapdsp idctdsp
 asv1_encoder_select=bswapdsp fdctdsp pixblockdsp
 asv2_decoder_select=blockdsp bswapdsp idctdsp
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index f8e2732..dd1d850 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -145,6 +145,7 @@ OBJS-$(CONFIG_ANM_DECODER) += anm.o
 OBJS-$(CONFIG_ANSI_DECODER)+= ansi.o cga_data.o
 OBJS-$(CONFIG_APE_DECODER) += apedec.o
 OBJS-$(CONFIG_APNG_DECODER)+= png.o pngdec.o pngdsp.o
+OBJS-$(CONFIG_APNG_ENCODER)+= png.o pngenc.o
 OBJS-$(CONFIG_SSA_DECODER) += assdec.o ass.o ass_split.o
 OBJS-$(CONFIG_SSA_ENCODER) += assenc.o ass.o
 OBJS-$(CONFIG_ASS_DECODER) += assdec.o ass.o ass_split.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 89acac1..ef3558a 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -108,7 +108,7 @@ void avcodec_register_all(void)
 REGISTER_ENCDEC (AMV,   amv);
 REGISTER_DECODER(ANM,   anm);
 REGISTER_DECODER(ANSI,  ansi);
-REGISTER_DECODER(APNG,  apng);
+REGISTER_ENCDEC (APNG,  apng);
 REGISTER_ENCDEC (ASV1,  asv1);
 REGISTER_ENCDEC (ASV2,  asv2);
 REGISTER_DECODER(AURA,  aura);
diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index e7c343b..21e35f2 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -24,6 +24,7 @@
 #include bytestream.h
 #include huffyuvencdsp.h
 #include png.h
+#include apng.h
 
 #include libavutil/avassert.h
 #include libavutil/libm.h
@@ -53,6 +54,10 @@ typedef struct PNGEncContext {
 int bit_depth;
 int color_type;
 int bits_per_pixel;
+
+// APNG
+uint32_t palette_checksum;   // Used to ensure a single unique palette
+uint32_t sequence_number;
 } PNGEncContext;
 
 static void png_get_interlaced_row(uint8_t *dst, int row_size,
@@ -216,9 +221,34 @@ static void png_write_chunk(uint8_t **f, uint32_t tag,
 bytestream_put_be32(f, crc);
 }
 
+static void png_write_image_data(AVCodecContext *avctx,
+ const uint8_t *buf, int length)
+{
+PNGEncContext *s = avctx-priv_data;
+uint32_t crc = crc32(0, Z_NULL, 0);
+
+if (avctx-codec_id == AV_CODEC_ID_PNG || avctx-frame_number == 0)
+return png_write_chunk(s-bytestream, MKTAG('I', 'D', 'A', 'T'), buf, 
length);
+
+bytestream_put_be32(s-bytestream, length + 4);
+
+bytestream_put_be32(s-bytestream, MKBETAG('f', 'd', 'A', 'T'));
+bytestream_put_be32(s-bytestream, s-sequence_number);
+crc = crc32(crc, s-bytestream - 8, 8);
+
+crc = crc32(crc, buf, length);
+memcpy(s-bytestream, buf, length);
+s-bytestream += length;
+
+bytestream_put_be32(s-bytestream, crc);
+
+++s-sequence_number;
+}
+
 /* XXX: do filtering */
-static int png_write_row(PNGEncContext *s, const uint8_t *data, int size)
+static int png_write_row(AVCodecContext *avctx, const uint8_t *data, int size)
 {
+PNGEncContext *s = avctx-priv_data;
 int ret;
 
 s-zstream.avail_in = size;
@@ -229,8 +259,7 @@ static int png_write_row(PNGEncContext *s, const uint8_t 
*data, int size)
 return -1;
 if (s-zstream.avail_out == 0) {
 if (s-bytestream_end - s-bytestream  IOBUF_SIZE + 100)
-png_write_chunk(s-bytestream,
-MKTAG('I', 'D', 'A', 'T'), s-buf, IOBUF_SIZE);
+png_write_image_data(avctx, s-buf, IOBUF_SIZE);
 s-zstream.avail_out = IOBUF_SIZE;
 s-zstream.next_out  = s-buf;
 }
@@ -409,7 +438,7 @@ static int encode_frame(AVCodecContext *avctx, const 
AVFrame *pict)
ptr, avctx-width);
 crow = png_choose_filter(s, crow_buf, progressive_buf,
  top, pass_row_size, 
s-bits_per_pixel  3);
-png_write_row(s, crow, pass_row_size + 1);
+png_write_row(avctx, crow, pass_row_size + 1);
 top = progressive_buf;
 }
 }
@@ -420,7 +449,7 @@ static int encode_frame(AVCodecContext *avctx, const 
AVFrame *pict)
 ptr = p-data[0] + y * p-linesize[0];
 crow = 

[FFmpeg-devel] [PATCH 1/4] png: Clear up the calculation of max packet size

2015-03-31 Thread Donny Yang
Signed-off-by: Donny Yang w...@kota.moe
---
 libavcodec/pngenc.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index 8fff0f3..ca0ed25 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -307,12 +307,16 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
 row_size   = (avctx-width * s-bits_per_pixel + 7)  3;
 
 enc_row_size= deflateBound(s-zstream, row_size);
-max_packet_size = avctx-height * (int64_t)(enc_row_size +
-   ((enc_row_size + IOBUF_SIZE - 1) / 
IOBUF_SIZE) * 12)
-  + FF_MIN_BUFFER_SIZE;
+max_packet_size =
+FF_MIN_BUFFER_SIZE + // headers
+avctx-height * (
+enc_row_size +
+12 * (((int64_t)enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) // 
IDAT * ceil(enc_row_size / IOBUF_SIZE)
+);
 if (max_packet_size  INT_MAX)
 return AVERROR(ENOMEM);
-if ((ret = ff_alloc_packet2(avctx, pkt, max_packet_size))  0)
+ret = ff_alloc_packet2(avctx, pkt, max_packet_size);
+if (ret)
 return ret;
 
 s-bytestream_start =
-- 
2.3.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/4] png: Clearly separate encoding header and frames

2015-03-31 Thread Donny Yang
Signed-off-by: Donny Yang w...@kota.moe
---
 libavcodec/pngenc.c | 142 +++-
 1 file changed, 84 insertions(+), 58 deletions(-)

diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index ca0ed25..e7c343b 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -291,58 +291,11 @@ static int png_get_gama(enum 
AVColorTransferCharacteristic trc, uint8_t *buf)
 return 1;
 }
 
-static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
-const AVFrame *pict, int *got_packet)
+static int encode_headers(AVCodecContext *avctx, const AVFrame *pict)
 {
-PNGEncContext *s   = avctx-priv_data;
-const AVFrame *const p = pict;
-int y, len, row_size, ret;
-int pass_row_size, enc_row_size;
-int64_t max_packet_size;
-uint8_t *ptr, *top, *crow_buf, *crow;
-uint8_t *crow_base   = NULL;
-uint8_t *progressive_buf = NULL;
-uint8_t *top_buf = NULL;
-
-row_size   = (avctx-width * s-bits_per_pixel + 7)  3;
-
-enc_row_size= deflateBound(s-zstream, row_size);
-max_packet_size =
-FF_MIN_BUFFER_SIZE + // headers
-avctx-height * (
-enc_row_size +
-12 * (((int64_t)enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) // 
IDAT * ceil(enc_row_size / IOBUF_SIZE)
-);
-if (max_packet_size  INT_MAX)
-return AVERROR(ENOMEM);
-ret = ff_alloc_packet2(avctx, pkt, max_packet_size);
-if (ret)
-return ret;
-
-s-bytestream_start =
-s-bytestream   = pkt-data;
-s-bytestream_end   = pkt-data + pkt-size;
-
-crow_base = av_malloc((row_size + 32)  (s-filter_type == 
PNG_FILTER_VALUE_MIXED));
-if (!crow_base) {
-ret = AVERROR(ENOMEM);
-goto the_end;
-}
-// pixel data should be aligned, but there's a control byte before it
-crow_buf = crow_base + 15;
-if (s-is_progressive) {
-progressive_buf = av_malloc(row_size + 1);
-top_buf = av_malloc(row_size + 1);
-if (!progressive_buf || !top_buf) {
-ret = AVERROR(ENOMEM);
-goto the_end;
-}
-}
+PNGEncContext *s = avctx-priv_data;
 
 /* write png header */
-AV_WB64(s-bytestream, PNGSIG);
-s-bytestream += 8;
-
 AV_WB32(s-buf, avctx-width);
 AV_WB32(s-buf + 4, avctx-height);
 s-buf[8]  = s-bit_depth;
@@ -381,9 +334,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
 int has_alpha, alpha, i;
 unsigned int v;
 uint32_t *palette;
-uint8_t *alpha_ptr;
+uint8_t *ptr, *alpha_ptr;
 
-palette   = (uint32_t *)p-data[1];
+palette   = (uint32_t *)pict-data[1];
 ptr   = s-buf;
 alpha_ptr = s-buf + 256 * 3;
 has_alpha = 0;
@@ -403,7 +356,39 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
 }
 }
 
-/* now put each row */
+return 0;
+}
+
+static int encode_frame(AVCodecContext *avctx, const AVFrame *pict)
+{
+PNGEncContext *s   = avctx-priv_data;
+const AVFrame *const p = pict;
+int y, len, ret;
+int row_size, pass_row_size;
+uint8_t *ptr, *top, *crow_buf, *crow;
+uint8_t *crow_base   = NULL;
+uint8_t *progressive_buf = NULL;
+uint8_t *top_buf = NULL;
+
+row_size = (avctx-width * s-bits_per_pixel + 7)  3;
+
+crow_base = av_malloc((row_size + 32)  (s-filter_type == 
PNG_FILTER_VALUE_MIXED));
+if (!crow_base) {
+ret = AVERROR(ENOMEM);
+goto the_end;
+}
+// pixel data should be aligned, but there's a control byte before it
+crow_buf = crow_base + 15;
+if (s-is_progressive) {
+progressive_buf = av_malloc(row_size + 1);
+top_buf = av_malloc(row_size + 1);
+if (!progressive_buf || !top_buf) {
+ret = AVERROR(ENOMEM);
+goto the_end;
+}
+}
+
+/* put each row */
 s-zstream.avail_out = IOBUF_SIZE;
 s-zstream.next_out  = s-buf;
 if (s-is_progressive) {
@@ -456,12 +441,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
 goto the_end;
 }
 }
-png_write_chunk(s-bytestream, MKTAG('I', 'E', 'N', 'D'), NULL, 0);
 
-pkt-size   = s-bytestream - s-bytestream_start;
-pkt-flags |= AV_PKT_FLAG_KEY;
-*got_packet = 1;
-ret = 0;
+ret = 0;
 
 the_end:
 av_freep(crow_base);
@@ -471,6 +452,51 @@ the_end:
 return ret;
 }
 
+static int encode(AVCodecContext *avctx, AVPacket *pkt,
+  const AVFrame *pict, int *got_packet)
+{
+PNGEncContext *s = avctx-priv_data;
+int ret;
+int enc_row_size;
+size_t max_packet_size;
+
+enc_row_size= deflateBound(s-zstream, row_size);
+max_packet_size =
+FF_MIN_BUFFER_SIZE + // headers
+avctx-height * (
+enc_row_size +
+12 * (((int64_t)enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) // 
IDAT * ceil(enc_row_size / 

[FFmpeg-devel] [PATCH 4/4] apng: Add a basic APNG muxer

2015-03-31 Thread Donny Yang
Additionally, update some documentation with support for APNG

Signed-off-by: Donny Yang w...@kota.moe
---
 Changelog|   1 +
 doc/general.texi |   2 +
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   2 +-
 libavformat/apngenc.c| 269 +++
 5 files changed, 274 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/apngenc.c

diff --git a/Changelog b/Changelog
index 75da156..ba0dff5 100644
--- a/Changelog
+++ b/Changelog
@@ -12,6 +12,7 @@ version next:
 - Detelecine filter
 - Intel QSV-accelerated H.264 encoding
 - MMAL-accelerated H.264 decoding
+- basic APNG encoder and muxer
 
 
 version 2.6:
diff --git a/doc/general.texi b/doc/general.texi
index 85ee219..589b423 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -222,6 +222,7 @@ library:
 @tab Audio format used on the Nintendo Gamecube.
 @item AFC   @tab   @tab X
 @tab Audio format used on the Nintendo Gamecube.
+@item APNG  @tab X @tab X
 @item ASF   @tab X @tab X
 @item AST   @tab X @tab X
 @tab Audio format used on the Nintendo Wii.
@@ -508,6 +509,7 @@ following image formats are supported:
 @item Alias PIX@tab X @tab X
 @tab Alias/Wavefront PIX image format
 @item animated GIF @tab X @tab X
+@item APNG @tab X @tab X
 @item BMP  @tab X @tab X
 @tab Microsoft BMP image
 @item BRender PIX  @tab   @tab X
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 2118ff2..5082101 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -80,6 +80,7 @@ OBJS-$(CONFIG_ANM_DEMUXER)   += anm.o
 OBJS-$(CONFIG_APC_DEMUXER)   += apc.o
 OBJS-$(CONFIG_APE_DEMUXER)   += ape.o apetag.o img2.o
 OBJS-$(CONFIG_APNG_DEMUXER)  += apngdec.o
+OBJS-$(CONFIG_APNG_MUXER)+= apngenc.o
 OBJS-$(CONFIG_AQTITLE_DEMUXER)   += aqtitledec.o subtitles.o
 OBJS-$(CONFIG_ASF_DEMUXER)   += asfdec.o asf.o asfcrypt.o \
 avlanguage.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 26ccc27..ca45db8 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -74,7 +74,7 @@ void av_register_all(void)
 REGISTER_DEMUXER (ANM,  anm);
 REGISTER_DEMUXER (APC,  apc);
 REGISTER_DEMUXER (APE,  ape);
-REGISTER_DEMUXER (APNG, apng);
+REGISTER_MUXDEMUX(APNG, apng);
 REGISTER_DEMUXER (AQTITLE,  aqtitle);
 REGISTER_MUXDEMUX(ASF,  asf);
 REGISTER_MUXDEMUX(ASS,  ass);
diff --git a/libavformat/apngenc.c b/libavformat/apngenc.c
new file mode 100644
index 000..0e9af89
--- /dev/null
+++ b/libavformat/apngenc.c
@@ -0,0 +1,269 @@
+/*
+ * APNG muxer
+ * Copyright (c) 2015 Donny Yang
+ *
+ * first version by Donny Yang w...@kota.moe
+ *
+ * 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.1 of the License, or (at your option) any later version.
+ *
+ * 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 FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include zlib.h
+
+#include avformat.h
+#include internal.h
+#include libavutil/avassert.h
+#include libavutil/intreadwrite.h
+#include libavutil/log.h
+#include libavutil/opt.h
+#include libavcodec/png.h
+#include libavcodec/apng.h
+
+typedef struct APNGMuxContext {
+AVClass *class;
+uint32_t plays;
+AVRational last_delay;
+
+uint64_t acTL_offset;
+uint32_t frame_number;
+
+AVPacket *prev_packet;
+AVRational prev_delay;
+
+int framerate_warned;
+} APNGMuxContext;
+
+static uint8_t *apng_find_chunk(uint32_t tag, uint8_t *buf, size_t length)
+{
+size_t b;
+for (b = 0; b  length; b += AV_RB32(buf + b) + 12)
+if (AV_RB32(buf[b + 4]) == tag)
+return buf[b];
+return NULL;
+}
+
+static void apng_write_chunk(AVIOContext *io_context, uint32_t tag,
+ uint8_t *buf, size_t length)
+{
+uint32_t crc;
+uint8_t tagbuf[4];
+
+avio_wb32(io_context, length);
+crc = crc32(0, Z_NULL, 0);
+AV_WB32(tagbuf, tag);
+crc = crc32(crc, tagbuf, 4);
+avio_wb32(io_context, tag);
+if (length  0) {
+crc = crc32(crc, buf, length);
+avio_write(io_context, buf, length);
+}
+avio_wb32(io_context, crc);
+}

[FFmpeg-devel] [PATCH] Relaxed pattern to find ProRes in MXF.

2015-03-31 Thread Steve Dierker
Hello List,

I found another MXF File containing ProRes with the following
codec_uls: 060E2B34040101010E04020102110500
Therefor I relaxed the pattern.

Related to issue #4349
---
 libavformat/mxf.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mxf.c b/libavformat/mxf.c
index 61b37f8..e57ac34 100644
--- a/libavformat/mxf.c
+++ b/libavformat/mxf.c
@@ -50,7 +50,7 @@ const MXFCodecUL ff_mxf_codec_uls[] = {
 { { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x01,0x32,0x00,0x00 
},  
14,   AV_CODEC_ID_H264 }, /* H.264/MPEG-4 AVC Intra */
{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x01,0x31,0x11,0x01 
},
14,   AV_CODEC_ID_H264 }, /* H.264/MPEG-4 AVC SPS/PPS in-band */
{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x01,0x01,0x02,0x02,0x01 
},
16,   AV_CODEC_ID_V210 }, /* V210 */
-
{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0E,0x04,0x02,0x01,0x02,0x11,0x04,0x00 
},
15, AV_CODEC_ID_PRORES }, /* PRORES */
+
{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0E,0x04,0x02,0x01,0x02,0x11,0x00,0x00 
},
14, AV_CODEC_ID_PRORES }, /* PRORES */ /* SoundEssenceCompression
*/
{ { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x03,0x04,0x02,0x02,0x02,0x03,0x03,0x01,0x00 
},
14,AV_CODEC_ID_AAC }, /* MPEG2 AAC ADTS (legacy) */
{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 
},
13,  AV_CODEC_ID_PCM_S16LE }, /* Uncompressed */
-- 
1.7.10.4

-- 
Email: steve.dier...@flavoursys.com
Github: github.com/bigzed
XMPP: big...@jabber.ccc.de
From daeb2f4b524e36514e231742467e491b04bf758c Mon Sep 17 00:00:00 2001
From: Steve Dierker steve.dier...@flavoursys.com
Date: Tue, 31 Mar 2015 13:09:40 +0200
Subject: [PATCH] Relaxed pattern to find ProRes in MXF.

I found another MXF File containing ProRes with the following
codec_uls: 060E2B34040101010E04020102110500
Therefor I relaxed the pattern.

Related to issue #4349
---
 libavformat/mxf.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mxf.c b/libavformat/mxf.c
index 61b37f8..e57ac34 100644
--- a/libavformat/mxf.c
+++ b/libavformat/mxf.c
@@ -50,7 +50,7 @@ const MXFCodecUL ff_mxf_codec_uls[] = {
 { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x01,0x32,0x00,0x00 }, 14,   AV_CODEC_ID_H264 }, /* H.264/MPEG-4 AVC Intra */
 { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x01,0x31,0x11,0x01 }, 14,   AV_CODEC_ID_H264 }, /* H.264/MPEG-4 AVC SPS/PPS in-band */
 { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x01,0x01,0x02,0x02,0x01 }, 16,   AV_CODEC_ID_V210 }, /* V210 */
-{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0E,0x04,0x02,0x01,0x02,0x11,0x04,0x00 }, 15, AV_CODEC_ID_PRORES }, /* PRORES */
+{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0E,0x04,0x02,0x01,0x02,0x11,0x00,0x00 }, 14, AV_CODEC_ID_PRORES }, /* PRORES */
 /* SoundEssenceCompression */
 { { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x03,0x04,0x02,0x02,0x02,0x03,0x03,0x01,0x00 }, 14,AV_CODEC_ID_AAC }, /* MPEG2 AAC ADTS (legacy) */
 { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 }, 13,  AV_CODEC_ID_PCM_S16LE }, /* Uncompressed */
-- 
1.7.10.4



signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] webmdashenc: Support for live stream manifests

2015-03-31 Thread Timothy Gu
On Tue, Mar 31, 2015 at 7:40 PM Vignesh Venkatasubramanian 
vigne...@google.com wrote:

 This patch adds support for creating DASH manifests for WebM Live
 Streams. It also updates the documentation and adds a fate test to
 verify the behavior of the new muxer flag.

 Signed-off-by: Vignesh Venkatasubramanian vigne...@google.com
 ---
  doc/muxers.texi|  34 +-
  libavformat/webmdashenc.c  | 189
 -
  tests/fate/vpx.mak |   3 +
  tests/ref/fate/webm-dash-manifest-live |  26 +
  4 files changed, 224 insertions(+), 28 deletions(-)
  create mode 100644 tests/ref/fate/webm-dash-manifest-live


Documentation looks fine to me.

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


Re: [FFmpeg-devel] [PATCH 2/2] webmdashenc: Support for live stream manifests

2015-03-31 Thread Timothy Gu
On Tue, Mar 31, 2015 at 5:11 PM Vignesh Venkatasubramanian 
vigne...@google.com wrote:

 This patch adds support for creating DASH manifests for WebM Live
 Streams. It also updates the documentation and adds a fate test to
 verify the behavior of the new muxer flag.

 Signed-off-by: Vignesh Venkatasubramanian vigne...@google.com
 ---
  doc/muxers.texi|  27 -
  libavformat/webmdashenc.c  | 191
 -
  tests/fate/vpx.mak |   3 +
  tests/ref/fate/webm-dash-manifest-live |  26 +
  4 files changed, 219 insertions(+), 28 deletions(-)
  create mode 100644 tests/ref/fate/webm-dash-manifest-live

 diff --git a/doc/muxers.texi b/doc/muxers.texi
 index a8225fc..089af06 100644
 --- a/doc/muxers.texi
 +++ b/doc/muxers.texi
 @@ -1210,7 +1210,11 @@ is the @option{global_header} flag.

  WebM DASH Manifest muxer.

 -This muxer implements the WebM DASH Manifest specification to generate
 the DASH manifest XML.
 +This muxer implements the WebM DASH Manifest specification to generate
 the DASH
 +manifest XML. It also supports manifest generation for DASH live streams.
 +
 +WebM DASH Specification: @url{https://sites.google.com/
 a/webmproject.org/wiki/adaptive-streaming/webm-dash-specification}
 +ISO DASH Specification: @url{http://standards.iso.org/ittf/
 PubliclyAvailableStandards/c065274_ISO_IEC_23009-1_2014.zip}


Seriously? I know Texinfo is a relatively obscure format, but that is why
you need to check the HTML output to make sure it's pretty (enough).

Do this:

For more information, see:

@itemize @bullet

@item

WebM DASH…

@item

ISO DASH…

@end itemize



  @subsection Options

 @@ -1221,6 +1225,27 @@ This muxer supports the following options:
  This option has the following syntax: id=x,streams=a,b,c
 id=y,streams=d,e where x and y are the
  unique identifiers of the adaptation sets and a,b,c,d and e are the
 indices of the corresponding
  audio and video streams. Any number of adaptation sets can be added using
 this option.
 +
 +@item live
 +Set this to 1 to create a live stream DASH Manifest. Default: 0.
 +



 +@item chunk_start_index
 +Start index of the first chunk. This will go in the startNumber
 attribute of
 +the SegmentTemplate element in the manifest. Default: 0.
 +
 +@item chunk_duration_ms
 +Duration of each chunk in milliseconds. This will go in the duration
 attribute
 +of the SegmentTemplate element in the manifest. Default: 1000.
 +
 +@item utc_timing_url
 +URL of the page that will return the UTC timestamp in ISO format. This
 will go
 +in the value attribute of the UTCTiming element in the manifest.
 Default:
 +None.


Change all the quotes to @samp{UTCTiming etc.} please.

[…]

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


Re: [FFmpeg-devel] [PATCH 1/2] lavu/dict: fix set function when reuse existing key pointer

2015-03-31 Thread Michael Niedermayer
On Wed, Apr 01, 2015 at 03:25:23AM +0200, Lukasz Marek wrote:
 Fixes following scenario:
 
 av_dict_set(d, key, old, 0);
 AVDictionaryEentry *e = av_dict_get(d, key, NULL, 0);
 av_dict_set(d, e-key, new, 0);
 
 Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
 ---
  libavutil/dict.c | 18 --
  1 file changed, 16 insertions(+), 2 deletions(-)
 
 diff --git a/libavutil/dict.c b/libavutil/dict.c
 index 0d54c79..3163894 100644
 --- a/libavutil/dict.c
 +++ b/libavutil/dict.c
 @@ -72,6 +72,7 @@ int av_dict_set(AVDictionary **pm, const char *key, const 
 char *value,
  AVDictionary *m = *pm;
  AVDictionaryEntry *tag = av_dict_get(m, key, NULL, flags);
  char *oldval = NULL;
 +int the_same_key = 0;
  

does it work to av_strdup() both key and value if they need to be
strduped but at the top of the function and simplify the rest
accordingly ?

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 3
Rare item - Common item with rare defect or maybe just a lie
Professional - 'Toy' made in china, not functional except as doorstop
Experts will know - The seller hopes you are not an expert


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] fate: add AVDictionary tests

2015-03-31 Thread Lukasz Marek
Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
---
 tests/fate/libavutil.mak |  4 
 tests/ref/fate/dict  | 26 ++
 2 files changed, 30 insertions(+)
 create mode 100644 tests/ref/fate/dict

diff --git a/tests/fate/libavutil.mak b/tests/fate/libavutil.mak
index 58307ae..ff052e0 100644
--- a/tests/fate/libavutil.mak
+++ b/tests/fate/libavutil.mak
@@ -53,6 +53,10 @@ fate-des: libavutil/des-test$(EXESUF)
 fate-des: CMD = run libavutil/des-test
 fate-des: REF = /dev/null
 
+FATE_LIBAVUTIL += fate-dict
+fate-dict: libavutil/dict-test$(EXESUF)
+fate-dict: CMD = run libavutil/dict-test
+
 FATE_LIBAVUTIL += fate-eval
 fate-eval: libavutil/eval-test$(EXESUF)
 fate-eval: CMD = run libavutil/eval-test
diff --git a/tests/ref/fate/dict b/tests/ref/fate/dict
new file mode 100644
index 000..deb61ae
--- /dev/null
+++ b/tests/ref/fate/dict
@@ -0,0 +1,26 @@
+Testing av_dict_get_string() and av_dict_parse_string()
+
+aaa aaa   b,b bbb   c=c ccc   ddd d,d   eee e=e   f,f f=f   g=g g,g   
+aaa=aaa,b\,b=bbb,c\=c=ccc,ddd=d\,d,eee=e\=e,f\,f=f\=f,g\=g=g\,g
+aaa aaa   b,b bbb   c=c ccc   ddd d,d   eee e=e   f,f f=f   g=g g,g   
+aaa aaa   bbb bbb   ccc ccc   \,=' \,='   
+aaa=aaabbb=bbbccc=ccc\\,\=\'\=\\,\=\'\
+aaa aaa   bbb bbb   ccc ccc   \,=' \,='   
+aaa aaa   bbb bbb   ccc ccc   \,=' \,='   
+aaa=aaa'bbb=bbb'ccc=ccc'\\,\=\'=\\,\=\'
+aaa aaa   bbb bbb   ccc ccc   \,=' \,='   
+aaa aaa   bbb bbb   ccc ccc   \,=' \,='   
+aa,bb,cc,\\\,=\',=\'\
+aaa aaa   bbb bbb   ccc ccc   \,=' \,='   
+aaa aaa   bbb bbb   ccc ccc   \,=' \,='   
+aaa'aaa,bbb'bbb,ccc'ccc,\\\,=\''\\\,=\'
+aaa aaa   bbb bbb   ccc ccc   \,=' \,='   
+aaa aaa   bbb bbb   ccc ccc   \,=' \,='   
+aa'bb'cc'\\,=\'\\\,=\'\
+aaa aaa   bbb bbb   ccc ccc   \,=' \,='   
+aaa aaa   bbb bbb   ccc ccc   \,=' \,='   
+aaa'aaabbb'bbbccc'ccc\\,=\'\'\\,=\'\
+aaa aaa   bbb bbb   ccc ccc   \,=' \,='   
+
+Testing av_dict_set() with existing AVDictionaryEntry.key as key
+new val OK
-- 
1.9.1

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


[FFmpeg-devel] [PATCH 1/2] lavu/dict: fix set function when reuse existing key pointer

2015-03-31 Thread Lukasz Marek
Fixes following scenario:

av_dict_set(d, key, old, 0);
AVDictionaryEentry *e = av_dict_get(d, key, NULL, 0);
av_dict_set(d, e-key, new, 0);

Signed-off-by: Lukasz Marek lukasz.m.lu...@gmail.com
---
 libavutil/dict.c | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/libavutil/dict.c b/libavutil/dict.c
index 0d54c79..3163894 100644
--- a/libavutil/dict.c
+++ b/libavutil/dict.c
@@ -72,6 +72,7 @@ int av_dict_set(AVDictionary **pm, const char *key, const 
char *value,
 AVDictionary *m = *pm;
 AVDictionaryEntry *tag = av_dict_get(m, key, NULL, flags);
 char *oldval = NULL;
+int the_same_key = 0;
 
 if (!m)
 m = *pm = av_mallocz(sizeof(*m));
@@ -88,7 +89,10 @@ int av_dict_set(AVDictionary **pm, const char *key, const 
char *value,
 oldval = tag-value;
 else
 av_free(tag-value);
-av_free(tag-key);
+if (tag-key != key)
+av_free(tag-key);
+else
+the_same_key = 1;
 *tag = m-elems[--m-count];
 } else {
 AVDictionaryEntry *tmp = av_realloc(m-elems,
@@ -98,7 +102,7 @@ int av_dict_set(AVDictionary **pm, const char *key, const 
char *value,
 m-elems = tmp;
 }
 if (value) {
-if (flags  AV_DICT_DONT_STRDUP_KEY)
+if (flags  AV_DICT_DONT_STRDUP_KEY || the_same_key)
 m-elems[m-count].key = (char*)(intptr_t)key;
 else
 m-elems[m-count].key = av_strdup(key);
@@ -271,6 +275,7 @@ static void test_separators(const AVDictionary *m, const 
char pair, const char v
 int main(void)
 {
 AVDictionary *dict = NULL;
+AVDictionaryEntry *e;
 char *buffer = NULL;
 
 printf(Testing av_dict_get_string() and av_dict_parse_string()\n);
@@ -298,6 +303,15 @@ int main(void)
 test_separators(dict, '', '\'');
 av_dict_free(dict);
 
+//valgrind sensible test
+printf(\nTesting av_dict_set() with existing AVDictionaryEntry.key as 
key\n);
+av_dict_set(dict, key, old, 0);
+e = av_dict_get(dict, key, NULL, 0);
+av_dict_set(dict, e-key, new val OK, 0);
+e = av_dict_get(dict, key, NULL, 0);
+printf(%s\n, e-value);
+av_dict_free(dict);
+
 return 0;
 }
 #endif
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH 2/2] webmdashenc: Support for live stream manifests

2015-03-31 Thread Michael Niedermayer
On Tue, Mar 31, 2015 at 04:54:11PM -0700, Vignesh Venkatasubramanian wrote:
[...]
 The newly added fate test requires these two files to be present in
 vp8/ directory. Please put them there before running them:
 1) 
 https://drive.google.com/file/d/0Bx8Q1nhO9b6MSExHUEM5U1pyWW8/view?usp=sharing
 2) 
 https://drive.google.com/file/d/0Bx8Q1nhO9b6MbG5mRWZhREhpNlU/view?usp=sharing

uploaded

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 1
Used only once- Some unspecified defect prevented a second use
In good condition - Can be repaird by experienced expert
As is - You wouldnt want it even if you were payed for it, if you knew ...


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] webmdashenc: Support for live stream manifests

2015-03-31 Thread Michael Niedermayer
On Tue, Mar 31, 2015 at 04:51:58PM -0700, Vignesh Venkatasubramanian wrote:
 This patch adds support for creating DASH manifests for WebM Live
 Streams. It also updates the documentation and adds a fate test to
 verify the behavior of the new muxer flag.
 
 Signed-off-by: Vignesh Venkatasubramanian vigne...@google.com

[...]

 @@ -79,19 +89,42 @@ static double get_duration(AVFormatContext *s)
  
  static void write_header(AVFormatContext *s)
  {
 +WebMDashMuxContext *w = s-priv_data;
  double min_buffer_time = 1.0;
 +time_t local_time;
 +struct tm* gmt;
 +char* gmt_iso = av_malloc(21);
  avio_printf(s-pb, ?xml version=\1.0\ encoding=\UTF-8\?\n);
  avio_printf(s-pb, MPD\n);
  avio_printf(s-pb,   
 xmlns:xsi=\http://www.w3.org/2001/XMLSchema-instance\\n;);
  avio_printf(s-pb,   xmlns=\urn:mpeg:DASH:schema:MPD:2011\\n);
  avio_printf(s-pb,   
 xsi:schemaLocation=\urn:mpeg:DASH:schema:MPD:2011\\n);
 -avio_printf(s-pb,   type=\static\\n);
 -avio_printf(s-pb,   mediaPresentationDuration=\PT%gS\\n,
 -get_duration(s));
 -avio_printf(s-pb,   minBufferTime=\PT%gS\\n,
 -min_buffer_time);
 -avio_printf(s-pb,   
 profiles=\urn:webm:dash:profile:webm-on-demand:2012\);
 -avio_printf(s-pb, \n);
 +avio_printf(s-pb,   type=\%s\\n, w-is_live ? dynamic : static);
 +if (!w-is_live) {
 +avio_printf(s-pb,   mediaPresentationDuration=\PT%gS\\n,
 +get_duration(s));
 +}
 +avio_printf(s-pb,   minBufferTime=\PT%gS\\n, min_buffer_time);
 +avio_printf(s-pb,   profiles=\%s\%s,
 +w-is_live ? urn:mpeg:dash:profile:isoff-live:2011 : 
 urn:webm:dash:profile:webm-on-demand:2012,
 +w-is_live ? \n : \n);
 +time(local_time);

 +gmt = gmtime(local_time);

this should be using gmtime_r() please see libavutil/time_internal.h:

 +strftime(gmt_iso, 21, %FT%TZ, gmt);
 +if (w-debug_mode) {
 +av_strlcpy(gmt_iso, , 1);
 +}
 +if (w-is_live) {
 +avio_printf(s-pb,   availabilityStartTime=\%s\\n, gmt_iso);
 +avio_printf(s-pb,   timeShiftBufferDepth=\PT%gS\, 
 w-time_shift_buffer_depth);
 +avio_printf(s-pb, \n);
 +avio_printf(s-pb, UTCTiming\n);
 +avio_printf(s-pb,   schemeIdUri=\%s\\n,
 +w-utc_timing_url ? urn:mpeg:dash:utc:http-iso:2014 : 
 urn:mpeg:dash:utc:direct:2012);
 +avio_printf(s-pb,   value=\%s\/\n,
 +w-utc_timing_url ? w-utc_timing_url : gmt_iso);
 +}
 +av_free(gmt_iso);
  }

  static void write_footer(AVFormatContext *s)
 @@ -137,33 +170,47 @@ static int bitstream_switching(AVFormatContext *s, 
 AdaptationSet *as) {
   * Writes a Representation within an Adaptation Set. Returns 0 on success and
   *  0 on failure.
   */
 -static int write_representation(AVFormatContext *s, AVStream *stream, int id,
 +static int write_representation(AVFormatContext *s, AVStream *stream, char 
 *id,
  int output_width, int output_height,
  int output_sample_rate) {
 +WebMDashMuxContext *w = s-priv_data;
  AVDictionaryEntry *irange = av_dict_get(stream-metadata, 
 INITIALIZATION_RANGE, NULL, 0);
  AVDictionaryEntry *cues_start = av_dict_get(stream-metadata, 
 CUES_START, NULL, 0);
  AVDictionaryEntry *cues_end = av_dict_get(stream-metadata, CUES_END, 
 NULL, 0);
  AVDictionaryEntry *filename = av_dict_get(stream-metadata, FILENAME, 
 NULL, 0);
  AVDictionaryEntry *bandwidth = av_dict_get(stream-metadata, BANDWIDTH, 
 NULL, 0);
 -if (!irange || cues_start == NULL || cues_end == NULL || filename == 
 NULL ||
 -!bandwidth) {
 +if ((w-is_live  (!filename)) ||
 +(!w-is_live  (!irange || !cues_start || !cues_end || !filename || 
 !bandwidth))) {
  return -1;
  }
 -avio_printf(s-pb, Representation id=\%d\, id);
 -avio_printf(s-pb,  bandwidth=\%s\, bandwidth-value);
 +avio_printf(s-pb, Representation id=\%s\, id);
 +// FIXME: For live, This should be obtained from the input file or as an 
 AVOption.
 +avio_printf(s-pb,  bandwidth=\%s\,
 +w-is_live ? (stream-codec-codec_type == 
 AVMEDIA_TYPE_AUDIO ? 128000 : 100) : bandwidth-value);
  if (stream-codec-codec_type == AVMEDIA_TYPE_VIDEO  output_width)
  avio_printf(s-pb,  width=\%d\, stream-codec-width);
  if (stream-codec-codec_type == AVMEDIA_TYPE_VIDEO  output_height)
  avio_printf(s-pb,  height=\%d\, stream-codec-height);
  if (stream-codec-codec_type = AVMEDIA_TYPE_AUDIO  output_sample_rate)
  avio_printf(s-pb,  audioSamplingRate=\%d\, 
 stream-codec-sample_rate);
 -avio_printf(s-pb, \n);
 -avio_printf(s-pb, BaseURL%s/BaseURL\n, filename-value);
 -avio_printf(s-pb, SegmentBase\n);
 -avio_printf(s-pb,   indexRange=\%s-%s\\n, cues_start-value, 
 cues_end-value);
 -avio_printf(s-pb, Initialization\n);
 -

Re: [FFmpeg-devel] [PATCH 2/2] webmdashenc: Support for live stream manifests

2015-03-31 Thread Vignesh Venkatasubramanian
On Tue, Mar 31, 2015 at 6:45 PM, Timothy Gu timothyg...@gmail.com wrote:


 On Tue, Mar 31, 2015 at 5:11 PM Vignesh Venkatasubramanian
 vigne...@google.com wrote:

 This patch adds support for creating DASH manifests for WebM Live
 Streams. It also updates the documentation and adds a fate test to
 verify the behavior of the new muxer flag.

 Signed-off-by: Vignesh Venkatasubramanian vigne...@google.com
 ---
  doc/muxers.texi|  27 -
  libavformat/webmdashenc.c  | 191
 -
  tests/fate/vpx.mak |   3 +
  tests/ref/fate/webm-dash-manifest-live |  26 +
  4 files changed, 219 insertions(+), 28 deletions(-)
  create mode 100644 tests/ref/fate/webm-dash-manifest-live

 diff --git a/doc/muxers.texi b/doc/muxers.texi
 index a8225fc..089af06 100644
 --- a/doc/muxers.texi
 +++ b/doc/muxers.texi
 @@ -1210,7 +1210,11 @@ is the @option{global_header} flag.

  WebM DASH Manifest muxer.

 -This muxer implements the WebM DASH Manifest specification to generate
 the DASH manifest XML.
 +This muxer implements the WebM DASH Manifest specification to generate
 the DASH
 +manifest XML. It also supports manifest generation for DASH live streams.
 +
 +WebM DASH Specification:
 @url{https://sites.google.com/a/webmproject.org/wiki/adaptive-streaming/webm-dash-specification}
 +ISO DASH Specification:
 @url{http://standards.iso.org/ittf/PubliclyAvailableStandards/c065274_ISO_IEC_23009-1_2014.zip}


 Seriously? I know Texinfo is a relatively obscure format, but that is why
 you need to check the HTML output to make sure it's pretty (enough).

Sorry. I've changed it as you suggested and saw the HTML. It looks
fine now. Thanks!


 Do this:

 For more information, see:

 @itemize @bullet

 @item

 WebM DASH…

 @item

 ISO DASH…

 @end itemize



  @subsection Options

 @@ -1221,6 +1225,27 @@ This muxer supports the following options:
  This option has the following syntax: id=x,streams=a,b,c
 id=y,streams=d,e where x and y are the
  unique identifiers of the adaptation sets and a,b,c,d and e are the
 indices of the corresponding
  audio and video streams. Any number of adaptation sets can be added using
 this option.
 +
 +@item live
 +Set this to 1 to create a live stream DASH Manifest. Default: 0.
 +



 +@item chunk_start_index
 +Start index of the first chunk. This will go in the startNumber
 attribute of
 +the SegmentTemplate element in the manifest. Default: 0.
 +
 +@item chunk_duration_ms
 +Duration of each chunk in milliseconds. This will go in the duration
 attribute
 +of the SegmentTemplate element in the manifest. Default: 1000.
 +
 +@item utc_timing_url
 +URL of the page that will return the UTC timestamp in ISO format. This
 will go
 +in the value attribute of the UTCTiming element in the manifest.
 Default:
 +None.


 Change all the quotes to @samp{UTCTiming etc.} please.


Done. Please take another look.

 […]

 Timothy



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


[FFmpeg-devel] [PATCH] avutil/mem: set default allocation limit to unlimited

2015-03-31 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer michae...@gmx.at
---
 libavutil/mem.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/mem.c b/libavutil/mem.c
index 5fd2395..2849188 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -66,7 +66,7 @@ void  free(void *ptr);
  * dynamic libraries and remove -Wl,-Bsymbolic from the linker flags.
  * Note that this will cost performance. */
 
-static size_t max_alloc_size= INT_MAX;
+static size_t max_alloc_size= SIZE_MAX;
 
 void av_max_alloc(size_t max){
 max_alloc_size = max;
-- 
1.7.9.5

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


Re: [FFmpeg-devel] [PATCH 1/4] png: Clear up the calculation of max packet size

2015-03-31 Thread Michael Niedermayer
On Tue, Mar 31, 2015 at 12:37:22PM +, Donny Yang wrote:
 Signed-off-by: Donny Yang w...@kota.moe
 ---
  libavcodec/pngenc.c | 12 
  1 file changed, 8 insertions(+), 4 deletions(-)

 diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
 index 8fff0f3..ca0ed25 100644
 --- a/libavcodec/pngenc.c
 +++ b/libavcodec/pngenc.c
 @@ -307,12 +307,16 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
 *pkt,
  row_size   = (avctx-width * s-bits_per_pixel + 7)  3;
  
  enc_row_size= deflateBound(s-zstream, row_size);
 -max_packet_size = avctx-height * (int64_t)(enc_row_size +
 -   ((enc_row_size + IOBUF_SIZE - 1) / 
 IOBUF_SIZE) * 12)
 -  + FF_MIN_BUFFER_SIZE;
 +max_packet_size =
 +FF_MIN_BUFFER_SIZE + // headers
 +avctx-height * (
 +enc_row_size +
 +12 * (((int64_t)enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) // 
 IDAT * ceil(enc_row_size / IOBUF_SIZE)
 +);
  if (max_packet_size  INT_MAX)
  return AVERROR(ENOMEM);
 -if ((ret = ff_alloc_packet2(avctx, pkt, max_packet_size))  0)
 +ret = ff_alloc_packet2(avctx, pkt, max_packet_size);

 +if (ret)

changed to ret  0

applied

thanks


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Relaxed pattern to find ProRes in MXF.

2015-03-31 Thread tim nicholson
On 31/03/15 13:41, Steve Dierker wrote:
 Hello List,
 
 I found another MXF File containing ProRes with the following
 codec_uls: 060E2B34040101010E04020102110500
 Therefor I relaxed the pattern.
 

Are the Prores variants likely to be that big?
Difficult I know for private UL's

I wonder if we shouldn't be a little more cautous in widening the scope,
where was the sample from?

 Related to issue #4349
 ---
  libavformat/mxf.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 [...]


-- 
Tim.
Key Fingerprint 38CF DB09 3ED0 F607 8B67 6CED 0C0B FC44 8B0B FC83
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avutil/mem: set default allocation limit to unlimited

2015-03-31 Thread wm4
On Tue, 31 Mar 2015 16:55:00 +0200
Michael Niedermayer michae...@gmx.at wrote:

 Signed-off-by: Michael Niedermayer michae...@gmx.at
 ---
  libavutil/mem.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/libavutil/mem.c b/libavutil/mem.c
 index 5fd2395..2849188 100644
 --- a/libavutil/mem.c
 +++ b/libavutil/mem.c
 @@ -66,7 +66,7 @@ void  free(void *ptr);
   * dynamic libraries and remove -Wl,-Bsymbolic from the linker flags.
   * Note that this will cost performance. */
  
 -static size_t max_alloc_size= INT_MAX;
 +static size_t max_alloc_size= SIZE_MAX;
  
  void av_max_alloc(size_t max){
  max_alloc_size = max;

+1

What's left is turning av_max_alloc() into a stub.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Relaxed pattern to find ProRes in MXF.

2015-03-31 Thread Carl Eugen Hoyos
Steve Dierker steve.dierker at flavoursys.com writes:

 I found another MXF File containing ProRes with the following
 codec_uls: 060E2B34040101010E04020102110500
 Therefor I relaxed the pattern.

I support this patch if you didn't make the 
file yourself.
I only had one sample.

Thank you, Carl Eugen

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


Re: [FFmpeg-devel] ffpreset

2015-03-31 Thread Carl Eugen Hoyos
Clément Champetier cnt at mikrosimage.eu writes:

 Is it in your road map to

Just being curious: Does your project really 
have a road map?

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avutil/mem: set default allocation limit to unlimited

2015-03-31 Thread Carl Eugen Hoyos
Michael Niedermayer michaelni at gmx.at writes:

 -static size_t max_alloc_size= INT_MAX;
 +static size_t max_alloc_size= SIZE_MAX;

What would this fix?

I remember several reports about FFmpeg leaking 
memory where the users just meant that one of 
the libraries allocated more memory than the 
user meant is sane, sometimes even using the 
magical signs DOS.
I don't remember a report about 16kx16k being 
too small...

(I really don't care and certainly don't object)

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH] avutil/mem: set default allocation limit to unlimited

2015-03-31 Thread wm4
On Tue, 31 Mar 2015 15:53:36 + (UTC)
Carl Eugen Hoyos ceho...@ag.or.at wrote:

 Michael Niedermayer michaelni at gmx.at writes:
 
  -static size_t max_alloc_size= INT_MAX;
  +static size_t max_alloc_size= SIZE_MAX;
 
 What would this fix?

Nothing yet, because both AVPacket and AVFrame still use ints for size
quantities.

 I remember several reports about FFmpeg leaking 
 memory where the users just meant that one of 
 the libraries allocated more memory than the 
 user meant is sane, sometimes even using the 
 magical signs DOS.
 I don't remember a report about 16kx16k being 
 too small...

The 16kx16kx is a separate limitation in av_image_check_size(). (And
yes I know someone who tried to read highres images with ffmpeg, and it
failed because of this.)

 (I really don't care and certainly don't object)
 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/4] png: Clearly separate encoding header and frames

2015-03-31 Thread wm4
On Tue, 31 Mar 2015 20:01:45 +0200
Michael Niedermayer michae...@gmx.at wrote:

 On Tue, Mar 31, 2015 at 12:37:23PM +, Donny Yang wrote:
  Signed-off-by: Donny Yang w...@kota.moe
 [...]
 
  +ret = encode_headers(avctx, pict);
  +if (ret)
  +return ret;
  +
  +ret = encode_frame(avctx, pict);
  +if (ret)
  +return ret;
 
 error checks are  0 in ffmpeg unless something else is dicatated
 by external API
 
 also this fails build:
 
 ffmpeg/libavcodec/pngenc.c: In function ‘encode’:
 ffmpeg/libavcodec/pngenc.c:463:46: error: ‘row_size’ undeclared (first use in 
 this function)
 ffmpeg/libavcodec/pngenc.c:463:46: note: each undeclared identifier is 
 reported only once for each function it appears in
 
 [...]

Also the usual idiom is:

   if ((ret = somefunction())  0)
   return ret;

(Apparently.)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/libx265: export choosen picture types

2015-03-31 Thread Michael Niedermayer
On Tue, Mar 31, 2015 at 07:08:00PM +0100, Derek Buitenhuis wrote:
 On 3/30/2015 11:45 PM, Michael Niedermayer wrote:
   pkt-pts = x265pic_out.pts;
   pkt-dts = x265pic_out.dts;
  +switch (x265pic_out.sliceType) {
  +case X265_TYPE_IDR:
  +case X265_TYPE_I: avctx-coded_frame-pict_type = AV_PICTURE_TYPE_I; 
  break;
  +case X265_TYPE_P: avctx-coded_frame-pict_type = AV_PICTURE_TYPE_P; 
  break;
  +case X265_TYPE_B: avctx-coded_frame-pict_type = AV_PICTURE_TYPE_B; 
  break;
  +}
 
 LGTM if you format it like this (for consistency in the file):

applied


 
 pkt-pts = x265pic_out.pts;
 pkt-dts = x265pic_out.dts;
 
 switch (x265pic_out.sliceType) {
 case X265_TYPE_I:
 avctx-coded_frame-pict_type = AV_PICTURE_TYPE_I;
 break;
 case X265_TYPE_P:
 avctx-coded_frame-pict_type = AV_PICTURE_TYPE_P;
 break;
 case X265_TYPE_B:
 avctx-coded_frame-pict_type = AV_PICTURE_TYPE_B;
 break;
 }
 

 Also I assume it is set to AV_PICTURE_TYPE_NONE by default?

yes thats the value after init and thus before the first frame

if you want i can add a explicit default case though

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/4] png: Clearly separate encoding header and frames

2015-03-31 Thread Michael Niedermayer
On Tue, Mar 31, 2015 at 12:37:23PM +, Donny Yang wrote:
 Signed-off-by: Donny Yang w...@kota.moe
[...]

 +ret = encode_headers(avctx, pict);
 +if (ret)
 +return ret;
 +
 +ret = encode_frame(avctx, pict);
 +if (ret)
 +return ret;

error checks are  0 in ffmpeg unless something else is dicatated
by external API

also this fails build:

ffmpeg/libavcodec/pngenc.c: In function ‘encode’:
ffmpeg/libavcodec/pngenc.c:463:46: error: ‘row_size’ undeclared (first use in 
this function)
ffmpeg/libavcodec/pngenc.c:463:46: note: each undeclared identifier is reported 
only once for each function it appears in

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/libx265: export choosen picture types

2015-03-31 Thread Derek Buitenhuis
On 3/30/2015 11:45 PM, Michael Niedermayer wrote:
  pkt-pts = x265pic_out.pts;
  pkt-dts = x265pic_out.dts;
 +switch (x265pic_out.sliceType) {
 +case X265_TYPE_IDR:
 +case X265_TYPE_I: avctx-coded_frame-pict_type = AV_PICTURE_TYPE_I; 
 break;
 +case X265_TYPE_P: avctx-coded_frame-pict_type = AV_PICTURE_TYPE_P; 
 break;
 +case X265_TYPE_B: avctx-coded_frame-pict_type = AV_PICTURE_TYPE_B; 
 break;
 +}

LGTM if you format it like this (for consistency in the file):

pkt-pts = x265pic_out.pts;
pkt-dts = x265pic_out.dts;

switch (x265pic_out.sliceType) {
case X265_TYPE_I:
avctx-coded_frame-pict_type = AV_PICTURE_TYPE_I;
break;
case X265_TYPE_P:
avctx-coded_frame-pict_type = AV_PICTURE_TYPE_P;
break;
case X265_TYPE_B:
avctx-coded_frame-pict_type = AV_PICTURE_TYPE_B;
break;
}

Also I assume it is set to AV_PICTURE_TYPE_NONE by default?

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


Re: [FFmpeg-devel] ffpreset

2015-03-31 Thread Michael Niedermayer
On Tue, Mar 31, 2015 at 04:24:07PM +0200, Clément Champetier wrote:
 Hello,
 
 I work on an opensource project, AvTranscoder (
 https://github.com/mikrosimage/avTranscoder), which is basically a project
 to give a high level API of ffmpeg in C++, Java and python.
 
 To easily launch some encodes, we created preset files, with the same idea
 of ffpreset: text files with a list of key/value to set several options of
 the encoder before the process.
 
 I saw some useful commands in the ffmpeg project, to manage preset files:
 https://github.com/FFmpeg/FFmpeg/blob/master/cmdutils.c#L1921
 We would like to manipulate this type of command to get presets, like these
 ones:
 https://github.com/FFmpeg/FFmpeg/tree/master/presets
 https://github.com/joeyblake/FFmpeg-Presets
 
 Unfortunately, no functions are exposed in your library to manage the
 presets.
 What is your position about it? Is it in your road map to give the
 developers the ability to manipulate ffpreset from outside?

there are no plans to support that which iam aware of
but you can submit a patch(set) that implements this

Thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec[/format]/webpenc: use WebPAnimEncoder API to generate animated WebP

2015-03-31 Thread Pascal Massimino
Hi,

On Sat, Mar 28, 2015 at 4:51 AM, James Almer jamr...@gmail.com wrote:

 On 27/03/15 7:02 AM, Pascal Massimino wrote:
  diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c
  index ee110de..d4411a9 100644
  --- a/libavformat/webpenc.c
  +++ b/libavformat/webpenc.c
  @@ -24,10 +24,20 @@
   #include avformat.h
   #include internal.h
 
  +#include webp/encode.h
  +#if (WEBP_ENCODER_ABI_VERSION = 0x0206)
  +#include webp/mux.h
  +#if (WEBP_MUX_ABI_VERSION = 0x0104)
  +#define USE_WEBP_ANIMENCODER
  +#endif
  +#endif

 While checking for CONFIG_LIBWEBP would be enough to know if webp/encode.h
 is available
 here as i mentioned in a previous email, it doesn't guarantee that
 webp/mux.h is available
 as well, so you will need to add webp_mux_h to HEADERS_LIST in configure
 (the check for
 libwebpmux you already added will enable it if available) and use the
 resulting define.


thanks for the suggestions, i'll rework and post an updated patch soon.

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


Re: [FFmpeg-devel] [PATCH]Support more audio in Hikvision recordings

2015-03-31 Thread Michael Niedermayer
On Tue, Mar 31, 2015 at 10:21:05AM +0200, Carl Eugen Hoyos wrote:
 Hi!
 
 Attached patch fixes audio in a cctv recording a user uploaded.
 
 Please comment, Carl Eugen

  mpeg.c |3 +++
  1 file changed, 3 insertions(+)
 f03e9ec0eb1e90c97c74d0ed51d61849cb8703dd  patchcctvaac.diff
 diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
 index a0b5738..af47652 100644
 --- a/libavformat/mpeg.c
 +++ b/libavformat/mpeg.c
 @@ -501,6 +501,9 @@ redo:
  goto found;
  }
  
 +if (m-imkh_cctv)
 +request_probe = 25;

i think its better to do this only in the mp2 case where its needed
not for all types

otherwise LGTM

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 3/3] apng: Add a basic APNG muxer

2015-03-31 Thread Donny Yang
Additionally, update some documentation with support for APNG

Signed-off-by: Donny Yang w...@kota.moe
---
 Changelog|   1 +
 doc/general.texi |   2 +
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   2 +-
 libavformat/apngenc.c| 269 +++
 5 files changed, 274 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/apngenc.c

diff --git a/Changelog b/Changelog
index 75da156..ba0dff5 100644
--- a/Changelog
+++ b/Changelog
@@ -12,6 +12,7 @@ version next:
 - Detelecine filter
 - Intel QSV-accelerated H.264 encoding
 - MMAL-accelerated H.264 decoding
+- basic APNG encoder and muxer
 
 
 version 2.6:
diff --git a/doc/general.texi b/doc/general.texi
index 85ee219..589b423 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -222,6 +222,7 @@ library:
 @tab Audio format used on the Nintendo Gamecube.
 @item AFC   @tab   @tab X
 @tab Audio format used on the Nintendo Gamecube.
+@item APNG  @tab X @tab X
 @item ASF   @tab X @tab X
 @item AST   @tab X @tab X
 @tab Audio format used on the Nintendo Wii.
@@ -508,6 +509,7 @@ following image formats are supported:
 @item Alias PIX@tab X @tab X
 @tab Alias/Wavefront PIX image format
 @item animated GIF @tab X @tab X
+@item APNG @tab X @tab X
 @item BMP  @tab X @tab X
 @tab Microsoft BMP image
 @item BRender PIX  @tab   @tab X
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 2118ff2..5082101 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -80,6 +80,7 @@ OBJS-$(CONFIG_ANM_DEMUXER)   += anm.o
 OBJS-$(CONFIG_APC_DEMUXER)   += apc.o
 OBJS-$(CONFIG_APE_DEMUXER)   += ape.o apetag.o img2.o
 OBJS-$(CONFIG_APNG_DEMUXER)  += apngdec.o
+OBJS-$(CONFIG_APNG_MUXER)+= apngenc.o
 OBJS-$(CONFIG_AQTITLE_DEMUXER)   += aqtitledec.o subtitles.o
 OBJS-$(CONFIG_ASF_DEMUXER)   += asfdec.o asf.o asfcrypt.o \
 avlanguage.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 26ccc27..ca45db8 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -74,7 +74,7 @@ void av_register_all(void)
 REGISTER_DEMUXER (ANM,  anm);
 REGISTER_DEMUXER (APC,  apc);
 REGISTER_DEMUXER (APE,  ape);
-REGISTER_DEMUXER (APNG, apng);
+REGISTER_MUXDEMUX(APNG, apng);
 REGISTER_DEMUXER (AQTITLE,  aqtitle);
 REGISTER_MUXDEMUX(ASF,  asf);
 REGISTER_MUXDEMUX(ASS,  ass);
diff --git a/libavformat/apngenc.c b/libavformat/apngenc.c
new file mode 100644
index 000..0e9af89
--- /dev/null
+++ b/libavformat/apngenc.c
@@ -0,0 +1,269 @@
+/*
+ * APNG muxer
+ * Copyright (c) 2015 Donny Yang
+ *
+ * first version by Donny Yang w...@kota.moe
+ *
+ * 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.1 of the License, or (at your option) any later version.
+ *
+ * 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 FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include zlib.h
+
+#include avformat.h
+#include internal.h
+#include libavutil/avassert.h
+#include libavutil/intreadwrite.h
+#include libavutil/log.h
+#include libavutil/opt.h
+#include libavcodec/png.h
+#include libavcodec/apng.h
+
+typedef struct APNGMuxContext {
+AVClass *class;
+uint32_t plays;
+AVRational last_delay;
+
+uint64_t acTL_offset;
+uint32_t frame_number;
+
+AVPacket *prev_packet;
+AVRational prev_delay;
+
+int framerate_warned;
+} APNGMuxContext;
+
+static uint8_t *apng_find_chunk(uint32_t tag, uint8_t *buf, size_t length)
+{
+size_t b;
+for (b = 0; b  length; b += AV_RB32(buf + b) + 12)
+if (AV_RB32(buf[b + 4]) == tag)
+return buf[b];
+return NULL;
+}
+
+static void apng_write_chunk(AVIOContext *io_context, uint32_t tag,
+ uint8_t *buf, size_t length)
+{
+uint32_t crc;
+uint8_t tagbuf[4];
+
+avio_wb32(io_context, length);
+crc = crc32(0, Z_NULL, 0);
+AV_WB32(tagbuf, tag);
+crc = crc32(crc, tagbuf, 4);
+avio_wb32(io_context, tag);
+if (length  0) {
+crc = crc32(crc, buf, length);
+avio_write(io_context, buf, length);
+}
+avio_wb32(io_context, crc);
+}

[FFmpeg-devel] [PATCH 2/3] apng: Add a basic APNG encoder

2015-03-31 Thread Donny Yang
Signed-off-by: Donny Yang w...@kota.moe
---
 configure  |   1 +
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   2 +-
 libavcodec/pngenc.c| 149 ++---
 4 files changed, 143 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 392946a..bc59271 100755
--- a/configure
+++ b/configure
@@ -2099,6 +2099,7 @@ amv_decoder_select=sp5x_decoder exif
 amv_encoder_select=aandcttables jpegtables mpegvideoenc
 ape_decoder_select=bswapdsp llauddsp
 apng_decoder_select=zlib
+apng_encoder_select=huffyuvencdsp zlib
 asv1_decoder_select=blockdsp bswapdsp idctdsp
 asv1_encoder_select=bswapdsp fdctdsp pixblockdsp
 asv2_decoder_select=blockdsp bswapdsp idctdsp
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index f8e2732..dd1d850 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -145,6 +145,7 @@ OBJS-$(CONFIG_ANM_DECODER) += anm.o
 OBJS-$(CONFIG_ANSI_DECODER)+= ansi.o cga_data.o
 OBJS-$(CONFIG_APE_DECODER) += apedec.o
 OBJS-$(CONFIG_APNG_DECODER)+= png.o pngdec.o pngdsp.o
+OBJS-$(CONFIG_APNG_ENCODER)+= png.o pngenc.o
 OBJS-$(CONFIG_SSA_DECODER) += assdec.o ass.o ass_split.o
 OBJS-$(CONFIG_SSA_ENCODER) += assenc.o ass.o
 OBJS-$(CONFIG_ASS_DECODER) += assdec.o ass.o ass_split.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 89acac1..ef3558a 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -108,7 +108,7 @@ void avcodec_register_all(void)
 REGISTER_ENCDEC (AMV,   amv);
 REGISTER_DECODER(ANM,   anm);
 REGISTER_DECODER(ANSI,  ansi);
-REGISTER_DECODER(APNG,  apng);
+REGISTER_ENCDEC (APNG,  apng);
 REGISTER_ENCDEC (ASV1,  asv1);
 REGISTER_ENCDEC (ASV2,  asv2);
 REGISTER_DECODER(AURA,  aura);
diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index bf7c49e..4349d1a 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -24,6 +24,7 @@
 #include bytestream.h
 #include huffyuvencdsp.h
 #include png.h
+#include apng.h
 
 #include libavutil/avassert.h
 #include libavutil/libm.h
@@ -53,6 +54,10 @@ typedef struct PNGEncContext {
 int bit_depth;
 int color_type;
 int bits_per_pixel;
+
+// APNG
+uint32_t palette_checksum;   // Used to ensure a single unique palette
+uint32_t sequence_number;
 } PNGEncContext;
 
 static void png_get_interlaced_row(uint8_t *dst, int row_size,
@@ -216,9 +221,34 @@ static void png_write_chunk(uint8_t **f, uint32_t tag,
 bytestream_put_be32(f, crc);
 }
 
+static void png_write_image_data(AVCodecContext *avctx,
+ const uint8_t *buf, int length)
+{
+PNGEncContext *s = avctx-priv_data;
+uint32_t crc = crc32(0, Z_NULL, 0);
+
+if (avctx-codec_id == AV_CODEC_ID_PNG || avctx-frame_number == 0)
+return png_write_chunk(s-bytestream, MKTAG('I', 'D', 'A', 'T'), buf, 
length);
+
+bytestream_put_be32(s-bytestream, length + 4);
+
+bytestream_put_be32(s-bytestream, MKBETAG('f', 'd', 'A', 'T'));
+bytestream_put_be32(s-bytestream, s-sequence_number);
+crc = crc32(crc, s-bytestream - 8, 8);
+
+crc = crc32(crc, buf, length);
+memcpy(s-bytestream, buf, length);
+s-bytestream += length;
+
+bytestream_put_be32(s-bytestream, crc);
+
+++s-sequence_number;
+}
+
 /* XXX: do filtering */
-static int png_write_row(PNGEncContext *s, const uint8_t *data, int size)
+static int png_write_row(AVCodecContext *avctx, const uint8_t *data, int size)
 {
+PNGEncContext *s = avctx-priv_data;
 int ret;
 
 s-zstream.avail_in = size;
@@ -229,8 +259,7 @@ static int png_write_row(PNGEncContext *s, const uint8_t 
*data, int size)
 return -1;
 if (s-zstream.avail_out == 0) {
 if (s-bytestream_end - s-bytestream  IOBUF_SIZE + 100)
-png_write_chunk(s-bytestream,
-MKTAG('I', 'D', 'A', 'T'), s-buf, IOBUF_SIZE);
+png_write_image_data(avctx, s-buf, IOBUF_SIZE);
 s-zstream.avail_out = IOBUF_SIZE;
 s-zstream.next_out  = s-buf;
 }
@@ -409,7 +438,7 @@ static int encode_frame(AVCodecContext *avctx, const 
AVFrame *pict)
ptr, avctx-width);
 crow = png_choose_filter(s, crow_buf, progressive_buf,
  top, pass_row_size, 
s-bits_per_pixel  3);
-png_write_row(s, crow, pass_row_size + 1);
+png_write_row(avctx, crow, pass_row_size + 1);
 top = progressive_buf;
 }
 }
@@ -420,7 +449,7 @@ static int encode_frame(AVCodecContext *avctx, const 
AVFrame *pict)
 ptr = p-data[0] + y * p-linesize[0];
 crow = 

[FFmpeg-devel] [PATCH 1/3] png: Clearly separate encoding header and frames

2015-03-31 Thread Donny Yang
Signed-off-by: Donny Yang w...@kota.moe
---
 libavcodec/pngenc.c | 142 +++-
 1 file changed, 84 insertions(+), 58 deletions(-)

diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index c913cce..bf7c49e 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -291,58 +291,11 @@ static int png_get_gama(enum 
AVColorTransferCharacteristic trc, uint8_t *buf)
 return 1;
 }
 
-static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
-const AVFrame *pict, int *got_packet)
+static int encode_headers(AVCodecContext *avctx, const AVFrame *pict)
 {
-PNGEncContext *s   = avctx-priv_data;
-const AVFrame *const p = pict;
-int y, len, row_size, ret;
-int pass_row_size, enc_row_size;
-int64_t max_packet_size;
-uint8_t *ptr, *top, *crow_buf, *crow;
-uint8_t *crow_base   = NULL;
-uint8_t *progressive_buf = NULL;
-uint8_t *top_buf = NULL;
-
-row_size   = (avctx-width * s-bits_per_pixel + 7)  3;
-
-enc_row_size= deflateBound(s-zstream, row_size);
-max_packet_size =
-FF_MIN_BUFFER_SIZE + // headers
-avctx-height * (
-enc_row_size +
-12 * (((int64_t)enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) // 
IDAT * ceil(enc_row_size / IOBUF_SIZE)
-);
-if (max_packet_size  INT_MAX)
-return AVERROR(ENOMEM);
-ret = ff_alloc_packet2(avctx, pkt, max_packet_size);
-if (ret  0)
-return ret;
-
-s-bytestream_start =
-s-bytestream   = pkt-data;
-s-bytestream_end   = pkt-data + pkt-size;
-
-crow_base = av_malloc((row_size + 32)  (s-filter_type == 
PNG_FILTER_VALUE_MIXED));
-if (!crow_base) {
-ret = AVERROR(ENOMEM);
-goto the_end;
-}
-// pixel data should be aligned, but there's a control byte before it
-crow_buf = crow_base + 15;
-if (s-is_progressive) {
-progressive_buf = av_malloc(row_size + 1);
-top_buf = av_malloc(row_size + 1);
-if (!progressive_buf || !top_buf) {
-ret = AVERROR(ENOMEM);
-goto the_end;
-}
-}
+PNGEncContext *s = avctx-priv_data;
 
 /* write png header */
-AV_WB64(s-bytestream, PNGSIG);
-s-bytestream += 8;
-
 AV_WB32(s-buf, avctx-width);
 AV_WB32(s-buf + 4, avctx-height);
 s-buf[8]  = s-bit_depth;
@@ -381,9 +334,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
 int has_alpha, alpha, i;
 unsigned int v;
 uint32_t *palette;
-uint8_t *alpha_ptr;
+uint8_t *ptr, *alpha_ptr;
 
-palette   = (uint32_t *)p-data[1];
+palette   = (uint32_t *)pict-data[1];
 ptr   = s-buf;
 alpha_ptr = s-buf + 256 * 3;
 has_alpha = 0;
@@ -403,7 +356,39 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
 }
 }
 
-/* now put each row */
+return 0;
+}
+
+static int encode_frame(AVCodecContext *avctx, const AVFrame *pict)
+{
+PNGEncContext *s   = avctx-priv_data;
+const AVFrame *const p = pict;
+int y, len, ret;
+int row_size, pass_row_size;
+uint8_t *ptr, *top, *crow_buf, *crow;
+uint8_t *crow_base   = NULL;
+uint8_t *progressive_buf = NULL;
+uint8_t *top_buf = NULL;
+
+row_size = (avctx-width * s-bits_per_pixel + 7)  3;
+
+crow_base = av_malloc((row_size + 32)  (s-filter_type == 
PNG_FILTER_VALUE_MIXED));
+if (!crow_base) {
+ret = AVERROR(ENOMEM);
+goto the_end;
+}
+// pixel data should be aligned, but there's a control byte before it
+crow_buf = crow_base + 15;
+if (s-is_progressive) {
+progressive_buf = av_malloc(row_size + 1);
+top_buf = av_malloc(row_size + 1);
+if (!progressive_buf || !top_buf) {
+ret = AVERROR(ENOMEM);
+goto the_end;
+}
+}
+
+/* put each row */
 s-zstream.avail_out = IOBUF_SIZE;
 s-zstream.next_out  = s-buf;
 if (s-is_progressive) {
@@ -456,12 +441,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
 goto the_end;
 }
 }
-png_write_chunk(s-bytestream, MKTAG('I', 'E', 'N', 'D'), NULL, 0);
 
-pkt-size   = s-bytestream - s-bytestream_start;
-pkt-flags |= AV_PKT_FLAG_KEY;
-*got_packet = 1;
-ret = 0;
+ret = 0;
 
 the_end:
 av_freep(crow_base);
@@ -471,6 +452,51 @@ the_end:
 return ret;
 }
 
+static int encode(AVCodecContext *avctx, AVPacket *pkt,
+  const AVFrame *pict, int *got_packet)
+{
+PNGEncContext *s = avctx-priv_data;
+int ret;
+int enc_row_size;
+size_t max_packet_size;
+
+enc_row_size= deflateBound(s-zstream, (avctx-width * 
s-bits_per_pixel + 7)  3);
+max_packet_size =
+FF_MIN_BUFFER_SIZE + // headers
+avctx-height * (
+enc_row_size +
+12 * (((int64_t)enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) // 

[FFmpeg-devel] ffpreset

2015-03-31 Thread Clément Champetier
Hello,

I work on an opensource project, AvTranscoder (
https://github.com/mikrosimage/avTranscoder), which is basically a project
to give a high level API of ffmpeg in C++, Java and python.

To easily launch some encodes, we created preset files, with the same idea
of ffpreset: text files with a list of key/value to set several options of
the encoder before the process.

I saw some useful commands in the ffmpeg project, to manage preset files:
https://github.com/FFmpeg/FFmpeg/blob/master/cmdutils.c#L1921
We would like to manipulate this type of command to get presets, like these
ones:
https://github.com/FFmpeg/FFmpeg/tree/master/presets
https://github.com/joeyblake/FFmpeg-Presets

Unfortunately, no functions are exposed in your library to manage the
presets.
What is your position about it? Is it in your road map to give the
developers the ability to manipulate ffpreset from outside?

Best regards,

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


[FFmpeg-devel] [PATCH 2/2] webmdashenc: Support for live stream manifests

2015-03-31 Thread Vignesh Venkatasubramanian
This patch adds support for creating DASH manifests for WebM Live
Streams. It also updates the documentation and adds a fate test to
verify the behavior of the new muxer flag.

Signed-off-by: Vignesh Venkatasubramanian vigne...@google.com
---
 doc/muxers.texi|  27 -
 libavformat/webmdashenc.c  | 187 -
 tests/fate/vpx.mak |   3 +
 tests/ref/fate/webm-dash-manifest-live |  26 +
 4 files changed, 216 insertions(+), 27 deletions(-)
 create mode 100644 tests/ref/fate/webm-dash-manifest-live

diff --git a/doc/muxers.texi b/doc/muxers.texi
index a8225fc..089af06 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1210,7 +1210,11 @@ is the @option{global_header} flag.
 
 WebM DASH Manifest muxer.
 
-This muxer implements the WebM DASH Manifest specification to generate the 
DASH manifest XML.
+This muxer implements the WebM DASH Manifest specification to generate the DASH
+manifest XML. It also supports manifest generation for DASH live streams.
+
+WebM DASH Specification: 
@url{https://sites.google.com/a/webmproject.org/wiki/adaptive-streaming/webm-dash-specification}
+ISO DASH Specification: 
@url{http://standards.iso.org/ittf/PubliclyAvailableStandards/c065274_ISO_IEC_23009-1_2014.zip}
 
 @subsection Options
 
@@ -1221,6 +1225,27 @@ This muxer supports the following options:
 This option has the following syntax: id=x,streams=a,b,c id=y,streams=d,e 
where x and y are the
 unique identifiers of the adaptation sets and a,b,c,d and e are the indices of 
the corresponding
 audio and video streams. Any number of adaptation sets can be added using this 
option.
+
+@item live
+Set this to 1 to create a live stream DASH Manifest. Default: 0.
+
+@item chunk_start_index
+Start index of the first chunk. This will go in the startNumber attribute of
+the SegmentTemplate element in the manifest. Default: 0.
+
+@item chunk_duration_ms
+Duration of each chunk in milliseconds. This will go in the duration 
attribute
+of the SegmentTemplate element in the manifest. Default: 1000.
+
+@item utc_timing_url
+URL of the page that will return the UTC timestamp in ISO format. This will go
+in the value attribute of the UTCTiming element in the manifest. Default:
+None.
+
+@item time_shift_buffer_depth
+Smallest time (in seconds) shifting buffer for which any Representation is
+guaranteed to be available. Default: 60.
+
 @end table
 
 @subsection Example
diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
index 4536b7d..84cc9d8 100644
--- a/libavformat/webmdashenc.c
+++ b/libavformat/webmdashenc.c
@@ -22,10 +22,14 @@
 /*
  * WebM DASH Specification:
  * 
https://sites.google.com/a/webmproject.org/wiki/adaptive-streaming/webm-dash-specification
+ * ISO DASH Specification:
+ * 
http://standards.iso.org/ittf/PubliclyAvailableStandards/c065274_ISO_IEC_23009-1_2014.zip
  */
 
+#include float.h
 #include stdint.h
 #include string.h
+#include time.h
 
 #include avformat.h
 #include avio_internal.h
@@ -47,6 +51,12 @@ typedef struct WebMDashMuxContext {
 AdaptationSet *as;
 int nb_as;
 int representation_id;
+int is_live;
+int chunk_start_index;
+int chunk_duration;
+char *utc_timing_url;
+double time_shift_buffer_depth;
+int debug_mode;
 } WebMDashMuxContext;
 
 static const char *get_codec_name(int codec_id)
@@ -79,19 +89,42 @@ static double get_duration(AVFormatContext *s)
 
 static void write_header(AVFormatContext *s)
 {
+WebMDashMuxContext *w = s-priv_data;
 double min_buffer_time = 1.0;
+time_t local_time;
+struct tm* gmt;
+char* gmt_iso = av_malloc(21);
 avio_printf(s-pb, ?xml version=\1.0\ encoding=\UTF-8\?\n);
 avio_printf(s-pb, MPD\n);
 avio_printf(s-pb,   
xmlns:xsi=\http://www.w3.org/2001/XMLSchema-instance\\n;);
 avio_printf(s-pb,   xmlns=\urn:mpeg:DASH:schema:MPD:2011\\n);
 avio_printf(s-pb,   
xsi:schemaLocation=\urn:mpeg:DASH:schema:MPD:2011\\n);
-avio_printf(s-pb,   type=\static\\n);
-avio_printf(s-pb,   mediaPresentationDuration=\PT%gS\\n,
-get_duration(s));
-avio_printf(s-pb,   minBufferTime=\PT%gS\\n,
-min_buffer_time);
-avio_printf(s-pb,   
profiles=\urn:webm:dash:profile:webm-on-demand:2012\);
-avio_printf(s-pb, \n);
+avio_printf(s-pb,   type=\%s\\n, w-is_live ? dynamic : static);
+if (!w-is_live) {
+avio_printf(s-pb,   mediaPresentationDuration=\PT%gS\\n,
+get_duration(s));
+}
+avio_printf(s-pb,   minBufferTime=\PT%gS\\n, min_buffer_time);
+avio_printf(s-pb,   profiles=\%s\%s,
+w-is_live ? urn:mpeg:dash:profile:isoff-live:2011 : 
urn:webm:dash:profile:webm-on-demand:2012,
+w-is_live ? \n : \n);
+time(local_time);
+gmt = gmtime(local_time);
+strftime(gmt_iso, 21, %FT%TZ, gmt);
+if (w-debug_mode) {
+av_strlcpy(gmt_iso, , 1);
+}
+if (w-is_live) {
+avio_printf(s-pb,   

Re: [FFmpeg-devel] [PATCH] avformat/mp3dec: offset seek index to end of id3v2 tag

2015-03-31 Thread Michael Niedermayer
On Tue, Mar 31, 2015 at 10:47:37PM +0200, wm4 wrote:
 The Xing index won't account for the id3 tag - it's relative to the
 headers.
 ---
  libavformat/mp3dec.c | 10 +-
  1 file changed, 5 insertions(+), 5 deletions(-)

applied

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avformat/mp3dec: offset seek index to end of id3v2 tag

2015-03-31 Thread wm4
The Xing index won't account for the id3 tag - it's relative to the
headers.
---
 libavformat/mp3dec.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index d2498a0..161f27d 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -106,7 +106,7 @@ static int mp3_read_probe(AVProbeData *p)
 //mpegps_mp3_unrecognized_format.mpg has max_frames=3
 }
 
-static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t 
duration)
+static void read_xing_toc(AVFormatContext *s, int64_t base, int64_t filesize, 
int64_t duration)
 {
 int i;
 MP3DecContext *mp3 = s-priv_data;
@@ -122,7 +122,7 @@ static void read_xing_toc(AVFormatContext *s, int64_t 
filesize, int64_t duration
 uint8_t b = avio_r8(s-pb);
 if (fill_index)
 av_add_index_entry(s-streams[0],
-   av_rescale(b, filesize, 256),
+   av_rescale(b, filesize, 256) + base,
av_rescale(i, duration, XING_TOC_COUNT),
0, 0, AVINDEX_KEYFRAME);
 }
@@ -130,7 +130,7 @@ static void read_xing_toc(AVFormatContext *s, int64_t 
filesize, int64_t duration
 mp3-xing_toc = 1;
 }
 
-static void mp3_parse_info_tag(AVFormatContext *s, AVStream *st,
+static void mp3_parse_info_tag(AVFormatContext *s, AVStream *st, int64_t base,
MPADecodeHeader *c, uint32_t spf)
 {
 #define LAST_BITS(k, n) ((k)  ((1  (n)) - 1))
@@ -172,7 +172,7 @@ static void mp3_parse_info_tag(AVFormatContext *s, AVStream 
*st,
 }
 }
 if (v  XING_FLAG_TOC)
-read_xing_toc(s, mp3-header_filesize, av_rescale_q(mp3-frames,
+read_xing_toc(s, base, mp3-header_filesize, av_rescale_q(mp3-frames,
(AVRational){spf, c-sample_rate},
st-time_base));
 /* VBR quality */
@@ -310,7 +310,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream 
*st, int64_t base)
 mp3-frames = 0;
 mp3-header_filesize   = 0;
 
-mp3_parse_info_tag(s, st, c, spf);
+mp3_parse_info_tag(s, st, base, c, spf);
 mp3_parse_vbri_tag(s, st, base);
 
 if (!mp3-frames  !mp3-header_filesize)
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH 3/4] lavu/avstring: add av_append_path_component() funcion

2015-03-31 Thread Michael Niedermayer
On Tue, Mar 31, 2015 at 10:47:44PM +0200, Mariusz Szczepańczyk wrote:
 On Mon, Mar 30, 2015 at 12:38 AM, Michael Niedermayer michae...@gmx.at
 wrote:
 
  On Thu, Mar 26, 2015 at 05:39:49PM +0100, Mariusz Szczepańczyk wrote:
   On Thu, Mar 26, 2015 at 3:40 PM, Michael Niedermayer michae...@gmx.at
   wrote:
  
On Thu, Mar 26, 2015 at 01:25:19AM +0100, Mariusz Szczepańczyk wrote:
 From: Lukasz Marek lukasz.m.lu...@gmail.com

 Convinient function to build paths.
 ---
  libavutil/avstring.c| 43
  +++
  libavutil/avstring.h| 10 ++
  tests/ref/fate/avstring |  9 +
  3 files changed, 62 insertions(+)

 diff --git a/libavutil/avstring.c b/libavutil/avstring.c
 index 25c65b4..f105aa7 100644
 --- a/libavutil/avstring.c
 +++ b/libavutil/avstring.c
 @@ -269,6 +269,35 @@ const char *av_dirname(char *path)
  return path;
  }

 +char *av_append_path_component(const char *path, const char
  *component)
 +{
 +size_t p_len, c_len;
 +char *fullpath;
 +
 +if (!path)
 +return component ? av_strdup(component) : NULL;
 +if (!component)
 +return av_strdup(path);
 +
 +p_len = strlen(path);
 +c_len = strlen(component);
   
 +fullpath = malloc(p_len + c_len + 2);
   
av_malloc()
   
   
   fixed
  
  
 +if (fullpath) {
 +if (p_len) {
   
 +strcpy(fullpath, path);
   
av_strlcpy() is more robust/secure
   
   
   fixed
  
  
   
 +if (c_len) {
 +if (fullpath[p_len - 1] != '/'  component[0] !=
  '/')
 +fullpath[p_len++] = '/';
 +else if (fullpath[p_len - 1] == '/'  component[0]
  ==
'/')
 +p_len--;
 +}
 +}
 +strcpy(fullpath[p_len], component);
   
av_strlcpy()
   
  
   fixed
  
  
   Mariusz
 
libavutil/avstring.c|   43
  +++
libavutil/avstring.h|   10 ++
tests/ref/fate/avstring |9 +
3 files changed, 62 insertions(+)
   63e9d3c9f993fff81fbbb734a1e4d2728ebf85eb
  0003-lavu-avstring-add-av_append_path_component-funcion.patch
   From a79c0aceef2d3c9f51973958910bed773462fdd8 Mon Sep 17 00:00:00 2001
   From: Lukasz Marek lukasz.m.lu...@gmail.com
   Date: Sat, 5 Jul 2014 18:12:02 +0200
   Subject: [PATCH 3/4] lavu/avstring: add av_append_path_component()
  funcion
  
   Convinient function to build paths.
   ---
libavutil/avstring.c| 43 +++
libavutil/avstring.h| 10 ++
tests/ref/fate/avstring |  9 +
3 files changed, 62 insertions(+)
  
   diff --git a/libavutil/avstring.c b/libavutil/avstring.c
   index 25c65b4..24bc23a 100644
   --- a/libavutil/avstring.c
   +++ b/libavutil/avstring.c
   @@ -269,6 +269,35 @@ const char *av_dirname(char *path)
return path;
}
  
   +char *av_append_path_component(const char *path, const char *component)
   +{
   +size_t p_len, c_len;
   +char *fullpath;
   +
   +if (!path)
   +return component ? av_strdup(component) : NULL;
 
  the NULL check before av_strdup should not be needed
 
 
 ok
 
 
 
   +if (!component)
   +return av_strdup(path);
   +
   +p_len = strlen(path);
   +c_len = strlen(component);
   +fullpath = av_malloc(p_len + c_len + 2);
 
  this needs a check for potential integer overflow of the additions
 
 
 Added checking.
 
 New patch also updates version.h and APIchanges.
 
 Regards,
 Mariusz

  doc/APIchanges  |3 +++
  libavutil/avstring.c|   45 +
  libavutil/avstring.h|   10 ++
  libavutil/version.h |2 +-
  tests/ref/fate/avstring |9 +
  5 files changed, 68 insertions(+), 1 deletion(-)
 c78c3f0222bc75a34aa73b884148b6cf5246a599  
 0003-lavu-avstring-add-av_append_path_component-funcion.patch
 From 86ecd3c3f56426e7860399724147bee15d26bbcc Mon Sep 17 00:00:00 2001
 From: Lukasz Marek lukasz.m.lu...@gmail.com
 Date: Sat, 5 Jul 2014 18:12:02 +0200
 Subject: [PATCH 1/2] lavu/avstring: add av_append_path_component() funcion
 
 Convinient function to build paths.

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] png: Clearly separate encoding header and frames

2015-03-31 Thread Michael Niedermayer
On Tue, Mar 31, 2015 at 08:58:25PM +, Donny Yang wrote:
 Signed-off-by: Donny Yang w...@kota.moe
 ---
  libavcodec/pngenc.c | 142 
 +++-
  1 file changed, 84 insertions(+), 58 deletions(-)

applied

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

DNS cache poisoning attacks, popular search engine, Google internet authority
dont be evil, please


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel