[FFmpeg-cvslog] Merge commit '1098f5c0495c61a98d4ff6b8e24c17974d4bace5'

2016-04-14 Thread Derek Buitenhuis
ffmpeg | branch: master | Derek Buitenhuis  | Thu 
Apr 14 13:25:17 2016 +0100| [7af788aa625735fa9b3ff2e647f497c62127e855] | 
committer: Derek Buitenhuis

Merge commit '1098f5c0495c61a98d4ff6b8e24c17974d4bace5'

* commit '1098f5c0495c61a98d4ff6b8e24c17974d4bace5':
  svq3: Use a separate buffer for decoding the slices

Merged-by: Derek Buitenhuis 

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

 libavcodec/svq3.c |   55 +++--
 1 file changed, 32 insertions(+), 23 deletions(-)

diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 57205c6..ad3bd5a 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -76,10 +76,12 @@ typedef struct SVQ3Context {
 H264Picture *cur_pic;
 H264Picture *next_pic;
 H264Picture *last_pic;
+GetBitContext gb;
+uint8_t *slice_buf;
+int slice_size;
 int halfpel_flag;
 int thirdpel_flag;
 int has_watermark;
-int next_slice_index;
 uint32_t watermark_key;
 uint8_t *buf;
 int buf_size;
@@ -787,37 +789,43 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
 int i, header;
 unsigned slice_id;
 
-header = get_bits(&h->gb, 8);
+header = get_bits(&s->gb, 8);
 
 if (((header & 0x9F) != 1 && (header & 0x9F) != 2) || (header & 0x60) == 
0) {
 /* TODO: what? */
 av_log(avctx, AV_LOG_ERROR, "unsupported slice header (%02X)\n", 
header);
 return -1;
 } else {
+int slice_bits, slice_bytes, slice_length;
 int length = header >> 5 & 3;
 
-s->next_slice_index = get_bits_count(&h->gb) +
-  8 * show_bits(&h->gb, 8 * length) +
-  8 * length;
+slice_length = show_bits(&s->gb, 8 * length);
+slice_bits   = slice_length * 8;
+slice_bytes  = slice_length + length - 1;
 
-if (s->next_slice_index > h->gb.size_in_bits) {
+if (slice_bytes > get_bits_left(&s->gb)) {
 av_log(avctx, AV_LOG_ERROR, "slice after bitstream end\n");
 return -1;
 }
 
-h->gb.size_in_bits = s->next_slice_index - 8 * (length - 1);
-skip_bits(&h->gb, 8);
+skip_bits(&s->gb, 8);
+
+av_fast_malloc(&s->slice_buf, &s->slice_size, slice_bytes + 
AV_INPUT_BUFFER_PADDING_SIZE);
+if (!s->slice_buf)
+return AVERROR(ENOMEM);
+
+memcpy(s->slice_buf, s->gb.buffer + s->gb.index / 8, slice_bytes);
+
+init_get_bits(&h->gb, s->slice_buf, slice_bits);
 
 if (s->watermark_key) {
-uint32_t header = AV_RL32(&h->gb.buffer[(get_bits_count(&h->gb) >> 
3) + 1]);
-AV_WL32(&h->gb.buffer[(get_bits_count(&h->gb) >> 3) + 1],
-header ^ s->watermark_key);
+uint32_t header = AV_RL32(&h->gb.buffer[1]);
+AV_WL32(&h->gb.buffer[1], header ^ s->watermark_key);
 }
 if (length > 0) {
-memmove((uint8_t *) &h->gb.buffer[get_bits_count(&h->gb) >> 3],
-&h->gb.buffer[h->gb.size_in_bits >> 3], length - 1);
+memmove(s->slice_buf, &s->slice_buf[slice_length], length - 1);
 }
-skip_bits_long(&h->gb, 0);
+skip_bits_long(&s->gb, slice_bytes * 8);
 }
 
 if ((slice_id = svq3_get_ue_golomb(&h->gb)) >= 3) {
@@ -1194,7 +1202,9 @@ static int svq3_decode_frame(AVCodecContext *avctx, void 
*data,
 buf = avpkt->data;
 }
 
-init_get_bits(&h->gb, buf, 8 * buf_size);
+ret = init_get_bits(&s->gb, buf, 8 * buf_size);
+if (ret < 0)
+return ret;
 
 if (svq3_decode_slice_header(avctx))
 return -1;
@@ -1310,15 +1320,13 @@ static int svq3_decode_frame(AVCodecContext *avctx, 
void *data,
 unsigned mb_type;
 sl->mb_xy = sl->mb_x + sl->mb_y * h->mb_stride;
 
-if ((get_bits_count(&h->gb) + 7) >= h->gb.size_in_bits &&
-((get_bits_count(&h->gb) & 7) == 0 ||
- show_bits(&h->gb, -get_bits_count(&h->gb) & 7) == 0)) {
-skip_bits(&h->gb, s->next_slice_index - 
get_bits_count(&h->gb));
-h->gb.size_in_bits = 8 * buf_size;
-
-if (svq3_decode_slice_header(avctx))
-return -1;
+if ((get_bits_left(&h->gb)) <= 7) {
+if (((get_bits_count(&h->gb) & 7) == 0 ||
+show_bits(&h->gb, get_bits_left(&h->gb) & 7) == 0)) {
 
+if (svq3_decode_slice_header(avctx))
+return -1;
+}
 /* TODO: support s->mb_skip_run */
 }
 
@@ -1394,6 +1402,7 @@ static av_cold int svq3_decode_end(AVCodecContext *avctx)
 av_freep(&s->cur_pic);
 av_freep(&s->next_pic);
 av_freep(&s->last_pic);
+av_freep(&s->slice_buf);
 
 memset(&h->cur_pic, 0, sizeof(h->cur_pic));
 


==


[FFmpeg-cvslog] svq3: Use a separate buffer for decoding the slices

2016-04-14 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Sat Mar 12 
17:46:36 2016 +0100| [1098f5c0495c61a98d4ff6b8e24c17974d4bace5] | committer: 
Luca Barbato

svq3: Use a separate buffer for decoding the slices

The AVPacket.data should be considered read-only.

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

 libavcodec/svq3.c |   55 +++--
 1 file changed, 32 insertions(+), 23 deletions(-)

diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 80bc46a..90b20af 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -75,10 +75,12 @@ typedef struct SVQ3Context {
 H264Picture *cur_pic;
 H264Picture *next_pic;
 H264Picture *last_pic;
+GetBitContext gb;
+uint8_t *slice_buf;
+int slice_size;
 int halfpel_flag;
 int thirdpel_flag;
 int unknown_flag;
-int next_slice_index;
 uint32_t watermark_key;
 int adaptive_quant;
 int next_p_frame_damaged;
@@ -780,37 +782,43 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
 int i, header;
 unsigned slice_id;
 
-header = get_bits(&h->gb, 8);
+header = get_bits(&s->gb, 8);
 
 if (((header & 0x9F) != 1 && (header & 0x9F) != 2) || (header & 0x60) == 
0) {
 /* TODO: what? */
 av_log(avctx, AV_LOG_ERROR, "unsupported slice header (%02X)\n", 
header);
 return -1;
 } else {
+int slice_bits, slice_bytes, slice_length;
 int length = header >> 5 & 3;
 
-s->next_slice_index = get_bits_count(&h->gb) +
-  8 * show_bits(&h->gb, 8 * length) +
-  8 * length;
+slice_length = show_bits(&s->gb, 8 * length);
+slice_bits   = slice_length * 8;
+slice_bytes  = slice_length + length - 1;
 
-if (s->next_slice_index > h->gb.size_in_bits) {
+if (slice_bytes > get_bits_left(&s->gb)) {
 av_log(avctx, AV_LOG_ERROR, "slice after bitstream end\n");
 return -1;
 }
 
-h->gb.size_in_bits = s->next_slice_index - 8 * (length - 1);
-skip_bits(&h->gb, 8);
+skip_bits(&s->gb, 8);
+
+av_fast_malloc(&s->slice_buf, &s->slice_size, slice_bytes + 
AV_INPUT_BUFFER_PADDING_SIZE);
+if (!s->slice_buf)
+return AVERROR(ENOMEM);
+
+memcpy(s->slice_buf, s->gb.buffer + s->gb.index / 8, slice_bytes);
+
+init_get_bits(&h->gb, s->slice_buf, slice_bits);
 
 if (s->watermark_key) {
-uint32_t header = AV_RL32(&h->gb.buffer[(get_bits_count(&h->gb) >> 
3) + 1]);
-AV_WL32(&h->gb.buffer[(get_bits_count(&h->gb) >> 3) + 1],
-header ^ s->watermark_key);
+uint32_t header = AV_RL32(&h->gb.buffer[1]);
+AV_WL32(&h->gb.buffer[1], header ^ s->watermark_key);
 }
 if (length > 0) {
-memcpy((uint8_t *) &h->gb.buffer[get_bits_count(&h->gb) >> 3],
-   &h->gb.buffer[h->gb.size_in_bits >> 3], length - 1);
+memcpy(s->slice_buf, &s->slice_buf[slice_length], length - 1);
 }
-skip_bits_long(&h->gb, 0);
+skip_bits_long(&s->gb, slice_bytes * 8);
 }
 
 if ((slice_id = svq3_get_ue_golomb(&h->gb)) >= 3) {
@@ -1153,7 +1161,9 @@ static int svq3_decode_frame(AVCodecContext *avctx, void 
*data,
 return 0;
 }
 
-init_get_bits(&h->gb, buf, 8 * buf_size);
+ret = init_get_bits(&s->gb, buf, 8 * buf_size);
+if (ret < 0)
+return ret;
 
 sl->mb_x = sl->mb_y = sl->mb_xy = 0;
 
@@ -1269,15 +1279,13 @@ static int svq3_decode_frame(AVCodecContext *avctx, 
void *data,
 unsigned mb_type;
 sl->mb_xy = sl->mb_x + sl->mb_y * h->mb_stride;
 
-if ((get_bits_count(&h->gb) + 7) >= h->gb.size_in_bits &&
-((get_bits_count(&h->gb) & 7) == 0 ||
- show_bits(&h->gb, -get_bits_count(&h->gb) & 7) == 0)) {
-skip_bits(&h->gb, s->next_slice_index - 
get_bits_count(&h->gb));
-h->gb.size_in_bits = 8 * buf_size;
-
-if (svq3_decode_slice_header(avctx))
-return -1;
+if ((get_bits_left(&h->gb)) <= 7) {
+if (((get_bits_count(&h->gb) & 7) == 0 ||
+show_bits(&h->gb, get_bits_left(&h->gb) & 7) == 0)) {
 
+if (svq3_decode_slice_header(avctx))
+return -1;
+}
 /* TODO: support s->mb_skip_run */
 }
 
@@ -1341,6 +1349,7 @@ static av_cold int svq3_decode_end(AVCodecContext *avctx)
 av_freep(&s->cur_pic);
 av_freep(&s->next_pic);
 av_freep(&s->last_pic);
+av_freep(&s->slice_buf);
 
 memset(&h->cur_pic, 0, sizeof(h->cur_pic));
 

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


[FFmpeg-cvslog] lavu: add a way to query hwcontext frame constraints

2016-04-14 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Thu Feb 18 23:25:52 
2016 +| [b1f01e85a92d401a9b29c79f23db36b7685e8c09] | committer: Anton 
Khirnov

lavu: add a way to query hwcontext frame constraints

Signed-off-by: Anton Khirnov 

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

 doc/APIchanges |3 ++
 libavutil/hwcontext.c  |   45 ++
 libavutil/hwcontext.h  |   69 
 libavutil/hwcontext_internal.h |   10 ++
 libavutil/version.h|2 +-
 5 files changed, 128 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 20fecb9..759816b 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2016-xx-xx - xxx - lavu 55.7.0 - hwcontext.h
+  Add AVHWFramesConstraints and associated API.
+
 2016-02-23 - 9200514 - lavf 57.5.0 - avformat.h
   Add AVStream.codecpar, deprecate AVStream.codec.
 
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index b6d0518..53e11b8 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -400,3 +400,48 @@ int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, 
AVFrame *frame, int flags)
 
 return 0;
 }
+
+void *av_hwdevice_hwconfig_alloc(AVBufferRef *ref)
+{
+AVHWDeviceContext *ctx = (AVHWDeviceContext*)ref->data;
+const HWContextType  *hw_type = ctx->internal->hw_type;
+
+if (hw_type->device_hwconfig_size == 0)
+return NULL;
+
+return av_mallocz(hw_type->device_hwconfig_size);
+}
+
+AVHWFramesConstraints *av_hwdevice_get_hwframe_constraints(AVBufferRef *ref,
+   const void 
*hwconfig)
+{
+AVHWDeviceContext *ctx = (AVHWDeviceContext*)ref->data;
+const HWContextType  *hw_type = ctx->internal->hw_type;
+AVHWFramesConstraints *constraints;
+
+if (!hw_type->frames_get_constraints)
+return NULL;
+
+constraints = av_mallocz(sizeof(*constraints));
+if (!constraints)
+return NULL;
+
+constraints->min_width = constraints->min_height = 0;
+constraints->max_width = constraints->max_height = INT_MAX;
+
+if (hw_type->frames_get_constraints(ctx, hwconfig, constraints) >= 0) {
+return constraints;
+} else {
+av_hwframe_constraints_free(&constraints);
+return NULL;
+}
+}
+
+void av_hwframe_constraints_free(AVHWFramesConstraints **constraints)
+{
+if (*constraints) {
+av_freep(&(*constraints)->valid_hw_formats);
+av_freep(&(*constraints)->valid_sw_formats);
+}
+av_freep(constraints);
+}
diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h
index 81ae817..681b555 100644
--- a/libavutil/hwcontext.h
+++ b/libavutil/hwcontext.h
@@ -326,4 +326,73 @@ int av_hwframe_transfer_get_formats(AVBufferRef 
*hwframe_ctx,
 enum AVPixelFormat **formats, int flags);
 
 
+/**
+ * This struct describes the constraints on hardware frames attached to
+ * a given device with a hardware-specific configuration.  This is returned
+ * by av_hwdevice_get_hwframe_constraints() and must be freed by
+ * av_hwframe_constraints_free() after use.
+ */
+typedef struct AVHWFramesConstraints {
+/**
+ * A list of possible values for format in the hw_frames_ctx,
+ * terminated by AV_PIX_FMT_NONE.  This member will always be filled.
+ */
+enum AVPixelFormat *valid_hw_formats;
+
+/**
+ * A list of possible values for sw_format in the hw_frames_ctx,
+ * terminated by AV_PIX_FMT_NONE.  Can be NULL if this information is
+ * not known.
+ */
+enum AVPixelFormat *valid_sw_formats;
+
+/**
+ * The minimum size of frames in this hw_frames_ctx.
+ * (Zero if not known.)
+ */
+int min_width;
+int min_height;
+
+/**
+ * The maximum size of frames in this hw_frames_ctx.
+ * (INT_MAX if not known / no limit.)
+ */
+int max_width;
+int max_height;
+} AVHWFramesConstraints;
+
+/**
+ * Allocate a HW-specific configuration structure for a given HW device.
+ * After use, the user must free all members as required by the specific
+ * hardware structure being used, then free the structure itself with
+ * av_free().
+ *
+ * @param device_ctx a reference to the associated AVHWDeviceContext.
+ * @return The newly created HW-specific configuration structure on
+ * success or NULL on failure.
+ */
+void *av_hwdevice_hwconfig_alloc(AVBufferRef *device_ctx);
+
+/**
+ * Get the constraints on HW frames given a device and the HW-specific
+ * configuration to be used with that device.  If no HW-specific
+ * confgiuration is provided, returns the maximum possible capabilities
+ * of the device.
+ *
+ * @param device_ctx a reference to the associated AVHWDeviceContext.
+ * @param hwconfig a filled HW-specific configuration structure, or NULL
+ *to re

[FFmpeg-cvslog] Merge commit 'b1f01e85a92d401a9b29c79f23db36b7685e8c09'

2016-04-14 Thread Derek Buitenhuis
ffmpeg | branch: master | Derek Buitenhuis  | Thu 
Apr 14 13:33:37 2016 +0100| [afccfaf26ac8fae3257302a74110b40615dfa05d] | 
committer: Derek Buitenhuis

Merge commit 'b1f01e85a92d401a9b29c79f23db36b7685e8c09'

* commit 'b1f01e85a92d401a9b29c79f23db36b7685e8c09':
  lavu: add a way to query hwcontext frame constraints

Merged-by: Derek Buitenhuis 

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

 doc/APIchanges |3 ++
 libavutil/hwcontext.c  |   45 ++
 libavutil/hwcontext.h  |   69 
 libavutil/hwcontext_internal.h |   10 ++
 libavutil/version.h|2 +-
 5 files changed, 128 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index cc73528..626fe18 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2016-xx-xx - xxx - lavu 55.21.0 - hwcontext.h
+  Add AVHWFramesConstraints and associated API.
+
 2016-04-11 - xxx - lavf 57.33.0 - avformat.h
   Add AVStream.codecpar, deprecate AVStream.codec.
 
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index 3eada29..4dfec2c 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -400,3 +400,48 @@ int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, 
AVFrame *frame, int flags)
 
 return 0;
 }
+
+void *av_hwdevice_hwconfig_alloc(AVBufferRef *ref)
+{
+AVHWDeviceContext *ctx = (AVHWDeviceContext*)ref->data;
+const HWContextType  *hw_type = ctx->internal->hw_type;
+
+if (hw_type->device_hwconfig_size == 0)
+return NULL;
+
+return av_mallocz(hw_type->device_hwconfig_size);
+}
+
+AVHWFramesConstraints *av_hwdevice_get_hwframe_constraints(AVBufferRef *ref,
+   const void 
*hwconfig)
+{
+AVHWDeviceContext *ctx = (AVHWDeviceContext*)ref->data;
+const HWContextType  *hw_type = ctx->internal->hw_type;
+AVHWFramesConstraints *constraints;
+
+if (!hw_type->frames_get_constraints)
+return NULL;
+
+constraints = av_mallocz(sizeof(*constraints));
+if (!constraints)
+return NULL;
+
+constraints->min_width = constraints->min_height = 0;
+constraints->max_width = constraints->max_height = INT_MAX;
+
+if (hw_type->frames_get_constraints(ctx, hwconfig, constraints) >= 0) {
+return constraints;
+} else {
+av_hwframe_constraints_free(&constraints);
+return NULL;
+}
+}
+
+void av_hwframe_constraints_free(AVHWFramesConstraints **constraints)
+{
+if (*constraints) {
+av_freep(&(*constraints)->valid_hw_formats);
+av_freep(&(*constraints)->valid_sw_formats);
+}
+av_freep(constraints);
+}
diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h
index f46a39f..ee0f1df 100644
--- a/libavutil/hwcontext.h
+++ b/libavutil/hwcontext.h
@@ -326,4 +326,73 @@ int av_hwframe_transfer_get_formats(AVBufferRef 
*hwframe_ctx,
 enum AVPixelFormat **formats, int flags);
 
 
+/**
+ * This struct describes the constraints on hardware frames attached to
+ * a given device with a hardware-specific configuration.  This is returned
+ * by av_hwdevice_get_hwframe_constraints() and must be freed by
+ * av_hwframe_constraints_free() after use.
+ */
+typedef struct AVHWFramesConstraints {
+/**
+ * A list of possible values for format in the hw_frames_ctx,
+ * terminated by AV_PIX_FMT_NONE.  This member will always be filled.
+ */
+enum AVPixelFormat *valid_hw_formats;
+
+/**
+ * A list of possible values for sw_format in the hw_frames_ctx,
+ * terminated by AV_PIX_FMT_NONE.  Can be NULL if this information is
+ * not known.
+ */
+enum AVPixelFormat *valid_sw_formats;
+
+/**
+ * The minimum size of frames in this hw_frames_ctx.
+ * (Zero if not known.)
+ */
+int min_width;
+int min_height;
+
+/**
+ * The maximum size of frames in this hw_frames_ctx.
+ * (INT_MAX if not known / no limit.)
+ */
+int max_width;
+int max_height;
+} AVHWFramesConstraints;
+
+/**
+ * Allocate a HW-specific configuration structure for a given HW device.
+ * After use, the user must free all members as required by the specific
+ * hardware structure being used, then free the structure itself with
+ * av_free().
+ *
+ * @param device_ctx a reference to the associated AVHWDeviceContext.
+ * @return The newly created HW-specific configuration structure on
+ * success or NULL on failure.
+ */
+void *av_hwdevice_hwconfig_alloc(AVBufferRef *device_ctx);
+
+/**
+ * Get the constraints on HW frames given a device and the HW-specific
+ * configuration to be used with that device.  If no HW-specific
+ * confgiuration is provided, returns the maximum possible capabilities
+ * of the device.
+ *
+ * @param device_ctx a reference to the a

[FFmpeg-cvslog] lavu: deprecate AV_PIX_FMT_VAAPI_*, replace with AV_PIX_FMT_VAAPI

2016-04-14 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Mon Mar  7 22:34:59 
2016 +| [d264c720f7b74286840719e506daba39f83b438b] | committer: Anton 
Khirnov

lavu: deprecate AV_PIX_FMT_VAAPI_*, replace with AV_PIX_FMT_VAAPI

Signed-off-by: Anton Khirnov 

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

 doc/APIchanges   |4 
 libavcodec/h263dec.c |2 +-
 libavcodec/h264_slice.c  |2 +-
 libavcodec/mpeg12dec.c   |2 +-
 libavcodec/vaapi_h264.c  |2 +-
 libavcodec/vaapi_mpeg2.c |2 +-
 libavcodec/vaapi_mpeg4.c |4 ++--
 libavcodec/vaapi_vc1.c   |4 ++--
 libavcodec/vc1dec.c  |2 +-
 libavutil/pixdesc.c  |   14 ++
 libavutil/pixfmt.h   |5 +
 libavutil/version.h  |5 -
 12 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 759816b..4effe0a 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,10 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2016-xx-xx - xxx - lavu 55.8.0 - pixfmt.h
+  Deprecate all AV_PIX_FMT_VAAPI_* formats.
+  Replaced by AV_PIX_FMT_VAAPI.
+
 2016-xx-xx - xxx - lavu 55.7.0 - hwcontext.h
   Add AVHWFramesConstraints and associated API.
 
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 9e8cea5..10db4d9 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -655,7 +655,7 @@ intrax8_decoded:
 
 const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[] = {
 #if CONFIG_H263_VAAPI_HWACCEL || CONFIG_MPEG4_VAAPI_HWACCEL
-AV_PIX_FMT_VAAPI_VLD,
+AV_PIX_FMT_VAAPI,
 #endif
 #if CONFIG_MPEG4_VDPAU_HWACCEL
 AV_PIX_FMT_VDPAU,
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 8dde140..a94ff28 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -876,7 +876,7 @@ static enum AVPixelFormat get_pixel_format(H264Context *h)
 *fmt++ = AV_PIX_FMT_D3D11VA_VLD;
 #endif
 #if CONFIG_H264_VAAPI_HWACCEL
-*fmt++ = AV_PIX_FMT_VAAPI_VLD;
+*fmt++ = AV_PIX_FMT_VAAPI;
 #endif
 #if CONFIG_H264_VDA_HWACCEL
 *fmt++ = AV_PIX_FMT_VDA_VLD;
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index c1f3527..6e1db1e 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1137,7 +1137,7 @@ static const enum AVPixelFormat 
mpeg12_hwaccel_pixfmt_list_420[] = {
 AV_PIX_FMT_D3D11VA_VLD,
 #endif
 #if CONFIG_MPEG2_VAAPI_HWACCEL
-AV_PIX_FMT_VAAPI_VLD,
+AV_PIX_FMT_VAAPI,
 #endif
 #if CONFIG_MPEG1_VDPAU_HWACCEL | CONFIG_MPEG2_VDPAU_HWACCEL
 AV_PIX_FMT_VDPAU,
diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
index 82a49f6..7f7de56 100644
--- a/libavcodec/vaapi_h264.c
+++ b/libavcodec/vaapi_h264.c
@@ -358,7 +358,7 @@ AVHWAccel ff_h264_vaapi_hwaccel = {
 .name   = "h264_vaapi",
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_H264,
-.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
+.pix_fmt= AV_PIX_FMT_VAAPI,
 .start_frame= vaapi_h264_start_frame,
 .end_frame  = vaapi_h264_end_frame,
 .decode_slice   = vaapi_h264_decode_slice,
diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
index 7d0e205..cb8a782 100644
--- a/libavcodec/vaapi_mpeg2.c
+++ b/libavcodec/vaapi_mpeg2.c
@@ -139,7 +139,7 @@ AVHWAccel ff_mpeg2_vaapi_hwaccel = {
 .name   = "mpeg2_vaapi",
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_MPEG2VIDEO,
-.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
+.pix_fmt= AV_PIX_FMT_VAAPI,
 .start_frame= vaapi_mpeg2_start_frame,
 .end_frame  = ff_vaapi_mpeg_end_frame,
 .decode_slice   = vaapi_mpeg2_decode_slice,
diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c
index 1b9053c..5498a9e 100644
--- a/libavcodec/vaapi_mpeg4.c
+++ b/libavcodec/vaapi_mpeg4.c
@@ -153,7 +153,7 @@ AVHWAccel ff_mpeg4_vaapi_hwaccel = {
 .name   = "mpeg4_vaapi",
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_MPEG4,
-.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
+.pix_fmt= AV_PIX_FMT_VAAPI,
 .start_frame= vaapi_mpeg4_start_frame,
 .end_frame  = ff_vaapi_mpeg_end_frame,
 .decode_slice   = vaapi_mpeg4_decode_slice,
@@ -165,7 +165,7 @@ AVHWAccel ff_h263_vaapi_hwaccel = {
 .name   = "h263_vaapi",
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_H263,
-.pix_fmt= AV_PIX_FMT_VAAPI_VLD,
+.pix_fmt= AV_PIX_FMT_VAAPI,
 .start_frame= vaapi_mpeg4_start_frame,
 .end_frame  = ff_vaapi_mpeg_end_frame,
 .decode_slice   = vaapi_mpeg4_decode_slice,
diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
index fe01c52..87a75ec 100644
--- a/libavcodec/vaapi_vc1.c
+++ b/libavcodec/vaapi_vc1.c
@@ -339,7 +339,7 @@ AVHWAccel ff_wmv3_vaapi_hwaccel = {
 .name   = "wmv3_vaapi",
 .type   

[FFmpeg-cvslog] Merge commit 'd264c720f7b74286840719e506daba39f83b438b'

2016-04-14 Thread Derek Buitenhuis
ffmpeg | branch: master | Derek Buitenhuis  | Thu 
Apr 14 13:44:19 2016 +0100| [eb2da769bddf7e8f4f3202162dacd17c0dd8] | 
committer: Derek Buitenhuis

Merge commit 'd264c720f7b74286840719e506daba39f83b438b'

* commit 'd264c720f7b74286840719e506daba39f83b438b':
  lavu: deprecate AV_PIX_FMT_VAAPI_*, replace with AV_PIX_FMT_VAAPI

Merged-by: Derek Buitenhuis 

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

 libavutil/pixdesc.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 981fa0e..8a9475c 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2134,6 +2134,11 @@ enum AVPixelFormat av_get_pix_fmt(const char *name)
 snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
 pix_fmt = get_pix_fmt_internal(name2);
 }
+
+#if FF_API_VAAPI
+if (pix_fmt == AV_PIX_FMT_NONE && !strcmp(name, "vaapi"))
+pix_fmt = AV_PIX_FMT_VAAPI;
+#endif
 return pix_fmt;
 }
 


==


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


[FFmpeg-cvslog] Merge commit '551c6775abb5e0ad34c26d7e23bc6fbbe8ccc9d4'

2016-04-14 Thread Derek Buitenhuis
ffmpeg | branch: master | Derek Buitenhuis  | Thu 
Apr 14 13:49:55 2016 +0100| [28abb216cbd5736d65973165b830c08815ce0227] | 
committer: Derek Buitenhuis

Merge commit '551c6775abb5e0ad34c26d7e23bc6fbbe8ccc9d4'

* commit '551c6775abb5e0ad34c26d7e23bc6fbbe8ccc9d4':
  lavu: VAAPI hwcontext implementation

Merged-by: Derek Buitenhuis 

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

 configure  |4 +
 doc/APIchanges |3 +
 libavutil/Makefile |3 +
 libavutil/hwcontext.c  |3 +
 libavutil/hwcontext.h  |1 +
 libavutil/hwcontext_internal.h |1 +
 libavutil/hwcontext_vaapi.c|  850 
 libavutil/hwcontext_vaapi.h|   82 
 libavutil/version.h|2 +-
 9 files changed, 948 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 0ff1b9d..f981a4e 100755
--- a/configure
+++ b/configure
@@ -5852,6 +5852,10 @@ enabled vaapi &&
 check_lib va/va.h vaInitialize -lva ||
 disable vaapi
 
+enabled vaapi &&
+check_code cc "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)" ||
+disable vaapi
+
 enabled vaapi && enabled xlib &&
 check_lib2 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 &&
 enable vaapi_x11
diff --git a/doc/APIchanges b/doc/APIchanges
index 626fe18..7972b07 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2016-xx-xx - xxx - lavu 55.22.0 - hwcontext_vaapi.h
+  Add new installed header with VAAPI-specific hwcontext definitions.
+
 2016-xx-xx - xxx - lavu 55.21.0 - hwcontext.h
   Add AVHWFramesConstraints and associated API.
 
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 7a3076f..a91e701 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -33,6 +33,7 @@ HEADERS = adler32.h   
  \
   hmac.h\
   hwcontext.h   \
   hwcontext_cuda.h  \
+  hwcontext_vaapi.h \
   hwcontext_vdpau.h \
   imgutils.h\
   intfloat.h\
@@ -153,6 +154,7 @@ OBJS-$(!HAVE_ATOMICS_NATIVE)+= atomic.o 
\
 OBJS-$(CONFIG_LZO)  += lzo.o
 OBJS-$(CONFIG_OPENCL)   += opencl.o opencl_internal.o
 OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o
+OBJS-$(CONFIG_VAAPI)+= hwcontext_vaapi.o
 OBJS-$(CONFIG_VDPAU)+= hwcontext_vdpau.o
 
 OBJS += $(COMPAT_OBJS:%=../compat/%)
@@ -161,6 +163,7 @@ OBJS += $(COMPAT_OBJS:%=../compat/%)
 SLIBOBJS-$(HAVE_GNU_WINDRES)+= avutilres.o
 
 SKIPHEADERS-$(CONFIG_CUDA) += hwcontext_cuda.h
+SKIPHEADERS-$(CONFIG_VAAPI)+= hwcontext_vaapi.h
 SKIPHEADERS-$(CONFIG_VDPAU)+= hwcontext_vdpau.h
 SKIPHEADERS-$(HAVE_ATOMICS_GCC)+= atomic_gcc.h
 SKIPHEADERS-$(HAVE_ATOMICS_SUNCC)  += atomic_suncc.h
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index 4dfec2c..b34b317 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -32,6 +32,9 @@ static const HWContextType *hw_table[] = {
 #if CONFIG_CUDA
 &ff_hwcontext_type_cuda,
 #endif
+#if CONFIG_VAAPI
+&ff_hwcontext_type_vaapi,
+#endif
 #if CONFIG_VDPAU
 &ff_hwcontext_type_vdpau,
 #endif
diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h
index ee0f1df..44be197 100644
--- a/libavutil/hwcontext.h
+++ b/libavutil/hwcontext.h
@@ -27,6 +27,7 @@
 enum AVHWDeviceType {
 AV_HWDEVICE_TYPE_VDPAU,
 AV_HWDEVICE_TYPE_CUDA,
+AV_HWDEVICE_TYPE_VAAPI,
 };
 
 typedef struct AVHWDeviceInternal AVHWDeviceInternal;
diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_internal.h
index 0ea04f8..f18b616 100644
--- a/libavutil/hwcontext_internal.h
+++ b/libavutil/hwcontext_internal.h
@@ -97,6 +97,7 @@ struct AVHWFramesInternal {
 };
 
 extern const HWContextType ff_hwcontext_type_cuda;
+extern const HWContextType ff_hwcontext_type_vaapi;
 extern const HWContextType ff_hwcontext_type_vdpau;
 
 #endif /* AVUTIL_HWCONTEXT_INTERNAL_H */
diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
new file mode 100644
index 000..c2cdaa9
--- /dev/null
+++ b/libavutil/hwcontext_vaapi.c
@@ -0,0 +1,850 @@
+/*
+ * 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-cvslog] lavu: VAAPI hwcontext implementation

2016-04-14 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Mon Feb 15 19:32:45 
2016 +| [551c6775abb5e0ad34c26d7e23bc6fbbe8ccc9d4] | committer: Anton 
Khirnov

lavu: VAAPI hwcontext implementation

Signed-off-by: Anton Khirnov 

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

 configure  |4 +
 doc/APIchanges |3 +
 libavutil/Makefile |3 +
 libavutil/hwcontext.c  |3 +
 libavutil/hwcontext.h  |1 +
 libavutil/hwcontext_internal.h |1 +
 libavutil/hwcontext_vaapi.c|  850 
 libavutil/hwcontext_vaapi.h|   82 
 libavutil/version.h|2 +-
 9 files changed, 948 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 9ffb679..5376e67 100755
--- a/configure
+++ b/configure
@@ -4681,6 +4681,10 @@ if enabled x11grab; then
 require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
 fi
 
+enabled vaapi &&
+check_code cc "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)" ||
+disable vaapi
+
 enabled vaapi && enabled xlib &&
 check_lib2 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 &&
 enable vaapi_x11
diff --git a/doc/APIchanges b/doc/APIchanges
index 4effe0a..bce8504 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2016-xx-xx - xxx - lavu 55.9.0 - hwcontext_vaapi.h
+  Add new installed header with VAAPI-specific hwcontext definitions.
+
 2016-xx-xx - xxx - lavu 55.8.0 - pixfmt.h
   Deprecate all AV_PIX_FMT_VAAPI_* formats.
   Replaced by AV_PIX_FMT_VAAPI.
diff --git a/libavutil/Makefile b/libavutil/Makefile
index a095f0d..0956703 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -25,6 +25,7 @@ HEADERS = adler32.h   
  \
   hmac.h\
   hwcontext.h   \
   hwcontext_cuda.h  \
+  hwcontext_vaapi.h \
   hwcontext_vdpau.h \
   imgutils.h\
   intfloat.h\
@@ -108,11 +109,13 @@ OBJS = adler32.o  
  \
 
 OBJS-$(CONFIG_LZO)  += lzo.o
 OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o
+OBJS-$(CONFIG_VAAPI)+= hwcontext_vaapi.o
 OBJS-$(CONFIG_VDPAU)+= hwcontext_vdpau.o
 
 OBJS += $(COMPAT_OBJS:%=../compat/%)
 
 SKIPHEADERS-$(CONFIG_CUDA) += hwcontext_cuda.h
+SKIPHEADERS-$(CONFIG_VAAPI)+= hwcontext_vaapi.h
 SKIPHEADERS-$(CONFIG_VDPAU)+= hwcontext_vdpau.h
 SKIPHEADERS-$(HAVE_ATOMICS_GCC)+= atomic_gcc.h
 SKIPHEADERS-$(HAVE_ATOMICS_SUNCC)  += atomic_suncc.h
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index 53e11b8..ac1e2c9 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -32,6 +32,9 @@ static const HWContextType *hw_table[] = {
 #if CONFIG_CUDA
 &ff_hwcontext_type_cuda,
 #endif
+#if CONFIG_VAAPI
+&ff_hwcontext_type_vaapi,
+#endif
 #if CONFIG_VDPAU
 &ff_hwcontext_type_vdpau,
 #endif
diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h
index 681b555..8502342 100644
--- a/libavutil/hwcontext.h
+++ b/libavutil/hwcontext.h
@@ -27,6 +27,7 @@
 enum AVHWDeviceType {
 AV_HWDEVICE_TYPE_VDPAU,
 AV_HWDEVICE_TYPE_CUDA,
+AV_HWDEVICE_TYPE_VAAPI,
 };
 
 typedef struct AVHWDeviceInternal AVHWDeviceInternal;
diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_internal.h
index 27de1f9..b7828c0 100644
--- a/libavutil/hwcontext_internal.h
+++ b/libavutil/hwcontext_internal.h
@@ -97,6 +97,7 @@ struct AVHWFramesInternal {
 };
 
 extern const HWContextType ff_hwcontext_type_cuda;
+extern const HWContextType ff_hwcontext_type_vaapi;
 extern const HWContextType ff_hwcontext_type_vdpau;
 
 #endif /* AVUTIL_HWCONTEXT_INTERNAL_H */
diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
new file mode 100644
index 000..1a385ba
--- /dev/null
+++ b/libavutil/hwcontext_vaapi.c
@@ -0,0 +1,850 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details

[FFmpeg-cvslog] Merge commit '07a844f32ebb78503981df017fa3ebfedb75fe1c'

2016-04-14 Thread Derek Buitenhuis
ffmpeg | branch: master | Derek Buitenhuis  | Thu 
Apr 14 13:59:45 2016 +0100| [8688d3af39e8cd8848e74407998777dd5aad3863] | 
committer: Derek Buitenhuis

Merge commit '07a844f32ebb78503981df017fa3ebfedb75fe1c'

* commit '07a844f32ebb78503981df017fa3ebfedb75fe1c':
  lavfi: generic hardware surface upload and download filters

Merged-by: Derek Buitenhuis 

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

 doc/APIchanges  |3 +
 libavfilter/Makefile|2 +
 libavfilter/allfilters.c|2 +
 libavfilter/avfilter.c  |2 +
 libavfilter/avfilter.h  |9 ++
 libavfilter/version.h   |4 +-
 libavfilter/vf_hwdownload.c |  212 +
 libavfilter/vf_hwupload.c   |  241 +++
 8 files changed, 473 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 7972b07..33bd02e 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2016-xx-xx - xxx - lavfi 6.42.0 - avfilter.h
+  Add AVFilterContext.hw_device_ctx.
+
 2016-xx-xx - xxx - lavu 55.22.0 - hwcontext_vaapi.h
   Add new installed header with VAAPI-specific hwcontext definitions.
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 9107514..ac1c35b 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -181,6 +181,8 @@ OBJS-$(CONFIG_HISTEQ_FILTER) += vf_histeq.o
 OBJS-$(CONFIG_HISTOGRAM_FILTER)  += vf_histogram.o
 OBJS-$(CONFIG_HQDN3D_FILTER) += vf_hqdn3d.o
 OBJS-$(CONFIG_HQX_FILTER)+= vf_hqx.o
+OBJS-$(CONFIG_HWDOWNLOAD_FILTER) += vf_hwdownload.o
+OBJS-$(CONFIG_HWUPLOAD_FILTER)   += vf_hwupload.o
 OBJS-$(CONFIG_HWUPLOAD_CUDA_FILTER)  += vf_hwupload_cuda.o
 OBJS-$(CONFIG_HSTACK_FILTER) += vf_stack.o framesync.o
 OBJS-$(CONFIG_HUE_FILTER)+= vf_hue.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 5c31ff2..5055a3b 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -202,6 +202,8 @@ void avfilter_register_all(void)
 REGISTER_FILTER(HISTOGRAM,  histogram,  vf);
 REGISTER_FILTER(HQDN3D, hqdn3d, vf);
 REGISTER_FILTER(HQX,hqx,vf);
+REGISTER_FILTER(HWDOWNLOAD, hwdownload, vf);
+REGISTER_FILTER(HWUPLOAD,   hwupload,   vf);
 REGISTER_FILTER(HWUPLOAD_CUDA,  hwupload_cuda,  vf);
 REGISTER_FILTER(HSTACK, hstack, vf);
 REGISTER_FILTER(HUE,hue,vf);
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 3a2a6c2..21f8d9e 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -762,6 +762,8 @@ void avfilter_free(AVFilterContext *filter)
 if (filter->filter->priv_class)
 av_opt_free(filter->priv);
 
+av_buffer_unref(&filter->hw_device_ctx);
+
 av_freep(&filter->name);
 av_freep(&filter->input_pads);
 av_freep(&filter->output_pads);
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 835a519..79227a7 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -344,6 +344,15 @@ struct AVFilterContext {
  */
 AVFilterInternal *internal;
 
+/**
+ * For filters which will create hardware frames, sets the device the
+ * filter should create them in.  All other filters will ignore this field:
+ * in particular, a filter which consumes or processes hardware frames will
+ * instead use the hw_frames_ctx field in AVFilterLink to carry the
+ * hardware context information.
+ */
+AVBufferRef *hw_device_ctx;
+
 struct AVFilterCommand *command_queue;
 
 char *enable_str;   ///< enable expression string
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 4cb5a2e..48b9d9a 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,8 +30,8 @@
 #include "libavutil/version.h"
 
 #define LIBAVFILTER_VERSION_MAJOR   6
-#define LIBAVFILTER_VERSION_MINOR  41
-#define LIBAVFILTER_VERSION_MICRO 101
+#define LIBAVFILTER_VERSION_MINOR  42
+#define LIBAVFILTER_VERSION_MICRO 100
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
diff --git a/libavfilter/vf_hwdownload.c b/libavfilter/vf_hwdownload.c
new file mode 100644
index 000..2dcc9fa
--- /dev/null
+++ b/libavfilter/vf_hwdownload.c
@@ -0,0 +1,212 @@
+/*
+ * 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 b

[FFmpeg-cvslog] lavfi: generic hardware surface upload and download filters

2016-04-14 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Thu Feb 25 00:21:40 
2016 +| [07a844f32ebb78503981df017fa3ebfedb75fe1c] | committer: Anton 
Khirnov

lavfi: generic hardware surface upload and download filters

Signed-off-by: Anton Khirnov 

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

 doc/APIchanges  |3 +
 libavfilter/Makefile|2 +
 libavfilter/allfilters.c|2 +
 libavfilter/avfilter.c  |2 +
 libavfilter/avfilter.h  |9 ++
 libavfilter/version.h   |2 +-
 libavfilter/vf_hwdownload.c |  212 +
 libavfilter/vf_hwupload.c   |  241 +++
 8 files changed, 472 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index bce8504..e0c4678 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2016-xx-xx - xxx - lavfi 6.3.0 - avfilter.h
+  Add AVFilterContext.hw_device_ctx.
+
 2016-xx-xx - xxx - lavu 55.9.0 - hwcontext_vaapi.h
   Add new installed header with VAAPI-specific hwcontext definitions.
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index f5dd2e9..fa6647b 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -56,6 +56,8 @@ OBJS-$(CONFIG_FREI0R_FILTER) += vf_frei0r.o
 OBJS-$(CONFIG_GRADFUN_FILTER)+= vf_gradfun.o
 OBJS-$(CONFIG_HFLIP_FILTER)  += vf_hflip.o
 OBJS-$(CONFIG_HQDN3D_FILTER) += vf_hqdn3d.o
+OBJS-$(CONFIG_HWDOWNLOAD_FILTER) += vf_hwdownload.o
+OBJS-$(CONFIG_HWUPLOAD_FILTER)   += vf_hwupload.o
 OBJS-$(CONFIG_HWUPLOAD_CUDA_FILTER)  += vf_hwupload_cuda.o
 OBJS-$(CONFIG_INTERLACE_FILTER)  += vf_interlace.o
 OBJS-$(CONFIG_LUT_FILTER)+= vf_lut.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 4bdfaea..9461145 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -82,6 +82,8 @@ void avfilter_register_all(void)
 REGISTER_FILTER(GRADFUN,gradfun,vf);
 REGISTER_FILTER(HFLIP,  hflip,  vf);
 REGISTER_FILTER(HQDN3D, hqdn3d, vf);
+REGISTER_FILTER(HWDOWNLOAD, hwdownload, vf);
+REGISTER_FILTER(HWUPLOAD,   hwupload,   vf);
 REGISTER_FILTER(HWUPLOAD_CUDA,  hwupload_cuda,  vf);
 REGISTER_FILTER(INTERLACE,  interlace,  vf);
 REGISTER_FILTER(LUT,lut,vf);
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 8eefc51..190d8ab 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -525,6 +525,8 @@ void avfilter_free(AVFilterContext *filter)
 if (filter->filter->priv_class)
 av_opt_free(filter->priv);
 
+av_buffer_unref(&filter->hw_device_ctx);
+
 av_freep(&filter->name);
 av_freep(&filter->input_pads);
 av_freep(&filter->output_pads);
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 0a0c415..65918fc 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -300,6 +300,15 @@ struct AVFilterContext {
  * An opaque struct for libavfilter internal use.
  */
 AVFilterInternal *internal;
+
+/**
+ * For filters which will create hardware frames, sets the device the
+ * filter should create them in.  All other filters will ignore this field:
+ * in particular, a filter which consumes or processes hardware frames will
+ * instead use the hw_frames_ctx field in AVFilterLink to carry the
+ * hardware context information.
+ */
+AVBufferRef *hw_device_ctx;
 };
 
 /**
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 0f3a522..1ca0f37 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,7 +30,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVFILTER_VERSION_MAJOR  6
-#define LIBAVFILTER_VERSION_MINOR  2
+#define LIBAVFILTER_VERSION_MINOR  3
 #define LIBAVFILTER_VERSION_MICRO  0
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
diff --git a/libavfilter/vf_hwdownload.c b/libavfilter/vf_hwdownload.c
new file mode 100644
index 000..0ba1d98
--- /dev/null
+++ b/libavfilter/vf_hwdownload.c
@@ -0,0 +1,212 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if

[FFmpeg-cvslog] Merge commit '9765549f551ff40869aee1a6492b6a976c86cfe9'

2016-04-14 Thread Derek Buitenhuis
ffmpeg | branch: master | Derek Buitenhuis  | Thu 
Apr 14 14:01:31 2016 +0100| [0520d573db71171053a684b1b2fed0598df1641f] | 
committer: Derek Buitenhuis

Merge commit '9765549f551ff40869aee1a6492b6a976c86cfe9'

* commit '9765549f551ff40869aee1a6492b6a976c86cfe9':
  mpegts: Forward the errors on mpeg4 objects parsing

Merged-by: Derek Buitenhuis 

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

 libavformat/mpegts.c |   25 -
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 5cdab58..e3de46a 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1362,6 +1362,8 @@ static int parse_MP4ODescrTag(MP4DescrParseContext *d, 
int64_t off, int len)
 static int parse_MP4ESDescrTag(MP4DescrParseContext *d, int64_t off, int len)
 {
 int es_id = 0;
+int ret   = 0;
+
 if (d->descr_count >= d->max_descr_count)
 return AVERROR_INVALIDDATA;
 ff_mp4_parse_es_descr(&d->pb, &es_id);
@@ -1369,12 +1371,13 @@ static int parse_MP4ESDescrTag(MP4DescrParseContext *d, 
int64_t off, int len)
 
 d->active_descr->es_id = es_id;
 update_offsets(&d->pb, &off, &len);
-parse_mp4_descr(d, off, len, MP4DecConfigDescrTag);
+if ((ret = parse_mp4_descr(d, off, len, MP4DecConfigDescrTag)) < 0)
+return ret;
 update_offsets(&d->pb, &off, &len);
 if (len > 0)
-parse_mp4_descr(d, off, len, MP4SLDescrTag);
+ret = parse_mp4_descr(d, off, len, MP4SLDescrTag);
 d->active_descr = NULL;
-return 0;
+return ret;
 }
 
 static int parse_MP4DecConfigDescrTag(MP4DescrParseContext *d, int64_t off,
@@ -1435,6 +1438,8 @@ static int parse_mp4_descr(MP4DescrParseContext *d, 
int64_t off, int len,
 {
 int tag;
 int len1 = ff_mp4_read_descr(d->s, &d->pb, &tag);
+int ret = 0;
+
 update_offsets(&d->pb, &off, &len);
 if (len < 0 || len1 > len || len1 <= 0) {
 av_log(d->s, AV_LOG_ERROR,
@@ -1445,30 +1450,32 @@ static int parse_mp4_descr(MP4DescrParseContext *d, 
int64_t off, int len,
 
 if (d->level++ >= MAX_LEVEL) {
 av_log(d->s, AV_LOG_ERROR, "Maximum MP4 descriptor level exceeded\n");
+ret = AVERROR_INVALIDDATA;
 goto done;
 }
 
 if (target_tag && tag != target_tag) {
 av_log(d->s, AV_LOG_ERROR, "Found tag %x expected %x\n", tag,
target_tag);
+ret = AVERROR_INVALIDDATA;
 goto done;
 }
 
 switch (tag) {
 case MP4IODescrTag:
-parse_MP4IODescrTag(d, off, len1);
+ret = parse_MP4IODescrTag(d, off, len1);
 break;
 case MP4ODescrTag:
-parse_MP4ODescrTag(d, off, len1);
+ret = parse_MP4ODescrTag(d, off, len1);
 break;
 case MP4ESDescrTag:
-parse_MP4ESDescrTag(d, off, len1);
+ret = parse_MP4ESDescrTag(d, off, len1);
 break;
 case MP4DecConfigDescrTag:
-parse_MP4DecConfigDescrTag(d, off, len1);
+ret = parse_MP4DecConfigDescrTag(d, off, len1);
 break;
 case MP4SLDescrTag:
-parse_MP4SLDescrTag(d, off, len1);
+ret = parse_MP4SLDescrTag(d, off, len1);
 break;
 }
 
@@ -1476,7 +1483,7 @@ static int parse_mp4_descr(MP4DescrParseContext *d, 
int64_t off, int len,
 done:
 d->level--;
 avio_seek(&d->pb, off + len1, SEEK_SET);
-return 0;
+return ret;
 }
 
 static int mp4_read_iods(AVFormatContext *s, const uint8_t *buf, unsigned size,


==


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


[FFmpeg-cvslog] mpegts: Forward the errors on mpeg4 objects parsing

2016-04-14 Thread Luca Barbato
ffmpeg | branch: master | Luca Barbato  | Wed Feb 17 
02:23:02 2016 +0100| [9765549f551ff40869aee1a6492b6a976c86cfe9] | committer: 
Luca Barbato

mpegts: Forward the errors on mpeg4 objects parsing

Signed-off-by: Luca Barbato 

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

 libavformat/mpegts.c |   25 -
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 63e333b..4a593cb 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1112,6 +1112,8 @@ static int parse_MP4ODescrTag(MP4DescrParseContext *d, 
int64_t off, int len)
 static int parse_MP4ESDescrTag(MP4DescrParseContext *d, int64_t off, int len)
 {
 int es_id = 0;
+int ret   = 0;
+
 if (d->descr_count >= d->max_descr_count)
 return AVERROR_INVALIDDATA;
 ff_mp4_parse_es_descr(&d->pb, &es_id);
@@ -1119,12 +1121,13 @@ static int parse_MP4ESDescrTag(MP4DescrParseContext *d, 
int64_t off, int len)
 
 d->active_descr->es_id = es_id;
 update_offsets(&d->pb, &off, &len);
-parse_mp4_descr(d, off, len, MP4DecConfigDescrTag);
+if ((ret = parse_mp4_descr(d, off, len, MP4DecConfigDescrTag)) < 0)
+return ret;
 update_offsets(&d->pb, &off, &len);
 if (len > 0)
-parse_mp4_descr(d, off, len, MP4SLDescrTag);
+ret = parse_mp4_descr(d, off, len, MP4SLDescrTag);
 d->active_descr = NULL;
-return 0;
+return ret;
 }
 
 static int parse_MP4DecConfigDescrTag(MP4DescrParseContext *d, int64_t off,
@@ -1179,6 +1182,8 @@ static int parse_mp4_descr(MP4DescrParseContext *d, 
int64_t off, int len,
 {
 int tag;
 int len1 = ff_mp4_read_descr(d->s, &d->pb, &tag);
+int ret = 0;
+
 update_offsets(&d->pb, &off, &len);
 if (len < 0 || len1 > len || len1 <= 0) {
 av_log(d->s, AV_LOG_ERROR,
@@ -1189,30 +1194,32 @@ static int parse_mp4_descr(MP4DescrParseContext *d, 
int64_t off, int len,
 
 if (d->level++ >= MAX_LEVEL) {
 av_log(d->s, AV_LOG_ERROR, "Maximum MP4 descriptor level exceeded\n");
+ret = AVERROR_INVALIDDATA;
 goto done;
 }
 
 if (target_tag && tag != target_tag) {
 av_log(d->s, AV_LOG_ERROR, "Found tag %x expected %x\n", tag,
target_tag);
+ret = AVERROR_INVALIDDATA;
 goto done;
 }
 
 switch (tag) {
 case MP4IODescrTag:
-parse_MP4IODescrTag(d, off, len1);
+ret = parse_MP4IODescrTag(d, off, len1);
 break;
 case MP4ODescrTag:
-parse_MP4ODescrTag(d, off, len1);
+ret = parse_MP4ODescrTag(d, off, len1);
 break;
 case MP4ESDescrTag:
-parse_MP4ESDescrTag(d, off, len1);
+ret = parse_MP4ESDescrTag(d, off, len1);
 break;
 case MP4DecConfigDescrTag:
-parse_MP4DecConfigDescrTag(d, off, len1);
+ret = parse_MP4DecConfigDescrTag(d, off, len1);
 break;
 case MP4SLDescrTag:
-parse_MP4SLDescrTag(d, off, len1);
+ret = parse_MP4SLDescrTag(d, off, len1);
 break;
 }
 
@@ -1220,7 +1227,7 @@ static int parse_mp4_descr(MP4DescrParseContext *d, 
int64_t off, int len,
 done:
 d->level--;
 avio_seek(&d->pb, off + len1, SEEK_SET);
-return 0;
+return ret;
 }
 
 static int mp4_read_iods(AVFormatContext *s, const uint8_t *buf, unsigned size,

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


[FFmpeg-cvslog] Merge commit 'a2d1922bde8db2cdac95051918fe81ae18c0376b'

2016-04-14 Thread Derek Buitenhuis
ffmpeg | branch: master | Derek Buitenhuis  | Thu 
Apr 14 14:02:16 2016 +0100| [e1a8f7818cc8bb975d856b7ba4cec4772e4a38ba] | 
committer: Derek Buitenhuis

Merge commit 'a2d1922bde8db2cdac95051918fe81ae18c0376b'

This commit is a no-op.

* commit 'a2d1922bde8db2cdac95051918fe81ae18c0376b':
  takdec: ensure chan2 is a valid channel index

Merged-by: Derek Buitenhuis 

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



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


[FFmpeg-cvslog] takdec: ensure chan2 is a valid channel index

2016-04-14 Thread Andreas Cadhalpun
ffmpeg | branch: master | Andreas Cadhalpun  
| Wed Jun 10 00:12:38 2015 +0200| [a2d1922bde8db2cdac95051918fe81ae18c0376b] | 
committer: Luca Barbato

takdec: ensure chan2 is a valid channel index

If chan2 is not smaller than the number of channels, it can cause
segmentation faults due to dereferencing a NULL pointer.

Signed-off-by: Andreas Cadhalpun 
Signed-off-by: Luca Barbato 

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

 libavcodec/takdec.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c
index c84cca4..93098be 100644
--- a/libavcodec/takdec.c
+++ b/libavcodec/takdec.c
@@ -806,6 +806,12 @@ static int tak_decode_frame(AVCodecContext *avctx, void 
*data,
 if (s->mcdparams[i].present) {
 s->mcdparams[i].index = get_bits(gb, 2);
 s->mcdparams[i].chan2 = get_bits(gb, 4);
+if (s->mcdparams[i].chan2 >= avctx->channels) {
+av_log(avctx, AV_LOG_ERROR,
+   "invalid channel 2 (%d) for %d 
channel(s)\n",
+   s->mcdparams[i].chan2, avctx->channels);
+return AVERROR_INVALIDDATA;
+}
 if (s->mcdparams[i].index == 1) {
 if ((nbit == s->mcdparams[i].chan2) ||
 (ch_mask & 1 << s->mcdparams[i].chan2))

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


[FFmpeg-cvslog] avcodec/bmp_parser: Ensure remaining_size is not too small in startcode packet crossing corner case

2016-04-14 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Apr 14 15:10:31 2016 +0200| [8e26bdd59bf559d00c7e60c53fff292de10139ff] | 
committer: Michael Niedermayer

avcodec/bmp_parser: Ensure remaining_size is not too small in startcode packet 
crossing corner case

Fixes Ticket 5438

Signed-off-by: Michael Niedermayer 

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

 libavcodec/bmp_parser.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/bmp_parser.c b/libavcodec/bmp_parser.c
index c9493dc..7ab32a0 100644
--- a/libavcodec/bmp_parser.c
+++ b/libavcodec/bmp_parser.c
@@ -63,7 +63,7 @@ restart:
 continue;
 }
 bpc->pc.frame_start_found++;
-bpc->remaining_size = bpc->fsize + i - 17;
+bpc->remaining_size = bpc->fsize + FFMAX(i - 17, 0);
 
 if (bpc->pc.index + i > 17) {
 next = i - 17;

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


[FFmpeg-cvslog] avformat: add AVFormatContext to ff_get_extradata()

2016-04-14 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Apr 14 18:21:08 
2016 +0200| [323b8c95e41094b90ed2a9bdd9a06d22d2f74856] | committer: Paul B Mahol

avformat: add AVFormatContext to ff_get_extradata()

Needed for av_log() inside that function.

Signed-off-by: Paul B Mahol 

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

 libavformat/adxdec.c   |2 +-
 libavformat/aiffdec.c  |2 +-
 libavformat/aixdec.c   |2 +-
 libavformat/apc.c  |2 +-
 libavformat/apetag.c   |2 +-
 libavformat/avidec.c   |4 ++--
 libavformat/bink.c |2 +-
 libavformat/cafdec.c   |2 +-
 libavformat/flvdec.c   |2 +-
 libavformat/idcin.c|2 +-
 libavformat/internal.h |2 +-
 libavformat/isom.c |2 +-
 libavformat/mov.c  |   10 +-
 libavformat/mpc.c  |2 +-
 libavformat/mpc8.c |2 +-
 libavformat/nutdec.c   |2 +-
 libavformat/nuv.c  |2 +-
 libavformat/riffdec.c  |4 ++--
 libavformat/rl2.c  |2 +-
 libavformat/rmdec.c|2 +-
 libavformat/rsd.c  |2 +-
 libavformat/utils.c|4 ++--
 libavformat/vc1test.c  |2 +-
 libavformat/westwood_vqa.c |2 +-
 24 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
index fd09670..4f83348 100644
--- a/libavformat/adxdec.c
+++ b/libavformat/adxdec.c
@@ -94,7 +94,7 @@ static int adx_read_header(AVFormatContext *s)
 c->header_size = avio_rb16(s->pb) + 4;
 avio_seek(s->pb, -4, SEEK_CUR);
 
-if (ff_get_extradata(par, s->pb, c->header_size) < 0)
+if (ff_get_extradata(s, par, s->pb, c->header_size) < 0)
 return AVERROR(ENOMEM);
 
 if (par->extradata_size < 12) {
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index bb5299c..d191bc4 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -299,7 +299,7 @@ static int aiff_read_header(AVFormatContext *s)
 case MKTAG('w', 'a', 'v', 'e'):
 if ((uint64_t)size > (1<<30))
 return -1;
-if (ff_get_extradata(st->codecpar, pb, size) < 0)
+if (ff_get_extradata(s, st->codecpar, pb, size) < 0)
 return AVERROR(ENOMEM);
 if (st->codecpar->codec_id == AV_CODEC_ID_QDM2 && size>=12*4 && 
!st->codecpar->block_align) {
 st->codecpar->block_align = 
AV_RB32(st->codecpar->extradata+11*4);
diff --git a/libavformat/aixdec.c b/libavformat/aixdec.c
index 5f40d6b..cad8a1e 100644
--- a/libavformat/aixdec.c
+++ b/libavformat/aixdec.c
@@ -77,7 +77,7 @@ static int aix_read_header(AVFormatContext *s)
 if (size <= 8)
 return AVERROR_INVALIDDATA;
 avio_skip(s->pb, 8);
-ff_get_extradata(s->streams[i]->codecpar, s->pb, size - 8);
+ff_get_extradata(s, s->streams[i]->codecpar, s->pb, size - 8);
 }
 
 return 0;
diff --git a/libavformat/apc.c b/libavformat/apc.c
index 64c1c6d..a4dcf66 100644
--- a/libavformat/apc.c
+++ b/libavformat/apc.c
@@ -53,7 +53,7 @@ static int apc_read_header(AVFormatContext *s)
 st->codecpar->sample_rate = avio_rl32(pb);
 
 /* initial predictor values for adpcm decoder */
-if (ff_get_extradata(st->codecpar, pb, 2 * 4) < 0)
+if (ff_get_extradata(s, st->codecpar, pb, 2 * 4) < 0)
 return AVERROR(ENOMEM);
 
 if (avio_rl32(pb)) {
diff --git a/libavformat/apetag.c b/libavformat/apetag.c
index 53e076f..08e80f4 100644
--- a/libavformat/apetag.c
+++ b/libavformat/apetag.c
@@ -96,7 +96,7 @@ static int ape_tag_read_field(AVFormatContext *s)
 st->attached_pic.stream_index = st->index;
 st->attached_pic.flags   |= AV_PKT_FLAG_KEY;
 } else {
-if (ff_get_extradata(st->codecpar, s->pb, size) < 0)
+if (ff_get_extradata(s, st->codecpar, s->pb, size) < 0)
 return AVERROR(ENOMEM);
 st->codecpar->codec_type = AVMEDIA_TYPE_ATTACHMENT;
 }
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 87c9bd4..b114a74 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -762,7 +762,7 @@ static int avi_read_header(AVFormatContext *s)
 st->codecpar->extradata_size = esize - 10 * 4;
 } else
 st->codecpar->extradata_size =  size - 10 * 4;
-if (ff_get_extradata(st->codecpar, pb, 
st->codecpar->extradata_size) < 0)
+if (ff_get_extradata(s, st->codecpar, pb, 
st->codecpar->extradata_size) < 0)
 return AVERROR(ENOMEM);
 }
 
@@ -917,7 +917,7 @@ static int avi_read_header(AVFormatContext *s)
 st = s->streams[stream_index];
 
 if (size<(1<<30)) {
-if (ff_get_extradata(st->codecpar, pb, size) < 0)
+if (ff_get_extra

[FFmpeg-cvslog] avcodec/atrac3: pass AVCodecContext to av_log if available

2016-04-14 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Apr 14 18:47:57 
2016 +0200| [c9fb81ff411ad1aa0f34dae553d05ff7c4644500] | committer: Paul B Mahol

avcodec/atrac3: pass AVCodecContext to av_log if available

Signed-off-by: Paul B Mahol 

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

 libavcodec/atrac3.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c
index 4bdb63f..256990b 100644
--- a/libavcodec/atrac3.c
+++ b/libavcodec/atrac3.c
@@ -762,7 +762,7 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void 
*data,
 
 ret = decode_frame(avctx, databuf, (float **)frame->extended_data);
 if (ret) {
-av_log(NULL, AV_LOG_ERROR, "Frame decoding error!\n");
+av_log(avctx, AV_LOG_ERROR, "Frame decoding error!\n");
 return ret;
 }
 
@@ -843,7 +843,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
 q->scrambled_stream= 1;
 
 } else {
-av_log(NULL, AV_LOG_ERROR, "Unknown extradata size %d.\n",
+av_log(avctx, AV_LOG_ERROR, "Unknown extradata size %d.\n",
avctx->extradata_size);
 return AVERROR(EINVAL);
 }

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


[FFmpeg-cvslog] avcodec/ralf: add support for mono

2016-04-14 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Thu Apr 14 22:31:57 
2016 +0200| [9cd2ca9966d0f6c07192a01cbe6184bba0167d05] | committer: Paul B Mahol

avcodec/ralf: add support for mono

Signed-off-by: Paul B Mahol 

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

 libavcodec/ralf.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ralf.c b/libavcodec/ralf.c
index 8cd9f88..3f7953c 100644
--- a/libavcodec/ralf.c
+++ b/libavcodec/ralf.c
@@ -479,7 +479,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame_ptr,
 init_get_bits(&gb, src + 2, table_size);
 ctx->num_blocks = 0;
 while (get_bits_left(&gb) > 0) {
-ctx->block_size[ctx->num_blocks] = get_bits(&gb, 15);
+ctx->block_size[ctx->num_blocks] = get_bits(&gb, 13 + avctx->channels);
 if (get_bits1(&gb)) {
 ctx->block_pts[ctx->num_blocks] = get_bits(&gb, 9);
 } else {

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


[FFmpeg-cvslog] avformat/yop: alloc codecpar extradata only once

2016-04-14 Thread James Almer
ffmpeg | branch: master | James Almer  | Thu Apr 14 15:55:10 
2016 -0300| [c8ed93efcf4d52babb7dd1d2dec6c564bbda6da5] | committer: James Almer

avformat/yop: alloc codecpar extradata only once

Fixes memleak

Signed-off-by: James Almer 

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

 libavformat/yop.c |6 --
 1 file changed, 6 deletions(-)

diff --git a/libavformat/yop.c b/libavformat/yop.c
index 997ca4b..e6fd896 100644
--- a/libavformat/yop.c
+++ b/libavformat/yop.c
@@ -72,12 +72,6 @@ static int yop_read_header(AVFormatContext *s)
 if (ff_alloc_extradata(video_stream->codecpar, 8))
 return AVERROR(ENOMEM);
 
-video_stream->codecpar->extradata = av_mallocz(8 + 
AV_INPUT_BUFFER_PADDING_SIZE);
-
-if (!video_stream->codecpar->extradata)
-return AVERROR(ENOMEM);
-video_stream->codecpar->extradata_size = 8;
-
 // Audio
 audio_par = audio_stream->codecpar;
 audio_par->codec_type = AVMEDIA_TYPE_AUDIO;

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


[FFmpeg-cvslog] avcodec: Add bits_per_raw_sample to AVCodecParameters

2016-04-14 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Tue 
Apr 12 13:10:09 2016 +0200| [21acc4db5fa3f11997b2a27f03e87eac4d69e088] | 
committer: Michael Niedermayer

avcodec: Add bits_per_raw_sample to AVCodecParameters

The bits_per_raw_sample represents the number of bits of precision per sample.

The field is added at the logical place, not at the end as the code was just
recently added

This fixes the regression about losing the audio sample precision information

The change in the fate test checksum un-does the change from the merge

Previous version reviewed by: wm4 
Previous version reviewed by: Dominik 'Rathann' Mierzejewski 

Signed-off-by: Michael Niedermayer 

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

 libavcodec/avcodec.h |   24 
 libavcodec/utils.c   |2 ++
 libavcodec/version.h |2 +-
 tests/ref/lavf/ffm   |2 +-
 4 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index b3655c5..9e6169f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3832,9 +3832,33 @@ typedef struct AVCodecParameters {
  */
 int64_t bit_rate;
 
+/**
+ * The number of bits per sample in the codedwords.
+ *
+ * This is basically the bitrate per sample. It is mandatory for a bunch of
+ * formats to actually decode them. It's the number of bits for one sample 
in
+ * the actual coded bitstream.
+ *
+ * This could be for example 4 for ADPCM
+ * For PCM formats this matches bits_per_raw_sample
+ * Can be 0
+ */
 int bits_per_coded_sample;
 
 /**
+ * This is the number of valid bits in each output sample. If the
+ * sample format has more bits, the least significant bits are additional
+ * padding bits, which are always 0. Use right shifts to reduce the sample
+ * to its actual size. For example, audio formats with 24 bit samples will
+ * have bits_per_raw_sample set to 24, and format set to AV_SAMPLEFMT_S32.
+ * To get the original sample use "(uint32_t)sample >> 8"."
+ *
+ * For ADPCM this might be 12 or 16 or similar
+ * Can be 0
+ */
+int bits_per_raw_sample;
+
+/**
  * Codec-specific bitstream restrictions that the stream conforms to.
  */
 int profile;
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index c1f8e22..e0edce3 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -3771,6 +3771,7 @@ int avcodec_parameters_from_context(AVCodecParameters 
*par,
 
 par->bit_rate  = codec->bit_rate;
 par->bits_per_coded_sample = codec->bits_per_coded_sample;
+par->bits_per_raw_sample   = codec->bits_per_raw_sample;
 par->profile   = codec->profile;
 par->level = codec->level;
 
@@ -3824,6 +3825,7 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
 
 codec->bit_rate  = par->bit_rate;
 codec->bits_per_coded_sample = par->bits_per_coded_sample;
+codec->bits_per_raw_sample   = par->bits_per_raw_sample;
 codec->profile   = par->profile;
 codec->level = par->level;
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 1438e2e..8f0522b 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  57
 #define LIBAVCODEC_VERSION_MINOR  34
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
diff --git a/tests/ref/lavf/ffm b/tests/ref/lavf/ffm
index e45ef08..c4d7e1f 100644
--- a/tests/ref/lavf/ffm
+++ b/tests/ref/lavf/ffm
@@ -1,3 +1,3 @@
-79674a5219d00e1d2221a29157b35eb4 *./tests/data/lavf/lavf.ffm
+e63c16b5f0ad5015304fc4009fdb33ca *./tests/data/lavf/lavf.ffm
 376832 ./tests/data/lavf/lavf.ffm
 ./tests/data/lavf/lavf.ffm CRC=0x000e23ae

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


[FFmpeg-cvslog] avformat/hashenc: simplify hash_write_trailer

2016-04-14 Thread James Almer
ffmpeg | branch: master | James Almer  | Thu Apr 14 20:49:35 
2016 -0300| [bb505cd5057ce926e81048e19bb96dbdcb6ae2cf] | committer: James Almer

avformat/hashenc: simplify hash_write_trailer

Reviewed-by: Michael Niedermayer 
Signed-off-by: James Almer 

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

 libavformat/hashenc.c |   28 +---
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c
index ced2f66..01b00b5 100644
--- a/libavformat/hashenc.c
+++ b/libavformat/hashenc.c
@@ -34,25 +34,6 @@ struct HashContext {
 int format_version;
 };
 
-static void hash_finish(struct AVFormatContext *s, char *buf)
-{
-struct HashContext *c = s->priv_data;
-uint8_t hash[AV_HASH_MAX_SIZE];
-int i, offset = strlen(buf);
-int len = av_hash_get_size(c->hash);
-av_assert0(len > 0 && len <= sizeof(hash));
-av_hash_final(c->hash, hash);
-for (i = 0; i < len; i++) {
-snprintf(buf + offset, 3, "%02"PRIx8, hash[i]);
-offset += 2;
-}
-buf[offset] = '\n';
-buf[offset+1] = 0;
-
-avio_write(s->pb, buf, strlen(buf));
-avio_flush(s->pb);
-}
-
 #define OFFSET(x) offsetof(struct HashContext, x)
 #define ENC AV_OPT_FLAG_ENCODING_PARAM
 #if CONFIG_HASH_MUXER || CONFIG_FRAMEHASH_MUXER
@@ -92,11 +73,12 @@ static int hash_write_packet(struct AVFormatContext *s, 
AVPacket *pkt)
 static int hash_write_trailer(struct AVFormatContext *s)
 {
 struct HashContext *c = s->priv_data;
-char buf[256];
-av_strlcpy(buf, av_hash_get_name(c->hash), sizeof(buf) - 200);
-av_strlcat(buf, "=", sizeof(buf) - 200);
+char buf[AV_HASH_MAX_SIZE*2+128];
+snprintf(buf, sizeof(buf) - 200, "%s=", av_hash_get_name(c->hash));
 
-hash_finish(s, buf);
+av_hash_final_hex(c->hash, buf + strlen(buf), sizeof(buf) - strlen(buf));
+av_strlcatf(buf, sizeof(buf), "\n");
+avio_write(s->pb, buf, strlen(buf));
 
 av_hash_freep(&c->hash);
 return 0;

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