[FFmpeg-cvslog] Merge commit '319424d25c53f82b87187ce03ed984d438f1bee6'
ffmpeg | branch: master | Michael Niedermayer | Mon Oct 6 11:38:06 2014 +0200| [567c0dcee6745dc53d67e6de796270449b5753f7] | committer: Michael Niedermayer Merge commit '319424d25c53f82b87187ce03ed984d438f1bee6' * commit '319424d25c53f82b87187ce03ed984d438f1bee6': vdpau: add helper for VDPAU to libav error codes conversion Conflicts: libavcodec/vdpau.c Merged-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=567c0dcee6745dc53d67e6de796270449b5753f7 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] vdpau: add helper for VDPAU to libav error codes conversion
ffmpeg | branch: master | Rémi Denis-Courmont | Sat Oct 4 16:55:02 2014 +0300| [319424d25c53f82b87187ce03ed984d438f1bee6] | committer: Anton Khirnov vdpau: add helper for VDPAU to libav error codes conversion Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=319424d25c53f82b87187ce03ed984d438f1bee6 --- libavcodec/vdpau.c | 24 1 file changed, 24 insertions(+) diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 5406874..581eada 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -38,6 +38,30 @@ * @{ */ +static int vdpau_error(VdpStatus status) +{ +switch (status) { +case VDP_STATUS_OK: +return 0; +case VDP_STATUS_NO_IMPLEMENTATION: +return AVERROR(ENOSYS); +case VDP_STATUS_DISPLAY_PREEMPTED: +return AVERROR(EIO); +case VDP_STATUS_INVALID_HANDLE: +return AVERROR(EBADF); +case VDP_STATUS_INVALID_POINTER: +return AVERROR(EFAULT); +case VDP_STATUS_RESOURCES: +return AVERROR(ENOBUFS); +case VDP_STATUS_HANDLE_DEVICE_MISMATCH: +return AVERROR(EXDEV); +case VDP_STATUS_ERROR: +return AVERROR(EIO); +default: +return AVERROR(EINVAL); +} +} + int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic_ctx, av_unused const uint8_t *buffer, av_unused uint32_t size) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] vdpau: factor out common end-of-frame handling
ffmpeg | branch: master | Rémi Denis-Courmont | Sat Oct 4 16:55:03 2014 +0300| [fcc1022611f79c2f3aa2f392a5ce14c74be9c1d7] | committer: Anton Khirnov vdpau: factor out common end-of-frame handling Also add error handling. Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fcc1022611f79c2f3aa2f392a5ce14c74be9c1d7 --- libavcodec/vdpau.c | 25 +++-- libavcodec/vdpau_h264.c | 10 -- libavcodec/vdpau_internal.h |2 ++ 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 581eada..0a4b796 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -72,23 +72,36 @@ int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic_ctx, return 0; } +int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame, + struct vdpau_picture_context *pic_ctx) +{ +AVVDPAUContext *hwctx = avctx->hwaccel_context; +VdpVideoSurface surf = ff_vdpau_get_surface_id(frame); +VdpStatus status; + +status = hwctx->render(hwctx->decoder, surf, (void *)&pic_ctx->info, + pic_ctx->bitstream_buffers_used, + pic_ctx->bitstream_buffers); + +av_freep(&pic_ctx->bitstream_buffers); +return vdpau_error(status); +} + #if CONFIG_H263_VDPAU_HWACCEL || CONFIG_MPEG1_VDPAU_HWACCEL || \ CONFIG_MPEG2_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL || \ CONFIG_VC1_VDPAU_HWACCEL || CONFIG_WMV3_VDPAU_HWACCEL int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx) { -AVVDPAUContext *hwctx = avctx->hwaccel_context; MpegEncContext *s = avctx->priv_data; Picture *pic = s->current_picture_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; -VdpVideoSurface surf = ff_vdpau_get_surface_id(pic->f); +int val; -hwctx->render(hwctx->decoder, surf, (void *)&pic_ctx->info, - pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers); +val = ff_vdpau_common_end_frame(avctx, pic->f, pic_ctx); +if (val < 0) +return val; ff_mpeg_draw_horiz_band(s, 0, s->avctx->height); -av_freep(&pic_ctx->bitstream_buffers); - return 0; } #endif diff --git a/libavcodec/vdpau_h264.c b/libavcodec/vdpau_h264.c index 32e9c28..838a670 100644 --- a/libavcodec/vdpau_h264.c +++ b/libavcodec/vdpau_h264.c @@ -189,18 +189,16 @@ static int vdpau_h264_decode_slice(AVCodecContext *avctx, static int vdpau_h264_end_frame(AVCodecContext *avctx) { -AVVDPAUContext *hwctx = avctx->hwaccel_context; H264Context *h = avctx->priv_data; H264Picture *pic = h->cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; -VdpVideoSurface surf = ff_vdpau_get_surface_id(&pic->f); +int val; -hwctx->render(hwctx->decoder, surf, (void *)&pic_ctx->info, - pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers); +val = ff_vdpau_common_end_frame(avctx, &pic->f, pic_ctx); +if (val < 0) +return val; ff_h264_draw_horiz_band(h, 0, h->avctx->height); -av_freep(&pic_ctx->bitstream_buffers); - return 0; } diff --git a/libavcodec/vdpau_internal.h b/libavcodec/vdpau_internal.h index 2443e0a..3f55ee7 100644 --- a/libavcodec/vdpau_internal.h +++ b/libavcodec/vdpau_internal.h @@ -72,6 +72,8 @@ struct vdpau_picture_context { int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic, const uint8_t *buffer, uint32_t size); +int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame, + struct vdpau_picture_context *pic); int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx); int ff_vdpau_add_buffer(struct vdpau_picture_context *pic, const uint8_t *buf, uint32_t buf_size); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'fcc1022611f79c2f3aa2f392a5ce14c74be9c1d7'
ffmpeg | branch: master | Michael Niedermayer | Mon Oct 6 12:04:25 2014 +0200| [b64b719ad5c212e197009fa3f1e7aa96255cbd28] | committer: Michael Niedermayer Merge commit 'fcc1022611f79c2f3aa2f392a5ce14c74be9c1d7' * commit 'fcc1022611f79c2f3aa2f392a5ce14c74be9c1d7': vdpau: factor out common end-of-frame handling Conflicts: libavcodec/vdpau.c libavcodec/vdpau_h264.c Merged-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b64b719ad5c212e197009fa3f1e7aa96255cbd28 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'ce083282f0a8b7d63c4047c30b7bac498f9806dd'
ffmpeg | branch: master | Michael Niedermayer | Mon Oct 6 12:32:07 2014 +0200| [10b6d7462cbf0d13913c9d07e85c79210427d71e] | committer: Michael Niedermayer Merge commit 'ce083282f0a8b7d63c4047c30b7bac498f9806dd' * commit 'ce083282f0a8b7d63c4047c30b7bac498f9806dd': vdpau: common support for managing the VdpDecoder in avcodec Conflicts: libavcodec/vdpau.c Merged-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=10b6d7462cbf0d13913c9d07e85c79210427d71e --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] vdpau: common support for managing the VdpDecoder in avcodec
ffmpeg | branch: master | Rémi Denis-Courmont | Sat Oct 4 16:55:04 2014 +0300| [ce083282f0a8b7d63c4047c30b7bac498f9806dd] | committer: Anton Khirnov vdpau: common support for managing the VdpDecoder in avcodec Using the not so new init and uninit callbacks, avcodec can now take care of creating and destroying the VDPAU decoder instance. The application is still responsible for creating the VDPAU device and allocating video surfaces - this is necessary to keep video surfaces on the GPU all the way to the output. But the application will no longer needs to care about any codec-specific aspects. Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ce083282f0a8b7d63c4047c30b7bac498f9806dd --- libavcodec/vdpau.c | 64 +++ libavcodec/vdpau_internal.h | 32 ++ 2 files changed, 96 insertions(+) diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 0a4b796..48bc365 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -22,7 +22,9 @@ */ #include +#include "libavutil/avassert.h" #include "avcodec.h" +#include "internal.h" #include "h264.h" #include "vc1.h" @@ -62,6 +64,68 @@ static int vdpau_error(VdpStatus status) } } +int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, + int level) +{ +VDPAUHWContext *hwctx = avctx->hwaccel_context; +VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data; +VdpDecoderCreate *create; +void *func; +VdpStatus status; +/* See vdpau/vdpau.h for alignment constraints. */ +uint32_t width = (avctx->coded_width + 1) & ~1; +uint32_t height = (avctx->coded_height + 3) & ~3; + +if (hwctx->context.decoder != VDP_INVALID_HANDLE) { +vdctx->decoder = hwctx->context.decoder; +vdctx->render = hwctx->context.render; +vdctx->device = VDP_INVALID_HANDLE; +return 0; /* Decoder created by user */ +} + +vdctx->device = hwctx->device; +vdctx->get_proc_address = hwctx->get_proc_address; + +status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_CREATE, + &func); +if (status != VDP_STATUS_OK) +return vdpau_error(status); +else +create = func; + +status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_RENDER, + &func); +if (status != VDP_STATUS_OK) +return vdpau_error(status); +else +vdctx->render = func; + +status = create(vdctx->device, profile, width, height, avctx->refs, +&vdctx->decoder); +return vdpau_error(status); +} + +int ff_vdpau_common_uninit(AVCodecContext *avctx) +{ +VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data; +VdpDecoderDestroy *destroy; +void *func; +VdpStatus status; + +if (vdctx->device == VDP_INVALID_HANDLE) +return 0; /* Decoder created and destroyed by user */ + +status = vdctx->get_proc_address(vdctx->device, + VDP_FUNC_ID_DECODER_DESTROY, &func); +if (status != VDP_STATUS_OK) +return vdpau_error(status); +else +destroy = func; + +status = destroy(vdctx->decoder); +return vdpau_error(status); +} + int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic_ctx, av_unused const uint8_t *buffer, av_unused uint32_t size) diff --git a/libavcodec/vdpau_internal.h b/libavcodec/vdpau_internal.h index 3f55ee7..94fa9aa 100644 --- a/libavcodec/vdpau_internal.h +++ b/libavcodec/vdpau_internal.h @@ -48,6 +48,34 @@ union AVVDPAUPictureInfo { #include "vdpau.h" #endif +typedef struct VDPAUHWContext { +AVVDPAUContext context; +VdpDevice device; +VdpGetProcAddress *get_proc_address; +} VDPAUHWContext; + +typedef struct VDPAUContext { +/** + * VDPAU device handle + */ +VdpDevice device; + +/** + * VDPAU decoder handle + */ +VdpDecoder decoder; + +/** + * VDPAU device driver + */ +VdpGetProcAddress *get_proc_address; + +/** + * VDPAU decoder render callback + */ +VdpDecoderRender *render; +} VDPAUContext; + struct vdpau_picture_context { /** * VDPAU picture information. @@ -70,6 +98,10 @@ struct vdpau_picture_context { VdpBitstreamBuffer *bitstream_buffers; }; +int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, + int level); +int ff_vdpau_common_uninit(AVCodecContext *avctx); + int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic, const uint8_t *buffer, uint32_t size); int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/list
[FFmpeg-cvslog] avcodec/vdpau_internal: add comment to #endif
ffmpeg | branch: master | Michael Niedermayer | Mon Oct 6 12:47:08 2014 +0200| [8df41976b7cd2e3ae0fd83ec585c886e94734acf] | committer: Michael Niedermayer avcodec/vdpau_internal: add comment to #endif Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8df41976b7cd2e3ae0fd83ec585c886e94734acf --- libavcodec/vdpau_internal.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vdpau_internal.h b/libavcodec/vdpau_internal.h index d76845e..bf9233d 100644 --- a/libavcodec/vdpau_internal.h +++ b/libavcodec/vdpau_internal.h @@ -107,7 +107,7 @@ struct vdpau_picture_context { int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, int level); -#endif +#endif //CONFIG_VDPAU int ff_vdpau_common_uninit(AVCodecContext *avctx); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '89ac99ba5f2dc9f69ad3bc294753930eb0b3e4a4'
ffmpeg | branch: master | Michael Niedermayer | Mon Oct 6 13:21:52 2014 +0200| [0ba887bbf4d99b609247a5447dc63dc2e7550ff5] | committer: Michael Niedermayer Merge commit '89ac99ba5f2dc9f69ad3bc294753930eb0b3e4a4' * commit '89ac99ba5f2dc9f69ad3bc294753930eb0b3e4a4': vdpau: pass codec-specific parameters from hwaccel Conflicts: libavcodec/vdpau.c Merged-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0ba887bbf4d99b609247a5447dc63dc2e7550ff5 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] vdpau: pass codec-specific parameters from hwaccel
ffmpeg | branch: master | Rémi Denis-Courmont | Sat Oct 4 16:55:05 2014 +0300| [89ac99ba5f2dc9f69ad3bc294753930eb0b3e4a4] | committer: Anton Khirnov vdpau: pass codec-specific parameters from hwaccel Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=89ac99ba5f2dc9f69ad3bc294753930eb0b3e4a4 --- libavcodec/vdpau.c|4 ++-- libavcodec/vdpau_h264.c | 30 ++ libavcodec/vdpau_mpeg12.c | 30 ++ libavcodec/vdpau_mpeg4.c | 30 ++ libavcodec/vdpau_vc1.c| 27 +++ 5 files changed, 119 insertions(+), 2 deletions(-) diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 48bc365..ed8fd7f 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -139,11 +139,11 @@ int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic_ctx, int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame, struct vdpau_picture_context *pic_ctx) { -AVVDPAUContext *hwctx = avctx->hwaccel_context; +VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data; VdpVideoSurface surf = ff_vdpau_get_surface_id(frame); VdpStatus status; -status = hwctx->render(hwctx->decoder, surf, (void *)&pic_ctx->info, +status = vdctx->render(vdctx->decoder, surf, (void *)&pic_ctx->info, pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers); diff --git a/libavcodec/vdpau_h264.c b/libavcodec/vdpau_h264.c index 838a670..b759335 100644 --- a/libavcodec/vdpau_h264.c +++ b/libavcodec/vdpau_h264.c @@ -24,6 +24,7 @@ #include #include "avcodec.h" +#include "internal.h" #include "h264.h" #include "mpegutils.h" #include "vdpau.h" @@ -202,6 +203,32 @@ static int vdpau_h264_end_frame(AVCodecContext *avctx) return 0; } +static int vdpau_h264_init(AVCodecContext *avctx) +{ +VdpDecoderProfile profile; +uint32_t level = avctx->level; + +switch (avctx->profile & ~FF_PROFILE_H264_INTRA) { +case FF_PROFILE_H264_CONSTRAINED_BASELINE: +case FF_PROFILE_H264_BASELINE: +profile = VDP_DECODER_PROFILE_H264_BASELINE; +break; +case FF_PROFILE_H264_MAIN: +profile = VDP_DECODER_PROFILE_H264_MAIN; +break; +case FF_PROFILE_H264_HIGH: +profile = VDP_DECODER_PROFILE_H264_HIGH; +break; +default: +return AVERROR(ENOTSUP); +} + +if ((avctx->profile & FF_PROFILE_H264_INTRA) && avctx->level == 11) +level = VDP_DECODER_LEVEL_H264_1b; + +return ff_vdpau_common_init(avctx, profile, level); +} + AVHWAccel ff_h264_vdpau_hwaccel = { .name = "h264_vdpau", .type = AVMEDIA_TYPE_VIDEO, @@ -211,4 +238,7 @@ AVHWAccel ff_h264_vdpau_hwaccel = { .end_frame = vdpau_h264_end_frame, .decode_slice = vdpau_h264_decode_slice, .frame_priv_data_size = sizeof(struct vdpau_picture_context), +.init = vdpau_h264_init, +.uninit = ff_vdpau_common_uninit, +.priv_data_size = sizeof(VDPAUContext), }; diff --git a/libavcodec/vdpau_mpeg12.c b/libavcodec/vdpau_mpeg12.c index 2b53e66..421abe9 100644 --- a/libavcodec/vdpau_mpeg12.c +++ b/libavcodec/vdpau_mpeg12.c @@ -95,6 +95,12 @@ static int vdpau_mpeg_decode_slice(AVCodecContext *avctx, } #if CONFIG_MPEG1_VDPAU_HWACCEL +static int vdpau_mpeg1_init(AVCodecContext *avctx) +{ +return ff_vdpau_common_init(avctx, VDP_DECODER_PROFILE_MPEG1, +VDP_DECODER_LEVEL_MPEG1_NA); +} + AVHWAccel ff_mpeg1_vdpau_hwaccel = { .name = "mpeg1_vdpau", .type = AVMEDIA_TYPE_VIDEO, @@ -104,10 +110,31 @@ AVHWAccel ff_mpeg1_vdpau_hwaccel = { .end_frame = ff_vdpau_mpeg_end_frame, .decode_slice = vdpau_mpeg_decode_slice, .frame_priv_data_size = sizeof(struct vdpau_picture_context), +.init = vdpau_mpeg1_init, +.uninit = ff_vdpau_common_uninit, +.priv_data_size = sizeof(VDPAUContext), }; #endif #if CONFIG_MPEG2_VDPAU_HWACCEL +static int vdpau_mpeg2_init(AVCodecContext *avctx) +{ +VdpDecoderProfile profile; + +switch (avctx->profile) { +case FF_PROFILE_MPEG2_MAIN: +profile = VDP_DECODER_PROFILE_MPEG2_MAIN; +break; +case FF_PROFILE_MPEG2_SIMPLE: +profile = VDP_DECODER_PROFILE_MPEG2_SIMPLE; +break; +default: +return AVERROR(EINVAL); +} + +return ff_vdpau_common_init(avctx, profile, VDP_DECODER_LEVEL_MPEG2_HL); +} + AVHWAccel ff_mpeg2_vdpau_hwaccel = { .name = "mpeg2_vdpau", .type = AVMEDIA_TYPE_VIDEO, @@ -117,5 +144,8 @@ AVHWAccel ff_mpeg2_vdpau_hwaccel = { .end_frame = ff_vdpau_mpeg_end_frame, .decode_slice = vdpau_mpeg_decode_slice, .frame_priv_data_size = sizeof(struct vdpau_picture_context), +.init = vdpau_mpeg2_init, +.uninit
[FFmpeg-cvslog] avcodec/vdpau: warn if the user application has not setup avctx-> hwaccel_context instead of potentially crashing
ffmpeg | branch: master | Michael Niedermayer | Mon Oct 6 14:10:37 2014 +0200| [ec6a855b3a6b87f3415cc4ecfc685bd2eefc6a80] | committer: Michael Niedermayer avcodec/vdpau: warn if the user application has not setup avctx->hwaccel_context instead of potentially crashing Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ec6a855b3a6b87f3415cc4ecfc685bd2eefc6a80 --- libavcodec/vdpau.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 3162814..f2b4acd 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -83,6 +83,12 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, uint32_t width = (avctx->coded_width + 1) & ~1; uint32_t height = (avctx->coded_height + 3) & ~3; +if (!hwctx) { +vdctx->device = VDP_INVALID_HANDLE; +av_log(avctx, AV_LOG_WARNING, "hwaccel_context has not been setup by the user application, cannot initialize\n"); +return 0; +} + if (hwctx->context.decoder != VDP_INVALID_HANDLE) { vdctx->decoder = hwctx->context.decoder; vdctx->render = hwctx->context.render; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] vdpau: force reinitialization when output resolution changes
ffmpeg | branch: master | Rémi Denis-Courmont | Sat Oct 4 16:55:06 2014 +0300| [502cde409ca5ee97ef70c2cdede88b9101746ff6] | committer: Anton Khirnov vdpau: force reinitialization when output resolution changes This is necessary to recreate the decoder with the correct parameters, as not all codecs invoke get_format() in this case. Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=502cde409ca5ee97ef70c2cdede88b9101746ff6 --- libavcodec/vdpau.c | 29 + libavcodec/vdpau_internal.h |3 +++ 2 files changed, 32 insertions(+) diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index ed8fd7f..c3a8a85 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -76,6 +76,9 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, uint32_t width = (avctx->coded_width + 1) & ~1; uint32_t height = (avctx->coded_height + 3) & ~3; +vdctx->width= UINT32_MAX; +vdctx->height = UINT32_MAX; + if (hwctx->context.decoder != VDP_INVALID_HANDLE) { vdctx->decoder = hwctx->context.decoder; vdctx->render = hwctx->context.render; @@ -102,6 +105,11 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, status = create(vdctx->device, profile, width, height, avctx->refs, &vdctx->decoder); +if (status == VDP_STATUS_OK) { +vdctx->width = avctx->coded_width; +vdctx->height = avctx->coded_height; +} + return vdpau_error(status); } @@ -114,6 +122,8 @@ int ff_vdpau_common_uninit(AVCodecContext *avctx) if (vdctx->device == VDP_INVALID_HANDLE) return 0; /* Decoder created and destroyed by user */ +if (vdctx->width == UINT32_MAX && vdctx->height == UINT32_MAX) +return 0; status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_DESTROY, &func); @@ -126,6 +136,20 @@ int ff_vdpau_common_uninit(AVCodecContext *avctx) return vdpau_error(status); } +static int ff_vdpau_common_reinit(AVCodecContext *avctx) +{ +VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data; + +if (vdctx->device == VDP_INVALID_HANDLE) +return 0; /* Decoder created by user */ +if (avctx->coded_width == vdctx->width && +avctx->coded_height == vdctx->height) +return 0; + +avctx->hwaccel->uninit(avctx); +return avctx->hwaccel->init(avctx); +} + int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic_ctx, av_unused const uint8_t *buffer, av_unused uint32_t size) @@ -142,6 +166,11 @@ int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame, VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data; VdpVideoSurface surf = ff_vdpau_get_surface_id(frame); VdpStatus status; +int val; + +val = ff_vdpau_common_reinit(avctx); +if (val < 0) +return val; status = vdctx->render(vdctx->decoder, surf, (void *)&pic_ctx->info, pic_ctx->bitstream_buffers_used, diff --git a/libavcodec/vdpau_internal.h b/libavcodec/vdpau_internal.h index 94fa9aa..3e74d46 100644 --- a/libavcodec/vdpau_internal.h +++ b/libavcodec/vdpau_internal.h @@ -74,6 +74,9 @@ typedef struct VDPAUContext { * VDPAU decoder render callback */ VdpDecoderRender *render; + +uint32_t width; +uint32_t height; } VDPAUContext; struct vdpau_picture_context { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '502cde409ca5ee97ef70c2cdede88b9101746ff6'
ffmpeg | branch: master | Michael Niedermayer | Mon Oct 6 14:17:40 2014 +0200| [067d11bf71e87d6bcc6a12eb302d6281a0d2408d] | committer: Michael Niedermayer Merge commit '502cde409ca5ee97ef70c2cdede88b9101746ff6' * commit '502cde409ca5ee97ef70c2cdede88b9101746ff6': vdpau: force reinitialization when output resolution changes Conflicts: libavcodec/vdpau.c Merged-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=067d11bf71e87d6bcc6a12eb302d6281a0d2408d --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'e3e158e81f0666b8fe66be9ce1cad63a535920e0'
ffmpeg | branch: master | Michael Niedermayer | Mon Oct 6 15:04:03 2014 +0200| [a61899a0f13c0b8fca26472537cf60da04347c6d] | committer: Michael Niedermayer Merge commit 'e3e158e81f0666b8fe66be9ce1cad63a535920e0' * commit 'e3e158e81f0666b8fe66be9ce1cad63a535920e0': vdpau: add av_vdpau_bind_context() Conflicts: doc/APIchanges libavcodec/vdpau.h libavcodec/version.h Merged-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a61899a0f13c0b8fca26472537cf60da04347c6d --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] vdpau: add av_vdpau_bind_context()
ffmpeg | branch: master | Rémi Denis-Courmont | Sat Oct 4 16:55:07 2014 +0300| [e3e158e81f0666b8fe66be9ce1cad63a535920e0] | committer: Anton Khirnov vdpau: add av_vdpau_bind_context() This function provides an explicit VDPAU device and VDPAU driver to libavcodec, so that the application is relieved from codec specifics and VdpDevice life cycle management. A stub flags parameter is added for future extension. For instance, it could be used to ignore codec level capabilities (if someone feels dangerous). Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e3e158e81f0666b8fe66be9ce1cad63a535920e0 --- doc/APIchanges |4 libavcodec/vdpau.c | 22 +- libavcodec/vdpau.h | 20 libavcodec/vdpau_internal.h |1 + libavcodec/version.h|2 +- 5 files changed, 47 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index f17f1cf..3df116e 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,10 @@ libavutil: 2014-08-09 API changes, most recent first: +2014-09-xx - xxx - lavc 56.2.0 - vdpau.h + Add av_vdpau_bind_context(). This function should now be used for creating + (or resetting) a AVVDPAUContext instead of av_vdpau_alloc_context(). + 2014-08-xx - xxx - lavc 56.1.0 - avcodec.h Add AV_PKT_DATA_STEREO3D to export container-level stereo3d information. diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index c3a8a85..685309f 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -78,6 +78,7 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, vdctx->width= UINT32_MAX; vdctx->height = UINT32_MAX; +hwctx->reset= 0; if (hwctx->context.decoder != VDP_INVALID_HANDLE) { vdctx->decoder = hwctx->context.decoder; @@ -138,12 +139,13 @@ int ff_vdpau_common_uninit(AVCodecContext *avctx) static int ff_vdpau_common_reinit(AVCodecContext *avctx) { +VDPAUHWContext *hwctx = avctx->hwaccel_context; VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data; if (vdctx->device == VDP_INVALID_HANDLE) return 0; /* Decoder created by user */ if (avctx->coded_width == vdctx->width && -avctx->coded_height == vdctx->height) +avctx->coded_height == vdctx->height && !hwctx->reset) return 0; avctx->hwaccel->uninit(avctx); @@ -266,4 +268,22 @@ AVVDPAUContext *av_vdpau_alloc_context(void) return av_mallocz(sizeof(AVVDPAUContext)); } +int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device, + VdpGetProcAddress *get_proc, unsigned flags) +{ +VDPAUHWContext *hwctx; + +if (av_reallocp(&avctx->hwaccel_context, sizeof(*hwctx))) +return AVERROR(ENOMEM); + +hwctx = avctx->hwaccel_context; + +memset(hwctx, 0, sizeof(*hwctx)); +hwctx->context.decoder = VDP_INVALID_HANDLE; +hwctx->device = device; +hwctx->get_proc_address = get_proc; +hwctx->reset= 1; +return 0; +} + /* @}*/ diff --git a/libavcodec/vdpau.h b/libavcodec/vdpau.h index 75cb1bf..1714b1e 100644 --- a/libavcodec/vdpau.h +++ b/libavcodec/vdpau.h @@ -131,6 +131,26 @@ typedef struct AVVDPAUContext { } AVVDPAUContext; /** + * Associate a VDPAU device with a codec context for hardware acceleration. + * This function is meant to be called from the get_format() codec callback, + * or earlier. It can also be called after avcodec_flush_buffers() to change + * the underlying VDPAU device mid-stream (e.g. to recover from non-transparent + * display preemption). + * + * @note get_format() must return AV_PIX_FMT_VDPAU if this function completes + * succesfully. + * + * @param avctx decoding context whose get_format() callback is invoked + * @param device VDPAU device handle to use for hardware acceleration + * @param get_proc_address VDPAU device driver + * @param flags for future use, must be zero + * + * @return 0 on success, an AVERROR code on failure. + */ +int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device, + VdpGetProcAddress *get_proc_address, unsigned flags); + +/** * Allocate an AVVDPAUContext. * * @return Newly-allocated AVVDPAUContext or NULL on failure. diff --git a/libavcodec/vdpau_internal.h b/libavcodec/vdpau_internal.h index 3e74d46..69cd455 100644 --- a/libavcodec/vdpau_internal.h +++ b/libavcodec/vdpau_internal.h @@ -52,6 +52,7 @@ typedef struct VDPAUHWContext { AVVDPAUContext context; VdpDevice device; VdpGetProcAddress *get_proc_address; +char reset; } VDPAUHWContext; typedef struct VDPAUContext { diff --git a/libavcodec/version.h b/libavcodec/version.h index 8cc2fb0..849c4b2 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 56 -#define LIBAVCODEC_VERSION_MIN
[FFmpeg-cvslog] vdpau: check video surface and decoder capabilities
ffmpeg | branch: master | Rémi Denis-Courmont | Sat Oct 4 16:55:08 2014 +0300| [bef067f88c74190cdf7e76d12f02e12e069974aa] | committer: Anton Khirnov vdpau: check video surface and decoder capabilities Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bef067f88c74190cdf7e76d12f02e12e069974aa --- libavcodec/vdpau.c | 40 1 file changed, 40 insertions(+) diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 685309f..44eef20 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -69,9 +69,13 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, { VDPAUHWContext *hwctx = avctx->hwaccel_context; VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data; +VdpVideoSurfaceQueryCapabilities *surface_query_caps; +VdpDecoderQueryCapabilities *decoder_query_caps; VdpDecoderCreate *create; void *func; VdpStatus status; +VdpBool supported; +uint32_t max_level, max_mb, max_width, max_height; /* See vdpau/vdpau.h for alignment constraints. */ uint32_t width = (avctx->coded_width + 1) & ~1; uint32_t height = (avctx->coded_height + 3) & ~3; @@ -90,6 +94,42 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, vdctx->device = hwctx->device; vdctx->get_proc_address = hwctx->get_proc_address; +if (level < 0) +return AVERROR(ENOTSUP); + +status = vdctx->get_proc_address(vdctx->device, + VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES, + &func); +if (status != VDP_STATUS_OK) +return vdpau_error(status); +else +surface_query_caps = func; + +status = surface_query_caps(vdctx->device, VDP_CHROMA_TYPE_420, &supported, +&max_width, &max_height); +if (status != VDP_STATUS_OK) +return vdpau_error(status); +if (supported != VDP_TRUE || +max_width < width || max_height < height) +return AVERROR(ENOTSUP); + +status = vdctx->get_proc_address(vdctx->device, + VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES, + &func); +if (status != VDP_STATUS_OK) +return vdpau_error(status); +else +decoder_query_caps = func; + +status = decoder_query_caps(vdctx->device, profile, &supported, &max_level, +&max_mb, &max_width, &max_height); +if (status != VDP_STATUS_OK) +return vdpau_error(status); + +if (supported != VDP_TRUE || max_level < level || +max_width < width || max_height < height) +return AVERROR(ENOTSUP); + status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_CREATE, &func); if (status != VDP_STATUS_OK) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'bef067f88c74190cdf7e76d12f02e12e069974aa'
ffmpeg | branch: master | Michael Niedermayer | Mon Oct 6 15:11:46 2014 +0200| [573d3330107b9a49d6bfbfc739727f8d1516a7a1] | committer: Michael Niedermayer Merge commit 'bef067f88c74190cdf7e76d12f02e12e069974aa' * commit 'bef067f88c74190cdf7e76d12f02e12e069974aa': vdpau: check video surface and decoder capabilities Merged-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=573d3330107b9a49d6bfbfc739727f8d1516a7a1 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/vdpau: fix render2() check
ffmpeg | branch: master | Michael Niedermayer | Mon Oct 6 16:23:36 2014 +0200| [0e57c051181c06d9a3468d5e072ded827ed09a53] | committer: Michael Niedermayer avcodec/vdpau: fix render2() check Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0e57c051181c06d9a3468d5e072ded827ed09a53 --- libavcodec/vdpau.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index ec7effb..a760988 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -237,7 +237,7 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS #endif -if (!hwctx->render) { +if (!hwctx->render && hwctx->render2) { status = hwctx->render2(avctx, frame, (void *)&pic_ctx->info, pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers); } else ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] ffmpeg: add vdpau_old to allow continued testing of the older ( but not oldest) API
ffmpeg | branch: master | Michael Niedermayer | Mon Oct 6 15:27:19 2014 +0200| [403133ab5eb39b5d6d1d2a94e881a40023caa109] | committer: Michael Niedermayer ffmpeg: add vdpau_old to allow continued testing of the older (but not oldest) API Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=403133ab5eb39b5d6d1d2a94e881a40023caa109 --- ffmpeg.h |1 + ffmpeg_opt.c |3 +++ ffmpeg_vdpau.c | 48 3 files changed, 52 insertions(+) diff --git a/ffmpeg.h b/ffmpeg.h index 56eb66a..c456603 100644 --- a/ffmpeg.h +++ b/ffmpeg.h @@ -490,6 +490,7 @@ extern int stdin_interaction; extern int frame_bits_per_raw_sample; extern AVIOContext *progress_avio; extern float max_error_rate; +extern int vdpau_api_ver; extern const AVIOInterruptCB int_cb; diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 4fb6fa3..10aaa3a 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -2984,6 +2984,9 @@ const OptionDef options[] = { { "hwaccel_device", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT | OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccel_devices) }, "select a device for HW acceleration" "devicename" }, +#if HAVE_VDPAU_X11 +{ "vdpau_api_ver", HAS_ARG | OPT_INT | OPT_EXPERT, { &vdpau_api_ver }, "" }, +#endif /* audio options */ { "aframes",OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_audio_frames }, diff --git a/ffmpeg_vdpau.c b/ffmpeg_vdpau.c index fe09306..ef35d22 100644 --- a/ffmpeg_vdpau.c +++ b/ffmpeg_vdpau.c @@ -57,6 +57,8 @@ typedef struct VDPAUContext { VdpYCbCrFormat vdpau_format; } VDPAUContext; +int vdpau_api_ver = 2; + static void vdpau_uninit(AVCodecContext *s) { InputStream *ist = s->opaque; @@ -291,6 +293,49 @@ fail: return AVERROR(EINVAL); } +static int vdpau_old_init(AVCodecContext *s) +{ +InputStream *ist = s->opaque; +int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR; +AVVDPAUContext *vdpau_ctx; +VDPAUContext *ctx; +VdpStatus err; +int profile, ret; + +if (!ist->hwaccel_ctx) { +ret = vdpau_alloc(s); +if (ret < 0) +return ret; +} +ctx = ist->hwaccel_ctx; +vdpau_ctx = s->hwaccel_context; + +ret = av_vdpau_get_profile(s, &profile); +if (ret < 0) { +av_log(NULL, loglevel, "No known VDPAU decoder profile for this stream.\n"); +return AVERROR(EINVAL); +} + +if (ctx->decoder) +ctx->decoder_destroy(ctx->decoder); + +err = ctx->decoder_create(ctx->device, profile, + s->coded_width, s->coded_height, + 16, &ctx->decoder); +if (err != VDP_STATUS_OK) { +av_log(NULL, loglevel, "Error creating the VDPAU decoder: %s\n", + ctx->get_error_string(err)); +return AVERROR_UNKNOWN; +} + +vdpau_ctx->decoder = ctx->decoder; + +ist->hwaccel_get_buffer= vdpau_get_buffer; +ist->hwaccel_retrieve_data = vdpau_retrieve_data; + +return 0; +} + int vdpau_init(AVCodecContext *s) { InputStream *ist = s->opaque; @@ -300,6 +345,9 @@ int vdpau_init(AVCodecContext *s) VdpStatus err; int profile, ret; +if (vdpau_api_ver == 1) +return vdpau_old_init(s); + if (!ist->hwaccel_ctx) { ret = vdpau_alloc(s); if (ret < 0) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '8de1d67967a9f9e22c66cb0c1e518ae4f30d07dd'
ffmpeg | branch: master | Michael Niedermayer | Mon Oct 6 16:23:56 2014 +0200| [4d8356b6788016d578941d1b43d141d5db2fdf14] | committer: Michael Niedermayer Merge commit '8de1d67967a9f9e22c66cb0c1e518ae4f30d07dd' * commit '8de1d67967a9f9e22c66cb0c1e518ae4f30d07dd': avconv_vdpau: update to new VDPAU interface Merged-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4d8356b6788016d578941d1b43d141d5db2fdf14 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avconv_vdpau: update to new VDPAU interface
ffmpeg | branch: master | Rémi Denis-Courmont | Sat Oct 4 16:55:09 2014 +0300| [8de1d67967a9f9e22c66cb0c1e518ae4f30d07dd] | committer: Anton Khirnov avconv_vdpau: update to new VDPAU interface Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8de1d67967a9f9e22c66cb0c1e518ae4f30d07dd --- avconv_vdpau.c | 45 ++--- 1 file changed, 2 insertions(+), 43 deletions(-) diff --git a/avconv_vdpau.c b/avconv_vdpau.c index 820678e..37b50f6 100644 --- a/avconv_vdpau.c +++ b/avconv_vdpau.c @@ -42,9 +42,6 @@ typedef struct VDPAUContext { VdpGetErrorString *get_error_string; VdpGetInformationString *get_information_string; VdpDeviceDestroy*device_destroy; -VdpDecoderCreate*decoder_create; -VdpDecoderDestroy *decoder_destroy; -VdpDecoderRender*decoder_render; VdpVideoSurfaceCreate *video_surface_create; VdpVideoSurfaceDestroy *video_surface_destroy; VdpVideoSurfaceGetBitsYCbCr *video_surface_get_bits; @@ -66,9 +63,6 @@ static void vdpau_uninit(AVCodecContext *s) ist->hwaccel_get_buffer= NULL; ist->hwaccel_retrieve_data = NULL; -if (ctx->decoder_destroy) -ctx->decoder_destroy(ctx->decoder); - if (ctx->device_destroy) ctx->device_destroy(ctx->device); @@ -190,7 +184,6 @@ static int vdpau_alloc(AVCodecContext *s) { InputStream *ist = s->opaque; int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR; -AVVDPAUContext *vdpau_ctx; VDPAUContext *ctx; const char *display, *vendor; VdpStatus err; @@ -239,9 +232,6 @@ do { GET_CALLBACK(VDP_FUNC_ID_GET_ERROR_STRING, get_error_string); GET_CALLBACK(VDP_FUNC_ID_GET_INFORMATION_STRING, get_information_string); GET_CALLBACK(VDP_FUNC_ID_DEVICE_DESTROY, device_destroy); -GET_CALLBACK(VDP_FUNC_ID_DECODER_CREATE, decoder_create); -GET_CALLBACK(VDP_FUNC_ID_DECODER_DESTROY,decoder_destroy); -GET_CALLBACK(VDP_FUNC_ID_DECODER_RENDER, decoder_render); GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_CREATE, video_surface_create); GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, video_surface_destroy); GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR, video_surface_get_bits); @@ -270,12 +260,8 @@ do { ctx->vdpau_format = vdpau_formats[i][0]; ctx->pix_fmt = vdpau_formats[i][1]; -vdpau_ctx = av_vdpau_alloc_context(); -if (!vdpau_ctx) +if (av_vdpau_bind_context(s, ctx->device, ctx->get_proc_address, 0)) goto fail; -vdpau_ctx->render = ctx->decoder_render; - -s->hwaccel_context = vdpau_ctx; ctx->get_information_string(&vendor); av_log(NULL, AV_LOG_VERBOSE, "Using VDPAU -- %s -- on X11 display %s, " @@ -294,39 +280,12 @@ fail: int vdpau_init(AVCodecContext *s) { InputStream *ist = s->opaque; -int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR; -AVVDPAUContext *vdpau_ctx; -VDPAUContext *ctx; -VdpStatus err; -int profile, ret; if (!ist->hwaccel_ctx) { -ret = vdpau_alloc(s); +int ret = vdpau_alloc(s); if (ret < 0) return ret; } -ctx = ist->hwaccel_ctx; -vdpau_ctx = s->hwaccel_context; - -ret = av_vdpau_get_profile(s, &profile); -if (ret < 0) { -av_log(NULL, loglevel, "No known VDPAU decoder profile for this stream.\n"); -return AVERROR(EINVAL); -} - -if (ctx->decoder) -ctx->decoder_destroy(ctx->decoder); - -err = ctx->decoder_create(ctx->device, profile, - s->coded_width, s->coded_height, - 16, &ctx->decoder); -if (err != VDP_STATUS_OK) { -av_log(NULL, loglevel, "Error creating the VDPAU decoder: %s\n", - ctx->get_error_string(err)); -return AVERROR_UNKNOWN; -} - -vdpau_ctx->decoder = ctx->decoder; ist->hwaccel_get_buffer= vdpau_get_buffer; ist->hwaccel_retrieve_data = vdpau_retrieve_data; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/vdpau: do not dereference hwctx before checking it for NULL
ffmpeg | branch: master | Michael Niedermayer | Mon Oct 6 17:39:28 2014 +0200| [67ddf21611b904de1ee3eb0206cd2744a135704a] | committer: Michael Niedermayer avcodec/vdpau: do not dereference hwctx before checking it for NULL Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=67ddf21611b904de1ee3eb0206cd2744a135704a --- libavcodec/vdpau.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index a760988..1827e1a 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -89,7 +89,6 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, vdctx->width= UINT32_MAX; vdctx->height = UINT32_MAX; -hwctx->reset= 0; if (!hwctx) { vdctx->device = VDP_INVALID_HANDLE; @@ -103,6 +102,7 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, vdctx->device = VDP_INVALID_HANDLE; return 0; /* Decoder created by user */ } +hwctx->reset= 0; vdctx->device = hwctx->device; vdctx->get_proc_address = hwctx->get_proc_address; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '577899a6458ccad9026eb268f10dc0b39c224c8d'
ffmpeg | branch: master | Michael Niedermayer | Mon Oct 6 21:08:55 2014 +0200| [d47dd84391f2a4d9dab36b375019bf05d83a5a29] | committer: Michael Niedermayer Merge commit '577899a6458ccad9026eb268f10dc0b39c224c8d' * commit '577899a6458ccad9026eb268f10dc0b39c224c8d': lavc: specify the behavior of av_lockmgr_register on failure. Conflicts: libavcodec/avcodec.h libavcodec/utils.c libavcodec/version.h See: a950edb472e8823e34832c7313ba447b2db76f27 Merged-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d47dd84391f2a4d9dab36b375019bf05d83a5a29 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc: specify the behavior of av_lockmgr_register on failure.
ffmpeg | branch: master | Manfred Georg | Thu Oct 2 13:19:34 2014 -0700| [577899a6458ccad9026eb268f10dc0b39c224c8d] | committer: Anton Khirnov lavc: specify the behavior of av_lockmgr_register on failure. The register function now specifies that the user callback should leave things in the same state that it found them on failure but that failure to destroy is ignored by the library. The register function is now explicit about its behavior on failure (it unregisters the previous callback and destroys all mutex). Signed-off-by: Manfred Georg Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=577899a6458ccad9026eb268f10dc0b39c224c8d --- libavcodec/avcodec.h | 28 +++- libavcodec/utils.c | 36 libavcodec/version.h |2 +- 3 files changed, 44 insertions(+), 22 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index dfbab9b..f0fa7a9 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -4393,16 +4393,26 @@ enum AVLockOp { /** * Register a user provided lock manager supporting the operations - * specified by AVLockOp. mutex points to a (void *) where the - * lockmgr should store/get a pointer to a user allocated mutex. It's - * NULL upon AV_LOCK_CREATE and != NULL for all other ops. + * specified by AVLockOp. The "mutex" argument to the function points + * to a (void *) where the lockmgr should store/get a pointer to a user + * allocated mutex. It is NULL upon AV_LOCK_CREATE and equal to the + * value left by the last call for all other ops. If the lock manager is + * unable to perform the op then it should leave the mutex in the same + * state as when it was called and return a non-zero value. However, + * when called with AV_LOCK_DESTROY the mutex will always be assumed to + * have been successfully destroyed. If av_lockmgr_register succeeds + * it will return a non-negative value, if it fails it will return a + * negative value and destroy all mutex and unregister all callbacks. + * av_lockmgr_register is not thread-safe, it must be called from a + * single thread before any calls which make use of locking are used. * - * @param cb User defined callback. Note: Libav may invoke calls to this - * callback during the call to av_lockmgr_register(). - * Thus, the application must be prepared to handle that. - * If cb is set to NULL the lockmgr will be unregistered. - * Also note that during unregistration the previously registered - * lockmgr callback may also be invoked. + * @param cb User defined callback. av_lockmgr_register invokes calls + * to this callback and the previously registered callback. + * The callback will be used to create more than one mutex + * each of which must be backed by its own underlying locking + * mechanism (i.e. do not use a single static object to + * implement your lock manager). If cb is set to NULL the + * lockmgr will be unregistered. */ int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)); diff --git a/libavcodec/utils.c b/libavcodec/utils.c index a472076..94eca9b 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -2318,20 +2318,32 @@ AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel) int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)) { if (lockmgr_cb) { -if (lockmgr_cb(&codec_mutex, AV_LOCK_DESTROY)) -return -1; -if (lockmgr_cb(&avformat_mutex, AV_LOCK_DESTROY)) -return -1; +// There is no good way to rollback a failure to destroy the +// mutex, so we ignore failures. +lockmgr_cb(&codec_mutex,AV_LOCK_DESTROY); +lockmgr_cb(&avformat_mutex, AV_LOCK_DESTROY); +lockmgr_cb = NULL; +codec_mutex= NULL; +avformat_mutex = NULL; +} + +if (cb) { +void *new_codec_mutex= NULL; +void *new_avformat_mutex = NULL; +int err; +if (err = cb(&new_codec_mutex, AV_LOCK_CREATE)) { +return err > 0 ? AVERROR_UNKNOWN : err; +} +if (err = cb(&new_avformat_mutex, AV_LOCK_CREATE)) { +// Ignore failures to destroy the newly created mutex. +cb(&new_codec_mutex, AV_LOCK_DESTROY); +return err > 0 ? AVERROR_UNKNOWN : err; +} +lockmgr_cb = cb; +codec_mutex= new_codec_mutex; +avformat_mutex = new_avformat_mutex; } -lockmgr_cb = cb; - -if (lockmgr_cb) { -if (lockmgr_cb(&codec_mutex, AV_LOCK_CREATE)) -return -1; -if (lockmgr_cb(&avformat_mutex, AV_LOCK_CREATE)) -return -1; -} return 0; } diff --git a/libavcodec/version.h b/libavcodec/version.h index 849c4b2..773d21e 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -30,7 +30,7 @@ #define LIBAVCODEC_VERSION_MAJOR 56
[FFmpeg-cvslog] ff_get_format: fix infinite loop
ffmpeg | branch: master | Rémi Denis-Courmont | Mon Oct 6 17:41:00 2014 +0300| [153fadc390d05aa47e5e2c56290401898fe41a23] | committer: Anton Khirnov ff_get_format: fix infinite loop Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=153fadc390d05aa47e5e2c56290401898fe41a23 --- libavcodec/utils.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 94eca9b..80ba858 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -973,7 +973,7 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt) do choices[n] = choices[n + 1]; -while (choices[n] != AV_PIX_FMT_NONE); +while (choices[n++] != AV_PIX_FMT_NONE); } av_freep(&choices); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '153fadc390d05aa47e5e2c56290401898fe41a23'
ffmpeg | branch: master | Michael Niedermayer | Tue Oct 7 02:15:07 2014 +0200| [a52384dcdab26e5925a44c0f5fd4b1c5ac5920fe] | committer: Michael Niedermayer Merge commit '153fadc390d05aa47e5e2c56290401898fe41a23' * commit '153fadc390d05aa47e5e2c56290401898fe41a23': ff_get_format: fix infinite loop Merged-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a52384dcdab26e5925a44c0f5fd4b1c5ac5920fe --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] sdp: Simplify parsing/conversion of H264 extradata
ffmpeg | branch: master | Martin Storsjö | Fri Oct 3 20:49:01 2014 +0300| [b76249443864c88ffb2d41ab8d1de7432e985dc7] | committer: Martin Storsjö sdp: Simplify parsing/conversion of H264 extradata By using ff_avc_write_annexb_extradata instead of the h264_mp4toannexb BSF, the code for doing the conversion itself is kept much shorter, there's less state to restore at the end, we don't risk leaving the AVCodecContext in an inconsistent state if returning early due to errors, etc. Also add a missing free if the base64 encoding fails. Signed-off-by: Martin Storsjö > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b76249443864c88ffb2d41ab8d1de7432e985dc7 --- libavformat/sdp.c | 42 -- 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/libavformat/sdp.c b/libavformat/sdp.c index eccd676..43a50d4 100644 --- a/libavformat/sdp.c +++ b/libavformat/sdp.c @@ -156,8 +156,9 @@ static char *extradata2psets(AVCodecContext *c) const uint8_t *r; static const char pset_string[] = "; sprop-parameter-sets="; static const char profile_string[] = "; profile-level-id="; -uint8_t *orig_extradata = NULL; -int orig_extradata_size = 0; +uint8_t *extradata = c->extradata; +int extradata_size = c->extradata_size; +uint8_t *tmpbuf = NULL; const uint8_t *sps = NULL, *sps_end; if (c->extradata_size > MAX_EXTRADATA_SIZE) { @@ -166,44 +167,28 @@ static char *extradata2psets(AVCodecContext *c) return NULL; } if (c->extradata[0] == 1) { -uint8_t *dummy_p; -int dummy_int; -AVBitStreamFilterContext *bsfc= av_bitstream_filter_init("h264_mp4toannexb"); - -if (!bsfc) { -av_log(c, AV_LOG_ERROR, "Cannot open the h264_mp4toannexb BSF!\n"); - +if (ff_avc_write_annexb_extradata(c->extradata, &extradata, + &extradata_size)) return NULL; -} - -orig_extradata_size = c->extradata_size; -orig_extradata = av_mallocz(orig_extradata_size + -FF_INPUT_BUFFER_PADDING_SIZE); -if (!orig_extradata) { -av_bitstream_filter_close(bsfc); -return NULL; -} -memcpy(orig_extradata, c->extradata, orig_extradata_size); -av_bitstream_filter_filter(bsfc, c, NULL, &dummy_p, &dummy_int, NULL, 0, 0); -av_bitstream_filter_close(bsfc); +tmpbuf = extradata; } psets = av_mallocz(MAX_PSET_SIZE); if (!psets) { av_log(c, AV_LOG_ERROR, "Cannot allocate memory for the parameter sets.\n"); -av_free(orig_extradata); +av_free(tmpbuf); return NULL; } memcpy(psets, pset_string, strlen(pset_string)); p = psets + strlen(pset_string); -r = ff_avc_find_startcode(c->extradata, c->extradata + c->extradata_size); -while (r < c->extradata + c->extradata_size) { +r = ff_avc_find_startcode(extradata, extradata + extradata_size); +while (r < extradata + extradata_size) { const uint8_t *r1; uint8_t nal_type; while (!*(r++)); nal_type = *r & 0x1f; -r1 = ff_avc_find_startcode(r, c->extradata + c->extradata_size); +r1 = ff_avc_find_startcode(r, extradata + extradata_size); if (nal_type != 7 && nal_type != 8) { /* Only output SPS and PPS */ r = r1; continue; @@ -219,6 +204,7 @@ static char *extradata2psets(AVCodecContext *c) if (!av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r)) { av_log(c, AV_LOG_ERROR, "Cannot Base64-encode %td %td!\n", MAX_PSET_SIZE - (p - psets), r1 - r); av_free(psets); +av_free(tmpbuf); return NULL; } @@ -231,11 +217,7 @@ static char *extradata2psets(AVCodecContext *c) ff_data_to_hex(p, sps + 1, 3, 0); p[6] = '\0'; } -if (orig_extradata) { -av_free(c->extradata); -c->extradata = orig_extradata; -c->extradata_size = orig_extradata_size; -} +av_free(tmpbuf); return psets; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'b76249443864c88ffb2d41ab8d1de7432e985dc7'
ffmpeg | branch: master | Michael Niedermayer | Tue Oct 7 02:39:58 2014 +0200| [4db0e8fd3366eadb2d6374b647b8738208749348] | committer: Michael Niedermayer Merge commit 'b76249443864c88ffb2d41ab8d1de7432e985dc7' * commit 'b76249443864c88ffb2d41ab8d1de7432e985dc7': sdp: Simplify parsing/conversion of H264 extradata Merged-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4db0e8fd3366eadb2d6374b647b8738208749348 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf: Set the stream time base hint properly for chained muxers
ffmpeg | branch: master | Martin Storsjö | Mon Oct 6 11:41:33 2014 +0300| [28816050e47b6dba430a52e429d21a864cffda8e] | committer: Martin Storsjö lavf: Set the stream time base hint properly for chained muxers This avoids warnings about using the codec time base as time base hint. Signed-off-by: Martin Storsjö > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=28816050e47b6dba430a52e429d21a864cffda8e --- libavformat/hdsenc.c |1 + libavformat/hlsenc.c |1 + libavformat/mpegtsenc.c |1 + libavformat/segment.c|1 + libavformat/smoothstreamingenc.c |1 + 5 files changed, 5 insertions(+) diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c index 882f157..53fef33 100644 --- a/libavformat/hdsenc.c +++ b/libavformat/hdsenc.c @@ -398,6 +398,7 @@ static int hds_write_header(AVFormatContext *s) } avcodec_copy_context(st->codec, s->streams[i]->codec); st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio; +st->time_base = s->streams[i]->time_base; } if (c->streams[c->nb_streams].ctx) c->nb_streams++; diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 5d18d13..ad53df5 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -80,6 +80,7 @@ static int hls_mux_init(AVFormatContext *s) return AVERROR(ENOMEM); avcodec_copy_context(st->codec, s->streams[i]->codec); st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio; +st->time_base = s->streams[i]->time_base; } return 0; diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 7621103..1082650 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -604,6 +604,7 @@ static int mpegts_write_header(AVFormatContext *s) ret = avcodec_copy_context(ast->codec, st->codec); if (ret != 0) goto fail; +ast->time_base = st->time_base; ret = avformat_write_header(ts_st->amux, NULL); if (ret < 0) goto fail; diff --git a/libavformat/segment.c b/libavformat/segment.c index 9c757e4..52da6b9 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -74,6 +74,7 @@ static int segment_mux_init(AVFormatContext *s) return AVERROR(ENOMEM); avcodec_copy_context(st->codec, s->streams[i]->codec); st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio; +st->time_base = s->streams[i]->time_base; } return 0; diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c index d955b343..b9f1dcb 100644 --- a/libavformat/smoothstreamingenc.c +++ b/libavformat/smoothstreamingenc.c @@ -342,6 +342,7 @@ static int ism_write_header(AVFormatContext *s) } avcodec_copy_context(st->codec, s->streams[i]->codec); st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio; +st->time_base = s->streams[i]->time_base; ctx->pb = avio_alloc_context(os->iobuf, sizeof(os->iobuf), AVIO_FLAG_WRITE, os, NULL, ism_write, ism_seek); if (!ctx->pb) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '28816050e47b6dba430a52e429d21a864cffda8e'
ffmpeg | branch: master | Michael Niedermayer | Tue Oct 7 02:51:08 2014 +0200| [3726d07a2af8d57f5af57be339c94fe902853e10] | committer: Michael Niedermayer Merge commit '28816050e47b6dba430a52e429d21a864cffda8e' * commit '28816050e47b6dba430a52e429d21a864cffda8e': lavf: Set the stream time base hint properly for chained muxers Conflicts: libavformat/segment.c Merged-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3726d07a2af8d57f5af57be339c94fe902853e10 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/mxfdec: read reel_name and source timecode from physical source package
ffmpeg | branch: master | Mark Reid | Sat Oct 4 17:42:51 2014 -0700| [5c50214eed19d039a162c5e16d6ee14bdf21500b] | committer: Michael Niedermayer avformat/mxfdec: read reel_name and source timecode from physical source package Reviewed-by: Tomas Härdin Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5c50214eed19d039a162c5e16d6ee14bdf21500b --- libavformat/mxfdec.c | 120 +- 1 file changed, 99 insertions(+), 21 deletions(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 7a4633f..ef4c4ec 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -188,6 +188,7 @@ typedef struct { int tracks_count; MXFDescriptor *descriptor; /* only one */ UID descriptor_ref; +char *name; } MXFPackage; typedef struct { @@ -731,6 +732,27 @@ static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID return 0; } +static int mxf_read_utf16_string(AVIOContext *pb, int size, char** str) +{ +int ret; +size_t buf_size; + +if (size < 0) +return AVERROR(EINVAL); + +buf_size = size + size / 2 + 1; +*str = av_malloc(buf_size); +if (!*str) +return AVERROR(ENOMEM); + +if ((ret = avio_get_str16be(pb, size, *str, buf_size)) < 0) { +av_freep(str); +return ret; +} + +return ret; +} + static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) { MXFPackage *package = arg; @@ -751,6 +773,8 @@ static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size case 0x4701: avio_read(pb, package->descriptor_ref, 16); break; +case 0x4402: +return mxf_read_utf16_string(pb, size, &package->name); } return 0; } @@ -1374,6 +1398,78 @@ static int mxf_add_timecode_metadata(AVDictionary **pm, const char *key, AVTimec return 0; } +static int mxf_parse_physical_source_package(MXFContext *mxf, MXFTrack *source_track, AVStream *st) +{ +MXFPackage *temp_package = NULL; +MXFPackage *physical_package = NULL; +MXFTrack *physical_track = NULL; +MXFStructuralComponent *component = NULL; +MXFStructuralComponent *sourceclip = NULL; +MXFTimecodeComponent *mxf_tc = NULL; +int i, j, k; +AVTimecode tc; +int flags; +int64_t start_position; + +for (i = 0; i < source_track->sequence->structural_components_count; i++) { +component = mxf_resolve_strong_ref(mxf, &source_track->sequence->structural_components_refs[i], SourceClip); +if (!component) +continue; + +for (j = 0; j < mxf->packages_count; j++) { +temp_package = mxf_resolve_strong_ref(mxf, &mxf->packages_refs[j], SourcePackage); +if (!temp_package) +continue; +if (!memcmp(temp_package->package_uid, component->source_package_uid, 16)){ +physical_package = temp_package; +sourceclip = component; +break; +} +} +if (!physical_package) +break; + +/* the name of physical source package is name of the reel or tape */ +if (physical_package->name[0]) +av_dict_set(&st->metadata, "reel_name", physical_package->name, 0); + +/* the source timecode is calculated by adding the start_position of the sourceclip from the file source package track + * to the start_frame of the timecode component located on one of the tracks of the physical source package. + */ +for (j = 0; j < physical_package->tracks_count; j++) { +if (!(physical_track = mxf_resolve_strong_ref(mxf, &physical_package->tracks_refs[j], Track))) { +av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track strong ref\n"); +continue; +} + +if (!(physical_track->sequence = mxf_resolve_strong_ref(mxf, &physical_track->sequence_ref, Sequence))) { +av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track sequence strong ref\n"); +continue; +} + +for (k = 0; k < physical_track->sequence->structural_components_count; k++) { +component = mxf_resolve_strong_ref(mxf, &physical_track->sequence->structural_components_refs[k], TimecodeComponent); +if (!component) +continue; + +mxf_tc = (MXFTimecodeComponent*)component; +flags = mxf_tc->drop_frame == 1 ? AV_TIMECODE_FLAG_DROPFRAME : 0; +/* scale sourceclip start_position to match physical track edit rate */ +start_position = av_rescale_q(sourceclip->start_position, + physical_track->edit_rate, + source_track->edit_rate); + +if (av_time
[FFmpeg-cvslog] avcodec/avpacket: use av_freep(), do not leave stale pointers in memory
ffmpeg | branch: master | Michael Niedermayer | Tue Oct 7 03:40:57 2014 +0200| [c9eac8062e6c68f854837f644aa6045f2a97c151] | committer: Michael Niedermayer avcodec/avpacket: use av_freep(), do not leave stale pointers in memory Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c9eac8062e6c68f854837f644aa6045f2a97c151 --- libavcodec/avpacket.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 9978712..3c26046 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -272,7 +272,7 @@ void av_packet_free_side_data(AVPacket *pkt) { int i; for (i = 0; i < pkt->side_data_elems; i++) -av_free(pkt->side_data[i].data); +av_freep(&pkt->side_data[i].data); av_freep(&pkt->side_data); pkt->side_data_elems = 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/avpacket: simplify freeing pkt->data
ffmpeg | branch: master | Michael Niedermayer | Tue Oct 7 03:40:15 2014 +0200| [b60938e4fd0504df5d1bf46e7ba0772c78904a67] | committer: Michael Niedermayer avcodec/avpacket: simplify freeing pkt->data Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b60938e4fd0504df5d1bf46e7ba0772c78904a67 --- libavcodec/avpacket.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index a87e8e3..9978712 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -34,8 +34,7 @@ void av_destruct_packet(AVPacket *pkt) { -av_free(pkt->data); -pkt->data = NULL; +av_freep(&pkt->data); pkt->size = 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/escape124: use av_freep(), do not leave stale pointers in memory
ffmpeg | branch: master | Michael Niedermayer | Tue Oct 7 03:40:57 2014 +0200| [f0d1b3acdfb8fc61005d19d13350b7fa1bd19a6f] | committer: Michael Niedermayer avcodec/escape124: use av_freep(), do not leave stale pointers in memory Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f0d1b3acdfb8fc61005d19d13350b7fa1bd19a6f --- libavcodec/escape124.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c index bed1efb..c7ccf22 100644 --- a/libavcodec/escape124.c +++ b/libavcodec/escape124.c @@ -76,7 +76,7 @@ static av_cold int escape124_decode_close(AVCodecContext *avctx) Escape124Context *s = avctx->priv_data; for (i = 0; i < 3; i++) -av_free(s->codebooks[i].blocks); +av_freep(&s->codebooks[i].blocks); av_frame_free(&s->frame); @@ -263,7 +263,7 @@ static int escape124_decode_frame(AVCodecContext *avctx, cb_size = s->num_superblocks << cb_depth; } } -av_free(s->codebooks[i].blocks); +av_freep(&s->codebooks[i].blocks); s->codebooks[i] = unpack_codebook(&gb, cb_depth, cb_size); if (!s->codebooks[i].blocks) return -1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/proresenc_kostya: use av_freep(), do not leave stale pointers in memory
ffmpeg | branch: master | Michael Niedermayer | Tue Oct 7 03:40:57 2014 +0200| [1c5647f419db1e93c0f8dac3602c2cec1ffa3a9c] | committer: Michael Niedermayer avcodec/proresenc_kostya: use av_freep(), do not leave stale pointers in memory Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1c5647f419db1e93c0f8dac3602c2cec1ffa3a9c --- libavcodec/proresenc_kostya.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c index 9f7c03e..ad27e16 100644 --- a/libavcodec/proresenc_kostya.c +++ b/libavcodec/proresenc_kostya.c @@ -1101,7 +1101,7 @@ static av_cold int encode_close(AVCodecContext *avctx) if (ctx->tdata) { for (i = 0; i < avctx->thread_count; i++) -av_free(ctx->tdata[i].nodes); +av_freep(&ctx->tdata[i].nodes); } av_freep(&ctx->tdata); av_freep(&ctx->slice_q); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/mpegvideo: check that the context is initialized in ff_mpv_common_frame_size_change( )
ffmpeg | branch: release/1.2 | Michael Niedermayer | Sun Sep 7 13:00:47 2014 +0200| [0f1882b9b2e443ed13f7dde4ec7487916d14e8ad] | committer: Michael Niedermayer avcodec/mpegvideo: check that the context is initialized in ff_mpv_common_frame_size_change() The function otherwise would initialize the context without setting context_initialized alternatively we could set context_initialized Fixes valgrind anomalies related to ticket 3928 Signed-off-by: Michael Niedermayer (cherry picked from commit 0d0f7f0ba43f64312ae4a05d97afecf1b7b1330c) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0f1882b9b2e443ed13f7dde4ec7487916d14e8ad --- libavcodec/mpegvideo.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 11e5467..5dab8d8 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1086,6 +1086,9 @@ int ff_MPV_common_frame_size_change(MpegEncContext *s) { int i, err = 0; +if (!s->context_initialized) +return AVERROR(EINVAL); + if (s->slice_context_count > 1) { for (i = 0; i < s->slice_context_count; i++) { free_duplicate_context(s->thread_context[i]); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/swfdec: Use side data to communicate w/h changes to the decoder
ffmpeg | branch: release/1.2 | Michael Niedermayer | Tue Sep 2 05:22:26 2014 +0200| [248a2fca908478d5036c8f5e418e2ead41b2f0a6] | committer: Michael Niedermayer avformat/swfdec: Use side data to communicate w/h changes to the decoder Fixes reading from freed data Fixes part of Ticket3539 Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit 1c55d0ff3202a04ebc67a72d72391104e9bdb633) Signed-off-by: Michael Niedermayer (cherry picked from commit a9734e7d3017ffc9539eaac2a8acce3ad427f746) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=248a2fca908478d5036c8f5e418e2ead41b2f0a6 --- libavformat/swfdec.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index 54e0f6d..00926c8 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -347,11 +347,15 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) avpriv_set_pts_info(vst, 64, 256, swf->frame_rate); st = vst; } -st->codec->width = width; -st->codec->height = height; if ((res = av_new_packet(pkt, out_len - colormapsize * colormapbpp)) < 0) goto bitmap_end; +if (!st->codec->width && !st->codec->height) { +st->codec->width = width; +st->codec->height = height; +} else { +ff_add_param_change(pkt, 0, 0, 0, width, height); +} pkt->pos = pos; pkt->stream_index = st->index; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/swfdec: Do not change the pixel format
ffmpeg | branch: release/1.2 | Michael Niedermayer | Tue Sep 2 16:42:33 2014 +0200| [6f02de4ee8ca10f7ec2ce61e75c7349b756faecb] | committer: Michael Niedermayer avformat/swfdec: Do not change the pixel format This is currently not supported Fixes part of Ticket 3539 Signed-off-by: Michael Niedermayer (cherry picked from commit c2430304dfb3cc0e3a59ce6d1b59ebdcc934a0c2) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6f02de4ee8ca10f7ec2ce61e75c7349b756faecb --- libavformat/swfdec.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index 00926c8..bf5b581 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -283,6 +283,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) const int bmp_fmt = avio_r8(pb); const int width = avio_rl16(pb); const int height = avio_rl16(pb); +int pix_fmt; len -= 2+1+2+2; @@ -361,7 +362,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) switch (bmp_fmt) { case 3: -st->codec->pix_fmt = AV_PIX_FMT_PAL8; +pix_fmt = AV_PIX_FMT_PAL8; for (i = 0; i < colormapsize; i++) if (alpha_bmp) colormap[i] = buf[3]<<24 | AV_RB24(buf + 4*i); elsecolormap[i] = 0xffU <<24 | AV_RB24(buf + 3*i); @@ -373,14 +374,20 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) memcpy(pal, colormap, AVPALETTE_SIZE); break; case 4: -st->codec->pix_fmt = AV_PIX_FMT_RGB555; +pix_fmt = AV_PIX_FMT_RGB555; break; case 5: -st->codec->pix_fmt = alpha_bmp ? AV_PIX_FMT_ARGB : AV_PIX_FMT_0RGB; +pix_fmt = alpha_bmp ? AV_PIX_FMT_ARGB : AV_PIX_FMT_0RGB; break; default: av_assert0(0); } +if (st->codec->pix_fmt != AV_PIX_FMT_NONE && st->codec->pix_fmt != pix_fmt) { +av_log(s, AV_LOG_ERROR, "pixel format change unsupported\n"); +res = AVERROR_PATCHWELCOME; +goto bitmap_end; +} +st->codec->pix_fmt = pix_fmt; if (linesize * height > pkt->size) { res = AVERROR_INVALIDDATA; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec: fix aac/ac3 parser bitstream buffer size
ffmpeg | branch: release/1.2 | Michael Niedermayer | Fri Aug 22 01:15:57 2014 +0200| [30ffb80dcaf7c5cfde35aafb0caf1c71effc8255] | committer: Michael Niedermayer avcodec: fix aac/ac3 parser bitstream buffer size Buffers containing copies of the AAC and AC3 header bits were not padded before parsing, violating init_get_bits() buffer padding requirement, leading to potential buffer read overflows. This change adds FF_INPUT_BUFFER_PADDING_SIZE bytes to the bit buffer for parsing the header in each of aac_parser.c and ac3_parser.c. Based on patch by: Matt Wolenetz Signed-off-by: Michael Niedermayer (cherry picked from commit fccd85b9f30525f88692f53134eba41f1f2d90db) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=30ffb80dcaf7c5cfde35aafb0caf1c71effc8255 --- libavcodec/aac_parser.c |2 +- libavcodec/ac3_parser.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/aac_parser.c b/libavcodec/aac_parser.c index ab6ca4e..cb93ba9 100644 --- a/libavcodec/aac_parser.c +++ b/libavcodec/aac_parser.c @@ -34,7 +34,7 @@ static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info, int size; union { uint64_t u64; -uint8_t u8[8]; +uint8_t u8[8 + FF_INPUT_BUFFER_PADDING_SIZE]; } tmp; tmp.u64 = av_be2ne64(state); diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c index 8dc4c0d..acfbc2e 100644 --- a/libavcodec/ac3_parser.c +++ b/libavcodec/ac3_parser.c @@ -147,7 +147,7 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info, int err; union { uint64_t u64; -uint8_t u8[8]; +uint8_t u8[8 + FF_INPUT_BUFFER_PADDING_SIZE]; } tmp = { av_be2ne64(state) }; AC3HeaderInfo hdr; GetBitContext gbc; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/mpegvideo: Use "goto fail" for all error paths in ff_mpv_common_frame_size_change()
ffmpeg | branch: release/1.2 | Michael Niedermayer | Sun Sep 7 12:52:24 2014 +0200| [0fc229450fd965d6fea86a95d1b7afec5d26e328] | committer: Michael Niedermayer avcodec/mpegvideo: Use "goto fail" for all error paths in ff_mpv_common_frame_size_change() Signed-off-by: Michael Niedermayer (cherry picked from commit 2762323c37511fbbc98b164c07620b9ebc59ec68) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0fc229450fd965d6fea86a95d1b7afec5d26e328 --- libavcodec/mpegvideo.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 3fbe03b..11e5467 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1115,7 +1115,7 @@ int ff_MPV_common_frame_size_change(MpegEncContext *s) if ((s->width || s->height) && av_image_check_size(s->width, s->height, 0, s->avctx)) -return AVERROR_INVALIDDATA; +goto fail; if ((err = init_context_frame(s))) goto fail; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] bktr: Fix Fabrice's name
ffmpeg | branch: release/1.2 | Timothy Gu | Tue Aug 26 16:13:52 2014 -0700| [0f578ea70521438e4fbb677fb6079acce893915a] | committer: Michael Niedermayer bktr: Fix Fabrice's name Signed-off-by: Timothy Gu This file with the incorrect name was added after the name was fixed in all other files. This is thus fixing a mistake Signed-off-by: Michael Niedermayer (cherry picked from commit 25cb697d0c866a7048a11e9321e60df94dfeaeca) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0f578ea70521438e4fbb677fb6079acce893915a --- libavdevice/bktr.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c index d5f3d9f..639133b 100644 --- a/libavdevice/bktr.c +++ b/libavdevice/bktr.c @@ -3,7 +3,7 @@ * Copyright (c) 2002 Steve O'Hara-Smith * based on * Linux video grab interface - * Copyright (c) 2000,2001 Gerard Lantau + * Copyright (c) 2000, 2001 Fabrice Bellard * and * simple_grab.c Copyright (c) 1999 Roger Hardiman * ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/utils: add GBRP16 to avcodec_align_dimensions2()
ffmpeg | branch: release/1.2 | Michael Niedermayer | Sun Aug 24 23:33:40 2014 +0200| [48443598ed51ee7a670a80687d0d5450307cde33] | committer: Michael Niedermayer avcodec/utils: add GBRP16 to avcodec_align_dimensions2() Fixes Ticket3869 Signed-off-by: Michael Niedermayer (cherry picked from commit 3fe9e7be4c70c8fccdcd56fd19276e668cfb7de8) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=48443598ed51ee7a670a80687d0d5450307cde33 --- libavcodec/utils.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index bd3858b..8acf4c4 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -244,6 +244,8 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, case AV_PIX_FMT_GBRP12BE: case AV_PIX_FMT_GBRP14LE: case AV_PIX_FMT_GBRP14BE: +case AV_PIX_FMT_GBRP16LE: +case AV_PIX_FMT_GBRP16BE: w_align = 16; //FIXME assume 16 pixel per macroblock h_align = 16 * 2; // interlaced needs 2 macroblocks height break; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/libilbc: support for latest git of libilbc
ffmpeg | branch: release/1.2 | Gianluigi Tiesi | Fri Sep 19 04:49:36 2014 +0200| [e28c27e25f30e9eb7bbc123cf4dc8d057e2e2ae2] | committer: Michael Niedermayer avcodec/libilbc: support for latest git of libilbc in the latest git commits of libilbc developers removed WebRtc_xxx typedefs This commit uses int types instead, it's safe to apply also for previous versions since WebRtc_Word16 was always a typedef of int16_t and WebRtc_UWord16 a typedef of uint16_t Reviewed-by: Timothy Gu Signed-off-by: Michael Niedermayer (cherry picked from commit 59af5383c18c8cf3fe2a4b5cc1ebf2f3300bdfe5) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e28c27e25f30e9eb7bbc123cf4dc8d057e2e2ae2 --- libavcodec/libilbc.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/libilbc.c b/libavcodec/libilbc.c index 9805348..3e77fbf 100644 --- a/libavcodec/libilbc.c +++ b/libavcodec/libilbc.c @@ -98,8 +98,7 @@ static int ilbc_decode_frame(AVCodecContext *avctx, void *data, return ret; } -WebRtcIlbcfix_DecodeImpl((WebRtc_Word16*) frame->data[0], - (const WebRtc_UWord16*) buf, &s->decoder, 1); +WebRtcIlbcfix_DecodeImpl((int16_t *) frame->data[0], (const uint16_t *) buf, &s->decoder, 1); *got_frame_ptr = 1; @@ -185,7 +184,7 @@ static int ilbc_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, if ((ret = ff_alloc_packet2(avctx, avpkt, 50)) < 0) return ret; -WebRtcIlbcfix_EncodeImpl((WebRtc_UWord16*) avpkt->data, (const WebRtc_Word16*) frame->data[0], &s->encoder); +WebRtcIlbcfix_EncodeImpl((uint16_t *) avpkt->data, (const int16_t *) frame->data[0], &s->encoder); avpkt->size = s->encoder.no_of_bytes; *got_packet_ptr = 1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] x86/dsputil: add emms to ff_scalarproduct_int16_mmxext()
ffmpeg | branch: release/1.2 | James Almer | Wed Mar 5 19:44:36 2014 -0300| [9b9048a3ddfe97e33a26c87f8c4b029032d49ad8] | committer: Michael Niedermayer x86/dsputil: add emms to ff_scalarproduct_int16_mmxext() Also undo the changes to ra144enc.c from previous commits. Should fix ticket #3429 Signed-off-by: James Almer Signed-off-by: Michael Niedermayer (cherry picked from commit 9e0e1f9067430de1655a7b28536b5afed48bded5) Conflicts: libavcodec/ra144enc.c Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9b9048a3ddfe97e33a26c87f8c4b029032d49ad8 --- libavcodec/ra144enc.c |1 - libavcodec/x86/dsputil.asm |3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/ra144enc.c b/libavcodec/ra144enc.c index 21d38dc..a67b14a 100644 --- a/libavcodec/ra144enc.c +++ b/libavcodec/ra144enc.c @@ -34,7 +34,6 @@ #include "celp_filters.h" #include "ra144.h" - static av_cold int ra144_encode_close(AVCodecContext *avctx) { RA144Context *ractx = avctx->priv_data; diff --git a/libavcodec/x86/dsputil.asm b/libavcodec/x86/dsputil.asm index aa18bdd..32e6134 100644 --- a/libavcodec/x86/dsputil.asm +++ b/libavcodec/x86/dsputil.asm @@ -61,6 +61,9 @@ cglobal scalarproduct_int16, 3,3,3, v1, v2, order %endif paddd m2, m0 movd eax, m2 +%if mmsize == 8 +emms +%endif RET ; int scalarproduct_and_madd_int16(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/mpegvideo: Set err on failure in ff_mpv_common_frame_size_change()
ffmpeg | branch: release/1.2 | Michael Niedermayer | Sun Sep 7 14:14:52 2014 +0200| [d49b57fe0f74264ba795ffdeadab1fe1be582369] | committer: Michael Niedermayer avcodec/mpegvideo: Set err on failure in ff_mpv_common_frame_size_change() Found-by: ubitux Signed-off-by: Michael Niedermayer (cherry picked from commit cfce6f7efd28130bf0dd409b2367ca0f8c9b2417) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d49b57fe0f74264ba795ffdeadab1fe1be582369 --- libavcodec/mpegvideo.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 5dab8d8..68bbe9f 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1117,7 +1117,7 @@ int ff_MPV_common_frame_size_change(MpegEncContext *s) s->mb_height = (s->height + 15) / 16; if ((s->width || s->height) && -av_image_check_size(s->width, s->height, 0, s->avctx)) +(err = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0) goto fail; if ((err = init_context_frame(s))) @@ -1134,7 +1134,7 @@ int ff_MPV_common_frame_size_change(MpegEncContext *s) } for (i = 0; i < nb_slices; i++) { -if (init_duplicate_context(s->thread_context[i]) < 0) +if ((err = init_duplicate_context(s->thread_context[i])) < 0) goto fail; s->thread_context[i]->start_mb_y = (s->mb_height * (i) + nb_slices / 2) / nb_slices; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] apetag: Fix APE tag size check
ffmpeg | branch: release/1.2 | Katerina Barone-Adesi | Tue Sep 16 01:40:24 2014 +0200| [70dc7bb893db63e7c8d8592e4730b69af20f6be4] | committer: Michael Niedermayer apetag: Fix APE tag size check The size variable is (correctly) unsigned, but is passed to several functions which take signed parameters, such as avio_read, sometimes after having numbers added to it. So ensure that size remains within the bounds that these functions can handle. CC: libav-sta...@libav.org Signed-off-by: Diego Biurrun (cherry picked from commit c5560e72d0bb69f8a1ac9536570398f84388f396) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=70dc7bb893db63e7c8d8592e4730b69af20f6be4 --- libavformat/apetag.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/apetag.c b/libavformat/apetag.c index a445c84..6f5f7bd 100644 --- a/libavformat/apetag.c +++ b/libavformat/apetag.c @@ -51,8 +51,10 @@ static int ape_tag_read_field(AVFormatContext *s) av_log(s, AV_LOG_WARNING, "Invalid APE tag key '%s'.\n", key); return -1; } -if (size >= UINT_MAX) -return -1; +if (size > INT32_MAX - FF_INPUT_BUFFER_PADDING_SIZE) { +av_log(s, AV_LOG_ERROR, "APE tag size too large.\n"); +return AVERROR_INVALIDDATA; +} if (flags & APE_TAG_FLAG_IS_BINARY) { uint8_t filename[1024]; enum AVCodecID id; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/m4vdec: Check for non startcode 00 00 00 sequences in probe
ffmpeg | branch: release/1.2 | Michael Niedermayer | Sun Sep 7 16:39:39 2014 +0200| [b9b97900c19c9bddd74d495aaa320af1924bf7ce] | committer: Michael Niedermayer avformat/m4vdec: Check for non startcode 00 00 00 sequences in probe Fixes miss detection of PCM as m4v Fixes Ticket 3928 Signed-off-by: Michael Niedermayer (cherry picked from commit 7c1835c52a4be2e4e996f83c91a8d5a147b01100) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b9b97900c19c9bddd74d495aaa320af1924bf7ce --- libavformat/m4vdec.c |8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavformat/m4vdec.c b/libavformat/m4vdec.c index e72fb42..2deff32 100644 --- a/libavformat/m4vdec.c +++ b/libavformat/m4vdec.c @@ -33,13 +33,15 @@ static int mpeg4video_probe(AVProbeData *probe_packet) for(i=0; ibuf_size; i++){ temp_buffer = (temp_buffer<<8) + probe_packet->buf[i]; -if ((temp_buffer & 0xff00) != 0x100) +if (temp_buffer & 0xfe00) +continue; +if (temp_buffer < 2) continue; if (temp_buffer == VOP_START_CODE) VOP++; else if (temp_buffer == VISUAL_OBJECT_START_CODE) VISO++; -else if (temp_buffer < 0x120) VO++; -else if (temp_buffer < 0x130) VOL++; +else if (temp_buffer >= 0x100 && temp_buffer < 0x120) VO++; +else if (temp_buffer >= 0x120 && temp_buffer < 0x130) VOL++; else if ( !(0x1AF < temp_buffer && temp_buffer < 0x1B7) && !(0x1B9 < temp_buffer && temp_buffer < 0x1C4)) res++; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/snow: check coeffs for validity
ffmpeg | branch: release/1.2 | Michael Niedermayer | Sat Aug 30 02:12:10 2014 +0200| [1482253790c61ccb3e042b07cbc288c4d79637e5] | committer: Michael Niedermayer avcodec/snow: check coeffs for validity Fixes deadlock Fixes integer overflow Fixes Ticket 3892 Signed-off-by: Michael Niedermayer (cherry picked from commit 596636a474ab201badaae269f3a2cef4824b8c1f) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1482253790c61ccb3e042b07cbc288c4d79637e5 --- libavcodec/snow.h |9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libavcodec/snow.h b/libavcodec/snow.h index f15b50f..cbec20b 100644 --- a/libavcodec/snow.h +++ b/libavcodec/snow.h @@ -652,7 +652,10 @@ static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, i if(v){ v= 2*(get_symbol2(&s->c, b->state[context + 2], context-4) + 1); v+=get_rac(&s->c, &b->state[0][16 + 1 + 3 + ff_quant3bA[l&0xFF] + 3*ff_quant3bA[t&0xFF]]); - +if ((uint16_t)v != v) { +av_log(s->avctx, AV_LOG_ERROR, "Coefficient damaged\n"); +v = 1; +} xc->x=x; (xc++)->coeff= v; } @@ -662,6 +665,10 @@ static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, i else run= INT_MAX; v= 2*(get_symbol2(&s->c, b->state[0 + 2], 0-4) + 1); v+=get_rac(&s->c, &b->state[0][16 + 1 + 3]); +if ((uint16_t)v != v) { +av_log(s->avctx, AV_LOG_ERROR, "Coefficient damaged\n"); +v = 1; +} xc->x=x; (xc++)->coeff= v; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swresample/swresample: fix sample drop loop end condition
ffmpeg | branch: release/1.2 | Michael Niedermayer | Mon Oct 6 01:08:20 2014 +0200| [65889b62b3ebd1133173becce7dfa27c6462863a] | committer: Michael Niedermayer swresample/swresample: fix sample drop loop end condition Fixes Ticket3985 Signed-off-by: Michael Niedermayer (cherry picked from commit f9fefa499f0af48f47ea73c8ce0b25df0976c315) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=65889b62b3ebd1133173becce7dfa27c6462863a --- libswresample/swresample.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/libswresample/swresample.c b/libswresample/swresample.c index 9b71b2e..464e7b7 100644 --- a/libswresample/swresample.c +++ b/libswresample/swresample.c @@ -751,6 +751,8 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun in_count = 0; if(ret>0) { s->drop_output -= ret; +if (!s->drop_output && !out_arg) +return 0; continue; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/mmvideo: Bounds check 2nd line of HHV Intra blocks
ffmpeg | branch: release/1.2 | Michael Niedermayer | Fri Oct 3 14:45:04 2014 +0200| [76601e4ab8f5d304906766bffabefbc3791819e9] | committer: Michael Niedermayer avcodec/mmvideo: Bounds check 2nd line of HHV Intra blocks Fixes out of array access Fixes: asan_heap-oob_4da4f3_8_asan_heap-oob_4da4f3_419_scene1a.mm Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 8b0e96e1f21b761ca15dbb470cd619a1ebf86c3e) Conflicts: libavcodec/mmvideo.c Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=76601e4ab8f5d304906766bffabefbc3791819e9 --- libavcodec/mmvideo.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c index b74424c..38aeac0 100644 --- a/libavcodec/mmvideo.c +++ b/libavcodec/mmvideo.c @@ -109,7 +109,7 @@ static int mm_decode_intra(MmContext * s, int half_horiz, int half_vert) if (color) { memset(s->frame.data[0] + y*s->frame.linesize[0] + x, color, run_length); -if (half_vert) +if (half_vert && y + half_vert < s->avctx->height) memset(s->frame.data[0] + (y+1)*s->frame.linesize[0] + x, color, run_length); } x+= run_length; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/tiff: more completely check bpp/bppcount
ffmpeg | branch: release/1.2 | Michael Niedermayer | Fri Oct 3 16:08:32 2014 +0200| [f56095c4d7e5a76be8b114bcf427ab0becf0c635] | committer: Michael Niedermayer avcodec/tiff: more completely check bpp/bppcount Fixes pixel format selection Fixes out of array accesses Fixes: asan_heap-oob_1766029_6_asan_heap-oob_20aa045_332_cov_1823216757_m2-d1d366d7965db766c19a66c7a2ccbb6b.tif Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit e1c0cfaa419aa5d320540d5a1b3f8fd9b82ab7e5) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f56095c4d7e5a76be8b114bcf427ab0becf0c635 --- libavcodec/tiff.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index b43fda8..1456dad 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -716,13 +716,13 @@ static int tiff_decode_tag(TiffContext *s) s->height = value; break; case TIFF_BPP: -s->bppcount = count; -if (count > 4) { +if (count > 4U) { av_log(s->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", - s->bpp, count); + value, count); return AVERROR_INVALIDDATA; } +s->bppcount = count; if (count == 1) s->bpp = value; else { @@ -743,6 +743,13 @@ static int tiff_decode_tag(TiffContext *s) s->bpp = -1; } } +if (s->bpp > 64U) { +av_log(s->avctx, AV_LOG_ERROR, + "This format is not supported (bpp=%d, %d components)\n", + s->bpp, count); +s->bpp = 0; +return AVERROR_INVALIDDATA; +} break; case TIFF_SAMPLES_PER_PIXEL: if (count != 1) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/pngdec: Calculate MPNG bytewidth more defensively
ffmpeg | branch: release/1.2 | Michael Niedermayer | Fri Oct 3 17:54:21 2014 +0200| [665f70209a95b573f1b2b35851d00298f04ffd0f] | committer: Michael Niedermayer avcodec/pngdec: Calculate MPNG bytewidth more defensively Signed-off-by: Michael Niedermayer (cherry picked from commit e830902934a29df05c7af65aef2a480b15f572c4) Conflicts: libavcodec/pngdec.c > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=665f70209a95b573f1b2b35851d00298f04ffd0f --- libavcodec/pngdec.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 5b02a4d..fc7d694 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -842,9 +842,10 @@ static int decode_frame(AVCodecContext *avctx, int i, j; uint8_t *pd = s->current_picture->data[0]; uint8_t *pd_last = s->last_picture->data[0]; +int ls = FFMIN(av_image_get_linesize(s->current_picture->format, s->width, 0), s->width * s->bpp); for (j = 0; j < s->height; j++) { -for (i = 0; i < s->width * s->bpp; i++) { +for (i = 0; i < ls; i++) { pd[i] += pd_last[i]; } pd += s->image_linesize; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/mjpegdec: check bits per pixel for changes similar to dimensions
ffmpeg | branch: release/1.2 | Michael Niedermayer | Fri Oct 3 01:50:27 2014 +0200| [0ffa44340f247e5d24d006726ecc9c66c55dcf22] | committer: Michael Niedermayer avcodec/mjpegdec: check bits per pixel for changes similar to dimensions Fixes out of array accesses Fixes: asan_heap-oob_16668e9_2_asan_heap-oob_16668e9_346_miss_congeniality_pegasus_mjpg.avi Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 5c378d6a6df8243f06c87962b873bd563e58cd39) Conflicts: libavcodec/mjpegdec.c (cherry picked from commit 94371a404c663c3dae3d542fa43951567ab67f82) Conflicts: libavcodec/mjpegdec.c > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0ffa44340f247e5d24d006726ecc9c66c55dcf22 --- libavcodec/mjpegdec.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index b9c6950..234dd20 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -211,7 +211,7 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s) int ff_mjpeg_decode_sof(MJpegDecodeContext *s) { -int len, nb_components, i, width, height, pix_fmt_id; +int len, nb_components, i, width, height, bits, pix_fmt_id; int h_count[MAX_COMPONENTS]; int v_count[MAX_COMPONENTS]; @@ -220,14 +220,14 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) /* XXX: verify len field validity */ len = get_bits(&s->gb, 16); -s->bits = get_bits(&s->gb, 8); +bits = get_bits(&s->gb, 8); if (s->pegasus_rct) -s->bits = 9; -if (s->bits == 9 && !s->pegasus_rct) +bits = 9; +if (bits == 9 && !s->pegasus_rct) s->rct = 1;// FIXME ugly -if (s->bits != 8 && !s->lossless) { +if (bits != 8 && !s->lossless) { av_log(s->avctx, AV_LOG_ERROR, "only 8 bits/component accepted\n"); return -1; } @@ -258,7 +258,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) return AVERROR_INVALIDDATA; } } -if (s->ls && !(s->bits <= 8 || nb_components == 1)) { +if (s->ls && !(bits <= 8 || nb_components == 1)) { av_log_missing_feature(s->avctx, "For JPEG-LS anything except <= 8 bits/component" " or 16-bit gray", 0); @@ -301,12 +301,14 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) /* if different size, realloc/alloc picture */ if ( width != s->width || height != s->height +|| bits != s->bits || memcmp(s->h_count, h_count, sizeof(h_count)) || memcmp(s->v_count, v_count, sizeof(v_count))) { av_freep(&s->qscale_table); s->width = width; s->height = height; +s->bits = bits; memcpy(s->h_count, h_count, sizeof(h_count)); memcpy(s->v_count, v_count, sizeof(v_count)); s->interlaced = 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/mpegts: Check desc_len / get8() return code
ffmpeg | branch: release/1.2 | Michael Niedermayer | Sat Oct 4 04:29:40 2014 +0200| [c4f0f3c52d977b58dc7723fbcb97ee8b1b0f588d] | committer: Michael Niedermayer avformat/mpegts: Check desc_len / get8() return code Fixes out of array read Fixes: signal_sigsegv_844d59_10_signal_sigsegv_a17bb7_366_mpegts_mpeg2video_mp2_dvbsub_topfield.rec Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit c3d7f00ee3e09801f56f25db8b5961f25e842bd2) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c4f0f3c52d977b58dc7723fbcb97ee8b1b0f588d --- libavformat/mpegts.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index c2efb53..58633d8 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1695,7 +1695,7 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len break; desc_len = get8(&p, desc_list_end); desc_end = p + desc_len; -if (desc_end > desc_list_end) +if (desc_len < 0 || desc_end > desc_list_end) break; av_dlog(ts->stream, "tag: 0x%02x len=%d\n", ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avutil/x86/cpu: fix cpuid sub-leaf selection
ffmpeg | branch: release/1.2 | lvqcl | Sat Sep 27 13:21:31 2014 +0200| [2144ce08c1de4d0947043d69ef2b9b5f10850dab] | committer: Michael Niedermayer avutil/x86/cpu: fix cpuid sub-leaf selection Signed-off-by: Michael Niedermayer (cherry picked from commit e58fc44649d07d523fcd17aa10d9eb0d3a5ef3f4) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2144ce08c1de4d0947043d69ef2b9b5f10850dab --- libavutil/x86/cpu.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c index a3a5239..9f8d749 100644 --- a/libavutil/x86/cpu.c +++ b/libavutil/x86/cpu.c @@ -44,7 +44,7 @@ "cpuid \n\t" \ "xchg %%"REG_b", %%"REG_S \ : "=a" (eax), "=S" (ebx), "=c" (ecx), "=d" (edx)\ -: "0" (index)) +: "0" (index), "2"(0)) #define xgetbv(index, eax, edx) \ __asm__ (".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c" (index)) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/smc: fix off by 1 error
ffmpeg | branch: release/1.2 | Michael Niedermayer | Fri Oct 3 22:50:45 2014 +0200| [4865948d2ea9d239ce0ebfe40420d111799ee742] | committer: Michael Niedermayer avcodec/smc: fix off by 1 error Fixes out of array access Fixes: asan_heap-oob_1685bf0_5_asan_heap-oob_1f35116_430_smc.mov Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit c727401aa9d62335e89d118a5b4e202edf39d905) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4865948d2ea9d239ce0ebfe40420d111799ee742 --- libavcodec/smc.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/smc.c b/libavcodec/smc.c index 6294f09..c602b9f 100644 --- a/libavcodec/smc.c +++ b/libavcodec/smc.c @@ -69,7 +69,7 @@ typedef struct SmcContext { row_ptr += stride * 4; \ } \ total_blocks--; \ -if (total_blocks < 0) \ +if (total_blocks < 0 + !!n_blocks) \ { \ av_log(s->avctx, AV_LOG_INFO, "warning: block counter just went negative (this should not happen)\n"); \ return; \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/cinepak: fix integer underflow
ffmpeg | branch: release/1.2 | Michael Niedermayer | Fri Oct 3 19:33:01 2014 +0200| [75f5fe165cedc63ea89514b3e9f6da67fd1038ec] | committer: Michael Niedermayer avcodec/cinepak: fix integer underflow Fixes out of array access Fixes: asan_heap-oob_4da0ba_6_asan_heap-oob_4da0ba_241_cvid_crash.avi Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit e7e5114c506957f40aafd794e06de1a7e341e9d5) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=75f5fe165cedc63ea89514b3e9f6da67fd1038ec --- libavcodec/cinepak.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c index 5bd3f13..ce0f1a9 100644 --- a/libavcodec/cinepak.c +++ b/libavcodec/cinepak.c @@ -134,7 +134,7 @@ static int cinepak_decode_vectors (CinepakContext *s, cvid_strip *strip, const uint8_t *eod = (data + size); uint32_t flag, mask; uint8_t *cb0, *cb1, *cb2, *cb3; -unsigned int x, y; +int x, y; char*ip0, *ip1, *ip2, *ip3; flag = 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/pngdec: Check bits per pixel before setting monoblack pixel format
ffmpeg | branch: release/1.2 | Michael Niedermayer | Fri Oct 3 17:35:58 2014 +0200| [12c8e4021c2db6c714bc0d419820c274f19333fc] | committer: Michael Niedermayer avcodec/pngdec: Check bits per pixel before setting monoblack pixel format Fixes out of array accesses Fixes: asan_heap-oob_14dbfcf_4_asan_heap-oob_1ce5767_179_add_method_small.png Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 3e2b745020c2dbf0201fe7df3dad9e7e0b2e1bb6) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=12c8e4021c2db6c714bc0d419820c274f19333fc --- libavcodec/pngdec.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 36db29e..5b02a4d 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -631,7 +631,7 @@ static int decode_frame(AVCodecContext *avctx, } else if ((s->bits_per_pixel == 1 || s->bits_per_pixel == 2 || s->bits_per_pixel == 4 || s->bits_per_pixel == 8) && s->color_type == PNG_COLOR_TYPE_PALETTE) { avctx->pix_fmt = AV_PIX_FMT_PAL8; -} else if (s->bit_depth == 1) { +} else if (s->bit_depth == 1 && s->bits_per_pixel == 1) { avctx->pix_fmt = AV_PIX_FMT_MONOBLACK; } else if (s->bit_depth == 8 && s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] configure: add noexecstack to linker options if supported.
ffmpeg | branch: release/1.2 | Reimar Döffinger | Sun Sep 21 09:58:10 2014 +0100| [997bf49b1c88a17128bfcbdad19a2b71e689276c] | committer: Michael Niedermayer configure: add noexecstack to linker options if supported. Signed-off-by: Reimar Döffinger (cherry picked from commit b7082d953fda93f7841e7d15a6c3cd15bdee) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=997bf49b1c88a17128bfcbdad19a2b71e689276c --- configure |1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 025941f..dc1c3b6 100755 --- a/configure +++ b/configure @@ -3750,6 +3750,7 @@ EOF fi check_ldflags -Wl,--as-needed +check_ldflags -Wl,-z,noexecstack if check_func dlopen; then ldl= ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/jpeglsdec: Check run value more completely in ls_decode_line()
ffmpeg | branch: release/1.2 | Michael Niedermayer | Thu Oct 2 23:17:21 2014 +0200| [0bd9b78fb6c4831cfffe368989583b337bdacca6] | committer: Michael Niedermayer avcodec/jpeglsdec: Check run value more completely in ls_decode_line() previously it could have been by 1 too large Fixes out of array access Fixes: asan_heap-oob_12240f5_1_asan_heap-oob_12240f5_448_t8c1e3.jls Fixes: asan_heap-oob_12240f5_1_asan_heap-oob_12240f5_448_t8nde0.jls Fixes: asan_heap-oob_12240fa_1_asan_heap-oob_12240fa_448_t16e3.jls Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 06e7d58410a17dc72c30ee7f3145fcacc425f4f2) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0bd9b78fb6c4831cfffe368989583b337bdacca6 --- libavcodec/jpeglsdec.c |5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c index 10fe31a..05eae38 100644 --- a/libavcodec/jpeglsdec.c +++ b/libavcodec/jpeglsdec.c @@ -207,6 +207,11 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, void * x += stride; } +if (x >= w) { +av_log(NULL, AV_LOG_ERROR, "run overflow\n"); +return; +} + /* decode run termination value */ Rb = R(last, x); RItype = (FFABS(Ra - Rb) <= state->near) ? 1 : 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/qpeg: fix off by 1 error in MV bounds check
ffmpeg | branch: release/1.2 | Michael Niedermayer | Fri Oct 3 21:08:52 2014 +0200| [891376d26108e0077f8456195770bbcb839fd02f] | committer: Michael Niedermayer avcodec/qpeg: fix off by 1 error in MV bounds check Fixes out of array access Fixes: asan_heap-oob_153760f_4_asan_heap-oob_1d7a4cf_164_VWbig6.avi Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit dd3bfe3cc1ca26d0fff3a3baf61a40207032143f) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=891376d26108e0077f8456195770bbcb839fd02f --- libavcodec/qpeg.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c index 73d652e..a9e7898 100644 --- a/libavcodec/qpeg.c +++ b/libavcodec/qpeg.c @@ -163,7 +163,7 @@ static void qpeg_decode_inter(QpegContext *qctx, uint8_t *dst, /* check motion vector */ if ((me_x + filled < 0) || (me_x + me_w + filled > width) || - (height - me_y - me_h < 0) || (height - me_y > orig_height) || + (height - me_y - me_h < 0) || (height - me_y >= orig_height) || (filled + me_w > width) || (height - me_h < 0)) av_log(NULL, AV_LOG_ERROR, "Bogus motion vector (%i,%i), block size %ix%i at %i,%i\n", me_x, me_y, me_w, me_h, filled, height); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/gifdec: factorize interleave end handling out
ffmpeg | branch: release/1.2 | Michael Niedermayer | Fri Oct 3 20:15:52 2014 +0200| [24a5cd720d579634ab7140f4cb7fa09fe4b780e4] | committer: Michael Niedermayer avcodec/gifdec: factorize interleave end handling out also change it to a loop Fixes out of array access Fixes: asan_heap-oob_ca5410_8_asan_heap-oob_ca5410_97_ID_LSD_Size_Less_Then_Data_Inter_3.gif Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 8f1457864be8fb9653643519dea1c6492f1dde57) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=24a5cd720d579634ab7140f4cb7fa09fe4b780e4 --- libavcodec/gifdec.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c index 727887a..a27dee7 100644 --- a/libavcodec/gifdec.c +++ b/libavcodec/gifdec.c @@ -253,26 +253,21 @@ static int gif_read_image(GifState *s) case 1: y1 += 8; ptr += linesize * 8; -if (y1 >= height) { -y1 = pass ? 2 : 4; -ptr = ptr1 + linesize * y1; -pass++; -} break; case 2: y1 += 4; ptr += linesize * 4; -if (y1 >= height) { -y1 = 1; -ptr = ptr1 + linesize; -pass++; -} break; case 3: y1 += 2; ptr += linesize * 2; break; } +while (y1 >= height) { +y1 = 4 >> pass; +ptr = ptr1 + linesize * y1; +pass++; +} } else { ptr += linesize; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/h264: Check mode before considering mixed mode intra prediction
ffmpeg | branch: release/1.2 | Michael Niedermayer | Sat Oct 4 14:51:46 2014 +0200| [7fc97160c27d358e8489fefccde10a89f7c9e310] | committer: Michael Niedermayer avcodec/h264: Check mode before considering mixed mode intra prediction Fixes out of array read Fixes: asan_heap-oob_e476fc_2_asan_heap-oob_1333ec6_61_CAMACI3_Sony_C.jsv Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 9734a7a1de3043f012ad0f1ef11027d9488067e6) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7fc97160c27d358e8489fefccde10a89f7c9e310 --- libavcodec/h264.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 8c0544a..21fcabe 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -417,18 +417,18 @@ int ff_h264_check_intra_pred_mode(H264Context *h, int mode, int is_chroma) if ((h->left_samples_available & 0x8080) != 0x8080) { mode = left[mode]; -if (is_chroma && (h->left_samples_available & 0x8080)) { -// mad cow disease mode, aka MBAFF + constrained_intra_pred -mode = ALZHEIMER_DC_L0T_PRED8x8 + - (!(h->left_samples_available & 0x8000)) + - 2 * (mode == DC_128_PRED8x8); -} if (mode < 0) { av_log(h->avctx, AV_LOG_ERROR, "left block unavailable for requested intra mode at %d %d\n", h->mb_x, h->mb_y); return -1; } +if (is_chroma && (h->left_samples_available & 0x8080)) { +// mad cow disease mode, aka MBAFF + constrained_intra_pred +mode = ALZHEIMER_DC_L0T_PRED8x8 + + (!(h->left_samples_available & 0x8000)) + + 2 * (mode == DC_128_PRED8x8); +} } return mode; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/ac3enc_template: fix out of array read
ffmpeg | branch: release/1.2 | Michael Niedermayer | Sat Sep 27 20:34:44 2014 +0200| [e9d85860d0f3d54cb1c6f67cf1856a7ebfea6ffe] | committer: Michael Niedermayer avcodec/ac3enc_template: fix out of array read Found-by: Andreas Cadhalpun Signed-off-by: Michael Niedermayer (cherry picked from commit d85ebea3f3b68ebccfe308fa839fc30fa634e4de) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e9d85860d0f3d54cb1c6f67cf1856a7ebfea6ffe --- libavcodec/ac3enc_template.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c index 0389c2e..76d42a2 100644 --- a/libavcodec/ac3enc_template.c +++ b/libavcodec/ac3enc_template.c @@ -260,7 +260,7 @@ static void apply_channel_coupling(AC3EncodeContext *s) energy_cpl = energy[blk][CPL_CH][bnd]; energy_ch = energy[blk][ch][bnd]; blk1 = blk+1; -while (!s->blocks[blk1].new_cpl_coords[ch] && blk1 < s->num_blocks) { +while (blk1 < s->num_blocks && !s->blocks[blk1].new_cpl_coords[ch]) { if (s->blocks[blk1].cpl_in_use) { energy_cpl += energy[blk1][CPL_CH][bnd]; energy_ch += energy[blk1][ch][bnd]; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/utils: Add case for jv to avcodec_align_dimensions2()
ffmpeg | branch: release/1.2 | Michael Niedermayer | Fri Oct 3 04:30:58 2014 +0200| [e90d620cb93eb23a17b8803d8bb164c903633378] | committer: Michael Niedermayer avcodec/utils: Add case for jv to avcodec_align_dimensions2() Fixes out of array accesses Fixes: asan_heap-oob_12304aa_8_asan_heap-oob_4da4f3_300_intro.jv Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 105654e376a736d243aef4a1d121abebce912e6b) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e90d620cb93eb23a17b8803d8bb164c903633378 --- libavcodec/utils.c |4 1 file changed, 4 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 8acf4c4..33ff8e0 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -274,6 +274,10 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, w_align = 4; h_align = 4; } +if (s->codec_id == AV_CODEC_ID_JV) { +w_align = 8; +h_align = 8; +} break; case AV_PIX_FMT_BGR24: if ((s->codec_id == AV_CODEC_ID_MSZH) || ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/hls: use av_freep(), do not leave stale pointers in memory
ffmpeg | branch: master | Michael Niedermayer | Tue Oct 7 04:29:27 2014 +0200| [0026c4ecfd7b122eb6d296e081747887676449f9] | committer: Michael Niedermayer avformat/hls: use av_freep(), do not leave stale pointers in memory Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0026c4ecfd7b122eb6d296e081747887676449f9 --- libavformat/hls.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index 0c86461..e7bbdfd 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -193,9 +193,9 @@ static void free_segment_list(struct playlist *pls) { int i; for (i = 0; i < pls->n_segments; i++) { -av_free(pls->segments[i]->key); -av_free(pls->segments[i]->url); -av_free(pls->segments[i]); +av_freep(&pls->segments[i]->key); +av_freep(&pls->segments[i]->url); +av_freep(&pls->segments[i]); } av_freep(&pls->segments); pls->n_segments = 0; @@ -212,7 +212,7 @@ static void free_playlist_list(HLSContext *c) av_dict_free(&pls->id3_initial); ff_id3v2_free_extra_meta(&pls->id3_deferred_extra); av_free_packet(&pls->pkt); -av_free(pls->pb.buffer); +av_freep(&pls->pb.buffer); if (pls->input) ffurl_close(pls->input); if (pls->ctx) { @@ -243,7 +243,7 @@ static void free_rendition_list(HLSContext *c) { int i; for (i = 0; i < c->n_renditions; i++) -av_free(c->renditions[i]); +av_freep(&c->renditions[i]); av_freep(&c->renditions); c->n_renditions = 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog