[FFmpeg-devel] [PATCH 2/2] libvpxenc, cosmetics: rename common fns vp8 -> vpx

2016-07-20 Thread James Zern
+ the context struct

Signed-off-by: James Zern 
---
 libavcodec/libvpxenc.c | 60 +-
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index c5b1b86..f3cff81 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -20,7 +20,7 @@
 
 /**
  * @file
- * VP8 encoder support via libvpx
+ * VP8/9 encoder support via libvpx
  */
 
 #define VPX_DISABLE_CTRL_TYPECHECKS 1
@@ -60,7 +60,7 @@ struct FrameListData {
 struct FrameListData *next;
 };
 
-typedef struct VP8EncoderContext {
+typedef struct VPxEncoderContext {
 AVClass *class;
 struct vpx_codec_ctx encoder;
 struct vpx_image rawimg;
@@ -107,7 +107,7 @@ typedef struct VP8EncoderContext {
 int drop_threshold;
 int noise_sensitivity;
 int vpx_cs;
-} VP8Context;
+} VPxContext;
 
 /** String mappings for enum vp8e_enc_control_id */
 static const char *const ctlidstr[] = {
@@ -139,7 +139,7 @@ static const char *const ctlidstr[] = {
 
 static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
 {
-VP8Context *ctx = avctx->priv_data;
+VPxContext *ctx = avctx->priv_data;
 const char *error  = vpx_codec_error(&ctx->encoder);
 const char *detail = vpx_codec_error_detail(&ctx->encoder);
 
@@ -242,7 +242,7 @@ static av_cold void free_frame_list(struct FrameListData 
*list)
 static av_cold int codecctl_int(AVCodecContext *avctx,
 enum vp8e_enc_control_id id, int val)
 {
-VP8Context *ctx = avctx->priv_data;
+VPxContext *ctx = avctx->priv_data;
 char buf[80];
 int width = -30;
 int res;
@@ -260,9 +260,9 @@ static av_cold int codecctl_int(AVCodecContext *avctx,
 return res == VPX_CODEC_OK ? 0 : AVERROR(EINVAL);
 }
 
-static av_cold int vp8_free(AVCodecContext *avctx)
+static av_cold int vpx_free(AVCodecContext *avctx)
 {
-VP8Context *ctx = avctx->priv_data;
+VPxContext *ctx = avctx->priv_data;
 
 vpx_codec_destroy(&ctx->encoder);
 if (ctx->is_alpha)
@@ -278,7 +278,7 @@ static int set_pix_fmt(AVCodecContext *avctx, 
vpx_codec_caps_t codec_caps,
struct vpx_codec_enc_cfg *enccfg, vpx_codec_flags_t 
*flags,
vpx_img_fmt_t *img_fmt)
 {
-VP8Context av_unused *ctx = avctx->priv_data;
+VPxContext av_unused *ctx = avctx->priv_data;
 #ifdef VPX_IMG_FMT_HIGHBITDEPTH
 enccfg->g_bit_depth = enccfg->g_input_bit_depth = 8;
 #endif
@@ -367,7 +367,7 @@ static int set_pix_fmt(AVCodecContext *avctx, 
vpx_codec_caps_t codec_caps,
 static void set_colorspace(AVCodecContext *avctx)
 {
 enum vpx_color_space vpx_cs;
-VP8Context *ctx = avctx->priv_data;
+VPxContext *ctx = avctx->priv_data;
 
 if (ctx->vpx_cs) {
 vpx_cs = ctx->vpx_cs;
@@ -413,7 +413,7 @@ static void set_color_range(AVCodecContext *avctx)
 static av_cold int vpx_init(AVCodecContext *avctx,
 const struct vpx_codec_iface *iface)
 {
-VP8Context *ctx = avctx->priv_data;
+VPxContext *ctx = avctx->priv_data;
 struct vpx_codec_enc_cfg enccfg = { 0 };
 struct vpx_codec_enc_cfg enccfg_alpha;
 vpx_codec_flags_t flags = (avctx->flags & AV_CODEC_FLAG_PSNR) ? 
VPX_CODEC_USE_PSNR : 0;
@@ -709,7 +709,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 static inline void cx_pktcpy(struct FrameListData *dst,
  const struct vpx_codec_cx_pkt *src,
  const struct vpx_codec_cx_pkt *src_alpha,
- VP8Context *ctx)
+ VPxContext *ctx)
 {
 dst->pts  = src->data.frame.pts;
 dst->duration = src->data.frame.duration;
@@ -828,7 +828,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
  */
 static int queue_frames(AVCodecContext *avctx, AVPacket *pkt_out)
 {
-VP8Context *ctx = avctx->priv_data;
+VPxContext *ctx = avctx->priv_data;
 const struct vpx_codec_cx_pkt *pkt;
 const struct vpx_codec_cx_pkt *pkt_alpha = NULL;
 const void *iter = NULL;
@@ -928,10 +928,10 @@ static int queue_frames(AVCodecContext *avctx, AVPacket 
*pkt_out)
 return size;
 }
 
-static int vp8_encode(AVCodecContext *avctx, AVPacket *pkt,
+static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt,
   const AVFrame *frame, int *got_packet)
 {
-VP8Context *ctx = avctx->priv_data;
+VPxContext *ctx = avctx->priv_data;
 struct vpx_image *rawimg = NULL;
 struct vpx_image *rawimg_alpha = NULL;
 int64_t timestamp = 0;
@@ -1010,7 +1010,7 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket 
*pkt,
 return 0;
 }
 
-#define OFFSET(x) offsetof(VP8Context, x)
+#define OFFSET(x) offsetof(VPxContext, x)
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 
 #ifndef VPX_ERROR_RESILIENT_DEFAULT
@@ -1043,23 +1043,23 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket 
*pkt,
  "by the bool decoder, meaning that partitions can be 
de

[FFmpeg-devel] [PATCH 1/2] libvpxdec, cosmetics: rename common fns vp8 -> vpx

2016-07-20 Thread James Zern
+ the context struct

Signed-off-by: James Zern 
---
 libavcodec/libvpxdec.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index f7acc39..5204c99 100644
--- a/libavcodec/libvpxdec.c
+++ b/libavcodec/libvpxdec.c
@@ -20,7 +20,7 @@
 
 /**
  * @file
- * VP8 decoder support via libvpx
+ * VP8/9 decoder support via libvpx
  */
 
 #define VPX_CODEC_DISABLE_COMPAT 1
@@ -35,17 +35,17 @@
 #include "libvpx.h"
 #include "profiles.h"
 
-typedef struct VP8DecoderContext {
+typedef struct VPxDecoderContext {
 struct vpx_codec_ctx decoder;
 struct vpx_codec_ctx decoder_alpha;
 int has_alpha_channel;
-} VP8Context;
+} VPxContext;
 
 static av_cold int vpx_init(AVCodecContext *avctx,
 const struct vpx_codec_iface *iface,
 int is_alpha_decoder)
 {
-VP8Context *ctx = avctx->priv_data;
+VPxContext *ctx = avctx->priv_data;
 struct vpx_codec_dec_cfg deccfg = {
 /* token partitions+1 would be a decent choice */
 .threads = FFMIN(avctx->thread_count, 16)
@@ -193,10 +193,10 @@ static int decode_frame(AVCodecContext *avctx, 
vpx_codec_ctx_t *decoder,
 return 0;
 }
 
-static int vp8_decode(AVCodecContext *avctx,
+static int vpx_decode(AVCodecContext *avctx,
   void *data, int *got_frame, AVPacket *avpkt)
 {
-VP8Context *ctx = avctx->priv_data;
+VPxContext *ctx = avctx->priv_data;
 AVFrame *picture = data;
 const void *iter = NULL;
 const void *iter_alpha = NULL;
@@ -282,9 +282,9 @@ static int vp8_decode(AVCodecContext *avctx,
 return avpkt->size;
 }
 
-static av_cold int vp8_free(AVCodecContext *avctx)
+static av_cold int vpx_free(AVCodecContext *avctx)
 {
-VP8Context *ctx = avctx->priv_data;
+VPxContext *ctx = avctx->priv_data;
 vpx_codec_destroy(&ctx->decoder);
 if (ctx->has_alpha_channel)
 vpx_codec_destroy(&ctx->decoder_alpha);
@@ -302,10 +302,10 @@ AVCodec ff_libvpx_vp8_decoder = {
 .long_name  = NULL_IF_CONFIG_SMALL("libvpx VP8"),
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_VP8,
-.priv_data_size = sizeof(VP8Context),
+.priv_data_size = sizeof(VPxContext),
 .init   = vp8_init,
-.close  = vp8_free,
-.decode = vp8_decode,
+.close  = vpx_free,
+.decode = vpx_decode,
 .capabilities   = AV_CODEC_CAP_AUTO_THREADS | AV_CODEC_CAP_DR1,
 };
 #endif /* CONFIG_LIBVPX_VP8_DECODER */
@@ -321,10 +321,10 @@ AVCodec ff_libvpx_vp9_decoder = {
 .long_name  = NULL_IF_CONFIG_SMALL("libvpx VP9"),
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_VP9,
-.priv_data_size = sizeof(VP8Context),
+.priv_data_size = sizeof(VPxContext),
 .init   = vp9_init,
-.close  = vp8_free,
-.decode = vp8_decode,
+.close  = vpx_free,
+.decode = vpx_decode,
 .capabilities   = AV_CODEC_CAP_AUTO_THREADS | AV_CODEC_CAP_DR1,
 .init_static_data = ff_vp9_init_static,
 .profiles   = NULL_IF_CONFIG_SMALL(ff_vp9_profiles),
-- 
2.8.0.rc3.226.g39d4020

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


Re: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before video or audio stream was created

2016-07-20 Thread XinZheng Zhang
On Thu, Jul 21, 2016 at 5:03 AM, Moritz Barsnick  wrote:
> On Thu, Jul 21, 2016 at 00:06:44 +0800, zhangxinzheng wrote:
>
>> Subject: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before 
>> video or audio stream was created
>^^^ flv
>
>> There has an error when seeking in a flv file, which key frames was
>> sorted before video frame.
>> This ensures that all the key frames was cached, and add to
>> corresponding stream when it was created.
>
> Thanks to the grammar, I don't understand the intent of the patch.
> (Don't get me wrong, I'm not scorning your English, but it needs to be
> improved.)
>

In flvdec.c 420
case AMF_DATA_TYPE_OBJECT:
if ((vstream || astream) && key &&
ioc->seekable &&
!strcmp(KEYFRAMES_TAG, key) && depth == 1)
if (parse_keyframes_index(s, ioc, vstream ? vstream : astream,
  max_pos) < 0)

If the first packet we got is object, both vstream and astream are NULL,
that may prevent keyframe index being parsed.

This patch saves keyframe index before A/V streams are created.

The issue was introduced since 09ae7b81ea.

I have created a ticket #5729 with a sample attatched.

>>  #define RESYNC_BUFFER_SIZE (1<<20)
>>
>> +
>> +typedef struct FLVKeyFrame {
>
> Why the extra newline?
>

The extra newline has been removed in new patch.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before video or audio stream was created

2016-07-20 Thread Steven Liu
2016-07-21 10:35 GMT+08:00 XinZheng Zhang :

> I apologize about my English and let me re-arrange my words.
> The current realization would result in the loss of all key frame
> indices from all the current video frames,
> which would lead to the failure of seeking in FLVs.
> My current patch will cache all key frame indices without creating any
> video streams,
> and put in all those immediately after creating any relevant video streams.
>
> I found that there has something error with my `egrep`,
> caused all the patches (include applied patch) could not be checked
> successfully.
> The error message is same to the log which Steven Liu posted.
> Here is my platform message:
> egrep (BSD grep) 2.5.1-FreeBSD
> osx 10.11.4
>
> Your patch is passed by tool/patcheck,
and is have read your patch, it read the keyframe ts and pos from metadata,
is see,
Perhaps it's usefull when the flv is TOO BIG,

Thanks!

>
> I will resend a new patch without the extra new line.
>
> On Thu, Jul 21, 2016 at 7:39 AM, Steven Liu 
> wrote:
> > 2016-07-21 7:29 GMT+08:00 Steven Liu :
> >
> >>
> >>
> >> 2016-07-21 5:03 GMT+08:00 Moritz Barsnick :
> >>
> >>> On Thu, Jul 21, 2016 at 00:06:44 +0800, zhangxinzheng wrote:
> >>>
> >>> > Subject: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes
> >>> before video or audio stream was created
> >>>^^^ flv
> >>>
> >>> > There has an error when seeking in a flv file, which key frames was
> >>> > sorted before video frame.
> >>> > This ensures that all the key frames was cached, and add to
> >>> > corresponding stream when it was created.
> >>>
> >>> Thanks to the grammar, I don't understand the intent of the patch.
> >>> (Don't get me wrong, I'm not scorning your English, but it needs to be
> >>> improved.)
> >>>
> >> Hi Moritz,
> >> Perhaps he want to create a keyframe index for flv file, to seek flv
> >> keyframe.
> >>
> >>
> >>
> >>> >  #define RESYNC_BUFFER_SIZE (1<<20)
> >>> >
> >>> > +
> >>> > +typedef struct FLVKeyFrame {
> >>>
> >>> Why the extra newline?
> >>
> >>
> >> Hi Zhang Xinzheng ,
> >>
> >> You should check the patch use the tool at ./tools/patcheck .
> >>  Please reading
> >> http://ffmpeg.org/developer.html#toc-Submitting-patches-1 .
> >>
> > ok, I make a mistake, the patchcheck can not check the newline
> >
> >
> >
> > localhost:ffmpeg StevenLiu$ cat new_patch.patch | head -n 30
> > ---
> >  libavformat/flvdec.c | 52
> > +---
> >  1 file changed, 45 insertions(+), 7 deletions(-)
> >
> > diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
> > index 2bf1e05..8a73b68 100644
> > --- a/libavformat/flvdec.c
> > +++ b/libavformat/flvdec.c
> > @@ -30,6 +30,7 @@
> >  #include "libavutil/opt.h"
> >  #include "libavutil/intfloat.h"
> >  #include "libavutil/mathematics.h"
> > +#include "libavutil/mem.h"
> >  #include "libavcodec/bytestream.h"
> >  #include "libavcodec/mpeg4audio.h"
> >  #include "avformat.h"
> > @@ -41,6 +42,12 @@
> >
> >  #define RESYNC_BUFFER_SIZE (1<<20)
> >
> > +
> > +typedef struct FLVKeyFrame {
> > +int64_t pos;
> > +int64_t timestamp;
> > +} FLVKeyFrame;
> > +
> >  typedef struct FLVContext {
> >  const AVClass *class; ///< Class for private options.
> >  int trust_metadata;   ///< configure streams according onMetaData
> > @@ -61,6 +68,10 @@ typedef struct FLVContext {
> > localhost:ffmpeg StevenLiu$
> > localhost:ffmpeg StevenLiu$ ./tools/patcheck new_patch.patch
> > patCHeck 1e10.0
> > This tool is intended to help a human check/review patches. It is very
> far
> > from
> > being free of false positives and negatives, and its output are just
> hints
> > of what
> > may or may not be bad. When you use it and it misses something or detects
> > something wrong, fix it and send a patch to the ffmpeg-devel mailing
> list.
> > License: GPL, Author: Michael Niedermayer
> > egrep: empty (sub)expression
> > egrep: empty (sub)expression
> > egrep: empty (sub)expression
> > egrep: empty (sub)expression
> > egrep: empty (sub)expression
> > egrep: empty (sub)expression
> > egrep: empty (sub)expression
> > egrep: empty (sub)expression
> > egrep: empty (sub)expression
> > egrep: empty (sub)expression
> > egrep: empty (sub)expression
> > xargs: illegal option -- d
> > usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J
> replstr]
> >  [-L number] [-n number [-x]] [-P maxprocs] [-s size]
> >  [utility [argument ...]]
> >
> > Missing changelog entry (ignore if minor change)
> > egrep: empty (sub)expression
> > localhost:ffmpeg StevenLiu$
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before video or audio stream was created

2016-07-20 Thread Xinzheng Zhang
---
 libavformat/flvdec.c | 51 ---
 1 file changed, 44 insertions(+), 7 deletions(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 2bf1e05..b4fb4e2 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -30,6 +30,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/intfloat.h"
 #include "libavutil/mathematics.h"
+#include "libavutil/mem.h"
 #include "libavcodec/bytestream.h"
 #include "libavcodec/mpeg4audio.h"
 #include "avformat.h"
@@ -41,6 +42,11 @@
 
 #define RESYNC_BUFFER_SIZE (1<<20)
 
+typedef struct FLVKeyFrame {
+int64_t pos;
+int64_t timestamp;
+} FLVKeyFrame;
+
 typedef struct FLVContext {
 const AVClass *class; ///< Class for private options.
 int trust_metadata;   ///< configure streams according onMetaData
@@ -61,6 +67,10 @@ typedef struct FLVContext {
 
 int broken_sizes;
 int sum_flv_tag_size;
+
+int head_flags; //r8
+FLVKeyFrame *keyframes;
+int keyframe_count;
 } FLVContext;
 
 static int probe(AVProbeData *p, int live)
@@ -95,6 +105,9 @@ static int live_flv_probe(AVProbeData *p)
 static AVStream *create_stream(AVFormatContext *s, int codec_type)
 {
 AVStream *st = avformat_new_stream(s, NULL);
+FLVContext *flv = s->priv_data;
+int flags = flv->head_flags;
+int i = 0;
 if (!st)
 return NULL;
 st->codecpar->codec_type = codec_type;
@@ -104,6 +117,17 @@ static AVStream *create_stream(AVFormatContext *s, int 
codec_type)
 s->ctx_flags &= ~AVFMTCTX_NOHEADER;
 
 avpriv_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
+if ((!(flags & FLV_HEADER_FLAG_HASVIDEO) && codec_type == 
AVMEDIA_TYPE_AUDIO) ||
+(codec_type == AVMEDIA_TYPE_VIDEO)
+) {
+for (; i < flv->keyframe_count; i++) {
+FLVKeyFrame *keyframe = &flv->keyframes[i];
+av_add_index_entry(st, keyframe->pos, keyframe->timestamp,
+   0, 0, AVINDEX_KEYFRAME);
+}
+flv->keyframe_count = 0;
+av_freep(&flv->keyframes);
+}
 return st;
 }
 
@@ -306,7 +330,7 @@ static int amf_get_string(AVIOContext *ioc, char *buffer, 
int buffsize)
 }
 
 static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc,
- AVStream *vstream, int64_t max_pos)
+ AVStream *vstream, AVStream *astream, int64_t 
max_pos)
 {
 FLVContext *flv   = s->priv_data;
 unsigned int timeslen = 0, fileposlen = 0, i;
@@ -315,8 +339,12 @@ static int parse_keyframes_index(AVFormatContext *s, 
AVIOContext *ioc,
 int64_t *filepositions = NULL;
 int ret= AVERROR(ENOSYS);
 int64_t initial_pos= avio_tell(ioc);
+int head_flags = flv->head_flags;
+AVStream *kf_stream= vstream;
+if (!kf_stream && astream && (!(head_flags & FLV_HEADER_FLAG_HASVIDEO) && 
(head_flags & FLV_HEADER_FLAG_HASAUDIO)))
+kf_stream = astream;
 
-if (vstream->nb_index_entries>0) {
+if (kf_stream && kf_stream->nb_index_entries > 0) {
 av_log(s, AV_LOG_WARNING, "Skipping duplicate index\n");
 return 0;
 }
@@ -369,8 +397,16 @@ static int parse_keyframes_index(AVFormatContext *s, 
AVIOContext *ioc,
 
 if (timeslen == fileposlen && fileposlen>1 && max_pos <= filepositions[0]) 
{
 for (i = 0; i < fileposlen; i++) {
-av_add_index_entry(vstream, filepositions[i], times[i] * 1000,
-   0, 0, AVINDEX_KEYFRAME);
+if (kf_stream) {
+av_add_index_entry(kf_stream, filepositions[i], times[i] * 
1000,
+   0, 0, AVINDEX_KEYFRAME);
+} else {
+FLVKeyFrame frame = {0};
+frame.pos = filepositions[i];
+frame.timestamp = times[i] * 1000;
+av_dynarray2_add((void **)&flv->keyframes, 
&flv->keyframe_count,sizeof(FLVKeyFrame), (const uint8_t *)&frame);
+}
+
 if (i < 2) {
 flv->validate_index[i].pos = filepositions[i];
 flv->validate_index[i].dts = times[i] * 1000;
@@ -418,10 +454,10 @@ static int amf_parse_object(AVFormatContext *s, AVStream 
*astream,
 }
 break;
 case AMF_DATA_TYPE_OBJECT:
-if ((vstream || astream) && key &&
+if (key &&
 ioc->seekable &&
 !strcmp(KEYFRAMES_TAG, key) && depth == 1)
-if (parse_keyframes_index(s, ioc, vstream ? vstream : astream,
+if (parse_keyframes_index(s, ioc, vstream, astream,
   max_pos) < 0)
 av_log(s, AV_LOG_ERROR, "Keyframe index parsing failed\n");
 
@@ -633,7 +669,7 @@ static int flv_read_header(AVFormatContext *s)
 int offset;
 
 avio_skip(s->pb, 4);
-avio_r8(s->pb); // flags
+flv->head_flags = avio_r8(s->pb); // flags
 
 s->ctx_flags |= AVFMTCTX_NOHEADER;
 
@@ -653,6 +689,7 @@ sta

Re: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before video or audio stream was created

2016-07-20 Thread XinZheng Zhang
I apologize about my English and let me re-arrange my words.
The current realization would result in the loss of all key frame
indices from all the current video frames,
which would lead to the failure of seeking in FLVs.
My current patch will cache all key frame indices without creating any
video streams,
and put in all those immediately after creating any relevant video streams.

I found that there has something error with my `egrep`,
caused all the patches (include applied patch) could not be checked
successfully.
The error message is same to the log which Steven Liu posted.
Here is my platform message:
egrep (BSD grep) 2.5.1-FreeBSD
osx 10.11.4


I will resend a new patch without the extra new line.

On Thu, Jul 21, 2016 at 7:39 AM, Steven Liu  wrote:
> 2016-07-21 7:29 GMT+08:00 Steven Liu :
>
>>
>>
>> 2016-07-21 5:03 GMT+08:00 Moritz Barsnick :
>>
>>> On Thu, Jul 21, 2016 at 00:06:44 +0800, zhangxinzheng wrote:
>>>
>>> > Subject: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes
>>> before video or audio stream was created
>>>^^^ flv
>>>
>>> > There has an error when seeking in a flv file, which key frames was
>>> > sorted before video frame.
>>> > This ensures that all the key frames was cached, and add to
>>> > corresponding stream when it was created.
>>>
>>> Thanks to the grammar, I don't understand the intent of the patch.
>>> (Don't get me wrong, I'm not scorning your English, but it needs to be
>>> improved.)
>>>
>> Hi Moritz,
>> Perhaps he want to create a keyframe index for flv file, to seek flv
>> keyframe.
>>
>>
>>
>>> >  #define RESYNC_BUFFER_SIZE (1<<20)
>>> >
>>> > +
>>> > +typedef struct FLVKeyFrame {
>>>
>>> Why the extra newline?
>>
>>
>> Hi Zhang Xinzheng ,
>>
>> You should check the patch use the tool at ./tools/patcheck .
>>  Please reading
>> http://ffmpeg.org/developer.html#toc-Submitting-patches-1 .
>>
> ok, I make a mistake, the patchcheck can not check the newline
>
>
>
> localhost:ffmpeg StevenLiu$ cat new_patch.patch | head -n 30
> ---
>  libavformat/flvdec.c | 52
> +---
>  1 file changed, 45 insertions(+), 7 deletions(-)
>
> diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
> index 2bf1e05..8a73b68 100644
> --- a/libavformat/flvdec.c
> +++ b/libavformat/flvdec.c
> @@ -30,6 +30,7 @@
>  #include "libavutil/opt.h"
>  #include "libavutil/intfloat.h"
>  #include "libavutil/mathematics.h"
> +#include "libavutil/mem.h"
>  #include "libavcodec/bytestream.h"
>  #include "libavcodec/mpeg4audio.h"
>  #include "avformat.h"
> @@ -41,6 +42,12 @@
>
>  #define RESYNC_BUFFER_SIZE (1<<20)
>
> +
> +typedef struct FLVKeyFrame {
> +int64_t pos;
> +int64_t timestamp;
> +} FLVKeyFrame;
> +
>  typedef struct FLVContext {
>  const AVClass *class; ///< Class for private options.
>  int trust_metadata;   ///< configure streams according onMetaData
> @@ -61,6 +68,10 @@ typedef struct FLVContext {
> localhost:ffmpeg StevenLiu$
> localhost:ffmpeg StevenLiu$ ./tools/patcheck new_patch.patch
> patCHeck 1e10.0
> This tool is intended to help a human check/review patches. It is very far
> from
> being free of false positives and negatives, and its output are just hints
> of what
> may or may not be bad. When you use it and it misses something or detects
> something wrong, fix it and send a patch to the ffmpeg-devel mailing list.
> License: GPL, Author: Michael Niedermayer
> egrep: empty (sub)expression
> egrep: empty (sub)expression
> egrep: empty (sub)expression
> egrep: empty (sub)expression
> egrep: empty (sub)expression
> egrep: empty (sub)expression
> egrep: empty (sub)expression
> egrep: empty (sub)expression
> egrep: empty (sub)expression
> egrep: empty (sub)expression
> egrep: empty (sub)expression
> xargs: illegal option -- d
> usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr]
>  [-L number] [-n number [-x]] [-P maxprocs] [-s size]
>  [utility [argument ...]]
>
> Missing changelog entry (ignore if minor change)
> egrep: empty (sub)expression
> localhost:ffmpeg StevenLiu$
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding

2016-07-20 Thread Umair Khan
On Tue, Jul 19, 2016 at 11:17 PM, Umair Khan  wrote:
>
> Updated patch.
>
> On Tue, Jul 19, 2016 at 8:19 PM, Thilo Borgmann  
> wrote:
> > Am 19.07.16 um 15:42 schrieb Umair Khan:
> >> On Tue, Jul 19, 2016 at 5:20 PM, Thilo Borgmann  
> >> wrote:
> >>> Am 19.07.16 um 09:22 schrieb Umair Khan:
>  On Tue, Jul 19, 2016 at 12:29 PM, Paul B Mahol  wrote:
> >
> > On 7/19/16, Umair Khan  wrote:
> >> On Tue, Jul 19, 2016 at 3:08 AM, Michael Niedermayer
> >>  wrote:
> >>> On Mon, Jul 18, 2016 at 11:42:48PM +0530, Umair Khan wrote:
>  On Sun, Jul 17, 2016 at 3:38 PM, Michael Niedermayer
>   wrote:
> > On Sun, Jul 17, 2016 at 11:54:49AM +0200, Michael Niedermayer wrote:
> >> On Sun, Jul 17, 2016 at 09:00:48AM +0530, Umair Khan wrote:
> >>> Hi,
> >>>
> >>> On Sun, Jul 17, 2016 at 12:25 AM, Thilo Borgmann
> >>>  wrote:
>  Hi,
> 
> > From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 
> > 00:00:00
> > 2001
> > From: Umair Khan 
> > Date: Sat, 16 Jul 2016 23:52:39 +0530
> > Subject: [PATCH 1/1] avcodec/alsdec: implement floating point
> > decoding
> >
> > It conforms to RM22 version of the reference codec.
> >
> > Signed-off-by: Umair Khan 
> > ---
> >  libavcodec/Makefile   |   2 +-
> >  libavcodec/alsdec.c   | 284
> > +-
> >  libavcodec/mlz.c  | 171 +
> >  libavcodec/mlz.h  |  69 ++
> >  libavutil/softfloat_ieee754.h | 115 +
> >  5 files changed, 638 insertions(+), 3 deletions(-)
> >  create mode 100644 libavcodec/mlz.c
> >  create mode 100644 libavcodec/mlz.h
> >  create mode 100644 libavutil/softfloat_ieee754.h
> >
> > diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> > index abef19e..a03adf5 100644
> > --- a/libavcodec/Makefile
> > +++ b/libavcodec/Makefile
> > @@ -163,7 +163,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+=
> > alac.o alac_data.o alacdsp.o
> >  OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o
> >  OBJS-$(CONFIG_ALIAS_PIX_DECODER)   += aliaspixdec.o
> >  OBJS-$(CONFIG_ALIAS_PIX_ENCODER)   += aliaspixenc.o
> > -OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o
> > mpeg4audio.o
> > +OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o
> > mpeg4audio.o
> >  OBJS-$(CONFIG_AMRNB_DECODER)   += amrnbdec.o
> > celp_filters.o   \
> >celp_math.o
> > acelp_filters.o \
> >acelp_vectors.o
> >  \
> > diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
> > index a7e58a2..c710fc3 100644
> > --- a/libavcodec/alsdec.c
> > +++ b/libavcodec/alsdec.c
> > @@ -35,8 +35,11 @@
> >  [...]
> >
> > +/** multiply two softfloats and handle the rounding off
> > + */
> > +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a,
> > SoftFloat_IEEE754 b) {
> > [...]
> 
>  Why is this in alsdec.c?
> >>>
> >>> This is not the actual IEEE 754 multiplication. It is as is
> >>> mentioned
> >>> in the reference spec.
> >>> The typical one for 754 floats, I've implemented here separately -
> >>> https://github.com/omerjerk/FFmpeg/commit/d6cd4bf66b9da46dd87580d7d974ce44abdcfba2#diff-4dd4b2d8d523f336fbefa96e9252187cR93
> >>>
>  [...]
> 
> > diff --git a/libavcodec/mlz.c b/libavcodec/mlz.c
> > new file mode 100644
> > index 000..cb2ed6a
> > --- /dev/null
> > +++ b/libavcodec/mlz.c
> > [...]
> 
> > +static int input_code(GetBitContext* gb, int len) {
> > +int tmp_code = 0;
> > +int i;
> > +for (i = 0; i < len; ++i) {
> > +tmp_code += get_bits1(gb) << i;
> >>>  |=
> >>> should be better.
> >>>
> > +}
> > +return tmp_code;
> > +}
> >>>
> >>> Also, you could revert it byte-wise using ff_revert[]... if len is often 
> >>> bigger
> >>> than 8 that might be worth it.
> >>
> >> I didn't get you.
> >
> > tmp_code |= get_bits1(gb) << i;
> >
> >
> >> I tried logging that variable and len is alwa

Re: [FFmpeg-devel] [PATCH 2/2] docs/demuxers: add libopenmpt section

2016-07-20 Thread Josh de Kock
On Tue, Jul 19, 2016, at 04:39 PM, Josh de Kock wrote:
> [...]

Set applied

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


Re: [FFmpeg-devel] [PATCH 3/3] libavformat/libopenmpt: Add "date" to metadata.

2016-07-20 Thread Josh de Kock
The rest of the set was applied, thanks.

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


Re: [FFmpeg-devel] [PATCH 4/4] avformat: add an Ogg Video muxer

2016-07-20 Thread James Almer
On 7/12/2016 11:24 PM, Michael Niedermayer wrote:
> On Wed, Jul 06, 2016 at 08:25:27PM -0300, James Almer wrote:
>> RFC 5334 recommendens this extension to go alongside the video/ogg
>> mimetype for video files, with or without audio and subtitles [1].
>>
>> [1] https://tools.ietf.org/html/rfc5334#section-10.2
>>
>> Signed-off-by: James Almer 
>> ---
>> TODO: Version bump and changelog entry.
>>
>>  configure|  1 +
>>  libavformat/allformats.c |  1 +
>>  libavformat/oggenc.c | 21 -
>>  3 files changed, 22 insertions(+), 1 deletion(-)
> 
> should be ok
> 
> thx

Pushed.

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


Re: [FFmpeg-devel] [PATCH 3/3] avformat/oggenc: add vp8 muxing support

2016-07-20 Thread James Almer
On 7/12/2016 6:36 PM, James Almer wrote:
> Addresses ticket #5687
> 
> Signed-off-by: James Almer 
> ---
> AVFMT_TS_NONSTRICT is added to flags because invisible vp8 frames don't
> increase the pts
> 
>  libavformat/oggenc.c| 94 
> +
>  tests/fate/avformat.mak |  1 +
>  tests/lavf-regression.sh|  4 ++
>  tests/ref/lavf-fate/ogg_vp8 |  3 ++
>  4 files changed, 94 insertions(+), 8 deletions(-)
>  create mode 100644 tests/ref/lavf-fate/ogg_vp8

Pushed.

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


[FFmpeg-devel] [PATCH] tests/fate/dnxhd: add dnxhr prefix tests

2016-07-20 Thread Mark Reid
The data offset value in the prefix increases as the heights increases.
This test adds a tests for some common dnxhr heights.

can somebody add the following test footage to fate/dnxhd?
https://dl.dropboxusercontent.com/u/170952/fate/dnxhd/prefix-256x1536.dnxhr
https://dl.dropboxusercontent.com/u/170952/fate/dnxhd/prefix-256x1716.dnxhr
https://dl.dropboxusercontent.com/u/170952/fate/dnxhd/prefix-256x2048.dnxhr
https://dl.dropboxusercontent.com/u/170952/fate/dnxhd/prefix-256x2160.dnxhr
https://dl.dropboxusercontent.com/u/170952/fate/dnxhd/prefix-256x3212.dnxhr

---
 tests/fate/dnxhd.mak | 12 +++-
 tests/ref/fate/dnxhr-prefix1 | 10 ++
 tests/ref/fate/dnxhr-prefix2 | 10 ++
 tests/ref/fate/dnxhr-prefix3 | 10 ++
 tests/ref/fate/dnxhr-prefix4 | 10 ++
 tests/ref/fate/dnxhr-prefix5 | 10 ++
 6 files changed, 61 insertions(+), 1 deletion(-)
 create mode 100644 tests/ref/fate/dnxhr-prefix1
 create mode 100644 tests/ref/fate/dnxhr-prefix2
 create mode 100644 tests/ref/fate/dnxhr-prefix3
 create mode 100644 tests/ref/fate/dnxhr-prefix4
 create mode 100644 tests/ref/fate/dnxhr-prefix5

diff --git a/tests/fate/dnxhd.mak b/tests/fate/dnxhd.mak
index b7f8b17..4008e6c 100644
--- a/tests/fate/dnxhd.mak
+++ b/tests/fate/dnxhd.mak
@@ -1,6 +1,11 @@
 FATE_DNXHD = fate-dnxhd-mbaff \
  fate-dnxhr-444   \
- fate-dnxhr-parse
+ fate-dnxhr-parse \
+ fate-dnxhr-prefix1   \
+ fate-dnxhr-prefix2   \
+ fate-dnxhr-prefix3   \
+ fate-dnxhr-prefix4   \
+ fate-dnxhr-prefix5

 FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, DNXHD) += $(FATE_DNXHD)
 fate-dnxhd: $(FATE_DNXHD) $(FATE_VCODEC_DNXHD)
@@ -8,3 +13,8 @@ fate-dnxhd: $(FATE_DNXHD) $(FATE_VCODEC_DNXHD)
 fate-dnxhd-mbaff: CMD = framecrc -flags +bitexact -idct simple -i 
$(TARGET_SAMPLES)/dnxhd/dnxhd100_cid1260.mov -pix_fmt yuv422p10le
 fate-dnxhr-444:   CMD = framecrc -flags +bitexact -idct simple -i 
$(TARGET_SAMPLES)/dnxhd/dnxhr444_cid1270.mov -pix_fmt yuv444p10le
 fate-dnxhr-parse: CMD = framecrc -flags +bitexact -idct simple -i 
$(TARGET_SAMPLES)/dnxhd/dnxhr_cid1274.dnxhr -pix_fmt yuv422p
+fate-dnxhr-prefix1: CMD = framecrc -flags +bitexact -idct simple -i 
$(TARGET_SAMPLES)/dnxhd/prefix-256x1536.dnxhr -pix_fmt yuv422p
+fate-dnxhr-prefix2: CMD = framecrc -flags +bitexact -idct simple -i 
$(TARGET_SAMPLES)/dnxhd/prefix-256x1716.dnxhr -pix_fmt yuv422p
+fate-dnxhr-prefix3: CMD = framecrc -flags +bitexact -idct simple -i 
$(TARGET_SAMPLES)/dnxhd/prefix-256x2048.dnxhr -pix_fmt yuv422p
+fate-dnxhr-prefix4: CMD = framecrc -flags +bitexact -idct simple -i 
$(TARGET_SAMPLES)/dnxhd/prefix-256x2160.dnxhr -pix_fmt yuv422p
+fate-dnxhr-prefix5: CMD = framecrc -flags +bitexact -idct simple -i 
$(TARGET_SAMPLES)/dnxhd/prefix-256x3212.dnxhr -pix_fmt yuv422p
diff --git a/tests/ref/fate/dnxhr-prefix1 b/tests/ref/fate/dnxhr-prefix1
new file mode 100644
index 000..bbad26e
--- /dev/null
+++ b/tests/ref/fate/dnxhr-prefix1
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 256x1536
+#sar 0: 0/1
+0,  0,  0,1,   786432, 0x5a07f1fe
+0,  1,  1,1,   786432, 0x5b5acaed
+0,  2,  2,1,   786432, 0x1a9aacb5
+0,  3,  3,1,   786432, 0x12ddf22d
+0,  4,  4,1,   786432, 0xde2515f8
diff --git a/tests/ref/fate/dnxhr-prefix2 b/tests/ref/fate/dnxhr-prefix2
new file mode 100644
index 000..cb062b5
--- /dev/null
+++ b/tests/ref/fate/dnxhr-prefix2
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 256x1716
+#sar 0: 0/1
+0,  0,  0,1,   878592, 0x9a99e1db
+0,  1,  1,1,   878592, 0x9317b608
+0,  2,  2,1,   878592, 0x2d6c9b2f
+0,  3,  3,1,   878592, 0xa7f0e3fe
+0,  4,  4,1,   878592, 0x98330125
diff --git a/tests/ref/fate/dnxhr-prefix3 b/tests/ref/fate/dnxhr-prefix3
new file mode 100644
index 000..e6a729f
--- /dev/null
+++ b/tests/ref/fate/dnxhr-prefix3
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 256x2048
+#sar 0: 0/1
+0,  0,  0,1,  1048576, 0xa2eb0c23
+0,  1,  1,1,  1048576, 0x2149e4f9
+0,  2,  2,1,  1048576, 0xbdfacc9b
+0,  3,  3,1,  1048576, 0x64040c52
+0,  4,  4,1,  1048576, 0x9fec31b4
diff --git a/tests/ref/fate/dnxhr-prefix4 b/tests/ref/fate/dnxhr-prefix4
new file mode 100644
index 000..15ed9a3
--- /dev/null
+++ b/tests/ref/fate/dnxhr-prefix4
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 256x2160
+#sar 0: 0/1
+0,  0,  0,1,  1105920, 0xcc1cc322
+0,  1,  1,1,  1105920, 0xd3038a1d
+0,  2

[FFmpeg-devel] [PATCH 1/1] libavformat/rawenc: add dnxhr raw format extension

2016-07-20 Thread Mark Reid
---
 libavformat/rawenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index 4b8b41c..c4d7a90 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -128,7 +128,7 @@ AVOutputFormat ff_dirac_muxer = {
 AVOutputFormat ff_dnxhd_muxer = {
 .name  = "dnxhd",
 .long_name = NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"),
-.extensions= "dnxhd",
+.extensions= "dnxhd,dnxhr",
 .audio_codec   = AV_CODEC_ID_NONE,
 .video_codec   = AV_CODEC_ID_DNXHD,
 .write_header  = force_one_stream,
-- 
2.7.3

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


Re: [FFmpeg-devel] [PATCH 1/2] avformat/mux: Fix some codecpar non uses

2016-07-20 Thread Michael Niedermayer
On Sun, Jul 17, 2016 at 04:10:38AM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/mux.c |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

applied

thanks

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


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: Add max stats to PSNR log

2016-07-20 Thread Michael Niedermayer
On Tue, Jul 19, 2016 at 10:49:20AM -0700, Lucas Cooper wrote:
> This allows retroactive aggregation of the PSNR statistics (e.g.
> calculating average PSNR for entire video or a segment of the video).

To do this accurate it would be better to list the actual integer
differences instead of float rounded to 2 digits afer the decimal
point.
Also that different information should possibly be optional
as in version 2 format, and with that the first line could specify
the version of the format

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

What does censorship reveal? It reveals fear. -- Julian Assange


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


[FFmpeg-devel] [PATCH] avfilter/vf_psnr: Fix rounding error in average_max

2016-07-20 Thread Michael Niedermayer
The intermediate was rounded to an integer

Signed-off-by: Michael Niedermayer 
---
 libavfilter/vf_psnr.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c
index f3dff62..54d4ff0 100644
--- a/libavfilter/vf_psnr.c
+++ b/libavfilter/vf_psnr.c
@@ -246,6 +246,7 @@ static int config_input_ref(AVFilterLink *inlink)
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
 AVFilterContext *ctx  = inlink->dst;
 PSNRContext *s = ctx->priv;
+double average_max;
 unsigned sum;
 int j;
 
@@ -278,10 +279,12 @@ static int config_input_ref(AVFilterLink *inlink)
 sum = 0;
 for (j = 0; j < s->nb_components; j++)
 sum += s->planeheight[j] * s->planewidth[j];
+average_max = 0;
 for (j = 0; j < s->nb_components; j++) {
 s->planeweight[j] = (double) s->planeheight[j] * s->planewidth[j] / 
sum;
-s->average_max += s->max[j] * s->planeweight[j];
+average_max += s->max[j] * s->planeweight[j];
 }
+s->average_max = lrint(average_max);
 
 s->dsp.sse_line = desc->comp[0].depth > 8 ? sse_line_16bit : sse_line_8bit;
 if (ARCH_X86)
-- 
1.7.9.5

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


Re: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before video or audio stream was created

2016-07-20 Thread Steven Liu
2016-07-21 7:29 GMT+08:00 Steven Liu :

>
>
> 2016-07-21 5:03 GMT+08:00 Moritz Barsnick :
>
>> On Thu, Jul 21, 2016 at 00:06:44 +0800, zhangxinzheng wrote:
>>
>> > Subject: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes
>> before video or audio stream was created
>>^^^ flv
>>
>> > There has an error when seeking in a flv file, which key frames was
>> > sorted before video frame.
>> > This ensures that all the key frames was cached, and add to
>> > corresponding stream when it was created.
>>
>> Thanks to the grammar, I don't understand the intent of the patch.
>> (Don't get me wrong, I'm not scorning your English, but it needs to be
>> improved.)
>>
> Hi Moritz,
> Perhaps he want to create a keyframe index for flv file, to seek flv
> keyframe.
>
>
>
>> >  #define RESYNC_BUFFER_SIZE (1<<20)
>> >
>> > +
>> > +typedef struct FLVKeyFrame {
>>
>> Why the extra newline?
>
>
> Hi Zhang Xinzheng ,
>
> You should check the patch use the tool at ./tools/patcheck .
>  Please reading
> http://ffmpeg.org/developer.html#toc-Submitting-patches-1 .
>
ok, I make a mistake, the patchcheck can not check the newline



localhost:ffmpeg StevenLiu$ cat new_patch.patch | head -n 30
---
 libavformat/flvdec.c | 52
+---
 1 file changed, 45 insertions(+), 7 deletions(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 2bf1e05..8a73b68 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -30,6 +30,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/intfloat.h"
 #include "libavutil/mathematics.h"
+#include "libavutil/mem.h"
 #include "libavcodec/bytestream.h"
 #include "libavcodec/mpeg4audio.h"
 #include "avformat.h"
@@ -41,6 +42,12 @@

 #define RESYNC_BUFFER_SIZE (1<<20)

+
+typedef struct FLVKeyFrame {
+int64_t pos;
+int64_t timestamp;
+} FLVKeyFrame;
+
 typedef struct FLVContext {
 const AVClass *class; ///< Class for private options.
 int trust_metadata;   ///< configure streams according onMetaData
@@ -61,6 +68,10 @@ typedef struct FLVContext {
localhost:ffmpeg StevenLiu$
localhost:ffmpeg StevenLiu$ ./tools/patcheck new_patch.patch
patCHeck 1e10.0
This tool is intended to help a human check/review patches. It is very far
from
being free of false positives and negatives, and its output are just hints
of what
may or may not be bad. When you use it and it misses something or detects
something wrong, fix it and send a patch to the ffmpeg-devel mailing list.
License: GPL, Author: Michael Niedermayer
egrep: empty (sub)expression
egrep: empty (sub)expression
egrep: empty (sub)expression
egrep: empty (sub)expression
egrep: empty (sub)expression
egrep: empty (sub)expression
egrep: empty (sub)expression
egrep: empty (sub)expression
egrep: empty (sub)expression
egrep: empty (sub)expression
egrep: empty (sub)expression
xargs: illegal option -- d
usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr]
 [-L number] [-n number [-x]] [-P maxprocs] [-s size]
 [utility [argument ...]]

Missing changelog entry (ignore if minor change)
egrep: empty (sub)expression
localhost:ffmpeg StevenLiu$
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before video or audio stream was created

2016-07-20 Thread Steven Liu
2016-07-21 5:03 GMT+08:00 Moritz Barsnick :

> On Thu, Jul 21, 2016 at 00:06:44 +0800, zhangxinzheng wrote:
>
> > Subject: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before
> video or audio stream was created
>^^^ flv
>
> > There has an error when seeking in a flv file, which key frames was
> > sorted before video frame.
> > This ensures that all the key frames was cached, and add to
> > corresponding stream when it was created.
>
> Thanks to the grammar, I don't understand the intent of the patch.
> (Don't get me wrong, I'm not scorning your English, but it needs to be
> improved.)
>
Hi Moritz,
Perhaps he want to create a keyframe index for flv file, to seek flv
keyframe.



> >  #define RESYNC_BUFFER_SIZE (1<<20)
> >
> > +
> > +typedef struct FLVKeyFrame {
>
> Why the extra newline?


Hi Zhang Xinzheng ,

You should check the patch use the tool at ./tools/patcheck .
 Please reading
http://ffmpeg.org/developer.html#toc-Submitting-patches-1 .
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Avoid sending packets to network when multicast ttl is 0 in udp

2016-07-20 Thread Michael Niedermayer
On Wed, Jul 20, 2016 at 05:38:10PM +0430, Omid Ghaffarinia wrote:
> Thanks for testing in mingw
> New patch attached, which should work now.

still fails, even on ubuntu:
libavformat/udp.c: In function ‘udp_set_multicast_ttl’:
libavformat/udp.c:367:13: warning: passing argument 1 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but argument is 
of type ‘struct sockaddr_storage *’
libavformat/udp.c:367:13: warning: passing argument 2 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
argument is of type ‘const char *’
libavformat/udp.c:367:13: error: too few arguments to function ‘udp_set_url’
libavformat/udp.c:328:12: note: declared here
libavformat/udp.c:376:13: warning: passing argument 1 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but argument is 
of type ‘struct sockaddr_storage *’
libavformat/udp.c:376:13: warning: passing argument 2 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
argument is of type ‘const char *’
libavformat/udp.c:376:13: error: too few arguments to function ‘udp_set_url’
libavformat/udp.c:328:12: note: declared here
libavformat/udp.c: In function ‘udp_open’:
libavformat/udp.c:907:17: warning: passing argument 1 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but argument is 
of type ‘struct sockaddr_storage *’
libavformat/udp.c:907:17: warning: passing argument 2 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
argument is of type ‘const char *’
libavformat/udp.c:907:17: error: too few arguments to function ‘udp_set_url’
libavformat/udp.c:328:12: note: declared here


on mingw64:
CC  libavformat/udp.o
src/libavformat/udp.c: In function ‘udp_set_multicast_ttl’:
src/libavformat/udp.c:367:13: warning: passing argument 1 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
src/libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but argument 
is of type ‘struct sockaddr_storage *’
src/libavformat/udp.c:367:13: warning: passing argument 2 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
src/libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
argument is of type ‘const char *’
src/libavformat/udp.c:367:13: error: too few arguments to function ‘udp_set_url’
src/libavformat/udp.c:328:12: note: declared here
src/libavformat/udp.c:376:13: warning: passing argument 1 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
src/libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but argument 
is of type ‘struct sockaddr_storage *’
src/libavformat/udp.c:376:13: warning: passing argument 2 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
src/libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
argument is of type ‘const char *’
src/libavformat/udp.c:376:13: error: too few arguments to function ‘udp_set_url’
src/libavformat/udp.c:328:12: note: declared here
src/libavformat/udp.c: In function ‘udp_open’:
src/libavformat/udp.c:907:17: warning: passing argument 1 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
src/libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but argument 
is of type ‘struct sockaddr_storage *’
src/libavformat/udp.c:907:17: warning: passing argument 2 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
src/libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
argument is of type ‘const char *’
src/libavformat/udp.c:907:17: error: too few arguments to function ‘udp_set_url’
src/libavformat/udp.c:328:12: note: declared here
make: *** [libavformat/udp.o] Error 1
make: Target `all' not remade because of errors.

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

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato


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


Re: [FFmpeg-devel] Fix for aviobuf.c::fill_buffer

2016-07-20 Thread Michael Niedermayer
On Wed, Jul 20, 2016 at 03:59:39PM +, code bythepound wrote:
> My app seems to hit the av_assert0(len >= s->orig_buffer_size) (line 535 in
> my sources) in aviobuf.c::fill_buffer.  FWIW I have registered a custom
> AVIOContext that will consistently not fill the entire buffer when the read
> callback is called.
> 
> The outcome is that 'len' in fill_buffer is decremented with each call
> until it is less than s->orig_buffer_size and will assert fail.  It seems
> that instead of the assertion failure, the method should be:
> 
> if( len >= s->orig_buffer_size )
> len = s->orig_buffer_size
> // otherwise, len is < than orig_buffer_size, but is sized correctly to
> fill remainder of buffer.
> 
> On the next iteration, the previous clause (dst == s->buffer) is executed
> and the buffer is reset.  After that, this block is never executed again.
> 
> With the above fix in, my app seems to work fine.
> 
> Since the fill_buffer code has been the same for many releases of ffmpeg,
> I'm wondering how I could be the first to notice it, and if there is
> something else I could be doing wrong to cause this?

is there some easy way to reproduce this ?
i tried
diff --git a/libavformat/file.c b/libavformat/file.c
index 264542a..529a975 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -108,6 +108,7 @@ static int file_read(URLContext *h, unsigned char *buf, int 
size)
 {
 FileContext *c = h->priv_data;
 int ret;
+size = FFMIN(size, size/5 + 1);
 size = FFMIN(size, c->blocksize);
 ret = read(c->fd, buf, size);
 if (ret == 0 && c->follow)

but it doesnt trigger the assert


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

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued


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


Re: [FFmpeg-devel] [PATCH] avutil: simplify LOCAL_ALIGNED macros

2016-07-20 Thread Michael Niedermayer
On Wed, Jul 20, 2016 at 11:25:15AM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
> I went overzealous with cosmetics and added a space before a bracket,
> obviously screwing up the macro in the process.
> 
>  configure| 10 --
>  libavutil/internal.h | 22 ++
>  2 files changed, 10 insertions(+), 22 deletions(-)

works fine on mips linuxx86-32/64 mingw 32/64

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

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad


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


Re: [FFmpeg-devel] [PATCH] fate: add test for earwax filter

2016-07-20 Thread Michael Niedermayer
On Wed, Jul 20, 2016 at 06:11:56PM +, Petru Rares Sincraian wrote:
> 
> Hi there,
> 
> Here is another test, in this case for earwax filter.
> 
> 
> Regards,
> Petru Rares.

>  fate/filter-audio.mak  |5 +
>  ref/fate/filter-earwax |   25 +
>  2 files changed, 30 insertions(+)
> 8e53f610b3c0c2960b3ae84f39f560e2b64ee68d  
> 0001-fate-add-test-for-earwax-filter.patch
> From c5bf7787be1ff7b9be2be31341a9bd9d0dd4ceaa Mon Sep 17 00:00:00 2001
> From: Petru Rares Sincraian 
> Date: Wed, 20 Jul 2016 18:41:58 +0200
> Subject: [PATCH] fate: add test for earwax filter
> 
> ---
>  tests/fate/filter-audio.mak  |  5 +
>  tests/ref/fate/filter-earwax | 25 +
>  2 files changed, 30 insertions(+)
>  create mode 100644 tests/ref/fate/filter-earwax

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


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


Re: [FFmpeg-devel] [PATCH] fate: add test for dcshift filter

2016-07-20 Thread Michael Niedermayer
On Wed, Jul 20, 2016 at 04:36:22PM +, Petru Rares Sincraian wrote:
> 
> Hi there,
> 
> Here is a test for dcshift filter :)
> 
> 
> Thanks,
> Petru Rares.

>  fate/filter-audio.mak   |5 +
>  ref/fate/filter-dcshift |   25 +
>  2 files changed, 30 insertions(+)
> c67869530a577cec36de823f233b1bc9dca54fa1  
> 0001-fate-add-test-for-dcshift-filter.patch
> From f64daccf65b56e6eff22989f42c70c771b2a3801 Mon Sep 17 00:00:00 2001
> From: Petru Rares Sincraian 
> Date: Wed, 20 Jul 2016 18:32:04 +0200
> Subject: [PATCH] fate: add test for dcshift filter

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No snowflake in an avalanche ever feels responsible. -- Voltaire


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


Re: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before video or audio stream was created

2016-07-20 Thread Moritz Barsnick
On Thu, Jul 21, 2016 at 00:06:44 +0800, zhangxinzheng wrote:

> Subject: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before 
> video or audio stream was created
   ^^^ flv

> There has an error when seeking in a flv file, which key frames was
> sorted before video frame.
> This ensures that all the key frames was cached, and add to
> corresponding stream when it was created.

Thanks to the grammar, I don't understand the intent of the patch.
(Don't get me wrong, I'm not scorning your English, but it needs to be
improved.)

>  #define RESYNC_BUFFER_SIZE (1<<20)
>  
> +
> +typedef struct FLVKeyFrame {

Why the extra newline?

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


[FFmpeg-devel] [PATCH] fate: add test for earwax filter

2016-07-20 Thread Petru Rares Sincraian

Hi there,

Here is another test, in this case for earwax filter.


Regards,
Petru Rares.From c5bf7787be1ff7b9be2be31341a9bd9d0dd4ceaa Mon Sep 17 00:00:00 2001
From: Petru Rares Sincraian 
Date: Wed, 20 Jul 2016 18:41:58 +0200
Subject: [PATCH] fate: add test for earwax filter

---
 tests/fate/filter-audio.mak  |  5 +
 tests/ref/fate/filter-earwax | 25 +
 2 files changed, 30 insertions(+)
 create mode 100644 tests/ref/fate/filter-earwax

diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak
index 1a52320..ae869d4 100644
--- a/tests/fate/filter-audio.mak
+++ b/tests/fate/filter-audio.mak
@@ -94,6 +94,11 @@ fate-filter-asetrate: tests/data/asynth-44100-2.wav
 fate-filter-asetrate: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-filter-asetrate: CMD = framecrc -i $(SRC) -aframes 20 -af asetrate=2
 
+FATE_AFILTER-$(call FILTERDEMDECENCMUX, EARWAX, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-filter-earwax
+fate-filter-earwax: tests/data/asynth-44100-2.wav
+fate-filter-earwax: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
+fate-filter-earwax: CMD = framecrc -i $(SRC) -aframes 20 -af earwax
+
 tests/data/hls-list.m3u8: TAG = GEN
 tests/data/hls-list.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
 	$(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
diff --git a/tests/ref/fate/filter-earwax b/tests/ref/fate/filter-earwax
new file mode 100644
index 000..8d4eaa8
--- /dev/null
+++ b/tests/ref/fate/filter-earwax
@@ -0,0 +1,25 @@
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: pcm_s16le
+#sample_rate 0: 44100
+#channel_layout 0: 3
+0,  0,  0, 1024, 4096, 0x900af751
+0,   1024,   1024, 1024, 4096, 0xad570065
+0,   2048,   2048, 1024, 4096, 0x93d5f494
+0,   3072,   3072, 1024, 4096, 0x2c65ef7d
+0,   4096,   4096, 1024, 4096, 0xdc8af6d2
+0,   5120,   5120, 1024, 4096, 0x7ae00249
+0,   6144,   6144, 1024, 4096, 0xaab5fdd0
+0,   7168,   7168, 1024, 4096, 0x4373ef39
+0,   8192,   8192, 1024, 4096, 0x0756eb43
+0,   9216,   9216, 1024, 4096, 0x494d06e0
+0,  10240,  10240, 1024, 4096, 0x4393ffae
+0,  11264,  11264, 1024, 4096, 0x6972f97e
+0,  12288,  12288, 1024, 4096, 0xb834ea05
+0,  13312,  13312, 1024, 4096, 0x39b8f871
+0,  14336,  14336, 1024, 4096, 0xf032fccd
+0,  15360,  15360, 1024, 4096, 0xefcd0709
+0,  16384,  16384, 1024, 4096, 0x0590ebc0
+0,  17408,  17408, 1024, 4096, 0x2e75f264
+0,  18432,  18432, 1024, 4096, 0xbea1fd03
+0,  19456,  19456, 1024, 4096, 0x9bbe0434
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH] avformat/matroskaenc: Write duration early during mkv_write_header

2016-07-20 Thread Soft Works


>> I apologize - I'm new to this project and have to get familiar with the 
>> coding styles..
>
>Before writing your first line of code, read other ffmpeg code as well
>as the developer guidelines. Those things mentioned in this thread are
>all noted here:
>https://ffmpeg.org/developer.html#Coding-Rules-1
>
>:-)
>
>Moritz

Moritz,

in fact I had actually done all of this before, but sometimes personal habits 
are stronger :-)

softworkz


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


Re: [FFmpeg-devel] [PATCH] x86/diracdsp: make ff_put_signed_rect_clamped_10_sse4 work on x86_32

2016-07-20 Thread James Almer
On 7/20/2016 1:28 PM, Rostislav Pehlivanov wrote:
> Very nice, thanks.
> Push whenever you have the time

Pushed.

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


[FFmpeg-devel] [PATCH] fate: add test for dcshift filter

2016-07-20 Thread Petru Rares Sincraian

Hi there,

Here is a test for dcshift filter :)


Thanks,
Petru Rares.From f64daccf65b56e6eff22989f42c70c771b2a3801 Mon Sep 17 00:00:00 2001
From: Petru Rares Sincraian 
Date: Wed, 20 Jul 2016 18:32:04 +0200
Subject: [PATCH] fate: add test for dcshift filter

---
 tests/fate/filter-audio.mak   |  5 +
 tests/ref/fate/filter-dcshift | 25 +
 2 files changed, 30 insertions(+)
 create mode 100644 tests/ref/fate/filter-dcshift

diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak
index 1a52320..a86db9c 100644
--- a/tests/fate/filter-audio.mak
+++ b/tests/fate/filter-audio.mak
@@ -94,6 +94,11 @@ fate-filter-asetrate: tests/data/asynth-44100-2.wav
 fate-filter-asetrate: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
 fate-filter-asetrate: CMD = framecrc -i $(SRC) -aframes 20 -af asetrate=2
 
+FATE_AFILTER-$(call FILTERDEMDECENCMUX, DCSHIFT, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-filter-dcshift
+fate-filter-dcshift: tests/data/asynth-44100-2.wav
+fate-filter-dcshift: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
+fate-filter-dcshift: CMD = framecrc -i $(SRC) -aframes 20 -af dcshift=shift=0.25:limitergain=0.05
+
 tests/data/hls-list.m3u8: TAG = GEN
 tests/data/hls-list.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
 	$(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
diff --git a/tests/ref/fate/filter-dcshift b/tests/ref/fate/filter-dcshift
new file mode 100644
index 000..d04aa92
--- /dev/null
+++ b/tests/ref/fate/filter-dcshift
@@ -0,0 +1,25 @@
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: pcm_s16le
+#sample_rate 0: 44100
+#channel_layout 0: 3
+0,  0,  0, 1024, 4096, 0x96868842
+0,   1024,   1024, 1024, 4096, 0xeff98700
+0,   2048,   2048, 1024, 4096, 0x6ea28e1e
+0,   3072,   3072, 1024, 4096, 0x67b982be
+0,   4096,   4096, 1024, 4096, 0xd08a8302
+0,   5120,   5120, 1024, 4096, 0xfdf891dc
+0,   6144,   6144, 1024, 4096, 0xbec4784a
+0,   7168,   7168, 1024, 4096, 0x04ca910a
+0,   8192,   8192, 1024, 4096, 0xe4af87d0
+0,   9216,   9216, 1024, 4096, 0xc7f18c66
+0,  10240,  10240, 1024, 4096, 0x6448732a
+0,  11264,  11264, 1024, 4096, 0x98b89706
+0,  12288,  12288, 1024, 4096, 0xf47887f4
+0,  13312,  13312, 1024, 4096, 0x387290d2
+0,  14336,  14336, 1024, 4096, 0xc5716e84
+0,  15360,  15360, 1024, 4096, 0x94de8aa8
+0,  16384,  16384, 1024, 4096, 0x3a618d88
+0,  17408,  17408, 1024, 4096, 0xfeb56ec2
+0,  18432,  18432, 1024, 4096, 0x55fe8fb6
+0,  19456,  19456, 1024, 4096, 0x8ff788fa
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH] x86/diracdsp: make ff_put_signed_rect_clamped_10_sse4 work on x86_32

2016-07-20 Thread Rostislav Pehlivanov
On 20 July 2016 at 02:40, James Almer  wrote:

> Signed-off-by: James Almer 
> ---
>  libavcodec/x86/diracdsp.asm| 37 -
>  libavcodec/x86/diracdsp_init.c |  4 
>  2 files changed, 20 insertions(+), 21 deletions(-)
>
> diff --git a/libavcodec/x86/diracdsp.asm b/libavcodec/x86/diracdsp.asm
> index d86b543..6b3f780 100644
> --- a/libavcodec/x86/diracdsp.asm
> +++ b/libavcodec/x86/diracdsp.asm
> @@ -303,24 +303,30 @@ cglobal dequant_subband_32, 7, 7, 4, src, dst,
> stride, qf, qs, tot_v, tot_h
>
>  RET
>
> -%if ARCH_X86_64 == 1
> +INIT_XMM sse4
>  ; void put_signed_rect_clamped_10(uint8_t *dst, int dst_stride, const
> uint8_t *src, int src_stride, int width, int height)
> -cglobal put_signed_rect_clamped_10, 6, 9, 6, dst, dst_stride, src,
> src_stride, w, h
> -mov  r6, srcq
> -mov  r7, dstq
> -mov  r8, wq
> +%if ARCH_X86_64
> +cglobal put_signed_rect_clamped_10, 6, 8, 5, dst, dst_stride, src,
> src_stride, w, h, t1, t2
> +%else
> +cglobal put_signed_rect_clamped_10, 5, 7, 5, dst, dst_stride, src,
> src_stride, w, t1, t2
> +%define  hd  r5mp
> +%endif
> +shl  wd, 2
> +addsrcq, wq
> +neg  wq
> +mov t2q, dstq
> +mov t1q, wq
>  pxor m2, m2
>  mova m3, [clip_10bit]
>  mova m4, [convert_to_unsigned_10bit]
>
>  .loop_h:
> -mov  srcq, r6
> -mov  dstq, r7
> -mov  wq,   r8
> +movdstq, t2q
> +mov  wq, t1q
>
>  .loop_w:
> -movu m0, [srcq+0*mmsize]
> -movu m1, [srcq+1*mmsize]
> +movu m0, [srcq+wq+0*mmsize]
> +movu m1, [srcq+wq+1*mmsize]
>
>  padddm0, m4
>  padddm1, m4
> @@ -329,16 +335,13 @@ cglobal put_signed_rect_clamped_10, 6, 9, 6, dst,
> dst_stride, src, src_stride, w
>
>  movu [dstq], m0
>
> -add  srcq, 2*mmsize
>  add  dstq, 1*mmsize
> -sub  wd, 8
> -jg   .loop_w
> +add  wq,   2*mmsize
> +jl   .loop_w
>
> -add  r6, src_strideq
> -add  r7, dst_strideq
> +addsrcq, src_strideq
> +add t2q, dst_strideq
>  sub  hd, 1
>  jg   .loop_h
>
>  RET
> -
> -%endif
> diff --git a/libavcodec/x86/diracdsp_init.c
> b/libavcodec/x86/diracdsp_init.c
> index d7c7cd1..b195113 100644
> --- a/libavcodec/x86/diracdsp_init.c
> +++ b/libavcodec/x86/diracdsp_init.c
> @@ -45,9 +45,7 @@ void ff_put_rect_clamped_mmx(uint8_t *dst, int
> dst_stride, const int16_t *src, i
>  void ff_put_rect_clamped_sse2(uint8_t *dst, int dst_stride, const int16_t
> *src, int src_stride, int width, int height);
>  void ff_put_signed_rect_clamped_mmx(uint8_t *dst, int dst_stride, const
> int16_t *src, int src_stride, int width, int height);
>  void ff_put_signed_rect_clamped_sse2(uint8_t *dst, int dst_stride, const
> int16_t *src, int src_stride, int width, int height);
> -#if ARCH_X86_64
>  void ff_put_signed_rect_clamped_10_sse4(uint8_t *dst, int dst_stride,
> const uint8_t *src, int src_stride, int width, int height);
> -#endif
>
>  void ff_dequant_subband_32_sse4(uint8_t *src, uint8_t *dst, ptrdiff_t
> stride, const int qf, const int qs, int tot_v, int tot_h);
>
> @@ -192,8 +190,6 @@ void ff_diracdsp_init_x86(DiracDSPContext* c)
>
>  if (EXTERNAL_SSE4(mm_flags)) {
>  c->dequant_subband[1] = ff_dequant_subband_32_sse4;
> -#if ARCH_X86_64
>  c->put_signed_rect_clamped[1] =
> ff_put_signed_rect_clamped_10_sse4;
> -#endif
>  }
>  }
> --
> 2.9.1
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

Very nice, thanks.
Push whenever you have the time
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] aviobuf: cap len to orig_buffer_size

2016-07-20 Thread Josh de Kock
Note: I don't know much about the issue itself, just converting the suggested 
changes into patch form
---
 libavformat/aviobuf.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 31e7202..b0a6208 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -532,8 +532,10 @@ static void fill_buffer(AVIOContext *s)
 
 s->checksum_ptr = dst = s->buffer;
 }
-av_assert0(len >= s->orig_buffer_size);
-len = s->orig_buffer_size;
+if (len >= s->orig_buffer_size)
+len = s->orig_buffer_size;
+/* else len is less than orig_buffer_size, but is sized correctly to
+   fill remainder of buffer. */
 }
 
 if (s->read_packet)
-- 
2.7.4 (Apple Git-66)

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


[FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before video or audio stream was created

2016-07-20 Thread zhangxinzheng
From: Xinzheng Zhang 

There has an error when seeking in a flv file, which key frames was
sorted before video frame.
This ensures that all the key frames was cached, and add to
corresponding stream when it was created.
---
 libavformat/flvdec.c | 52 +---
 1 file changed, 45 insertions(+), 7 deletions(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 2bf1e05..8a73b68 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -30,6 +30,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/intfloat.h"
 #include "libavutil/mathematics.h"
+#include "libavutil/mem.h"
 #include "libavcodec/bytestream.h"
 #include "libavcodec/mpeg4audio.h"
 #include "avformat.h"
@@ -41,6 +42,12 @@
 
 #define RESYNC_BUFFER_SIZE (1<<20)
 
+
+typedef struct FLVKeyFrame {
+int64_t pos;
+int64_t timestamp;
+} FLVKeyFrame;
+
 typedef struct FLVContext {
 const AVClass *class; ///< Class for private options.
 int trust_metadata;   ///< configure streams according onMetaData
@@ -61,6 +68,10 @@ typedef struct FLVContext {
 
 int broken_sizes;
 int sum_flv_tag_size;
+
+int head_flags; //r8
+FLVKeyFrame *keyframes;
+int keyframe_count;
 } FLVContext;
 
 static int probe(AVProbeData *p, int live)
@@ -95,6 +106,9 @@ static int live_flv_probe(AVProbeData *p)
 static AVStream *create_stream(AVFormatContext *s, int codec_type)
 {
 AVStream *st = avformat_new_stream(s, NULL);
+FLVContext *flv = s->priv_data;
+int flags = flv->head_flags;
+int i = 0;
 if (!st)
 return NULL;
 st->codecpar->codec_type = codec_type;
@@ -104,6 +118,17 @@ static AVStream *create_stream(AVFormatContext *s, int 
codec_type)
 s->ctx_flags &= ~AVFMTCTX_NOHEADER;
 
 avpriv_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
+if ((!(flags & FLV_HEADER_FLAG_HASVIDEO) && codec_type == 
AVMEDIA_TYPE_AUDIO) ||
+(codec_type == AVMEDIA_TYPE_VIDEO)
+) {
+for (; i < flv->keyframe_count; i++) {
+FLVKeyFrame *keyframe = &flv->keyframes[i];
+av_add_index_entry(st, keyframe->pos, keyframe->timestamp,
+   0, 0, AVINDEX_KEYFRAME);
+}
+flv->keyframe_count = 0;
+av_freep(&flv->keyframes);
+}
 return st;
 }
 
@@ -306,7 +331,7 @@ static int amf_get_string(AVIOContext *ioc, char *buffer, 
int buffsize)
 }
 
 static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc,
- AVStream *vstream, int64_t max_pos)
+ AVStream *vstream, AVStream *astream, int64_t 
max_pos)
 {
 FLVContext *flv   = s->priv_data;
 unsigned int timeslen = 0, fileposlen = 0, i;
@@ -315,8 +340,12 @@ static int parse_keyframes_index(AVFormatContext *s, 
AVIOContext *ioc,
 int64_t *filepositions = NULL;
 int ret= AVERROR(ENOSYS);
 int64_t initial_pos= avio_tell(ioc);
+int head_flags = flv->head_flags;
+AVStream *kf_stream= vstream;
+if (!kf_stream && astream && (!(head_flags & FLV_HEADER_FLAG_HASVIDEO) && 
(head_flags & FLV_HEADER_FLAG_HASAUDIO)))
+kf_stream = astream;
 
-if (vstream->nb_index_entries>0) {
+if (kf_stream && kf_stream->nb_index_entries > 0) {
 av_log(s, AV_LOG_WARNING, "Skipping duplicate index\n");
 return 0;
 }
@@ -369,8 +398,16 @@ static int parse_keyframes_index(AVFormatContext *s, 
AVIOContext *ioc,
 
 if (timeslen == fileposlen && fileposlen>1 && max_pos <= filepositions[0]) 
{
 for (i = 0; i < fileposlen; i++) {
-av_add_index_entry(vstream, filepositions[i], times[i] * 1000,
-   0, 0, AVINDEX_KEYFRAME);
+if (kf_stream) {
+av_add_index_entry(kf_stream, filepositions[i], times[i] * 
1000,
+   0, 0, AVINDEX_KEYFRAME);
+} else {
+FLVKeyFrame frame = {0};
+frame.pos = filepositions[i];
+frame.timestamp = times[i] * 1000;
+av_dynarray2_add((void **)&flv->keyframes, 
&flv->keyframe_count,sizeof(FLVKeyFrame), (const uint8_t *)&frame);
+}
+
 if (i < 2) {
 flv->validate_index[i].pos = filepositions[i];
 flv->validate_index[i].dts = times[i] * 1000;
@@ -418,10 +455,10 @@ static int amf_parse_object(AVFormatContext *s, AVStream 
*astream,
 }
 break;
 case AMF_DATA_TYPE_OBJECT:
-if ((vstream || astream) && key &&
+if (key &&
 ioc->seekable &&
 !strcmp(KEYFRAMES_TAG, key) && depth == 1)
-if (parse_keyframes_index(s, ioc, vstream ? vstream : astream,
+if (parse_keyframes_index(s, ioc, vstream, astream,
   max_pos) < 0)
 av_log(s, AV_LOG_ERROR, "Keyframe index parsing failed\n");
 
@@ -633,7 +670,7 @@ static int flv

[FFmpeg-devel] Fix for aviobuf.c::fill_buffer

2016-07-20 Thread code bythepound
My app seems to hit the av_assert0(len >= s->orig_buffer_size) (line 535 in
my sources) in aviobuf.c::fill_buffer.  FWIW I have registered a custom
AVIOContext that will consistently not fill the entire buffer when the read
callback is called.

The outcome is that 'len' in fill_buffer is decremented with each call
until it is less than s->orig_buffer_size and will assert fail.  It seems
that instead of the assertion failure, the method should be:

if( len >= s->orig_buffer_size )
len = s->orig_buffer_size
// otherwise, len is < than orig_buffer_size, but is sized correctly to
fill remainder of buffer.

On the next iteration, the previous clause (dst == s->buffer) is executed
and the buffer is reset.  After that, this block is never executed again.

With the above fix in, my app seems to work fine.

Since the fill_buffer code has been the same for many releases of ffmpeg,
I'm wondering how I could be the first to notice it, and if there is
something else I could be doing wrong to cause this?

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


Re: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before video or audio stream was created

2016-07-20 Thread Steven Liu
XinZheng Zhang 于2016年7月20日 周三下午11:05写道:

> What are you meaning for the original mail?
>
> On Wed, Jul 20, 2016 at 10:24 PM, Steven Liu 
> wrote:
> >
> >
> > 2016-07-20 21:46 GMT+08:00 XinZheng Zhang :
> >>
> >> There has an error when seeking in a flv file, which key frames was
> >> sorted before video frame.
> >> This ensures that all the key frames was cached, and add to
> >> corresponding stream when it was created.
> >>
> >> On Wed, Jul 20, 2016 at 9:30 PM, zhangxinzheng 
> >> wrote:
> >> > From: Xinzheng Zhang 
> >> >
> >> > ---
> >> >  libavformat/flvdec.c | 52
> >> > +---
> >> >  1 file changed, 45 insertions(+), 7 deletions(-)
> >> >
> >> > diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
> >> > index 2bf1e05..8a73b68 100644
> >> > --- a/libavformat/flvdec.c
> >> > +++ b/libavformat/flvdec.c
> >> > @@ -30,6 +30,7 @@
> >> >  #include "libavutil/opt.h"
> >> >  #include "libavutil/intfloat.h"
> >> >  #include "libavutil/mathematics.h"
> >> > +#include "libavutil/mem.h"
> >> >  #include "libavcodec/bytestream.h"
> >> >  #include "libavcodec/mpeg4audio.h"
> >> >  #include "avformat.h"
> >> > @@ -41,6 +42,12 @@
> >> >
> >> >  #define RESYNC_BUFFER_SIZE (1<<20)
> >> >
> >> > +
> >> > +typedef struct FLVKeyFrame {
> >> > +int64_t pos;
> >> > +int64_t timestamp;
> >> > +} FLVKeyFrame;
> >> > +
> >> >  typedef struct FLVContext {
> >> >  const AVClass *class; ///< Class for private options.
> >> >  int trust_metadata;   ///< configure streams according onMetaData
> >> > @@ -61,6 +68,10 @@ typedef struct FLVContext {
> >> >
> >> >  int broken_sizes;
> >> >  int sum_flv_tag_size;
> >> > +
> >> > +int head_flags; //r8
> >> > +FLVKeyFrame *keyframes;
> >> > +int keyframe_count;
> >> >  } FLVContext;
> >> >
> >> >  static int probe(AVProbeData *p, int live)
> >> > @@ -95,6 +106,9 @@ static int live_flv_probe(AVProbeData *p)
> >> >  static AVStream *create_stream(AVFormatContext *s, int codec_type)
> >> >  {
> >> >  AVStream *st = avformat_new_stream(s, NULL);
> >> > +FLVContext *flv = s->priv_data;
> >> > +int flags = flv->head_flags;
> >> > +int i = 0;
> >> >  if (!st)
> >> >  return NULL;
> >> >  st->codecpar->codec_type = codec_type;
> >> > @@ -104,6 +118,17 @@ static AVStream *create_stream(AVFormatContext
> *s,
> >> > int codec_type)
> >> >  s->ctx_flags &= ~AVFMTCTX_NOHEADER;
> >> >
> >> >  avpriv_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
> >> > +if ((!(flags & FLV_HEADER_FLAG_HASVIDEO) && codec_type ==
> >> > AVMEDIA_TYPE_AUDIO) ||
> >> > +(codec_type == AVMEDIA_TYPE_VIDEO)
> >> > +) {
> >> > +for (; i < flv->keyframe_count; i++) {
> >> > +FLVKeyFrame *keyframe = &flv->keyframes[i];
> >> > +av_add_index_entry(st, keyframe->pos,
> keyframe->timestamp,
> >> > +   0, 0, AVINDEX_KEYFRAME);
> >> > +}
> >> > +flv->keyframe_count = 0;
> >> > +av_freep(&flv->keyframes);
> >> > +}
> >> >  return st;
> >> >  }
> >> >
> >> > @@ -306,7 +331,7 @@ static int amf_get_string(AVIOContext *ioc, char
> >> > *buffer, int buffsize)
> >> >  }
> >> >
> >> >  static int parse_keyframes_index(AVFormatContext *s, AVIOContext
> *ioc,
> >> > - AVStream *vstream, int64_t max_pos)
> >> > + AVStream *vstream, AVStream
> *astream,
> >> > int64_t max_pos)
> >> >  {
> >> >  FLVContext *flv   = s->priv_data;
> >> >  unsigned int timeslen = 0, fileposlen = 0, i;
> >> > @@ -315,8 +340,12 @@ static int parse_keyframes_index(AVFormatContext
> >> > *s, AVIOContext *ioc,
> >> >  int64_t *filepositions = NULL;
> >> >  int ret= AVERROR(ENOSYS);
> >> >  int64_t initial_pos= avio_tell(ioc);
> >> > +int head_flags = flv->head_flags;
> >> > +AVStream *kf_stream= vstream;
> >> > +if (!kf_stream && astream && (!(head_flags &
> >> > FLV_HEADER_FLAG_HASVIDEO) && (head_flags & FLV_HEADER_FLAG_HASAUDIO)))
> >> > +kf_stream = astream;
> >> >
> >> > -if (vstream->nb_index_entries>0) {
> >> > +if (kf_stream && kf_stream->nb_index_entries > 0) {
> >> >  av_log(s, AV_LOG_WARNING, "Skipping duplicate index\n");
> >> >  return 0;
> >> >  }
> >> > @@ -369,8 +398,16 @@ static int parse_keyframes_index(AVFormatContext
> >> > *s, AVIOContext *ioc,
> >> >
> >> >  if (timeslen == fileposlen && fileposlen>1 && max_pos <=
> >> > filepositions[0]) {
> >> >  for (i = 0; i < fileposlen; i++) {
> >> > -av_add_index_entry(vstream, filepositions[i], times[i] *
> >> > 1000,
> >> > -   0, 0, AVINDEX_KEYFRAME);
> >> > +if (kf_stream) {
> >> > +av_add_index_entry(kf_stream, filepositions[i],
> >> > times[i] * 1000,
> >> > +   0, 0, AVINDEX_KEYFRAME);
>

Re: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before video or audio stream was created

2016-07-20 Thread Steven Liu
2016-07-20 21:46 GMT+08:00 XinZheng Zhang :

> There has an error when seeking in a flv file, which key frames was
> sorted before video frame.
> This ensures that all the key frames was cached, and add to
> corresponding stream when it was created.
>
> On Wed, Jul 20, 2016 at 9:30 PM, zhangxinzheng 
> wrote:
> > From: Xinzheng Zhang 
> >
> > ---
> >  libavformat/flvdec.c | 52
> +---
> >  1 file changed, 45 insertions(+), 7 deletions(-)
> >
> > diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
> > index 2bf1e05..8a73b68 100644
> > --- a/libavformat/flvdec.c
> > +++ b/libavformat/flvdec.c
> > @@ -30,6 +30,7 @@
> >  #include "libavutil/opt.h"
> >  #include "libavutil/intfloat.h"
> >  #include "libavutil/mathematics.h"
> > +#include "libavutil/mem.h"
> >  #include "libavcodec/bytestream.h"
> >  #include "libavcodec/mpeg4audio.h"
> >  #include "avformat.h"
> > @@ -41,6 +42,12 @@
> >
> >  #define RESYNC_BUFFER_SIZE (1<<20)
> >
> > +
> > +typedef struct FLVKeyFrame {
> > +int64_t pos;
> > +int64_t timestamp;
> > +} FLVKeyFrame;
> > +
> >  typedef struct FLVContext {
> >  const AVClass *class; ///< Class for private options.
> >  int trust_metadata;   ///< configure streams according onMetaData
> > @@ -61,6 +68,10 @@ typedef struct FLVContext {
> >
> >  int broken_sizes;
> >  int sum_flv_tag_size;
> > +
> > +int head_flags; //r8
> > +FLVKeyFrame *keyframes;
> > +int keyframe_count;
> >  } FLVContext;
> >
> >  static int probe(AVProbeData *p, int live)
> > @@ -95,6 +106,9 @@ static int live_flv_probe(AVProbeData *p)
> >  static AVStream *create_stream(AVFormatContext *s, int codec_type)
> >  {
> >  AVStream *st = avformat_new_stream(s, NULL);
> > +FLVContext *flv = s->priv_data;
> > +int flags = flv->head_flags;
> > +int i = 0;
> >  if (!st)
> >  return NULL;
> >  st->codecpar->codec_type = codec_type;
> > @@ -104,6 +118,17 @@ static AVStream *create_stream(AVFormatContext *s,
> int codec_type)
> >  s->ctx_flags &= ~AVFMTCTX_NOHEADER;
> >
> >  avpriv_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
> > +if ((!(flags & FLV_HEADER_FLAG_HASVIDEO) && codec_type ==
> AVMEDIA_TYPE_AUDIO) ||
> > +(codec_type == AVMEDIA_TYPE_VIDEO)
> > +) {
> > +for (; i < flv->keyframe_count; i++) {
> > +FLVKeyFrame *keyframe = &flv->keyframes[i];
> > +av_add_index_entry(st, keyframe->pos, keyframe->timestamp,
> > +   0, 0, AVINDEX_KEYFRAME);
> > +}
> > +flv->keyframe_count = 0;
> > +av_freep(&flv->keyframes);
> > +}
> >  return st;
> >  }
> >
> > @@ -306,7 +331,7 @@ static int amf_get_string(AVIOContext *ioc, char
> *buffer, int buffsize)
> >  }
> >
> >  static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc,
> > - AVStream *vstream, int64_t max_pos)
> > + AVStream *vstream, AVStream *astream,
> int64_t max_pos)
> >  {
> >  FLVContext *flv   = s->priv_data;
> >  unsigned int timeslen = 0, fileposlen = 0, i;
> > @@ -315,8 +340,12 @@ static int parse_keyframes_index(AVFormatContext
> *s, AVIOContext *ioc,
> >  int64_t *filepositions = NULL;
> >  int ret= AVERROR(ENOSYS);
> >  int64_t initial_pos= avio_tell(ioc);
> > +int head_flags = flv->head_flags;
> > +AVStream *kf_stream= vstream;
> > +if (!kf_stream && astream && (!(head_flags &
> FLV_HEADER_FLAG_HASVIDEO) && (head_flags & FLV_HEADER_FLAG_HASAUDIO)))
> > +kf_stream = astream;
> >
> > -if (vstream->nb_index_entries>0) {
> > +if (kf_stream && kf_stream->nb_index_entries > 0) {
> >  av_log(s, AV_LOG_WARNING, "Skipping duplicate index\n");
> >  return 0;
> >  }
> > @@ -369,8 +398,16 @@ static int parse_keyframes_index(AVFormatContext
> *s, AVIOContext *ioc,
> >
> >  if (timeslen == fileposlen && fileposlen>1 && max_pos <=
> filepositions[0]) {
> >  for (i = 0; i < fileposlen; i++) {
> > -av_add_index_entry(vstream, filepositions[i], times[i] *
> 1000,
> > -   0, 0, AVINDEX_KEYFRAME);
> > +if (kf_stream) {
> > +av_add_index_entry(kf_stream, filepositions[i],
> times[i] * 1000,
> > +   0, 0, AVINDEX_KEYFRAME);
> > +} else {
> > +FLVKeyFrame frame = {0};
> > +frame.pos = filepositions[i];
> > +frame.timestamp = times[i] * 1000;
> > +av_dynarray2_add((void **)&flv->keyframes,
> &flv->keyframe_count,sizeof(FLVKeyFrame), (const uint8_t *)&frame);
> > +}
> > +
> >  if (i < 2) {
> >  flv->validate_index[i].pos = filepositions[i];
> >  flv->validate_index[i].dts = times[i] * 1000;
> > @@ -418,10 +455,10 @@ static int amf_parse_obj

[FFmpeg-devel] [PATCH] avutil: simplify LOCAL_ALIGNED macros

2016-07-20 Thread James Almer
Signed-off-by: James Almer 
---
I went overzealous with cosmetics and added a space before a bracket,
obviously screwing up the macro in the process.

 configure| 10 --
 libavutil/internal.h | 22 ++
 2 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/configure b/configure
index cc51e67..5b13cbb 100755
--- a/configure
+++ b/configure
@@ -1773,9 +1773,7 @@ ARCH_FEATURES="
 fast_64bit
 fast_clz
 fast_cmov
-local_aligned_8
-local_aligned_16
-local_aligned_32
+local_aligned
 simd_align_16
 "
 
@@ -4350,7 +4348,7 @@ elif enabled mips; then
 loongson*)
 enable loongson2
 enable loongson3
-enable local_aligned_8 local_aligned_16 local_aligned_32
+enable local_aligned
 enable simd_align_16
 enable fast_64bit
 enable fast_clz
@@ -5256,7 +5254,7 @@ elif enabled parisc; then
 
 elif enabled ppc; then
 
-enable local_aligned_8 local_aligned_16 local_aligned_32
+enable local_aligned
 
 check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
 check_inline_asm ibm_asm   '"add 0, 0, 0"'
@@ -5297,7 +5295,7 @@ elif enabled x86; then
 check_builtin rdtscintrin.h   "__rdtsc()"
 check_builtin mm_empty mmintrin.h "_mm_empty()"
 
-enable local_aligned_8 local_aligned_16 local_aligned_32
+enable local_aligned
 
 # check whether EBP is available on x86
 # As 'i' is stored on the stack, this program will crash
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 61784b5..836db05 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -107,25 +107,15 @@
 DECLARE_ALIGNED(a, t, la_##v) s o;  \
 t (*v) o = la_##v
 
-#define LOCAL_ALIGNED(a, t, v, ...) E1(LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,))
-
-#if HAVE_LOCAL_ALIGNED_8
-#   define LOCAL_ALIGNED_8(t, v, ...) E1(LOCAL_ALIGNED_D(8, t, v, 
__VA_ARGS__,,))
-#else
-#   define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED(8, t, v, __VA_ARGS__)
-#endif
-
-#if HAVE_LOCAL_ALIGNED_16
-#   define LOCAL_ALIGNED_16(t, v, ...) E1(LOCAL_ALIGNED_D(16, t, v, 
__VA_ARGS__,,))
+#if HAVE_LOCAL_ALIGNED
+#   define LOCAL_ALIGNED(a, t, v, ...) E1(LOCAL_ALIGNED_D(a, t, v, 
__VA_ARGS__,,))
 #else
-#   define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__)
+#   define LOCAL_ALIGNED(a, t, v, ...) E1(LOCAL_ALIGNED_A(a, t, v, 
__VA_ARGS__,,))
 #endif
 
-#if HAVE_LOCAL_ALIGNED_32
-#   define LOCAL_ALIGNED_32(t, v, ...) E1(LOCAL_ALIGNED_D(32, t, v, 
__VA_ARGS__,,))
-#else
-#   define LOCAL_ALIGNED_32(t, v, ...) LOCAL_ALIGNED(32, t, v, __VA_ARGS__)
-#endif
+#define LOCAL_ALIGNED_8(t, v, ...)  LOCAL_ALIGNED(8,  t, v, __VA_ARGS__)
+#define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__)
+#define LOCAL_ALIGNED_32(t, v, ...) LOCAL_ALIGNED(32, t, v, __VA_ARGS__)
 
 #define FF_ALLOC_OR_GOTO(ctx, p, size, label)\
 {\
-- 
2.9.1

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


Re: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before video or audio stream was created

2016-07-20 Thread XinZheng Zhang
There has an error when seeking in a flv file, which key frames was
sorted before video frame.
This ensures that all the key frames was cached, and add to
corresponding stream when it was created.

On Wed, Jul 20, 2016 at 9:30 PM, zhangxinzheng  wrote:
> From: Xinzheng Zhang 
>
> ---
>  libavformat/flvdec.c | 52 
> +---
>  1 file changed, 45 insertions(+), 7 deletions(-)
>
> diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
> index 2bf1e05..8a73b68 100644
> --- a/libavformat/flvdec.c
> +++ b/libavformat/flvdec.c
> @@ -30,6 +30,7 @@
>  #include "libavutil/opt.h"
>  #include "libavutil/intfloat.h"
>  #include "libavutil/mathematics.h"
> +#include "libavutil/mem.h"
>  #include "libavcodec/bytestream.h"
>  #include "libavcodec/mpeg4audio.h"
>  #include "avformat.h"
> @@ -41,6 +42,12 @@
>
>  #define RESYNC_BUFFER_SIZE (1<<20)
>
> +
> +typedef struct FLVKeyFrame {
> +int64_t pos;
> +int64_t timestamp;
> +} FLVKeyFrame;
> +
>  typedef struct FLVContext {
>  const AVClass *class; ///< Class for private options.
>  int trust_metadata;   ///< configure streams according onMetaData
> @@ -61,6 +68,10 @@ typedef struct FLVContext {
>
>  int broken_sizes;
>  int sum_flv_tag_size;
> +
> +int head_flags; //r8
> +FLVKeyFrame *keyframes;
> +int keyframe_count;
>  } FLVContext;
>
>  static int probe(AVProbeData *p, int live)
> @@ -95,6 +106,9 @@ static int live_flv_probe(AVProbeData *p)
>  static AVStream *create_stream(AVFormatContext *s, int codec_type)
>  {
>  AVStream *st = avformat_new_stream(s, NULL);
> +FLVContext *flv = s->priv_data;
> +int flags = flv->head_flags;
> +int i = 0;
>  if (!st)
>  return NULL;
>  st->codecpar->codec_type = codec_type;
> @@ -104,6 +118,17 @@ static AVStream *create_stream(AVFormatContext *s, int 
> codec_type)
>  s->ctx_flags &= ~AVFMTCTX_NOHEADER;
>
>  avpriv_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
> +if ((!(flags & FLV_HEADER_FLAG_HASVIDEO) && codec_type == 
> AVMEDIA_TYPE_AUDIO) ||
> +(codec_type == AVMEDIA_TYPE_VIDEO)
> +) {
> +for (; i < flv->keyframe_count; i++) {
> +FLVKeyFrame *keyframe = &flv->keyframes[i];
> +av_add_index_entry(st, keyframe->pos, keyframe->timestamp,
> +   0, 0, AVINDEX_KEYFRAME);
> +}
> +flv->keyframe_count = 0;
> +av_freep(&flv->keyframes);
> +}
>  return st;
>  }
>
> @@ -306,7 +331,7 @@ static int amf_get_string(AVIOContext *ioc, char *buffer, 
> int buffsize)
>  }
>
>  static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc,
> - AVStream *vstream, int64_t max_pos)
> + AVStream *vstream, AVStream *astream, 
> int64_t max_pos)
>  {
>  FLVContext *flv   = s->priv_data;
>  unsigned int timeslen = 0, fileposlen = 0, i;
> @@ -315,8 +340,12 @@ static int parse_keyframes_index(AVFormatContext *s, 
> AVIOContext *ioc,
>  int64_t *filepositions = NULL;
>  int ret= AVERROR(ENOSYS);
>  int64_t initial_pos= avio_tell(ioc);
> +int head_flags = flv->head_flags;
> +AVStream *kf_stream= vstream;
> +if (!kf_stream && astream && (!(head_flags & FLV_HEADER_FLAG_HASVIDEO) 
> && (head_flags & FLV_HEADER_FLAG_HASAUDIO)))
> +kf_stream = astream;
>
> -if (vstream->nb_index_entries>0) {
> +if (kf_stream && kf_stream->nb_index_entries > 0) {
>  av_log(s, AV_LOG_WARNING, "Skipping duplicate index\n");
>  return 0;
>  }
> @@ -369,8 +398,16 @@ static int parse_keyframes_index(AVFormatContext *s, 
> AVIOContext *ioc,
>
>  if (timeslen == fileposlen && fileposlen>1 && max_pos <= 
> filepositions[0]) {
>  for (i = 0; i < fileposlen; i++) {
> -av_add_index_entry(vstream, filepositions[i], times[i] * 1000,
> -   0, 0, AVINDEX_KEYFRAME);
> +if (kf_stream) {
> +av_add_index_entry(kf_stream, filepositions[i], times[i] * 
> 1000,
> +   0, 0, AVINDEX_KEYFRAME);
> +} else {
> +FLVKeyFrame frame = {0};
> +frame.pos = filepositions[i];
> +frame.timestamp = times[i] * 1000;
> +av_dynarray2_add((void **)&flv->keyframes, 
> &flv->keyframe_count,sizeof(FLVKeyFrame), (const uint8_t *)&frame);
> +}
> +
>  if (i < 2) {
>  flv->validate_index[i].pos = filepositions[i];
>  flv->validate_index[i].dts = times[i] * 1000;
> @@ -418,10 +455,10 @@ static int amf_parse_object(AVFormatContext *s, 
> AVStream *astream,
>  }
>  break;
>  case AMF_DATA_TYPE_OBJECT:
> -if ((vstream || astream) && key &&
> +if (key &&
>  ioc->seekable &&
>  !strcmp(KEYFRAMES_TAG, key) && depth == 1)
> -   

Re: [FFmpeg-devel] [PATCH] Avoid sending packets to network when multicast ttl is 0 in udp

2016-07-20 Thread Omid Ghaffarinia
Thanks for testing in mingw
New patch attached, which should work now.


On Wed, Jul 20, 2016 at 1:25 PM, Michael Niedermayer
 wrote:
> On Wed, Jul 13, 2016 at 03:09:28PM +0430, Omid Ghaffarinia wrote:
>> I attached the patch.
>>
>> The actual bug is, when creating a local multicast stream (i.e. giving
>> "rtp://224.1.1.1:1?ttl=0" to avio_open), then you can see the
>> packets on the network and not just on local machine (despite setting
>> multicast ttl to 0) which was a security bug in my purpose of usage
>> (it also made a lot of unused traffic on network)
>>
>> The user does not choose to enable/disable the kernel hack, that is
>> how it is designed.
>>
>> This behavior does NOT happen in Windows machines, but the patch given
>> does no harm at all (it does nothing in Windows)
>>
>> On Wed, Jul 13, 2016 at 3:12 AM, Moritz Barsnick  wrote:
>> > On Tue, Jul 12, 2016 at 18:31:36 +0430, Omid Ghaffarinia wrote:
>> >
>> > Your mailer has broken the patch by inserting line breaks. You should
>> > try attaching the patch as a file, or directly using "git send-email".
>> >
>> >> Bug is due to kernel handling multicast ttl 0 differently (as noted in
>> >> kernel code net/ipv4/route.c:2191 see:
>> >
>> > ffmpeg is not a Linux-only tool/library, so comments should point out
>> > which "kernel" more precisely (and possibly which versions this applies
>> > to). Admitted, the link to github contains the string "linux". ;-)
>> >
>> > Furthermore: Please explain what the actual bug (i.e. misbehavior) is,
>> > and what this fix changes (or how it fixes it).
>> >
>> > Are you allowing ffmpeg to work when the user is making use of the
>> > kernel hack?
>> >
>> > What does this patch achieve on non-Linux operating systems?
>> >
>> > (Sorry for the stupid questions, all this isn't obvious to me, and I do
>> > have at least some understanding of network stuff.)
>> >
>> > Moritz
>> > ___
>> > ffmpeg-devel mailing list
>> > ffmpeg-devel@ffmpeg.org
>> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>>  sdp.c |2 +-
>>  udp.c |   28 
>>  2 files changed, 29 insertions(+), 1 deletion(-)
>> 697cb044e811d35b10a74ad9ca9181b372affc40  
>> 0001-Avoid-sending-packets-to-network-when-multicast-ttl-.patch
>> From aab1658d011f5b3eabd22ddc30f40107c6311c92 Mon Sep 17 00:00:00 2001
>> From: Omid Ghaffarinia 
>> Date: Tue, 12 Jul 2016 18:23:57 +0430
>> Subject: [PATCH] Avoid sending packets to network when multicast ttl is 0 in
>>  udp
>>
>> Signed-off-by: Omid Ghaffarinia 
>> ---
>>  libavformat/sdp.c |2 +-
>>  libavformat/udp.c |   28 
>>  2 files changed, 29 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/sdp.c b/libavformat/sdp.c
>> index 01b564b..0401f7a 100644
>> --- a/libavformat/sdp.c
>> +++ b/libavformat/sdp.c
>> @@ -61,7 +61,7 @@ static void sdp_write_address(char *buff, int size, const 
>> char *dest_addr,
>>  if (dest_addr) {
>>  if (!dest_type)
>>  dest_type = "IP4";
>> -if (ttl > 0 && !strcmp(dest_type, "IP4")) {
>> +if (ttl >= 0 && !strcmp(dest_type, "IP4")) {
>>  /* The TTL should only be specified for IPv4 multicast 
>> addresses,
>>   * not for IPv6. */
>>  av_strlcatf(buff, size, "c=IN %s %s/%d\r\n", dest_type, 
>> dest_addr, ttl);
>> diff --git a/libavformat/udp.c b/libavformat/udp.c
>> index 8699c1c..fe46ba5 100644
>> --- a/libavformat/udp.c
>> +++ b/libavformat/udp.c
>> @@ -176,6 +176,28 @@ static int udp_set_multicast_ttl(int sockfd, int 
>> mcastTTL,
>>  }
>>  }
>>  #endif
>> +if (mcastTTL == 0) {
>> +#ifdef IP_MULTICAST_IF
>> +if (addr->sa_family == AF_INET) {
>> +struct in_addr localhost_addr;
>> +inet_pton(AF_INET, "127.0.0.1", &localhost_addr);
>> +if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_IF, 
>> &localhost_addr, sizeof(localhost_addr)) < 0) {
>> +log_net_error(NULL, AV_LOG_ERROR, 
>> "setsockopt(IP_MULTICAST_IF)");
>> +return -1;
>> +}
>> +}
>> +#endif
>> +#if defined(IPPROTO_IPV6) && defined(IPV6_MULTICAST_IF)
>> +if (addr->sa_family == AF_INET6) {
>> +struct in6_addr localhost_addr;
>> +inet_pton(AF_INET6, "::1", &localhost_addr);
>> +if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_IF, 
>> &localhost_addr, sizeof(localhost_addr)) < 0) {
>> +log_net_error(NULL, AV_LOG_ERROR, 
>> "setsockopt(IPV6_MULTICAST_IF)");
>> +return -1;
>> +}
>> +}
>> +#endif
>
> breaks build with mingw64
> libavformat/udp.c:183:13: error: implicit declaration of function ‘inet_pton’ 
> [-Werror=implicit-function-declaration]
>
>
>> +}
>>  return 0;
>>  }
>>
>> @@ -882,6 +904,12 @@ static int udp_open(URLContext *h, const char *uri, int 
>> flags)
>>  }
>>  if (h->flags & AVIO_FLAG_READ) {
>>  

[FFmpeg-devel] [PATCH 1/2 v4] libopenmpt: add subsong support

2016-07-20 Thread Josh de Kock
---
 libavformat/libopenmpt.c | 30 +++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/libavformat/libopenmpt.c b/libavformat/libopenmpt.c
index 58a02be..ac67d28 100644
--- a/libavformat/libopenmpt.c
+++ b/libavformat/libopenmpt.c
@@ -36,15 +36,19 @@ typedef struct OpenMPTContext {
 /* options */
 int sample_rate;
 int64_t layout;
+int subsong;
 } OpenMPTContext;
 
 #define OFFSET(x) offsetof(OpenMPTContext, x)
 #define A AV_OPT_FLAG_AUDIO_PARAM
 #define D AV_OPT_FLAG_DECODING_PARAM
 static const AVOption options[] = {
-{"sample_rate", "set sample rate",OFFSET(sample_rate), 
AV_OPT_TYPE_INT,{.i64 = 48000},   1000, INT_MAX,   
A|D},
-{"layout",  "set channel layout", OFFSET(layout),  
AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64 = AV_CH_LAYOUT_STEREO}, 0,INT64_MAX, 
A|D},
-{NULL}
+{ "sample_rate", "set sample rate",OFFSET(sample_rate), 
AV_OPT_TYPE_INT,{ .i64 = 48000 },   1000, INT_MAX,   A 
| D },
+{ "layout",  "set channel layout", OFFSET(layout),  
AV_OPT_TYPE_CHANNEL_LAYOUT, { .i64 = AV_CH_LAYOUT_STEREO }, 0,INT64_MAX, A 
| D },
+{ "subsong", "set subsong",OFFSET(subsong), 
AV_OPT_TYPE_INT,{ .i64 = -2 },  -2,   INT_MAX,   A 
| D, "subsong"},
+{ "all", "all",0,   
AV_OPT_TYPE_CONST,  { .i64 = -1},   0,0, A 
| D, "subsong" },
+{ "auto","auto",   0,   
AV_OPT_TYPE_CONST,  { .i64 = -2},   0,0, A 
| D, "subsong" },
+{ NULL }
 };
 
 static void openmpt_logfunc(const char *message, void *userdata)
@@ -70,6 +74,8 @@ static int read_header_openmpt(AVFormatContext *s)
 OpenMPTContext *openmpt = s->priv_data;
 int64_t size = avio_size(s->pb);
 char *buf = av_malloc(size);
+int ret;
+
 
 if (!buf)
 return AVERROR(ENOMEM);
@@ -88,6 +94,24 @@ static int read_header_openmpt(AVFormatContext *s)
 add_meta(s, "encoder", openmpt_module_get_metadata(openmpt->module, 
"tracker"));
 add_meta(s, "comment", openmpt_module_get_metadata(openmpt->module, 
"message"));
 
+if (openmpt->subsong >= openmpt_module_get_num_subsongs(openmpt->module)) {
+openmpt_module_destroy(openmpt->module);
+av_log(s, AV_LOG_ERROR, "Invalid subsong index: %d\n", 
openmpt->subsong);
+return AVERROR(EINVAL);
+}
+
+if (openmpt->subsong != -2) {
+if (openmpt->subsong >= 0) {
+av_dict_set_int(&s->metadata, "track", openmpt->subsong + 1, 0);
+}
+ret = openmpt_module_select_subsong(openmpt->module, openmpt->subsong);
+if (!ret){
+openmpt_module_destroy(openmpt->module);
+av_log(s, AV_LOG_ERROR, "Could not select requested subsong: %d", 
openmpt->subsong);
+return AVERROR(EINVAL);   
+}
+}
+
 st = avformat_new_stream(s, NULL);
 if (!st) {
 openmpt_module_destroy(openmpt->module);
-- 
2.7.4 (Apple Git-66)

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


Re: [FFmpeg-devel] [PATCH 2/4] libavcodec/dnxhd: add dnxhr profiles

2016-07-20 Thread Michael Niedermayer
On Sat, Jul 16, 2016 at 07:37:37PM -0700, Mark Reid wrote:
> ---
>  libavcodec/avcodec.h|  7 +++
>  libavcodec/codec_desc.c |  1 +
>  libavcodec/dnxhddec.c   | 21 +
>  libavcodec/dnxhdenc.c   |  2 ++
>  libavcodec/profiles.c   | 10 ++
>  libavcodec/profiles.h   |  1 +
>  6 files changed, 42 insertions(+)

applied

thx

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

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato


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


Re: [FFmpeg-devel] [PATCH] opt: delete duplicate "hwaccel_output_format" option

2016-07-20 Thread Michael Niedermayer
On Wed, Jul 20, 2016 at 10:53:29AM +0800, Jun Zhao wrote:
>  ffmpeg_opt.c |3 ---
>  1 file changed, 3 deletions(-)
> 179bc295a55cb77f9ecfdc3a5636f53c52338e6e  
> 0001-ffmpeg_opt-Delete-duplicate-hwaccel_output_format-op.patch
> From d712488fd73bebaa8c8f38ee29b70aa34c1df7fa Mon Sep 17 00:00:00 2001
> From: Jun Zhao 
> Date: Fri, 24 Jun 2016 15:06:08 +0800
> Subject: [PATCH] =?UTF-8?q?ffmpeg=5Fopt:=20Delete=20duplicate=20=E2=80=9Ch?=
>  =?UTF-8?q?waccel=5Foutput=5Fformat=E2=80=9D=20option.?=
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> Delete duplicate “hwaccel_output_format” option.
> 
> Signed-off-by: Jun Zhao 

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad


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


Re: [FFmpeg-devel] [PATCH] avutil: simplify LOCAL_ALIGNED macros

2016-07-20 Thread Michael Niedermayer
On Tue, Jul 19, 2016 at 10:48:16PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  configure| 10 --
>  libavutil/internal.h | 22 ++
>  2 files changed, 10 insertions(+), 22 deletions(-)

fails to build here

CC  libavcodec/dvenc.o
In file included from libavcodec/dvenc.c:30:0:
./libavutil/internal.h:116:61: warning: __VA_ARGS__ can only appear in the 
expansion of a C99 variadic macro [enabled by default]
libavcodec/dvenc.c: In function ‘dv_encode_video_segment’:
libavcodec/dvenc.c:426:5: error: ‘t’ undeclared (first use in this function)
libavcodec/dvenc.c:426:5: note: each undeclared identifier is reported only 
once for each function it appears in
libavcodec/dvenc.c:426:5: error: ‘v’ undeclared (first use in this function)
libavcodec/dvenc.c:426:5: warning: left-hand operand of comma expression has no 
effect [-Wunused-value]
libavcodec/dvenc.c:426:5: error: expected expression before ‘...’ token
libavcodec/dvenc.c:426:5: warning: left-hand operand of comma expression has no 
effect [-Wunused-value]
libavcodec/dvenc.c:426:5: error: expected ‘;’ before ‘t’
libavcodec/dvenc.c:426:5: error: implicit declaration of function ‘t’ 
[-Werror=implicit-function-declaration]
libavcodec/dvenc.c:426:5: error: implicit declaration of function ‘la_v’ 
[-Werror=implicit-function-declaration]
libavcodec/dvenc.c:426:21: error: expected expression before ‘uint8_t’
libavcodec/dvenc.c:427:5: warning: ISO C90 forbids mixed declarations and code 
[-Wdeclaration-after-statement]
libavcodec/dvenc.c:476:30: error: ‘scratch’ undeclared (first use in this 
function)
cc1: some warnings being treated as errors
make: *** [libavcodec/dvenc.o] Error 1
CC  libavcodec/mpegvideo_motion.o
In file included from ./libavutil/common.h:467:0,
 from ./libavutil/avutil.h:288,
 from ./libavutil/avassert.h:31,
 from libavcodec/mpegvideo_motion.c:26:
./libavutil/internal.h:116:61: warning: __VA_ARGS__ can only appear in the 
expansion of a C99 variadic macro [enabled by default]
libavcodec/mpegvideo_motion.c: In function ‘apply_obmc’:
libavcodec/mpegvideo_motion.c:669:5: error: ‘t’ undeclared (first use in this 
function)
libavcodec/mpegvideo_motion.c:669:5: note: each undeclared identifier is 
reported only once for each function it appears in
libavcodec/mpegvideo_motion.c:669:5: error: ‘v’ undeclared (first use in this 
function)
libavcodec/mpegvideo_motion.c:669:5: warning: left-hand operand of comma 
expression has no effect [-Wunused-value]
libavcodec/mpegvideo_motion.c:669:5: error: expected expression before ‘...’ 
token
libavcodec/mpegvideo_motion.c:669:5: warning: left-hand operand of comma 
expression has no effect [-Wunused-value]
libavcodec/mpegvideo_motion.c:669:5: error: expected ‘;’ before ‘t’
libavcodec/mpegvideo_motion.c:669:5: error: implicit declaration of function 
‘t’ [-Werror=implicit-function-declaration]
libavcodec/mpegvideo_motion.c:669:5: error: implicit declaration of function 
‘la_v’ [-Werror=implicit-function-declaration]
libavcodec/mpegvideo_motion.c:669:21: error: expected expression before 
‘int16_t’
libavcodec/mpegvideo_motion.c:670:5: warning: ISO C90 forbids mixed 
declarations and code [-Wdeclaration-after-statement]
libavcodec/mpegvideo_motion.c:680:5: error: ‘mv_cache’ undeclared (first use in 
this function)
cc1: some warnings being treated as errors
make: *** [libavcodec/mpegvideo_motion.o] Error 1
CC  libavcodec/x86/simple_idct.o
In file included from ./libavutil/common.h:467:0,
 from ./libavutil/avutil.h:288,
 from ./libavutil/mem.h:34,
 from libavcodec/x86/simple_idct.c:23:
./libavutil/internal.h:116:61: warning: __VA_ARGS__ can only appear in the 
expansion of a C99 variadic macro [enabled by default]
libavcodec/x86/simple_idct.c: In function ‘idct’:
libavcodec/x86/simple_idct.c:88:9: error: ‘t’ undeclared (first use in this 
function)
libavcodec/x86/simple_idct.c:88:9: note: each undeclared identifier is reported 
only once for each function it appears in
libavcodec/x86/simple_idct.c:88:9: error: ‘v’ undeclared (first use in this 
function)
libavcodec/x86/simple_idct.c:88:9: warning: left-hand operand of comma 
expression has no effect [-Wunused-value]
libavcodec/x86/simple_idct.c:88:9: error: expected expression before ‘...’ token
libavcodec/x86/simple_idct.c:88:9: warning: left-hand operand of comma 
expression has no effect [-Wunused-value]
libavcodec/x86/simple_idct.c:88:9: error: expected ‘;’ before ‘t’
libavcodec/x86/simple_idct.c:88:9: error: implicit declaration of function ‘t’ 
[-Werror=implicit-function-declaration]
libavcodec/x86/simple_idct.c:88:9: error: implicit declaration of function 
‘la_v’ [-Werror=implicit-function-declaration]
libavcodec/x86/simple_idct.c:88:25: error: expected expression before ‘int64_t’
libavcodec/x86/simple_idct.c:89:41: error: ‘align_tmp’ undeclared (first use in 
this function)
libavcodec/x86/simple_id

Re: [FFmpeg-devel] [PATCH] Avoid sending packets to network when multicast ttl is 0 in udp

2016-07-20 Thread Michael Niedermayer
On Wed, Jul 13, 2016 at 03:09:28PM +0430, Omid Ghaffarinia wrote:
> I attached the patch.
> 
> The actual bug is, when creating a local multicast stream (i.e. giving
> "rtp://224.1.1.1:1?ttl=0" to avio_open), then you can see the
> packets on the network and not just on local machine (despite setting
> multicast ttl to 0) which was a security bug in my purpose of usage
> (it also made a lot of unused traffic on network)
> 
> The user does not choose to enable/disable the kernel hack, that is
> how it is designed.
> 
> This behavior does NOT happen in Windows machines, but the patch given
> does no harm at all (it does nothing in Windows)
> 
> On Wed, Jul 13, 2016 at 3:12 AM, Moritz Barsnick  wrote:
> > On Tue, Jul 12, 2016 at 18:31:36 +0430, Omid Ghaffarinia wrote:
> >
> > Your mailer has broken the patch by inserting line breaks. You should
> > try attaching the patch as a file, or directly using "git send-email".
> >
> >> Bug is due to kernel handling multicast ttl 0 differently (as noted in
> >> kernel code net/ipv4/route.c:2191 see:
> >
> > ffmpeg is not a Linux-only tool/library, so comments should point out
> > which "kernel" more precisely (and possibly which versions this applies
> > to). Admitted, the link to github contains the string "linux". ;-)
> >
> > Furthermore: Please explain what the actual bug (i.e. misbehavior) is,
> > and what this fix changes (or how it fixes it).
> >
> > Are you allowing ffmpeg to work when the user is making use of the
> > kernel hack?
> >
> > What does this patch achieve on non-Linux operating systems?
> >
> > (Sorry for the stupid questions, all this isn't obvious to me, and I do
> > have at least some understanding of network stuff.)
> >
> > Moritz
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

>  sdp.c |2 +-
>  udp.c |   28 
>  2 files changed, 29 insertions(+), 1 deletion(-)
> 697cb044e811d35b10a74ad9ca9181b372affc40  
> 0001-Avoid-sending-packets-to-network-when-multicast-ttl-.patch
> From aab1658d011f5b3eabd22ddc30f40107c6311c92 Mon Sep 17 00:00:00 2001
> From: Omid Ghaffarinia 
> Date: Tue, 12 Jul 2016 18:23:57 +0430
> Subject: [PATCH] Avoid sending packets to network when multicast ttl is 0 in
>  udp
> 
> Signed-off-by: Omid Ghaffarinia 
> ---
>  libavformat/sdp.c |2 +-
>  libavformat/udp.c |   28 
>  2 files changed, 29 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/sdp.c b/libavformat/sdp.c
> index 01b564b..0401f7a 100644
> --- a/libavformat/sdp.c
> +++ b/libavformat/sdp.c
> @@ -61,7 +61,7 @@ static void sdp_write_address(char *buff, int size, const 
> char *dest_addr,
>  if (dest_addr) {
>  if (!dest_type)
>  dest_type = "IP4";
> -if (ttl > 0 && !strcmp(dest_type, "IP4")) {
> +if (ttl >= 0 && !strcmp(dest_type, "IP4")) {
>  /* The TTL should only be specified for IPv4 multicast addresses,
>   * not for IPv6. */
>  av_strlcatf(buff, size, "c=IN %s %s/%d\r\n", dest_type, 
> dest_addr, ttl);
> diff --git a/libavformat/udp.c b/libavformat/udp.c
> index 8699c1c..fe46ba5 100644
> --- a/libavformat/udp.c
> +++ b/libavformat/udp.c
> @@ -176,6 +176,28 @@ static int udp_set_multicast_ttl(int sockfd, int 
> mcastTTL,
>  }
>  }
>  #endif
> +if (mcastTTL == 0) {
> +#ifdef IP_MULTICAST_IF
> +if (addr->sa_family == AF_INET) {
> +struct in_addr localhost_addr;
> +inet_pton(AF_INET, "127.0.0.1", &localhost_addr);
> +if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_IF, 
> &localhost_addr, sizeof(localhost_addr)) < 0) {
> +log_net_error(NULL, AV_LOG_ERROR, 
> "setsockopt(IP_MULTICAST_IF)");
> +return -1;
> +}
> +}
> +#endif
> +#if defined(IPPROTO_IPV6) && defined(IPV6_MULTICAST_IF)
> +if (addr->sa_family == AF_INET6) {
> +struct in6_addr localhost_addr;
> +inet_pton(AF_INET6, "::1", &localhost_addr);
> +if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_IF, 
> &localhost_addr, sizeof(localhost_addr)) < 0) {
> +log_net_error(NULL, AV_LOG_ERROR, 
> "setsockopt(IPV6_MULTICAST_IF)");
> +return -1;
> +}
> +}
> +#endif

breaks build with mingw64
libavformat/udp.c:183:13: error: implicit declaration of function ‘inet_pton’ 
[-Werror=implicit-function-declaration]


> +}
>  return 0;
>  }
>  
> @@ -882,6 +904,12 @@ static int udp_open(URLContext *h, const char *uri, int 
> flags)
>  }
>  if (h->flags & AVIO_FLAG_READ) {
>  /* input */
> + if (s->ttl == 0) {
> + if (s->dest_addr.ss_family == AF_INET)
> + inet_pton(AF_INET, "127.0.0.1", &((struct sockaddr_in 
> *)&s->local_addr_storage)->sin_addr);
> + else
> +   

Re: [FFmpeg-devel] [PATCH 2/3 v3] libopenmpt: add subsong support

2016-07-20 Thread Jörn Heusipp



On 07/19/2016 11:33 PM, Josh de Kock wrote:

---
 libavformat/libopenmpt.c | 26 +++---
 1 file changed, 23 insertions(+), 3 deletions(-)




+{ "subsong", "set subsong",OFFSET(subsong), AV_OPT_TYPE_INT,{ 
.i64 = -2 },   -2,   INT_MAX, A | D, "layout"},
+{ "all", "all",0,   AV_OPT_TYPE_CONST,  { 
.i64 = -1},0,0,   A | D, "layout" },
+{ "auto","auto",   0,   AV_OPT_TYPE_CONST,  { 
.i64 = -2},0,0,   A | D, "layout" },


.unit = "layout"? Shouldn't this be called "subsong"?



+if (openmpt->subsong >= openmpt_module_get_num_subsongs(openmpt->module)) {
+av_log(s, AV_LOG_ERROR, "Invalid subsong index: %d\n", 
openmpt->subsong);
+return AVERROR(EINVAL);
+}


Leaks openmpt->module in error path.



+ret = openmpt_module_select_subsong(openmpt->module, openmpt->subsong);
+if (!ret){
+av_log(s, AV_LOG_ERROR, "Could not select requested subsong: %d", 
openmpt->subsong);
+return AVERROR(EINVAL);
+}


Leaks openmpt->module in error path.


Regards,
Jörn
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel