[FFmpeg-cvslog] avfilter/avfilter: fix filtering frames with unknown channel layouts for filters needing writable frames
ffmpeg | branch: master | Marton Balint | Mon Dec 12 22:42:27 2016 +0100| [265d45183be13a43dc08d962a5a60b15e6eff6c0] | committer: Marton Balint avfilter/avfilter: fix filtering frames with unknown channel layouts for filters needing writable frames Reviewed-by: Paul B Mahol Signed-off-by: Marton Balint > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=265d45183be13a43dc08d962a5a60b15e6eff6c0 --- libavfilter/avfilter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 662f933..6f30e3b 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -1096,7 +1096,7 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame) case AVMEDIA_TYPE_AUDIO: av_samples_copy(out->extended_data, frame->extended_data, 0, 0, frame->nb_samples, - av_get_channel_layout_nb_channels(frame->channel_layout), +av_frame_get_channels(frame), frame->format); break; default: ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/utils: Print verbose error message if stream count exceeds max_streams
ffmpeg | branch: master | Michael Niedermayer | Sat Dec 10 20:15:13 2016 +0100| [f0bdd538712d8ed34120ab2b7bd1409fcc99fb45] | committer: Michael Niedermayer avformat/utils: Print verbose error message if stream count exceeds max_streams Reviewed-by: Andreas Cadhalpun Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f0bdd538712d8ed34120ab2b7bd1409fcc99fb45 --- libavformat/utils.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 9e979a7..8973529 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4217,8 +4217,11 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c) int i; AVStream **streams; -if (s->nb_streams >= FFMIN(s->max_streams, INT_MAX/sizeof(*streams))) +if (s->nb_streams >= FFMIN(s->max_streams, INT_MAX/sizeof(*streams))) { +if (s->max_streams < INT_MAX/sizeof(*streams)) +av_log(s, AV_LOG_ERROR, "Number of streams exceeds max_streams parameter (%d), see the documentation if you wish to increase it\n", s->max_streams); return NULL; +} streams = av_realloc_array(s->streams, s->nb_streams + 1, sizeof(*streams)); if (!streams) return NULL; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/options_table: Set the default maximum number of streams to 1000
ffmpeg | branch: master | Michael Niedermayer | Sat Dec 10 20:15:12 2016 +0100| [30581c51e72a7a7ea1572c1c6039f6e4c590a55c] | committer: Michael Niedermayer avformat/options_table: Set the default maximum number of streams to 1000 Fixes CVE-2016-9561, Note the security relevance of this is disputed as running out of memory can happen with valid files Suggested-by: Andreas Cadhalpun Reviewed-by: Andreas Cadhalpun Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=30581c51e72a7a7ea1572c1c6039f6e4c590a55c --- libavformat/options_table.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/options_table.h b/libavformat/options_table.h index d5448e5..a537dda 100644 --- a/libavformat/options_table.h +++ b/libavformat/options_table.h @@ -105,7 +105,7 @@ static const AVOption avformat_options[] = { {"format_whitelist", "List of demuxers that are allowed to be used", OFFSET(format_whitelist), AV_OPT_TYPE_STRING, { .str = NULL }, CHAR_MIN, CHAR_MAX, D }, {"protocol_whitelist", "List of protocols that are allowed to be used", OFFSET(protocol_whitelist), AV_OPT_TYPE_STRING, { .str = NULL }, CHAR_MIN, CHAR_MAX, D }, {"protocol_blacklist", "List of protocols that are not allowed to be used", OFFSET(protocol_blacklist), AV_OPT_TYPE_STRING, { .str = NULL }, CHAR_MIN, CHAR_MAX, D }, -{"max_streams", "maximum number of streams", OFFSET(max_streams), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 0, INT_MAX, D }, +{"max_streams", "maximum number of streams", OFFSET(max_streams), AV_OPT_TYPE_INT, { .i64 = 1000 }, 0, INT_MAX, D }, {NULL}, }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swresample/resample: do not allow negative dst_size return value
ffmpeg | branch: master | Muhammad Faiz | Tue Dec 13 14:11:48 2016 +0700| [6a8c0d83572deabc4cd1920b6d71cc65a37acc57] | committer: Muhammad Faiz swresample/resample: do not allow negative dst_size return value This should fix Ticket6012 Reviewed-by: Michael Niedermayer Signed-off-by: Muhammad Faiz > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6a8c0d83572deabc4cd1920b6d71cc65a37acc57 --- libswresample/resample.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libswresample/resample.c b/libswresample/resample.c index 71dffb9..ce6a82f 100644 --- a/libswresample/resample.c +++ b/libswresample/resample.c @@ -478,8 +478,9 @@ static int swri_resample(ResampleContext *c, int64_t incr= (1LL<<32) * c->dst_incr / c->src_incr; int new_size = (src_size * (int64_t)c->src_incr - frac + c->dst_incr - 1) / c->dst_incr; -dst_size= FFMIN(dst_size, new_size); -c->dsp.resample_one(dst, src, dst_size, index2, incr); +dst_size = FFMAX(FFMIN(dst_size, new_size), 0); +if (dst_size > 0) +c->dsp.resample_one(dst, src, dst_size, index2, incr); index += dst_size * c->dst_incr_div; index += (frac + dst_size * (int64_t)c->dst_incr_mod) / c->src_incr; @@ -494,7 +495,7 @@ static int swri_resample(ResampleContext *c, int64_t delta_frac = (end_index - c->index) * c->src_incr - c->frac; int delta_n = (delta_frac + c->dst_incr - 1) / c->dst_incr; -dst_size = FFMIN(dst_size, delta_n); +dst_size = FFMAX(FFMIN(dst_size, delta_n), 0); if (dst_size > 0) { /* resample_linear and resample_common should have same behavior * when frac and dst_incr_mod are zero */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] libvpxenc: Don't spam level errors for VP8 encodes
ffmpeg | branch: master | Alex Converse | Mon Dec 12 12:07:05 2016 -0800| [bf15981b126256c403a1529df5172dce761295d4] | committer: Alex Converse libvpxenc: Don't spam level errors for VP8 encodes Fixes "Failed to set VP9E_GET_LEVEL codec control: Codec does not implement requested capability" log messages on VP8 encodes. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bf15981b126256c403a1529df5172dce761295d4 --- libavcodec/libvpxenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 1325199..de0d0b6 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -293,7 +293,8 @@ static av_cold int vpx_free(AVCodecContext *avctx) VPxContext *ctx = avctx->priv_data; #if VPX_ENCODER_ABI_VERSION >= 12 -if (ctx->level >= 0 && !(avctx->flags & AV_CODEC_FLAG_PASS1)) { +if (avctx->codec_id == AV_CODEC_ID_VP9 && ctx->level >= 0 && +!(avctx->flags & AV_CODEC_FLAG_PASS1)) { int level_out = 0; if (!codecctl_intp(avctx, VP9E_GET_LEVEL, &level_out)) av_log(avctx, AV_LOG_INFO, "Encoded level %.1f\n", level_out * 0.1); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swresample/resample: remove swri_resample function
ffmpeg | branch: master | Muhammad Faiz | Wed Dec 14 00:51:18 2016 +0700| [2b0112d42d4dfc8976be20b4d9729c0e077146c6] | committer: Muhammad Faiz swresample/resample: remove swri_resample function integrate it inside multiple_resample allow some calculations to be performed outside loop Suggested-by: Michael Niedermayer Reviewed-by: Michael Niedermayer Signed-off-by: Muhammad Faiz > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2b0112d42d4dfc8976be20b4d9729c0e077146c6 --- libswresample/resample.c | 79 +--- 1 file changed, 35 insertions(+), 44 deletions(-) diff --git a/libswresample/resample.c b/libswresample/resample.c index ce6a82f..8e2f769 100644 --- a/libswresample/resample.c +++ b/libswresample/resample.c @@ -467,70 +467,61 @@ static int set_compensation(ResampleContext *c, int sample_delta, int compensati return 0; } -static int swri_resample(ResampleContext *c, - uint8_t *dst, const uint8_t *src, int *consumed, - int src_size, int dst_size, int update_ctx) -{ +static int multiple_resample(ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed){ +int i; +int av_unused mm_flags = av_get_cpu_flags(); +int need_emms = c->format == AV_SAMPLE_FMT_S16P && ARCH_X86_32 && +(mm_flags & (AV_CPU_FLAG_MMX2 | AV_CPU_FLAG_SSE2)) == AV_CPU_FLAG_MMX2; +int64_t max_src_size = (INT64_MAX/2 / c->phase_count) / c->src_incr; + +if (c->compensation_distance) +dst_size = FFMIN(dst_size, c->compensation_distance); +src_size = FFMIN(src_size, max_src_size); + +*consumed = 0; + if (c->filter_length == 1 && c->phase_count == 1) { -int index= c->index; -int frac= c->frac; -int64_t index2= (1LL<<32)*c->frac/c->src_incr + (1LL<<32)*index; +int64_t index2= (1LL<<32)*c->frac/c->src_incr + (1LL<<32)*c->index; int64_t incr= (1LL<<32) * c->dst_incr / c->src_incr; -int new_size = (src_size * (int64_t)c->src_incr - frac + c->dst_incr - 1) / c->dst_incr; +int new_size = (src_size * (int64_t)c->src_incr - c->frac + c->dst_incr - 1) / c->dst_incr; dst_size = FFMAX(FFMIN(dst_size, new_size), 0); -if (dst_size > 0) -c->dsp.resample_one(dst, src, dst_size, index2, incr); - -index += dst_size * c->dst_incr_div; -index += (frac + dst_size * (int64_t)c->dst_incr_mod) / c->src_incr; -av_assert2(index >= 0); -*consumed= index; -if (update_ctx) { -c->frac = (frac + dst_size * (int64_t)c->dst_incr_mod) % c->src_incr; -c->index = 0; +if (dst_size > 0) { +for (i = 0; i < dst->ch_count; i++) { +c->dsp.resample_one(dst->ch[i], src->ch[i], dst_size, index2, incr); +if (i+1 == dst->ch_count) { +c->index += dst_size * c->dst_incr_div; +c->index += (c->frac + dst_size * (int64_t)c->dst_incr_mod) / c->src_incr; +av_assert2(c->index >= 0); +*consumed = c->index; +c->frac = (c->frac + dst_size * (int64_t)c->dst_incr_mod) % c->src_incr; +c->index = 0; +} +} } } else { int64_t end_index = (1LL + src_size - c->filter_length) * c->phase_count; int64_t delta_frac = (end_index - c->index) * c->src_incr - c->frac; int delta_n = (delta_frac + c->dst_incr - 1) / c->dst_incr; +int (*resample_func)(struct ResampleContext *c, void *dst, + const void *src, int n, int update_ctx); dst_size = FFMAX(FFMIN(dst_size, delta_n), 0); if (dst_size > 0) { /* resample_linear and resample_common should have same behavior * when frac and dst_incr_mod are zero */ -if (c->linear && (c->frac || c->dst_incr_mod)) -*consumed = c->dsp.resample_linear(c, dst, src, dst_size, update_ctx); -else -*consumed = c->dsp.resample_common(c, dst, src, dst_size, update_ctx); -} else { -*consumed = 0; +resample_func = (c->linear && (c->frac || c->dst_incr_mod)) ? +c->dsp.resample_linear : c->dsp.resample_common; +for (i = 0; i < dst->ch_count; i++) +*consumed = resample_func(c, dst->ch[i], src->ch[i], dst_size, i+1 == dst->ch_count); } } -return dst_size; -} - -static int multiple_resample(ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed){ -int i, ret= -1; -int av_unused mm_flags = av_get_cpu_flags(); -int need_emms = c->format == AV_SAMPLE_FMT_S16P && ARCH_X86_32 && -(mm_flags & (AV_CPU_FLAG_MMX2 | AV_CPU_FLAG_SSE2)) == AV_CPU_FLAG_MMX2; -int64_t max_src_size
[FFmpeg-cvslog] avformat: fix overflows during bit rate calculation
ffmpeg | branch: master | Andreas Cadhalpun | Tue Dec 13 00:38:25 2016 +0100| [ad5807f8aa883bee5431186dc1f24c5435d722d3] | committer: Andreas Cadhalpun avformat: fix overflows during bit rate calculation The bit_rate field has type int64_t since commit 7404f3bdb90e6a5dcb59bc0a091e2c5c038e557d. Reviewed-by: Paul B Mahol Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ad5807f8aa883bee5431186dc1f24c5435d722d3 --- libavformat/adxdec.c | 2 +- libavformat/aiffdec.c| 4 ++-- libavformat/apc.c| 2 +- libavformat/bfi.c| 2 +- libavformat/electronicarts.c | 2 +- libavformat/iff.c| 2 +- libavformat/soxdec.c | 2 +- libavformat/voc_packet.c | 2 +- libavformat/vqf.c| 2 +- libavformat/wsddec.c | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c index 0315ecb..a271e2a 100644 --- a/libavformat/adxdec.c +++ b/libavformat/adxdec.c @@ -116,7 +116,7 @@ static int adx_read_header(AVFormatContext *s) par->codec_type = AVMEDIA_TYPE_AUDIO; par->codec_id= s->iformat->raw_codec_id; -par->bit_rate= par->sample_rate * par->channels * BLOCK_SIZE * 8LL / BLOCK_SAMPLES; +par->bit_rate= (int64_t)par->sample_rate * par->channels * BLOCK_SIZE * 8LL / BLOCK_SAMPLES; avpriv_set_pts_info(st, 64, BLOCK_SAMPLES, par->sample_rate); diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 59e969d..9e7a39c 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -181,7 +181,7 @@ static int get_aiff_header(AVFormatContext *s, int size, par->block_align = (av_get_bits_per_sample(par->codec_id) * par->channels) >> 3; if (aiff->block_duration) { -par->bit_rate = par->sample_rate * (par->block_align << 3) / +par->bit_rate = (int64_t)par->sample_rate * (par->block_align << 3) / aiff->block_duration; } @@ -318,7 +318,7 @@ static int aiff_read_header(AVFormatContext *s) st->codecpar->block_align = 35; } aiff->block_duration = 160; -st->codecpar->bit_rate = st->codecpar->sample_rate * (st->codecpar->block_align << 3) / +st->codecpar->bit_rate = (int64_t)st->codecpar->sample_rate * (st->codecpar->block_align << 3) / aiff->block_duration; } break; diff --git a/libavformat/apc.c b/libavformat/apc.c index a4dcf66..b180a50 100644 --- a/libavformat/apc.c +++ b/libavformat/apc.c @@ -65,7 +65,7 @@ static int apc_read_header(AVFormatContext *s) } st->codecpar->bits_per_coded_sample = 4; -st->codecpar->bit_rate = st->codecpar->bits_per_coded_sample * st->codecpar->channels +st->codecpar->bit_rate = (int64_t)st->codecpar->bits_per_coded_sample * st->codecpar->channels * st->codecpar->sample_rate; st->codecpar->block_align = 1; diff --git a/libavformat/bfi.c b/libavformat/bfi.c index ef4c17d..6c98e33 100644 --- a/libavformat/bfi.c +++ b/libavformat/bfi.c @@ -108,7 +108,7 @@ static int bfi_read_header(AVFormatContext * s) astream->codecpar->channel_layout = AV_CH_LAYOUT_MONO; astream->codecpar->bits_per_coded_sample = 8; astream->codecpar->bit_rate= -astream->codecpar->sample_rate * astream->codecpar->bits_per_coded_sample; +(int64_t)astream->codecpar->sample_rate * astream->codecpar->bits_per_coded_sample; avio_seek(pb, chunk_header - 3, SEEK_SET); avpriv_set_pts_info(astream, 64, 1, astream->codecpar->sample_rate); return 0; diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index 80ce4c6..30eb723 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -557,7 +557,7 @@ static int ea_read_header(AVFormatContext *s) st->codecpar->channels = ea->num_channels; st->codecpar->sample_rate = ea->sample_rate; st->codecpar->bits_per_coded_sample = ea->bytes * 8; -st->codecpar->bit_rate = st->codecpar->channels * +st->codecpar->bit_rate = (int64_t)st->codecpar->channels * st->codecpar->sample_rate * st->codecpar->bits_per_coded_sample / 4; st->codecpar->block_align = st->codecpar->channels * diff --git a/libavformat/iff.c b/libavformat/iff.c index bf44170..29fb7bf 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -748,7 +748,7 @@ static int iff_read_header(AVFormatContext *s) } st->codecpar->bits_per_coded_sample = av_get_bits_per_sample(st->codecpar->codec_id); -st->codecpar->bit_rate = st->codecpar->channels * st->codecpar->sample_rate * st->codecpar->bits_per_coded_sample; +st->codecpar-
[FFmpeg-cvslog] libavcodec : add decoder for Photoshop PSD image files
ffmpeg | branch: master | Martin Vignali | Thu Nov 24 21:26:42 2016 +0100| [90af962911bbe10f32a4367954c4f11a9e47a98f] | committer: Michael Niedermayer libavcodec : add decoder for Photoshop PSD image files Decode the Image Data Section (which contains merged pictures). Support RGB/A and Grayscale/A in 8bits and 16 bits per channel. Support uncompress and rle decompression in Image Data Section. Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=90af962911bbe10f32a4367954c4f11a9e47a98f --- Changelog | 1 + doc/general.texi| 2 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/avcodec.h| 1 + libavcodec/codec_desc.c | 7 + libavcodec/psd.c| 435 7 files changed, 448 insertions(+) diff --git a/Changelog b/Changelog index 37fbb36..b36a631 100644 --- a/Changelog +++ b/Changelog @@ -8,6 +8,7 @@ version : - premultiply video filter - Support for spherical videos - configure now fails if autodetect-libraries are requested but not found +- PSD Decoder version 3.2: - libopenmpt demuxer diff --git a/doc/general.texi b/doc/general.texi index 56b9e4d..9ea3ba3 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -584,6 +584,8 @@ following image formats are supported: @item PNG @tab X @tab X @item PPM @tab X @tab X @tab Portable PixelMap image +@item PSD @tab @tab X +@tab Photoshop @item PTX @tab @tab X @tab V.Flash PTX format @item SGI @tab X @tab X diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 6dd294e..23e41dd 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -462,6 +462,7 @@ OBJS-$(CONFIG_PRORES_LGPL_DECODER) += proresdec_lgpl.o proresdsp.o proresdat OBJS-$(CONFIG_PRORES_ENCODER) += proresenc_anatoliy.o OBJS-$(CONFIG_PRORES_AW_ENCODER) += proresenc_anatoliy.o OBJS-$(CONFIG_PRORES_KS_ENCODER) += proresenc_kostya.o proresdata.o +OBJS-$(CONFIG_PSD_DECODER) += psd.o OBJS-$(CONFIG_PTX_DECODER) += ptx.o OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o \ celp_filters.o acelp_vectors.o \ diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index ada9481..bbcecce 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -287,6 +287,7 @@ void avcodec_register_all(void) REGISTER_ENCODER(PRORES_AW, prores_aw); REGISTER_ENCODER(PRORES_KS, prores_ks); REGISTER_DECODER(PRORES_LGPL, prores_lgpl); +REGISTER_DECODER(PSD, psd); REGISTER_DECODER(PTX, ptx); REGISTER_DECODER(QDRAW, qdraw); REGISTER_DECODER(QPEG, qpeg); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 02234ae..098debf 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -411,6 +411,7 @@ enum AVCodecID { AV_CODEC_ID_MAGICYUV, AV_CODEC_ID_SHEERVIDEO, AV_CODEC_ID_YLC, +AV_CODEC_ID_PSD, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the start of audio codecs diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 9dbe2dc..29ffcb9 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1461,6 +1461,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, }, { +.id= AV_CODEC_ID_PSD, +.type = AVMEDIA_TYPE_VIDEO, +.name = "psd", +.long_name = NULL_IF_CONFIG_SMALL("Photoshop PSD file"), +.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, +}, +{ .id= AV_CODEC_ID_PTX, .type = AVMEDIA_TYPE_VIDEO, .name = "ptx", diff --git a/libavcodec/psd.c b/libavcodec/psd.c new file mode 100644 index 000..d5a4f52 --- /dev/null +++ b/libavcodec/psd.c @@ -0,0 +1,435 @@ +/* + * Photoshop (PSD) image decoder + * Copyright (c) 2016 Jokyo Images + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "bytestream.h" +#include "
[FFmpeg-cvslog] libavformat : add Photoshop PSD demuxer.
ffmpeg | branch: master | Martin Vignali | Thu Nov 24 21:26:56 2016 +0100| [a534862b278a52c09ddf7d6e78e72397b6b4048b] | committer: Michael Niedermayer libavformat : add Photoshop PSD demuxer. Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a534862b278a52c09ddf7d6e78e72397b6b4048b --- libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/img2dec.c| 32 3 files changed, 34 insertions(+) diff --git a/libavformat/Makefile b/libavformat/Makefile index f93658d..f803d04 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -235,6 +235,7 @@ OBJS-$(CONFIG_IMAGE_PGM_PIPE_DEMUXER) += img2dec.o img2.o OBJS-$(CONFIG_IMAGE_PICTOR_PIPE_DEMUXER) += img2dec.o img2.o OBJS-$(CONFIG_IMAGE_PNG_PIPE_DEMUXER) += img2dec.o img2.o OBJS-$(CONFIG_IMAGE_PPM_PIPE_DEMUXER) += img2dec.o img2.o +OBJS-$(CONFIG_IMAGE_PSD_PIPE_DEMUXER) += img2dec.o img2.o OBJS-$(CONFIG_IMAGE_QDRAW_PIPE_DEMUXER) += img2dec.o img2.o OBJS-$(CONFIG_IMAGE_SGI_PIPE_DEMUXER) += img2dec.o img2.o OBJS-$(CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER) += img2dec.o img2.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 6a216ef..9d77b9c 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -366,6 +366,7 @@ void av_register_all(void) REGISTER_DEMUXER (IMAGE_PICTOR_PIPE, image_pictor_pipe); REGISTER_DEMUXER (IMAGE_PNG_PIPE,image_png_pipe); REGISTER_DEMUXER (IMAGE_PPM_PIPE,image_ppm_pipe); +REGISTER_DEMUXER (IMAGE_PSD_PIPE,image_psd_pipe); REGISTER_DEMUXER (IMAGE_QDRAW_PIPE, image_qdraw_pipe); REGISTER_DEMUXER (IMAGE_SGI_PIPE,image_sgi_pipe); REGISTER_DEMUXER (IMAGE_SUNRAST_PIPE,image_sunrast_pipe); diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index a920f46..f1a0e7f 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -822,6 +822,37 @@ static int png_probe(AVProbeData *p) return 0; } +static int psd_probe(AVProbeData *p) +{ +const uint8_t *b = p->buf; +int ret = 0; +uint16_t color_mode; + +if (AV_RL32(b) == MKTAG('8','B','P','S')) { +ret += 1; +} else { +return 0; +} + +if ((b[4] == 0) && (b[5] == 1)) {/* version 1 is PSD, version 2 is PSB */ +ret += 1; +} else { +return 0; +} + +if ((AV_RL32(b+6) == 0) && (AV_RL16(b+10) == 0))/* reserved must be 0 */ +ret += 1; + +color_mode = AV_RB16(b+24); +if ((color_mode <= 9) && (color_mode != 5) && (color_mode != 6)) +ret += 1; + +if (ret) +return AVPROBE_SCORE_EXTENSION + ret; + +return 0; +} + static int sgi_probe(AVProbeData *p) { const uint8_t *b = p->buf; @@ -947,6 +978,7 @@ IMAGEAUTO_DEMUXER(pgmyuv, AV_CODEC_ID_PGMYUV) IMAGEAUTO_DEMUXER(pictor, AV_CODEC_ID_PICTOR) IMAGEAUTO_DEMUXER(png, AV_CODEC_ID_PNG) IMAGEAUTO_DEMUXER(ppm, AV_CODEC_ID_PPM) +IMAGEAUTO_DEMUXER(psd, AV_CODEC_ID_PSD) IMAGEAUTO_DEMUXER(qdraw, AV_CODEC_ID_QDRAW) IMAGEAUTO_DEMUXER(sgi, AV_CODEC_ID_SGI) IMAGEAUTO_DEMUXER(sunrast, AV_CODEC_ID_SUNRAST) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog