[FFmpeg-devel] [PATCH 1/2] lavfi/vf_overlay: change variable name to avoid shadowing

2016-05-24 Thread Rodger Combs
---
 libavfilter/vf_overlay.c | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 37f19ea..71f4db7 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -401,7 +401,7 @@ static void blend_image(AVFilterContext *ctx,
 AVFrame *dst, const AVFrame *src,
 int x, int y)
 {
-OverlayContext *s = ctx->priv;
+OverlayContext *ol = ctx->priv;
 int i, imax, j, jmax, k, kmax;
 const int src_w = src->width;
 const int src_h = src->height;
@@ -412,19 +412,19 @@ static void blend_image(AVFilterContext *ctx,
 y >= dst_h || y+src_h < 0)
 return; /* no intersection */
 
-if (s->main_is_packed_rgb) {
+if (ol->main_is_packed_rgb) {
 uint8_t alpha;  ///< the amount of overlay to blend on to main
-const int dr = s->main_rgba_map[R];
-const int dg = s->main_rgba_map[G];
-const int db = s->main_rgba_map[B];
-const int da = s->main_rgba_map[A];
-const int dstep = s->main_pix_step[0];
-const int sr = s->overlay_rgba_map[R];
-const int sg = s->overlay_rgba_map[G];
-const int sb = s->overlay_rgba_map[B];
-const int sa = s->overlay_rgba_map[A];
-const int sstep = s->overlay_pix_step[0];
-const int main_has_alpha = s->main_has_alpha;
+const int dr = ol->main_rgba_map[R];
+const int dg = ol->main_rgba_map[G];
+const int db = ol->main_rgba_map[B];
+const int da = ol->main_rgba_map[A];
+const int dstep = ol->main_pix_step[0];
+const int sr = ol->overlay_rgba_map[R];
+const int sg = ol->overlay_rgba_map[G];
+const int sb = ol->overlay_rgba_map[B];
+const int sa = ol->overlay_rgba_map[A];
+const int sstep = ol->overlay_pix_step[0];
+const int main_has_alpha = ol->main_has_alpha;
 uint8_t *s, *sp, *d, *dp;
 
 i = FFMAX(-y, 0);
@@ -480,7 +480,7 @@ static void blend_image(AVFilterContext *ctx,
 sp += src->linesize[0];
 }
 } else {
-const int main_has_alpha = s->main_has_alpha;
+const int main_has_alpha = ol->main_has_alpha;
 if (main_has_alpha) {
 uint8_t alpha;  ///< the amount of overlay to blend on to 
main
 uint8_t *s, *sa, *d, *da;
@@ -518,8 +518,8 @@ static void blend_image(AVFilterContext *ctx,
 }
 }
 for (i = 0; i < 3; i++) {
-int hsub = i ? s->hsub : 0;
-int vsub = i ? s->vsub : 0;
+int hsub = i ? ol->hsub : 0;
+int vsub = i ? ol->vsub : 0;
 int src_wp = AV_CEIL_RSHIFT(src_w, hsub);
 int src_hp = AV_CEIL_RSHIFT(src_h, vsub);
 int dst_wp = AV_CEIL_RSHIFT(dst_w, hsub);
-- 
2.8.2

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


Re: [FFmpeg-devel] [PATCH 07/11] avcodec/mips: loongson optimize h264qpel with mmi v2

2016-05-24 Thread 周晓勇
these functions couldn't pass fate-h264 test neither O32 nor N64 ABI
but the earlier optimization (version 1) has too much bug in O32 ABI
i will fix the bugs in function put_h264_qpel16_hv_lowpass_mmi and
avg_h264_qpel16_hv_lowpass_mmi in the future


have you installed the lastest fedora21 for loongson?
http://mirror.lemote.com/fedora/live/Fedora-MATE-Live-2.iso
http://mirror.lemote.com/fedora/live/Fedora-MATE-Live-2.iso.md5
use this script to make live-usb installer:
http://mirror.lemote.com/fedora/live/makeliveusb
tips:make sure the /dev/sda1 is ext2 or ext3, as pmon not support ext4 to boot 
kernel








>
>why do these functions not work ?
>
>
>[...]
>-- 
>Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
>The misfortune of the wise is better than the prosperity of the fool.
>-- Epicurus
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] lavfi/vf_overlay: support NV12

2016-05-24 Thread Rodger Combs
---
 libavfilter/vf_overlay.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 71f4db7..e01b924 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -125,6 +125,7 @@ typedef struct OverlayContext {
 int main_pix_step[4];   ///< steps per pixel for each plane of the 
main output
 int overlay_pix_step[4];///< steps per pixel for each plane of the 
overlay
 int hsub, vsub; ///< chroma subsampling values
+const AVPixFmtDescriptor *main_desc;
 
 double var_values[VAR_VARS_NB];
 char *x_expr, *y_expr;
@@ -213,7 +214,7 @@ static int query_formats(AVFilterContext *ctx)
 
 /* overlay formats contains alpha, for avoiding conversion with alpha 
information loss */
 static const enum AVPixelFormat main_pix_fmts_yuv420[] = {
-AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE
+AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NV12, 
AV_PIX_FMT_NONE
 };
 static const enum AVPixelFormat overlay_pix_fmts_yuv420[] = {
 AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE
@@ -314,6 +315,8 @@ static int config_input_main(AVFilterLink *inlink)
 s->hsub = pix_desc->log2_chroma_w;
 s->vsub = pix_desc->log2_chroma_h;
 
+s->main_desc = pix_desc;
+
 s->main_is_packed_rgb =
 ff_fill_rgba_map(s->main_rgba_map, inlink->format) >= 0;
 s->main_has_alpha = ff_fmt_is_in(inlink->format, alpha_pix_fmts);
@@ -530,12 +533,14 @@ static void blend_image(AVFilterContext *ctx,
 
 j = FFMAX(-yp, 0);
 sp = src->data[i] + j * src->linesize[i];
-dp = dst->data[i] + (yp+j)* dst->linesize[i];
+dp = dst->data[ol->main_desc->comp[i].plane]
+  + (yp+j)* 
dst->linesize[ol->main_desc->comp[i].plane]
+  + ol->main_desc->comp[i].offset;
 ap = src->data[3] + (j<linesize[3];
 
 for (jmax = FFMIN(-yp + dst_hp, src_hp); j < jmax; j++) {
 k = FFMAX(-xp, 0);
-d = dp + xp+k;
+d = dp + (xp+k) * ol->main_desc->comp[i].step;
 s = sp + k;
 a = ap + (k<main_desc->comp[i].step;
 a += 1 << hsub;
 }
-dp += dst->linesize[i];
+dp += dst->linesize[ol->main_desc->comp[i].plane];
 sp += src->linesize[i];
 ap += (1 << vsub) * src->linesize[3];
 }
-- 
2.8.2

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


Re: [FFmpeg-devel] [PATCH 2/2] lavc: show gapless info in stream summary

2016-05-24 Thread Michael Niedermayer
On Tue, May 24, 2016 at 03:52:49PM -0700, Jon Toohill wrote:
> From: Jon Toohill 
> 
> Also adds trailing_padding to AVCodecContext to match
> AVCodecParameters so that it doesn't get lost when mapping
> between them.
> ---
>  libavcodec/avcodec.h | 11 +++
>  libavcodec/utils.c   | 38 ++
>  2 files changed, 33 insertions(+), 16 deletions(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 9ec9adf..408efe1 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -3321,6 +3321,17 @@ typedef struct AVCodecContext {
>  int initial_padding;
>  
>  /**
> + * Audio only. The amount of padding (in samples) appended by the 
> encoder to
> + * the end of the audio. I.e. this number of decoded samples must be
> + * discarded by the caller from the end of the stream to get the original
> + * audio without any trailing padding.
> + *
> + * - decoding: unused
> + * - encoding: unused
> + */
> +int trailing_padding;
> +
> +/**

new fields must be added at the end to avoid breaking ABI
also minor version has to be bumped and an entry should be added to
doc/APIchanges

[...]
-- 
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 0/2] Pass Xing gapless metadata to users during mp3 parsing

2016-05-24 Thread Jon Toohill
Forgot to fix the author line in those patches, it should read "Jon Toohill
" instead. I can fix it when sending updated patches
if there are revisions to make, otherwise can you change it before merging
(or should I send updated patches)?


Jon Toohill |  Google Play Music |  jtooh...@google.com |  (650) 215-0770

On Tue, May 24, 2016 at 3:52 PM, Jon Toohill  wrote:

> These patches expose the encoder delay/padding parsed from an mp3's Xing
> header to users of lavc/lavf, and show gapless info in the stream summary
> string.
>
> Jon Toohill (2):
>   lavf/mp3dec: pass Xing gapless metadata to AVCodecParameters
>   lavc: show gapless info in stream summary
>
>  libavcodec/avcodec.h | 11 +++
>  libavcodec/utils.c   | 38 ++
>  libavformat/mp3dec.c |  2 ++
>  3 files changed, 35 insertions(+), 16 deletions(-)
>
> --
> 2.8.0.rc3.226.g39d4020
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] trac antispam meassures

2016-05-24 Thread Michael Niedermayer
On Tue, May 24, 2016 at 11:36:53AM -0800, Lou Logan wrote:
> On Tue, May 24, 2016, at 10:13 AM, Michael Niedermayer wrote:
> >
> > So ive added a very basic pre registration page that asks 2 trivial
> > questions.
> 
> This should help reduce the load on trac itself regarding the unending
> stream of bots attempting to register. This will make training the bayes
> easier because there will be less noise to sift through.
> 

> As far as I can tell the spam that actually gets through is not usually
> from bots but from live criminal miscreants:

yes, the question though is do they know the project name
it certainly doesnt pay for them to do this just with one or even
a hundread websites. If it wasnt in our URL i would say they would
be out of the game too. As it is in the URL iam curious if these
2 questions will decrease human spam or not
also the live criminals might have automated some of their trac attack
procedure, that extra page might throw some off balance



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

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway


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: Add Pro-MPEG CoP #3-R2 FEC protocol

2016-05-24 Thread Michael Niedermayer
On Wed, May 18, 2016 at 04:18:11PM +0200, Vlad Tarca wrote:
> >
> > Have you tested this on actual receivers?
> > Are you aware this won't work effectively because of the bursty nature of
> > FFmpeg?
> >
> > Kieran
> >
> 
> Hello,
> 
> I tested the FFmpeg version on a software receiver, not a hardware one. I
> initially implemented this for one of my applications based on VideoLAN's
> multicat and that version seemed to work well with hardware receivers.
> 
> Now that you mention it I can see there are discussions about the UDP burst
> issues. Do you know if there are any planned improvements?

there was a patch, ive applied and fixed the worst of it
you can now prevent bursts with -packet_gap

What is missing now is to add either some -bandwidth option or even
better make udp use the bitrate or PCR/SCR to time the outputted udp
packets. Which would be nicer than the packet_gap based system

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

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch


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/udp: Add a delay between packets for streaming to clients with short buffer

2016-05-24 Thread Michael Niedermayer
On Tue, Mar 08, 2016 at 11:27:45PM +0300, Pavel Nikiforov wrote:
> Nicolas George george at nsup.org wrote:
> 
> >>  libavformat/udp.c | 133 
> >> --
> >>  1 file changed, 129 insertions(+), 4 deletions(-)
> 
> >Missing documentation update.
> fixed.
> 
> >> -while(1) {
> >> +for(;;) {
> 
> >Stray change.
> Portability. You don't know how a compiler other than clang or gcc
> will optimize or not optimize "while (1) { }".
> 
> 
> >> +if (!(h->flags & AVIO_FLAG_NONBLOCK)) {
> 
> >This looks suspicious: blocking/nonblocking is a property of the protocol as
> >seen by the calling application, it should not apply in a thread used
> >internally. See below.
> The thread should work as original non-thread code.
> 
> >> +ret = sendto (s->udp_fd, buf, size, 0,
> >> +  (struct sockaddr *) >dest_addr,
> 
> >Style: no spaces after function names and casts.
> It is not my code. This block from
> static int udp_write(URLContext *h, const uint8_t *buf, int size)
> 
> >> +av_usleep(s->packet_gap);
> 
> >Not very reliable: if the task gets unscheduled for some time, it will be
> >added to the gap and never catch, possibly causing playback hiccups. A
> >system with a kind of rate control would probably be better.
> Want reliable delay ? Spin in a loop polling dogettimeofday() in
> kernel w/o task switch. Otherwise the only thing we have is usleep() .
> No more options available to make a delay in user space: all of them
> cause task switch with unpredicted return time after delay (preemtable
> kernel, you knows).
> 
> If all goes right and a system is not overloaded the gap between
> packets will be as set (and tcpdump with -ttt prove this). Also, we
> have a sendto() syscall (preemption again), the UDP socket buffer, a
> network device TX ring and many other things like "backpressure" on an
> ethernet switch port that will cause the delay be more than specified.
> 
> >> +/*
> >> +  Create thread in case of:
> >> +  1. Input and circular_buffer_size is set
> >> +  2. Output and packet_gap and circular_buffer_size is set
> >> +*/
> 
> >UDP sockets can be read+write; in this case, two threads are needed.
> The UDP socket are mostly read or mostly write. The thread will handle
> the most part of socket communication, no need to make a thread for
> handle some packets.
> 
> Fixed version of the patch in attachment.

>  doc/protocols.texi |3 +
>  libavformat/udp.c  |  136 
> +++--
>  2 files changed, 135 insertions(+), 4 deletions(-)
> 04ecb9352d570991947f4481df8f3b3fcdba13a4  udp.patch
>  libavformat/udp.c  | 136 
> --
>  doc/protocols.texi |   3 +++
>  2 file changed, 135 insertions(+), 4 deletions(-)

applied with alot of fixes
i kept the code and most fixes in a seperate commit, felt more correct
to me as i changed alot

Thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 


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


[FFmpeg-devel] [PATCH 2/2] lavc: show gapless info in stream summary

2016-05-24 Thread Jon Toohill
From: Jon Toohill 

Also adds trailing_padding to AVCodecContext to match
AVCodecParameters so that it doesn't get lost when mapping
between them.
---
 libavcodec/avcodec.h | 11 +++
 libavcodec/utils.c   | 38 ++
 2 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 9ec9adf..408efe1 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3321,6 +3321,17 @@ typedef struct AVCodecContext {
 int initial_padding;
 
 /**
+ * Audio only. The amount of padding (in samples) appended by the encoder 
to
+ * the end of the audio. I.e. this number of decoded samples must be
+ * discarded by the caller from the end of the stream to get the original
+ * audio without any trailing padding.
+ *
+ * - decoding: unused
+ * - encoding: unused
+ */
+int trailing_padding;
+
+/**
  * - decoding: For codecs that store a framerate value in the compressed
  * bitstream, the decoder may export it here. { 0, 1} when
  * unknown.
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index e5a832b..51f50b0 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -3251,6 +3251,10 @@ void avcodec_string(char *buf, int buf_size, 
AVCodecContext *enc, int encode)
 && enc->bits_per_raw_sample != 
av_get_bytes_per_sample(enc->sample_fmt) * 8)
 snprintf(buf + strlen(buf), buf_size - strlen(buf),
  " (%d bit)", enc->bits_per_raw_sample);
+if (enc->initial_padding || enc->trailing_padding) {
+snprintf(buf + strlen(buf), buf_size - strlen(buf),
+ ", delay %d, padding %d", enc->initial_padding, 
enc->trailing_padding);
+}
 break;
 case AVMEDIA_TYPE_DATA:
 if (av_log_get_level() >= AV_LOG_DEBUG) {
@@ -4094,14 +4098,15 @@ int avcodec_parameters_from_context(AVCodecParameters 
*par,
 par->video_delay = codec->has_b_frames;
 break;
 case AVMEDIA_TYPE_AUDIO:
-par->format  = codec->sample_fmt;
-par->channel_layout  = codec->channel_layout;
-par->channels= codec->channels;
-par->sample_rate = codec->sample_rate;
-par->block_align = codec->block_align;
-par->frame_size  = codec->frame_size;
-par->initial_padding = codec->initial_padding;
-par->seek_preroll= codec->seek_preroll;
+par->format   = codec->sample_fmt;
+par->channel_layout   = codec->channel_layout;
+par->channels = codec->channels;
+par->sample_rate  = codec->sample_rate;
+par->block_align  = codec->block_align;
+par->frame_size   = codec->frame_size;
+par->initial_padding  = codec->initial_padding;
+par->trailing_padding = codec->trailing_padding;
+par->seek_preroll = codec->seek_preroll;
 break;
 case AVMEDIA_TYPE_SUBTITLE:
 par->width  = codec->width;
@@ -4148,14 +4153,15 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
 codec->has_b_frames   = par->video_delay;
 break;
 case AVMEDIA_TYPE_AUDIO:
-codec->sample_fmt  = par->format;
-codec->channel_layout  = par->channel_layout;
-codec->channels= par->channels;
-codec->sample_rate = par->sample_rate;
-codec->block_align = par->block_align;
-codec->frame_size  = par->frame_size;
-codec->initial_padding = par->initial_padding;
-codec->seek_preroll= par->seek_preroll;
+codec->sample_fmt   = par->format;
+codec->channel_layout   = par->channel_layout;
+codec->channels = par->channels;
+codec->sample_rate  = par->sample_rate;
+codec->block_align  = par->block_align;
+codec->frame_size   = par->frame_size;
+codec->initial_padding  = par->initial_padding;
+codec->trailing_padding = par->trailing_padding;
+codec->seek_preroll = par->seek_preroll;
 break;
 case AVMEDIA_TYPE_SUBTITLE:
 codec->width  = par->width;
-- 
2.8.0.rc3.226.g39d4020

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


[FFmpeg-devel] [PATCH 1/2] lavf/mp3dec: pass Xing gapless metadata to AVCodecParameters

2016-05-24 Thread Jon Toohill
From: Jon Toohill 

---
 libavformat/mp3dec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 3725d67..192f5ef 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -234,6 +234,8 @@ static void mp3_parse_info_tag(AVFormatContext *s, AVStream 
*st,
 
 mp3->start_pad = v>>12;
 mp3->  end_pad = v&4095;
+st->codecpar->initial_padding = mp3->start_pad;
+st->codecpar->trailing_padding = mp3->end_pad;
 st->start_skip_samples = mp3->start_pad + 528 + 1;
 if (mp3->frames) {
 st->first_discard_sample = -mp3->end_pad + 528 + 1 + mp3->frames * 
(int64_t)spf;
-- 
2.8.0.rc3.226.g39d4020

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


[FFmpeg-devel] [PATCH 0/2] Pass Xing gapless metadata to users during mp3 parsing

2016-05-24 Thread Jon Toohill
These patches expose the encoder delay/padding parsed from an mp3's Xing header 
to users of lavc/lavf, and show gapless info in the stream summary string.

Jon Toohill (2):
  lavf/mp3dec: pass Xing gapless metadata to AVCodecParameters
  lavc: show gapless info in stream summary

 libavcodec/avcodec.h | 11 +++
 libavcodec/utils.c   | 38 ++
 libavformat/mp3dec.c |  2 ++
 3 files changed, 35 insertions(+), 16 deletions(-)

-- 
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] fix few compiler warnings

2016-05-24 Thread Ronald S. Bultje
Hi,

On Tue, May 24, 2016 at 2:00 PM, Michael Niedermayer  wrote:

> On Mon, May 23, 2016 at 03:06:35PM +0200, Hendrik Leppkes wrote:
> > On Mon, May 23, 2016 at 1:59 PM, Michael Niedermayer
> >  wrote:
> > > On Mon, May 23, 2016 at 07:24:23AM -0400, Ronald S. Bultje wrote:
> > >> Hi,
> > >>
> > >> On Sun, May 22, 2016 at 11:39 PM, Michael Niedermayer <
> > >> mich...@niedermayer.cc> wrote:
> > >>
> > >> > On Sun, May 22, 2016 at 01:51:05AM +, Davinder Singh wrote:
> > >> > > On Sun, May 22, 2016 at 2:09 AM Michael Niedermayer
> > >> > 
> > >> > > wrote:
> > >> > >
> > >> > > > On Sat, May 21, 2016 at 02:21:17PM +, Davinder Singh wrote:
> > >> > > > > hi,
> > >> > > > >
> > >> > > > > this patch fixes following compiler warnings:
> > >> > > > >
> > >> > > > > libavcodec/cfhd.c:346:78: warning: format specifies type
> 'unsigned
> > >> > short'
> > >> > > > > but the argument has type 'int' [-Wformat]
> > >> > > > > av_log(avctx, AV_LOG_DEBUG, "Small chunk length
> %"PRIu16"
> > >> > > > > %s\n", data * 4, tag < 0 ? "optional" : "required");
> > >> > > > > ~~
> > >> > > > >   ^~~~
> > >> > > > > libavcodec/cfhd.c:472:110: warning: format specifies type
> 'unsigned
> > >> > > > short'
> > >> > > > > but the argument has type 'int' [-Wformat]
> > >> > > > > av_log(avctx, AV_LOG_DEBUG, "Start of lowpass
> coeffs
> > >> > > > component
> > >> > > > > %"PRIu16" height:%d, width:%d\n", s->channel_num,
> lowpass_height,
> > >> > > > > lowpass_width);
> > >> > > > >
> > >> > > > >  ~~^~
> > >> > > > > libavcodec/cfhd.c:490:77: warning: format specifies type
> 'unsigned
> > >> > short'
> > >> > > > > but the argument has type 'int' [-Wformat]
> > >> > > > > av_log(avctx, AV_LOG_DEBUG, "Lowpass coefficients
> > >> > > > %"PRIu16"\n",
> > >> > > > > lowpass_width * lowpass_height);
> > >> > > > >
>  ~~
> > >> > > > >  ^~
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > > libavcodec/dv_tablegen.c:30:60: warning: format specifies type
> > >> > 'char' but
> > >> > > > > the argument has type 'uint32_t' (aka 'unsigned int')
> [-Wformat]
> > >> > > > >"{0x%"PRIx32", %"PRId8"}", data[i].vlc,
> > >> > data[i].size)
> > >> > > > >
> > >> >
> ~~~^~~~
> > >> > > > > libavcodec/tableprint.h:37:29: note: expanded from macro
> > >> > > > > 'WRITE_1D_FUNC_ARGV'
> > >> > > > >printf(" "fmtstr",", __VA_ARGS__);\
> > >> > > > > ^~~
> > >> > > > > libavcodec/dv_tablegen.c:30:60: warning: format specifies type
> > >> > 'char' but
> > >> > > > > the argument has type 'uint32_t' (aka 'unsigned int')
> [-Wformat]
> > >> > > > >"{0x%"PRIx32", %"PRId8"}", data[i].vlc,
> > >> > data[i].size)
> > >> > > > >
> > >> >
> ~~~^~~~
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > > libavfilter/af_hdcd.c:896:57: warning: shifting a negative
> signed
> > >> > value
> > >> > > > is
> > >> > > > > undefined [-Wshift-negative-value]
> > >> > > > > state->readahead = readaheadtab[bits & ~(-1 <<
> 8)];
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > > libavfilter/vf_hwdownload.c:59:5: warning: ignoring return
> value of
> > >> > > > > function declared with warn_unused_result attribute
> [-Wunused-result]
> > >> > > > > ff_formats_ref(infmts,  >inputs[0]->out_formats);
> > >> > > > > ^~ ~~~
> > >> > > > > libavfilter/vf_hwdownload.c:60:5: warning: ignoring return
> value of
> > >> > > > > function declared with warn_unused_result attribute
> [-Wunused-result]
> > >> > > > > ff_formats_ref(outfmts, >outputs[0]->in_formats);
> > >> > > > > ^~ ~~~
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > > libavutil/opencl.c:456:17: warning: variable 'kernel_source'
> is used
> > >> > > > > uninitialized whenever 'for' loop exits because its condition
> is
> > >> > false
> > >> > > > > [-Wsometimes-uninitialized]
> > >> > > > > for (i = 0; i < opencl_ctx.kernel_code_count; i++) {
> > >> > > > > ^~~~
> > >> > > > > libavutil/opencl.c:466:10: note: uninitialized use occurs here
> > >> > > > > if (!kernel_source) {
> > >> > > > >  ^
> > >> > > > > libavutil/opencl.c:456:17: note: remove the condition if it
> is always
> > >> > > > true
> > >> > > > > for (i = 0; i < opencl_ctx.kernel_code_count; i++) {
> > >> > > > > ^~~~
> > >> > > > > libavutil/opencl.c:448:30: note: initialize the variable
> > >> > 'kernel_source'
> > >> > > > to
> > >> 

Re: [FFmpeg-devel] [PATCH] avformat: Add Pro-MPEG CoP #3-R2 FEC protocol

2016-05-24 Thread Michael Niedermayer
On Wed, May 18, 2016 at 02:46:33PM +0200, Vlad Tarca wrote:
> Fixed a type issue in xor added after the last modification and cleaned up 
> unnecessary NULL checks for av_dict_free
[...]

> +static int prompeg_init(URLContext *h, const uint8_t *buf, int size) {
> +PrompegContext *s = h->priv_data;
> +uint32_t seed;
> +int bitstring_len, rtp_buf_len, i;
> +
> +s->packet_idx = 0;
> +s->packet_idx_max = s->l * s->d;
> +s->packet_size = size;
> +s->recovery_len = size - 12;

I think size needs to be checked to avoid integer overflow
there is a check later but unless iam mising somthng thats too late

> +bitstring_len = s->recovery_len + 8;
> +s->bitstring_size = bitstring_len * sizeof (uint8_t);
> +rtp_buf_len = 12 + 16 + s->recovery_len;

a check for size being too large is missing too i think


> +s->rtp_buf_size = rtp_buf_len * sizeof (uint8_t);
> +s->fec_buf_len = 1 + 2 * s->l; // row + column tmp + column out
> +
> +if (h->flags & AVFMT_FLAG_BITEXACT) {
> +s->rtp_col_sn = 0;
> +s->rtp_row_sn = 0;
> +} else {
> +seed = av_get_random_seed();
> +s->rtp_col_sn = seed & 0x0fff;
> +s->rtp_row_sn = (seed >> 16) & 0x0fff;
> +}
> +
> +s->rtp_buf = NULL;
> +s->fec_buf = av_malloc_array(s->fec_buf_len, sizeof (PrompegFec*));
> +if (!s->fec_buf) {
> +goto fail;
> +}
> +for (i = 0; i < s->fec_buf_len; i++) {
> +s->fec_buf[i] = av_malloc(sizeof (PrompegFec));
> +if (!s->fec_buf[i]) {
> +goto fail;
> +}
> +s->fec_buf[i]->bitstring = av_malloc_array(bitstring_len, sizeof 
> (uint8_t));
> +if (!s->fec_buf[i]->bitstring) {
> +av_freep(>fec_buf[i]);
> +goto fail;
> +}
> +}
> +s->fec_row = *s->fec_buf;
> +s->fec_col = s->fec_buf + 1;
> +s->fec_col_tmp = s->fec_buf + 1 + s->l;
> +
> +s->rtp_buf = av_malloc_array(rtp_buf_len, sizeof (uint8_t));
> +if (!s->rtp_buf) {
> +goto fail;
> +}
> +memset(s->rtp_buf, 0, s->rtp_buf_size);
> +
> +s->init = 0;
> +s->first = 1;
> +
> +return 0;
> +
> +fail:
> +if (s->fec_buf) {
> +for (i = 0; i < s->fec_buf_len; i++) {
> +if (!s->fec_buf[i]) {
> +break;
> +}
> +av_free(s->fec_buf[i]->bitstring);
> +av_freep(>fec_buf[i]);
> +}
> +av_freep(>fec_buf);
> +}

> +if (s->rtp_buf) {
> +av_freep(>rtp_buf);
> +}

redudant NULL check


[...]
> +static int prompeg_close(URLContext *h) {
> +PrompegContext *s = h->priv_data;
> +int i;
> +
> +ffurl_close(s->fec_col_hd);
> +ffurl_close(s->fec_row_hd);
> +
> +if (s->fec_buf) {
> +for (i = 0; i < s->fec_buf_len; i++) {
> +av_free(s->fec_buf[i]->bitstring);
> +av_freep(>fec_buf[i]);
> +}
> +av_freep(>fec_buf);
> +}
> +if (s->rtp_buf)
> +av_freep(>rtp_buf);

this looks duplicated, can this be factored with the similar previous
code ?


[...]
> @@ -377,6 +382,33 @@ static int rtp_open(URLContext *h, const char *uri, int 
> flags)
>  }
>  }
>  
> +if (s->fec_options_str) {
> +p = s->fec_options_str;
> +
> +if (!(fec_protocol = av_get_token(, "="))) {
> +av_log(h, AV_LOG_ERROR, "Failed to parse the FEC protocol 
> value\n");
> +goto fail;
> +}
> +if (strcmp(fec_protocol, "prompeg")) {
> +av_log(h, AV_LOG_ERROR, "Unsupported FEC protocol %s\n", 
> fec_protocol);
> +goto fail;
> +}
> +
> +p = s->fec_options_str + strlen(fec_protocol);
> +while (*p && *p == '=') p++;
> +
> +if (av_dict_parse_string(_opts, p, "=", ":", 0) < 0) {
> +av_log(h, AV_LOG_ERROR, "Failed to parse the FEC options\n");
> +goto fail;
> +}
> +if (s->ttl > 0) {

> +snprintf(buf, 256, "%d", s->ttl);

sizeif(buf) or something, hardcoded 256 is bad, that can be missed
if someone changes the array size

[...]
-- 
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


Re: [FFmpeg-devel] [PATCH] lavf: add textdata virtual demuxer and demuxer

2016-05-24 Thread Moritz Barsnick
On Tue, May 24, 2016 at 19:50:26 +0200, Stefano Sabatini wrote:
> What warnings?
> 
> > [fftextdata @ 0xaf687a0] Using AVStream.codec to pass codec parameters to 
> > muxers is deprecated, use AVStream.codecpar instead.

Yes, that one.

> This one is currently shown in every conversion.

Ah, I missed that.

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


Re: [FFmpeg-devel] trac antispam meassures

2016-05-24 Thread Lou Logan
On Tue, May 24, 2016, at 10:13 AM, Michael Niedermayer wrote:
>
> So ive added a very basic pre registration page that asks 2 trivial
> questions.

This should help reduce the load on trac itself regarding the unending
stream of bots attempting to register. This will make training the bayes
easier because there will be less noise to sift through.

As far as I can tell the spam that actually gets through is not usually
from bots but from live criminal miscreants: may they be cursed into
becoming ffserver users.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 07/11] avcodec/mips: loongson optimize h264qpel with mmi v2

2016-05-24 Thread Michael Niedermayer
On Tue, May 17, 2016 at 03:08:13PM +0800, 周晓勇 wrote:
> avcodec/mips/h264qpel_mmi: Version 2 of the optimizations for loongson mmi
> 
> 1. no longer use the register names directly and optimized code format
> 2. to be compatible with O32, specify type of address variable with 
> mips_reg and handle the address variable with PTR_ operator
> 3. temporarily annotated func put_(avg_)h264_qpel16_hv_lowpass_mmi and 
> related funcs which couldn't pass fate testing in O32 ABI
> 4. use uld and mtc1 to workaround cpu 3A2000 gslwlc1 bug (gslwlc1 
> instruction extension bug in O32 ABI)
> 5. put_pixels_ an avg_pixels_ functions use hpeldsp optimizations instead
> 
> 
> 
> 
> 
> 
> 
> 
> 在 2016-05-13 18:05:51,"周晓勇"  写道:
> 
> From 151ccd1cefff1887b58166113e65893bcc2e724d Mon Sep 17 00:00:00 2001
> From: Zhou Xiaoyong 
> Date: Thu, 12 May 2016 10:46:09 +0800
> Subject: [PATCH 07/11] avcodec/mips: loongson optimize h264qpel with mmi v2
> 
> 
> ---
>  libavcodec/mips/h264qpel_init_mips.c |   28 +
>  libavcodec/mips/h264qpel_mmi.c   | 3823 
> --
>  2 files changed, 2252 insertions(+), 1599 deletions(-)
> 
> 
> diff --git a/libavcodec/mips/h264qpel_init_mips.c 
> b/libavcodec/mips/h264qpel_init_mips.c
> index 92219f8..d97e9cc 100644
> --- a/libavcodec/mips/h264qpel_init_mips.c
> +++ b/libavcodec/mips/h264qpel_init_mips.c
> @@ -133,38 +133,52 @@ static av_cold void h264qpel_init_msa(H264QpelContext 
> *c, int bit_depth)
>  static av_cold void h264qpel_init_mmi(H264QpelContext *c, int bit_depth)
>  {
>  if (8 == bit_depth) {
> +//FIXME put_h264_qpel16_hv_lowpass_mmi
>  c->put_h264_qpel_pixels_tab[0][0] = ff_put_h264_qpel16_mc00_mmi;
>  c->put_h264_qpel_pixels_tab[0][1] = ff_put_h264_qpel16_mc10_mmi;
>  c->put_h264_qpel_pixels_tab[0][2] = ff_put_h264_qpel16_mc20_mmi;
>  c->put_h264_qpel_pixels_tab[0][3] = ff_put_h264_qpel16_mc30_mmi;
>  c->put_h264_qpel_pixels_tab[0][4] = ff_put_h264_qpel16_mc01_mmi;
>  c->put_h264_qpel_pixels_tab[0][5] = ff_put_h264_qpel16_mc11_mmi;
> +#if 0
>  c->put_h264_qpel_pixels_tab[0][6] = ff_put_h264_qpel16_mc21_mmi;
> +#endif
>  c->put_h264_qpel_pixels_tab[0][7] = ff_put_h264_qpel16_mc31_mmi;
>  c->put_h264_qpel_pixels_tab[0][8] = ff_put_h264_qpel16_mc02_mmi;
> +#if 0
>  c->put_h264_qpel_pixels_tab[0][9] = ff_put_h264_qpel16_mc12_mmi;
>  c->put_h264_qpel_pixels_tab[0][10] = ff_put_h264_qpel16_mc22_mmi;
>  c->put_h264_qpel_pixels_tab[0][11] = ff_put_h264_qpel16_mc32_mmi;
> +#endif
>  c->put_h264_qpel_pixels_tab[0][12] = ff_put_h264_qpel16_mc03_mmi;
>  c->put_h264_qpel_pixels_tab[0][13] = ff_put_h264_qpel16_mc13_mmi;
> +#if 0
>  c->put_h264_qpel_pixels_tab[0][14] = ff_put_h264_qpel16_mc23_mmi;
> +#endif
>  c->put_h264_qpel_pixels_tab[0][15] = ff_put_h264_qpel16_mc33_mmi;
>  
> +//FIXME put_h264_qpel16_hv_lowpass_mmi
>  c->put_h264_qpel_pixels_tab[1][0] = ff_put_h264_qpel8_mc00_mmi;
>  c->put_h264_qpel_pixels_tab[1][1] = ff_put_h264_qpel8_mc10_mmi;
>  c->put_h264_qpel_pixels_tab[1][2] = ff_put_h264_qpel8_mc20_mmi;
>  c->put_h264_qpel_pixels_tab[1][3] = ff_put_h264_qpel8_mc30_mmi;
>  c->put_h264_qpel_pixels_tab[1][4] = ff_put_h264_qpel8_mc01_mmi;
>  c->put_h264_qpel_pixels_tab[1][5] = ff_put_h264_qpel8_mc11_mmi;
> +#if 0
>  c->put_h264_qpel_pixels_tab[1][6] = ff_put_h264_qpel8_mc21_mmi;
> +#endif
>  c->put_h264_qpel_pixels_tab[1][7] = ff_put_h264_qpel8_mc31_mmi;
>  c->put_h264_qpel_pixels_tab[1][8] = ff_put_h264_qpel8_mc02_mmi;
> +#if 0
>  c->put_h264_qpel_pixels_tab[1][9] = ff_put_h264_qpel8_mc12_mmi;
>  c->put_h264_qpel_pixels_tab[1][10] = ff_put_h264_qpel8_mc22_mmi;
>  c->put_h264_qpel_pixels_tab[1][11] = ff_put_h264_qpel8_mc32_mmi;
> +#endif
>  c->put_h264_qpel_pixels_tab[1][12] = ff_put_h264_qpel8_mc03_mmi;
>  c->put_h264_qpel_pixels_tab[1][13] = ff_put_h264_qpel8_mc13_mmi;
> +#if 0
>  c->put_h264_qpel_pixels_tab[1][14] = ff_put_h264_qpel8_mc23_mmi;
> +#endif
>  c->put_h264_qpel_pixels_tab[1][15] = ff_put_h264_qpel8_mc33_mmi;
>  
>  c->put_h264_qpel_pixels_tab[2][0] = ff_put_h264_qpel4_mc00_mmi;
> @@ -184,38 +198,52 @@ static av_cold void h264qpel_init_mmi(H264QpelContext 
> *c, int bit_depth)
>  c->put_h264_qpel_pixels_tab[2][14] = ff_put_h264_qpel4_mc23_mmi;
>  c->put_h264_qpel_pixels_tab[2][15] = ff_put_h264_qpel4_mc33_mmi;
>  
> +//FIXME avg_h264_qpel16_hv_lowpass_mmi
>  c->avg_h264_qpel_pixels_tab[0][0] = ff_avg_h264_qpel16_mc00_mmi;
>  c->avg_h264_qpel_pixels_tab[0][1] = ff_avg_h264_qpel16_mc10_mmi;
>  c->avg_h264_qpel_pixels_tab[0][2] = ff_avg_h264_qpel16_mc20_mmi;
>  c->avg_h264_qpel_pixels_tab[0][3] = ff_avg_h264_qpel16_mc30_mmi;
>  

Re: [FFmpeg-devel] [PATCH] fix few compiler warnings

2016-05-24 Thread Michael Niedermayer
On Sun, May 22, 2016 at 01:51:05AM +, Davinder Singh wrote:
> On Sun, May 22, 2016 at 2:09 AM Michael Niedermayer 
> wrote:
> 
> > On Sat, May 21, 2016 at 02:21:17PM +, Davinder Singh wrote:
> > > hi,
> > >
> > > this patch fixes following compiler warnings:
> > >
> > > libavcodec/cfhd.c:346:78: warning: format specifies type 'unsigned short'
> > > but the argument has type 'int' [-Wformat]
> > > av_log(avctx, AV_LOG_DEBUG, "Small chunk length %"PRIu16"
> > > %s\n", data * 4, tag < 0 ? "optional" : "required");
> > > ~~
> > >   ^~~~
> > > libavcodec/cfhd.c:472:110: warning: format specifies type 'unsigned
> > short'
> > > but the argument has type 'int' [-Wformat]
> > > av_log(avctx, AV_LOG_DEBUG, "Start of lowpass coeffs
> > component
> > > %"PRIu16" height:%d, width:%d\n", s->channel_num, lowpass_height,
> > > lowpass_width);
> > >
> > >  ~~^~
> > > libavcodec/cfhd.c:490:77: warning: format specifies type 'unsigned short'
> > > but the argument has type 'int' [-Wformat]
> > > av_log(avctx, AV_LOG_DEBUG, "Lowpass coefficients
> > %"PRIu16"\n",
> > > lowpass_width * lowpass_height);
> > >   ~~
> > >  ^~
> > >
> > >
> > >
> > > libavcodec/dv_tablegen.c:30:60: warning: format specifies type 'char' but
> > > the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
> > >"{0x%"PRIx32", %"PRId8"}", data[i].vlc, data[i].size)
> > > ~~~^~~~
> > > libavcodec/tableprint.h:37:29: note: expanded from macro
> > > 'WRITE_1D_FUNC_ARGV'
> > >printf(" "fmtstr",", __VA_ARGS__);\
> > > ^~~
> > > libavcodec/dv_tablegen.c:30:60: warning: format specifies type 'char' but
> > > the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
> > >"{0x%"PRIx32", %"PRId8"}", data[i].vlc, data[i].size)
> > > ~~~^~~~
> > >
> > >
> > >
> > > libavfilter/af_hdcd.c:896:57: warning: shifting a negative signed value
> > is
> > > undefined [-Wshift-negative-value]
> > > state->readahead = readaheadtab[bits & ~(-1 << 8)];
> > >
> > >
> > >
> > > libavfilter/vf_hwdownload.c:59:5: warning: ignoring return value of
> > > function declared with warn_unused_result attribute [-Wunused-result]
> > > ff_formats_ref(infmts,  >inputs[0]->out_formats);
> > > ^~ ~~~
> > > libavfilter/vf_hwdownload.c:60:5: warning: ignoring return value of
> > > function declared with warn_unused_result attribute [-Wunused-result]
> > > ff_formats_ref(outfmts, >outputs[0]->in_formats);
> > > ^~ ~~~
> > >
> > >
> > >
> > > libavutil/opencl.c:456:17: warning: variable 'kernel_source' is used
> > > uninitialized whenever 'for' loop exits because its condition is false
> > > [-Wsometimes-uninitialized]
> > > for (i = 0; i < opencl_ctx.kernel_code_count; i++) {
> > > ^~~~
> > > libavutil/opencl.c:466:10: note: uninitialized use occurs here
> > > if (!kernel_source) {
> > >  ^
> > > libavutil/opencl.c:456:17: note: remove the condition if it is always
> > true
> > > for (i = 0; i < opencl_ctx.kernel_code_count; i++) {
> > > ^~~~
> > > libavutil/opencl.c:448:30: note: initialize the variable 'kernel_source'
> > to
> > > silence this warning
> > > const char *kernel_source;
> > >  ^
> > >   = NULL
> >
> > >  libavcodec/cfhd.c   |6 +++---
> > >  libavcodec/dv_tablegen.c|2 +-
> > >  libavfilter/af_hdcd.c   |2 +-
> > >  libavfilter/vf_hwdownload.c |6 --
> > >  libavutil/opencl.c  |2 +-
> >
> > please split this patch
> > the fixed warnings are unrelated to each other and possibly differnt
> > developers would like to reply to different parts
> >
> > [...]
> >
> > --
> > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >
> > I have often repented speaking, but never of holding my tongue.
> > -- Xenocrates
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
[...]

>  opencl.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> b3b89a601cc0447677a9f0f375c20f1f63d66f42  
> 0005-libavutil-opencl-fixed-uninitialized-var-warning.patch
> From 9259a055b908c12c7ab7c5f08aae95f3cdaacfa8 Mon Sep 17 00:00:00 2001
> From: dsmudhar 
> Date: Sun, 22 May 2016 06:29:27 +0530
> Subject: [PATCH 5/7] 

[FFmpeg-devel] trac antispam meassures

2016-05-24 Thread Michael Niedermayer
Hi all

There where a few spams getting throgh in ffmpegs trac in the last 2
days.
It was suggested in #ffmpeg-devel to add some custom anti spam
meassures and ask for the project name during register.
trac doesnt support doing that in the current release

There are also hundreads of bots trying to register per hour since
months

So ive added a very basic pre registration page that asks 2 trivial
questions.
This is implemented purely at apache level so should be entirely
unaffected by trac upgrades and also could probably be added in front
of any other pages needing spam protection.
Furthermore the preregistration page can of course be changed and
extended if anyone wants and submits patches ...

If this causes any problems please report them

https://trac.mplayerhq.hu/register
https://trac.ffmpeg.org/register

Thanks

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates


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


Re: [FFmpeg-devel] [PATCH] lavf/mpegtsenc: move putstr8 definition up

2016-05-24 Thread Stefano Sabatini
On date Saturday 2016-05-21 22:14:22 +0200, Benoit Fouet encoded:
> Hi,
> 
> Le 19/05/2016 18:45, Stefano Sabatini a écrit :
> >This allows to use the function in a future commit.
> >---
> >  libavformat/mpegtsenc.c | 34 +-
> >  1 file changed, 17 insertions(+), 17 deletions(-)
> >
> >diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> >index 93cbac1..5f22032 100644
> >--- a/libavformat/mpegtsenc.c
> >+++ b/libavformat/mpegtsenc.c
> >@@ -253,6 +253,23 @@ static void mpegts_write_pat(AVFormatContext *s)
> >data, q - data);
> >  }
> >+/* NOTE: !str is accepted for an empty string */
> >+static void putstr8(uint8_t **q_ptr, const char *str)
> >+{
> >+uint8_t *q;
> >+int len;
> >+
> >+q = *q_ptr;
> >+if (!str)
> >+len = 0;
> >+else
> >+len = strlen(str);
> >+*q++ = len;
> >+memcpy(q, str, len);
> 

> Side note on this one, unrelated to your change.
> Isn't this undefined behavior to call memcpy with one of the
> pointers being NULL?

Yes, even if in practice doesn't seem to matter since we set len = 0.
-- 
FFmpeg = Fancy Fascinating MultiPurpose Enhancing Guide
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] fix few compiler warnings

2016-05-24 Thread Michael Niedermayer
On Mon, May 23, 2016 at 03:06:35PM +0200, Hendrik Leppkes wrote:
> On Mon, May 23, 2016 at 1:59 PM, Michael Niedermayer
>  wrote:
> > On Mon, May 23, 2016 at 07:24:23AM -0400, Ronald S. Bultje wrote:
> >> Hi,
> >>
> >> On Sun, May 22, 2016 at 11:39 PM, Michael Niedermayer <
> >> mich...@niedermayer.cc> wrote:
> >>
> >> > On Sun, May 22, 2016 at 01:51:05AM +, Davinder Singh wrote:
> >> > > On Sun, May 22, 2016 at 2:09 AM Michael Niedermayer
> >> > 
> >> > > wrote:
> >> > >
> >> > > > On Sat, May 21, 2016 at 02:21:17PM +, Davinder Singh wrote:
> >> > > > > hi,
> >> > > > >
> >> > > > > this patch fixes following compiler warnings:
> >> > > > >
> >> > > > > libavcodec/cfhd.c:346:78: warning: format specifies type 'unsigned
> >> > short'
> >> > > > > but the argument has type 'int' [-Wformat]
> >> > > > > av_log(avctx, AV_LOG_DEBUG, "Small chunk length 
> >> > > > > %"PRIu16"
> >> > > > > %s\n", data * 4, tag < 0 ? "optional" : "required");
> >> > > > > ~~
> >> > > > >   ^~~~
> >> > > > > libavcodec/cfhd.c:472:110: warning: format specifies type 'unsigned
> >> > > > short'
> >> > > > > but the argument has type 'int' [-Wformat]
> >> > > > > av_log(avctx, AV_LOG_DEBUG, "Start of lowpass coeffs
> >> > > > component
> >> > > > > %"PRIu16" height:%d, width:%d\n", s->channel_num, lowpass_height,
> >> > > > > lowpass_width);
> >> > > > >
> >> > > > >  ~~^~
> >> > > > > libavcodec/cfhd.c:490:77: warning: format specifies type 'unsigned
> >> > short'
> >> > > > > but the argument has type 'int' [-Wformat]
> >> > > > > av_log(avctx, AV_LOG_DEBUG, "Lowpass coefficients
> >> > > > %"PRIu16"\n",
> >> > > > > lowpass_width * lowpass_height);
> >> > > > >   ~~
> >> > > > >  ^~
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > > libavcodec/dv_tablegen.c:30:60: warning: format specifies type
> >> > 'char' but
> >> > > > > the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
> >> > > > >"{0x%"PRIx32", %"PRId8"}", data[i].vlc,
> >> > data[i].size)
> >> > > > >
> >> > ~~~^~~~
> >> > > > > libavcodec/tableprint.h:37:29: note: expanded from macro
> >> > > > > 'WRITE_1D_FUNC_ARGV'
> >> > > > >printf(" "fmtstr",", __VA_ARGS__);\
> >> > > > > ^~~
> >> > > > > libavcodec/dv_tablegen.c:30:60: warning: format specifies type
> >> > 'char' but
> >> > > > > the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
> >> > > > >"{0x%"PRIx32", %"PRId8"}", data[i].vlc,
> >> > data[i].size)
> >> > > > >
> >> > ~~~^~~~
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > > libavfilter/af_hdcd.c:896:57: warning: shifting a negative signed
> >> > value
> >> > > > is
> >> > > > > undefined [-Wshift-negative-value]
> >> > > > > state->readahead = readaheadtab[bits & ~(-1 << 8)];
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > > libavfilter/vf_hwdownload.c:59:5: warning: ignoring return value of
> >> > > > > function declared with warn_unused_result attribute 
> >> > > > > [-Wunused-result]
> >> > > > > ff_formats_ref(infmts,  >inputs[0]->out_formats);
> >> > > > > ^~ ~~~
> >> > > > > libavfilter/vf_hwdownload.c:60:5: warning: ignoring return value of
> >> > > > > function declared with warn_unused_result attribute 
> >> > > > > [-Wunused-result]
> >> > > > > ff_formats_ref(outfmts, >outputs[0]->in_formats);
> >> > > > > ^~ ~~~
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > > libavutil/opencl.c:456:17: warning: variable 'kernel_source' is 
> >> > > > > used
> >> > > > > uninitialized whenever 'for' loop exits because its condition is
> >> > false
> >> > > > > [-Wsometimes-uninitialized]
> >> > > > > for (i = 0; i < opencl_ctx.kernel_code_count; i++) {
> >> > > > > ^~~~
> >> > > > > libavutil/opencl.c:466:10: note: uninitialized use occurs here
> >> > > > > if (!kernel_source) {
> >> > > > >  ^
> >> > > > > libavutil/opencl.c:456:17: note: remove the condition if it is 
> >> > > > > always
> >> > > > true
> >> > > > > for (i = 0; i < opencl_ctx.kernel_code_count; i++) {
> >> > > > > ^~~~
> >> > > > > libavutil/opencl.c:448:30: note: initialize the variable
> >> > 'kernel_source'
> >> > > > to
> >> > > > > silence this warning
> >> > > > > const char *kernel_source;
> >> > > > >  ^
> >> > > > >   = NULL
> >> > > >
> >> > > > >  

Re: [FFmpeg-devel] [PATCH] lavf: add textdata virtual demuxer and demuxer

2016-05-24 Thread Stefano Sabatini
On date Monday 2016-05-23 15:31:33 +0200, Moritz Barsnick encoded:
> On Thu, May 19, 2016 at 19:29:40 +0200, Stefano Sabatini wrote:
> > > > +ffmpeg -i INPUT -codec copy -map 0 -an -vn data.fftd
> 
> BTW, is this possibly the first and only muxer which can actually remux
> timed_id3? I have been trying to *extract* timed_id3, but haven't
> figured out into which format I can dump data streams.
> 
> > Something like this should work:
> > ffmpeg -i INPUT -codec copy -map 0 -an -vn data.fftd
> 
> It turns out that my timed_id3 streams are either empty, or are not
> being read. AFAICT, the information I was hoping to find in there was
> apparently actually provided by Icy-metadata. (I was expecting either
> track information for radio programs or subtitles for video streams in
> the timed_id3.)
> 
> (I had been dumping HLS's MPEG-TS segments to MPEG-TS files, and they
> were showing timed_id3 data streams.)
> 
> So, no testing possibly from me, at least until I know for sure what's
> in those streams of mine.
> 
> Moritz
> 

> P.S.: Does the patch trigger deprecation warnings due to its own
>   nature, or due to something earlier in the chain? ffmpeg-cli
>   even?

What warnings?

> 
> barsnick@sunshine:~/Downloads/Radio/NRK/Amund/2015-12-28 > ffmpeg -i 
> nrk-outputfile-NzyUCD.ts -map 0:d -c copy nrk-outputfile-NzyUCD.fftd
> ffmpeg version N-80066-g566be4f Copyright (c) 2000-2016 the FFmpeg developers
>   built with icc (ICC) 14.0.3 20140422
>   configuration: --prefix=/usr/new/tools/video/install/ffmpeg/2016-05-22 
> --cc=icc --cxx=icpc --enable-gpl --enable-version3 --enable-nonfree 
> --disable-shared --enable-gnutls --enable-libcdio --enable-libfreetype 
> --enable-libx264 --enable-libvpx --enable-libmp3lame --enable-openal 
> --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtwolame 
> --enable-libopenjpeg --enable-librtmp --enable-libass --enable-libv4l2 
> --enable-libvidstab --enable-libfdk-aac --enable-libsmbclient 
> --enable-libzvbi --enable-libtesseract --enable-libzmq
>   libavutil  55. 24.100 / 55. 24.100
>   libavcodec 57. 43.100 / 57. 43.100
>   libavformat57. 37.100 / 57. 37.100
>   libavdevice57.  0.101 / 57.  0.101
>   libavfilter 6. 46.100 /  6. 46.100
>   libswscale  4.  1.100 /  4.  1.100
>   libswresample   2.  0.101 /  2.  0.101
>   libpostproc54.  0.100 / 54.  0.100
> [mpegts @ 0xaf60900] start time for stream 1 is not set in 
> estimate_timings_from_pts
> Input #0, mpegts, from 'nrk-outputfile-NzyUCD.ts':
>   Duration: 02:56:59.75, start: 10.099667, bitrate: 176 kb/s
>   Program 1
> Stream #0:0[0x100]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, 
> stereo, fltp, 175 kb/s
> Stream #0:1[0x101]: Data: timed_id3 (ID3  / 0x20334449)

> [fftextdata @ 0xaf687a0] Using AVStream.codec to pass codec parameters to 
> muxers is deprecated, use AVStream.codecpar instead.

This one is currently shown in every conversion.

[...]
-- 
FFmpeg = Fundamental and Fostering Minimalistic Philosophical Ecumenical Ghost
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avutil/qsv: move ff_qsv_error function from libavcodec into libavutil, because it's going to be shared between libavcodec (existing QSV encoders & decoders), libavfilter (up

2016-05-24 Thread Mark Thompson
On 24/05/16 12:49, nablet developer wrote:
> 
>> On 24 May 2016, at 17:01, Mark Thompson  wrote:
>>
>> On 13/04/16 09:18, nablet developer wrote:
>>> Signed-off-by: nablet developer 
>>> ---
>>> libavcodec/qsv.c  | 35 +---
>>> libavcodec/qsv_internal.h |  5 
>>> libavcodec/qsvdec.c   |  1 +
>>> libavcodec/qsvenc.c   |  1 +
>>> libavutil/Makefile|  1 +
>>> libavutil/qsv_internal.c  | 58 
>>> +++
>>> libavutil/qsv_internal.h  | 27 ++
>>> 7 files changed, 89 insertions(+), 39 deletions(-)
>>> create mode 100644 libavutil/qsv_internal.c
>>> create mode 100644 libavutil/qsv_internal.h
>>>
>>> diff --git a/libavutil/qsv_internal.h b/libavutil/qsv_internal.h
>>> new file mode 100644
>>> index 000..de00d09
>>> --- /dev/null
>>> +++ b/libavutil/qsv_internal.h
>>> ...
>>> +/**
>>> +  * Convert a libmfx error code into a ffmpeg error code.
>>> +  */
>>> +int ff_qsv_error(int mfx_err);
>>
>> This fails for non-static builds because of the namespace prefix (try 
>> building
>> the shared libraries).
> 
> oh, good catch, thanks. I think function then should be called 
> "avpriv_qsv_error" according to the 
> https://ffmpeg.org/developer.html#Naming-conventions 
> , right?

Correct, assuming this form is accepted.

(For example, it could instead be a static inline function and avoid the
namespace issue by not appearing as a symbol in the binary.  Not sure whether
that is actually better, but it is a possibility to consider.)

> I will also test my further changes with shared builds starting from now (I 
> was using instructions from 
> https://trac.ffmpeg.org/wiki/CompilationGuide/Centos 
>  which were for static 
> build).
> 
>>
>> Does this function really need to be available everywhere?  I think you 
>> should
>> wait until you have other patches which actually require it to so that this
>> change can be assessed properly.  In isolation, it is not useful.
> 
> hm, if my other patches will depend on this patch, how can they be applied 
> before this change? I am actually following advice from 
> https://ffmpeg.org/developer.html#Submitting-patches-1 
>  to split patches 
> into small self-contained pieces. please advice how to proceed.

I was meaning sending this patch along with others together as a patch series.
They are still distinct changes, self-contained in each patch and possible to
apply separately in order, but submitted together in order to make the review
more meaningful.

- Mark

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


Re: [FFmpeg-devel] [PATCH] avutil/qsv: move ff_qsv_error function from libavcodec into libavutil, because it's going to be shared between libavcodec (existing QSV encoders & decoders), libavfilter (up

2016-05-24 Thread nablet developer

> On 24 May 2016, at 17:01, Mark Thompson  wrote:
> 
> On 13/04/16 09:18, nablet developer wrote:
>> Signed-off-by: nablet developer 
>> ---
>> libavcodec/qsv.c  | 35 +---
>> libavcodec/qsv_internal.h |  5 
>> libavcodec/qsvdec.c   |  1 +
>> libavcodec/qsvenc.c   |  1 +
>> libavutil/Makefile|  1 +
>> libavutil/qsv_internal.c  | 58 
>> +++
>> libavutil/qsv_internal.h  | 27 ++
>> 7 files changed, 89 insertions(+), 39 deletions(-)
>> create mode 100644 libavutil/qsv_internal.c
>> create mode 100644 libavutil/qsv_internal.h
>> 
>> diff --git a/libavutil/qsv_internal.h b/libavutil/qsv_internal.h
>> new file mode 100644
>> index 000..de00d09
>> --- /dev/null
>> +++ b/libavutil/qsv_internal.h
>> ...
>> +/**
>> +  * Convert a libmfx error code into a ffmpeg error code.
>> +  */
>> +int ff_qsv_error(int mfx_err);
> 
> This fails for non-static builds because of the namespace prefix (try building
> the shared libraries).

oh, good catch, thanks. I think function then should be called 
"avpriv_qsv_error" according to the 
https://ffmpeg.org/developer.html#Naming-conventions 
, right?
I will also test my further changes with shared builds starting from now (I was 
using instructions from https://trac.ffmpeg.org/wiki/CompilationGuide/Centos 
 which were for static 
build).

> 
> Does this function really need to be available everywhere?  I think you should
> wait until you have other patches which actually require it to so that this
> change can be assessed properly.  In isolation, it is not useful.

hm, if my other patches will depend on this patch, how can they be applied 
before this change? I am actually following advice from 
https://ffmpeg.org/developer.html#Submitting-patches-1 
 to split patches into 
small self-contained pieces. please advice how to proceed.

> 
> Also, you should have a look at your mail setup.  This arrived today dated six
> weeks ago - either it has taken unreasonably long to arrive or something 
> strange
> is going on at your sending machine.

e-mail was sent today - I was using CentOS development virtual machine which 
had no ntp installed, now it's corrected. sorry for the inconveniences.

> 
> Thanks,
> 
> - Mark
> 
> ___
> 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] avutil/qsv: move ff_qsv_error function from libavcodec into libavutil, because it's going to be shared between libavcodec (existing QSV encoders & decoders), libavfilter (up

2016-05-24 Thread Mark Thompson
On 13/04/16 09:18, nablet developer wrote:
> Signed-off-by: nablet developer 
> ---
>  libavcodec/qsv.c  | 35 +---
>  libavcodec/qsv_internal.h |  5 
>  libavcodec/qsvdec.c   |  1 +
>  libavcodec/qsvenc.c   |  1 +
>  libavutil/Makefile|  1 +
>  libavutil/qsv_internal.c  | 58 
> +++
>  libavutil/qsv_internal.h  | 27 ++
>  7 files changed, 89 insertions(+), 39 deletions(-)
>  create mode 100644 libavutil/qsv_internal.c
>  create mode 100644 libavutil/qsv_internal.h
> 
> diff --git a/libavutil/qsv_internal.h b/libavutil/qsv_internal.h
> new file mode 100644
> index 000..de00d09
> --- /dev/null
> +++ b/libavutil/qsv_internal.h
> ...
> +/**
> +  * Convert a libmfx error code into a ffmpeg error code.
> +  */
> +int ff_qsv_error(int mfx_err);

This fails for non-static builds because of the namespace prefix (try building
the shared libraries).

Does this function really need to be available everywhere?  I think you should
wait until you have other patches which actually require it to so that this
change can be assessed properly.  In isolation, it is not useful.

Also, you should have a look at your mail setup.  This arrived today dated six
weeks ago - either it has taken unreasonably long to arrive or something strange
is going on at your sending machine.

Thanks,

- Mark

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


Re: [FFmpeg-devel] [PATCH] Respect payload offset in av_grow_packet

2016-05-24 Thread Michael Niedermayer
On Tue, May 24, 2016 at 12:32:19PM +0300, Andriy Lysnevych wrote:
> This one removed:
> 
> >> -if (!pkt->size)
> >> -return av_new_packet(pkt, grow_by);
> 
> pkt->size can be 0 but reference-counted buf allocated. av_new_packet
> leads to memory leak in this case. (FIXME?)
> 
> >> -if ((unsigned)grow_by >
> >> -INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE))
> >> -return -1;
> >>
> >>  new_size = pkt->size + grow_by + AV_INPUT_BUFFER_PADDING_SIZE;
> >
> > you remove the overflow check, which makes this undefined behavior
> > (note that this is also so when the value is not used)
> >
> 
> This check is not removed. It duplicated in two if branches:

The check must be before
 "new_size = pkt->size + grow_by + AV_INPUT_BUFFER_PADDING_SIZE;"

the addition is undefined bahevior if it overflows

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

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway


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


Re: [FFmpeg-devel] [PATCH] Respect payload offset in av_grow_packet

2016-05-24 Thread Andriy Lysnevych
This one removed:

>> -if (!pkt->size)
>> -return av_new_packet(pkt, grow_by);

pkt->size can be 0 but reference-counted buf allocated. av_new_packet
leads to memory leak in this case. (FIXME?)

>> -if ((unsigned)grow_by >
>> -INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE))
>> -return -1;
>>
>>  new_size = pkt->size + grow_by + AV_INPUT_BUFFER_PADDING_SIZE;
>
> you remove the overflow check, which makes this undefined behavior
> (note that this is also so when the value is not used)
>

This check is not removed. It duplicated in two if branches:

if (pkt->buf) {
+int data_offset = pkt->data - pkt->buf->data;
+if ((unsigned)grow_by >
+INT_MAX - (pkt->size + data_offset + AV_INPUT_BUFFER_PADDING_SIZE))
+return -1;
...
} else {
+if ((unsigned)grow_by >
+INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE))
+return -1;
...
}

Please specify more detailed if I missed something. Thanks!
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avutil/qsv: move ff_qsv_error function from libavcodec into libavutil, because it's going to be shared between libavcodec (existing QSV encoders & decoders), libavfilter (upcomi

2016-05-24 Thread nablet developer
Signed-off-by: nablet developer 
---
 libavcodec/qsv.c  | 35 +---
 libavcodec/qsv_internal.h |  5 
 libavcodec/qsvdec.c   |  1 +
 libavcodec/qsvenc.c   |  1 +
 libavutil/Makefile|  1 +
 libavutil/qsv_internal.c  | 58 +++
 libavutil/qsv_internal.h  | 27 ++
 7 files changed, 89 insertions(+), 39 deletions(-)
 create mode 100644 libavutil/qsv_internal.c
 create mode 100644 libavutil/qsv_internal.h

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 11d453d..6db4dd4 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -29,6 +29,7 @@
 
 #include "avcodec.h"
 #include "qsv_internal.h"
+#include "libavutil/qsv_internal.h"
 
 int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
 {
@@ -51,40 +52,6 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
 return AVERROR(ENOSYS);
 }
 
-int ff_qsv_error(int mfx_err)
-{
-switch (mfx_err) {
-case MFX_ERR_NONE:
-return 0;
-case MFX_ERR_MEMORY_ALLOC:
-case MFX_ERR_NOT_ENOUGH_BUFFER:
-return AVERROR(ENOMEM);
-case MFX_ERR_INVALID_HANDLE:
-return AVERROR(EINVAL);
-case MFX_ERR_DEVICE_FAILED:
-case MFX_ERR_DEVICE_LOST:
-case MFX_ERR_LOCK_MEMORY:
-return AVERROR(EIO);
-case MFX_ERR_NULL_PTR:
-case MFX_ERR_UNDEFINED_BEHAVIOR:
-case MFX_ERR_NOT_INITIALIZED:
-return AVERROR_BUG;
-case MFX_ERR_UNSUPPORTED:
-case MFX_ERR_NOT_FOUND:
-return AVERROR(ENOSYS);
-case MFX_ERR_MORE_DATA:
-case MFX_ERR_MORE_SURFACE:
-case MFX_ERR_MORE_BITSTREAM:
-return AVERROR(EAGAIN);
-case MFX_ERR_INCOMPATIBLE_VIDEO_PARAM:
-case MFX_ERR_INVALID_VIDEO_PARAM:
-return AVERROR(EINVAL);
-case MFX_ERR_ABORTED:
-case MFX_ERR_UNKNOWN:
-default:
-return AVERROR_UNKNOWN;
-}
-}
 static int ff_qsv_set_display_handle(AVCodecContext *avctx, QSVSession *qs)
 {
 // this code is only required for Linux.  It searches for a valid
diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index f289a2b..ce2531b 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -73,11 +73,6 @@ typedef struct QSVSession {
 #endif
 } QSVSession;
 
-/**
- * Convert a libmfx error code into a ffmpeg error code.
- */
-int ff_qsv_error(int mfx_err);
-
 int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id);
 
 int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs,
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index c17606d..a2a90b5 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -36,6 +36,7 @@
 #include "internal.h"
 #include "qsv.h"
 #include "qsv_internal.h"
+#include "libavutil/qsv_internal.h"
 #include "qsvdec.h"
 
 int ff_qsv_map_pixfmt(enum AVPixelFormat format)
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 132cf47..442ead6 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -36,6 +36,7 @@
 #include "internal.h"
 #include "qsv.h"
 #include "qsv_internal.h"
+#include "libavutil/qsv_internal.h"
 #include "qsvenc.h"
 
 static const struct {
diff --git a/libavutil/Makefile b/libavutil/Makefile
index a35deb6..e358767 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -154,6 +154,7 @@ OBJS-$(!HAVE_ATOMICS_NATIVE)+= atomic.o 
\
 OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o
 OBJS-$(CONFIG_LZO)  += lzo.o
 OBJS-$(CONFIG_OPENCL)   += opencl.o opencl_internal.o
+OBJS-$(CONFIG_QSV)  += qsv_internal.o
 OBJS-$(CONFIG_VAAPI)+= hwcontext_vaapi.o
 OBJS-$(CONFIG_VDPAU)+= hwcontext_vdpau.o
 
diff --git a/libavutil/qsv_internal.c b/libavutil/qsv_internal.c
new file mode 100644
index 000..9ebe035
--- /dev/null
+++ b/libavutil/qsv_internal.c
@@ -0,0 +1,58 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include "avutil.h"
+#include "qsv_internal.h"
+
+#include 
+
+int ff_qsv_error(int mfx_err)
+{
+switch (mfx_err) {
+case MFX_ERR_NONE:
+return 0;
+case MFX_ERR_MEMORY_ALLOC:
+case MFX_ERR_NOT_ENOUGH_BUFFER:
+return AVERROR(ENOMEM);
+case