Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/wmaprodec: >2 channel support for XMA
On 1/19/17, Michael Niedermayer wrote: > On Thu, Jan 19, 2017 at 12:44:38AM +0100, Paul B Mahol wrote: >> ffmpeg | branch: master | Paul B Mahol | Tue Jan 17 >> 15:54:57 2017 +0100| [6c43f33ac2e7606b2013f6261144389589394196] | >> committer: Paul B Mahol >> >> avcodec/wmaprodec: >2 channel support for XMA >> >> Signed-off-by: Paul B Mahol >> >> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6c43f33ac2e7606b2013f6261144389589394196 >> --- >> >> libavcodec/wmaprodec.c | 274 >> - >> libavformat/wavdec.c | 3 + >> 2 files changed, 204 insertions(+), 73 deletions(-) > > This causes an assertion failure: > > > [xma2 @ 0x2093b40] get_buffer() failed > [asf @ 0x2092500] packet fragment position invalid 0,0 not in 0 > Last message repeated 1 times > Assertion n>0 && n<=25 failed at libavcodec/get_bits.h:265 Do you have sample file? > > Program received signal SIGABRT, Aborted. > 0x701af035 in raise () from /lib/x86_64-linux-gnu/libc.so.6 > (gdb) bt > Python Exception No module named > gdb.frames: > #0 0x701af035 in raise () from /lib/x86_64-linux-gnu/libc.so.6 > #1 0x701b279b in abort () from /lib/x86_64-linux-gnu/libc.so.6 > #2 0x00c4dc1e in get_bits (s=0x7fffec42eda0, n=0) at > libavcodec/get_bits.h:265 > #3 0x00c52e26 in decode_packet (avctx=0x2093b40, s=0x7fffec41e040, > data=0x0, got_frame_ptr=0x7fffd6ac, avpkt=0x7fffd700) at > libavcodec/wmaprodec.c:1627 > #4 0x00c5333f in xma_decode_packet (avctx=0x2093b40, > data=0x2094a80, got_frame_ptr=0x7fffd7f4, avpkt=0x7fffd700) at > libavcodec/wmaprodec.c:1752 > #5 0x00b444b9 in avcodec_decode_audio4 (avctx=0x2093b40, > frame=0x2094a80, got_frame_ptr=0x7fffd7f4, avpkt=0x7fffd8b0) at > libavcodec/utils.c:2363 > #6 0x00b45ef3 in do_decode (avctx=0x2093b40, pkt=0x7fffd8b0) at > libavcodec/utils.c:2794 > #7 0x00b4629d in avcodec_send_packet (avctx=0x2093b40, > avpkt=0x7fffd8b0) at libavcodec/utils.c:2878 > #8 0x007582cb in try_decode_frame (s=0x2092500, st=0x20931a0, > avpkt=0x7fffd9a0, options=0x2093160) at libavformat/utils.c:2983 > #9 0x0075b12e in avformat_find_stream_info (ic=0x2092500, > options=0x2093160) at libavformat/utils.c:3684 > #10 0x0041ba23 in open_input_file (o=0x7fffde00, > filename=0x7fffe6b2 "a.wma") at ffmpeg_opt.c:1021 > #11 0x00425350 in open_files (l=0x2092318, inout=0x10bf117 "input", > open_file=0x41b097 ) at ffmpeg_opt.c:3233 > #12 0x004254d3 in ffmpeg_parse_options (argc=3, argv=0x7fffe408) > at ffmpeg_opt.c:3273 > #13 0x0043b047 in main (argc=3, argv=0x7fffe408) at > ffmpeg.c:4566 > > [...9 > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > The worst form of inequality is to try to make unequal things equal. > -- Aristotle > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavf/mov: ignore edit list with duration equals to 0 for covers art
On Thu, Jan 19, 2017 at 04:55:22AM +0900, Yusuke Nakamura wrote: > 2017-01-18 19:38 GMT+09:00 Matthieu Bouron : > > > Discards edit list with duration equals to 0 for video streams with only > > one frame and avoid discarding covers art muxed as a single frame video > > stream. > > --- > > Hello, > > > > The following patch discards single edit list with duration equals to 0 > > for video streams with only one frame which prevents discarding covers art > > muxed as a single frame video stream. > > > > The patch can be extended to make it always discards single edit list with > > duration equals to 0 (even if the video streams has more than one sample). > > What do you think ? > > > > Matthieu > > --- > > libavformat/mov.c | 11 +++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/libavformat/mov.c b/libavformat/mov.c > > index d1b929174d..88ffd0e5f2 100644 > > --- a/libavformat/mov.c > > +++ b/libavformat/mov.c > > @@ -2988,6 +2988,17 @@ static void mov_fix_index(MOVContext *mov, AVStream > > *st) > > if (!msc->elst_data || msc->elst_count <= 0 || nb_old <= 0) { > > return; > > } > > + > > +// Discard edit list with duration equals to 0 for video streams with > > only > > +// one frame and avoid discarding covers art muxed as a single frame > > video > > +// stream > > +if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && > > +msc->chunk_count == 1 && > > +msc->elst_count == 1 && > > +msc->elst_data[0].duration == 0) { > > > > This can be false positive since segment_duration=0 could be used for > implicit segment_duration when movie fragments. The spec explicitly says > that only when initial movie has no samples but > w16161-14496-12-DefectReport-R4.docx implies that the 14496-12 spec will > also apply it to more generic cases. And why msc->chunk_count == 1? The > chunk_count is the number of chunks but not samples. > If I understand correctly segment_duration=0 means implicit duration for all cases (fragmented / non-fragmented) ? Does that mean we should discard the duration but honor the rest of the elst fields ? Regarding the use of msc->chunk_count I wrongly assumed that one chunk == one video frame. I used originally st->nb_index_entries but I'm not sure if it's right though. Thanks, Matthieu [...] ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/h264: simplify find_unused_picture()
On Thu, Jan 19, 2017 at 02:37:09AM +0100, Michael Niedermayer wrote: > On Wed, Jan 18, 2017 at 06:13:02PM +0100, Clément Bœsch wrote: > > --- > > libavcodec/h264_slice.c | 16 +++- > > 1 file changed, 3 insertions(+), 13 deletions(-) > > LGTM > > thx > pushed -- Clément B. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/wmaprodec: >2 channel support for XMA
On 1/19/17, Paul B Mahol wrote: > On 1/19/17, Michael Niedermayer wrote: >> On Thu, Jan 19, 2017 at 12:44:38AM +0100, Paul B Mahol wrote: >>> ffmpeg | branch: master | Paul B Mahol | Tue Jan 17 >>> 15:54:57 2017 +0100| [6c43f33ac2e7606b2013f6261144389589394196] | >>> committer: Paul B Mahol >>> >>> avcodec/wmaprodec: >2 channel support for XMA >>> >>> Signed-off-by: Paul B Mahol >>> >>> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6c43f33ac2e7606b2013f6261144389589394196 >>> --- >>> >>> libavcodec/wmaprodec.c | 274 >>> - >>> libavformat/wavdec.c | 3 + >>> 2 files changed, 204 insertions(+), 73 deletions(-) >> >> This causes an assertion failure: >> >> >> [xma2 @ 0x2093b40] get_buffer() failed >> [asf @ 0x2092500] packet fragment position invalid 0,0 not in 0 >> Last message repeated 1 times >> Assertion n>0 && n<=25 failed at libavcodec/get_bits.h:265 > > Do you have sample file? Should be fixed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] avformat/avienc: add reserve_index_space option
On Wed, Jan 18, 2017 at 10:27:02AM +0100, Tobias Rapp wrote: > Allows the user to reserve space for the ODML master index. A sufficient > sized master index in the AVI header avoids storing follow-up master > indexes within the 'movi' data later. > > If the option is omitted or zero the index size is estimated from output > duration and bitrate. A worst-case bitrate for video streams is assumed > in case it is not available. > > Note: fate reference files changed because the video stream had zero > bitrate before and is guessed now. > > Signed-off-by: Tobias Rapp > --- > libavformat/avi.h | 1 - > libavformat/avienc.c| 77 > ++--- > libavformat/version.h | 2 +- > tests/ref/fate/mpeg4-bsf-unpack-bframes | 2 +- > tests/ref/lavf-fate/avi_cram| 2 +- > 5 files changed, 74 insertions(+), 10 deletions(-) this breaks segment: ./ffmpeg -i lena.pnm -f segment test%d.avi possibly related to avi_init() [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Republics decline into democracies and democracies degenerate into despotisms. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavf/mov: ignore edit list with duration equals to 0 for covers art
According to spec ( ISO-IEC-15444-12 ) specifying edit list duration 0, makes sense for MP4F files "A non‐empty edit may insert a portion of the media timeline that is not present in the initial movie, and is present only in subsequent movie fragments. Particularly in an empty initial movie of a fragmented movie file (when there are no media samples yet present), the segment_duration of this edit may be zero, whereupon the edit provides the offset from media composition time to movie presentation time, for the movie and subsequent movie fragments. It is recommended that such an edit be used to establish a presentation time of 0 for the first presented sample, when composition offsets are used" I was contacted with such a file previously and I tried playing that in Quicktime in mac to see its behavior. When I played the video with Quicktime 10.4 it showed the poster frame. When I played it with Quicktime 7 , it showed black screen. Even in Quicktime 10.4 when you export the video to reencode it, the output file has only audio. However your hack seems to be specialized enough, so as not to hurt other edit list cases. You just need to check that the file is not Fragmented MP4 , and need to check for st->nb_index_entries == 1 instead of chunk_count==1. On Thu, Jan 19, 2017 at 1:33 AM, Matthieu Bouron wrote: > On Thu, Jan 19, 2017 at 04:55:22AM +0900, Yusuke Nakamura wrote: > > 2017-01-18 19:38 GMT+09:00 Matthieu Bouron : > > > > > Discards edit list with duration equals to 0 for video streams with > only > > > one frame and avoid discarding covers art muxed as a single frame video > > > stream. > > > --- > > > Hello, > > > > > > The following patch discards single edit list with duration equals to 0 > > > for video streams with only one frame which prevents discarding covers > art > > > muxed as a single frame video stream. > > > > > > The patch can be extended to make it always discards single edit list > with > > > duration equals to 0 (even if the video streams has more than one > sample). > > > What do you think ? > > > > > > Matthieu > > > --- > > > libavformat/mov.c | 11 +++ > > > 1 file changed, 11 insertions(+) > > > > > > diff --git a/libavformat/mov.c b/libavformat/mov.c > > > index d1b929174d..88ffd0e5f2 100644 > > > --- a/libavformat/mov.c > > > +++ b/libavformat/mov.c > > > @@ -2988,6 +2988,17 @@ static void mov_fix_index(MOVContext *mov, > AVStream > > > *st) > > > if (!msc->elst_data || msc->elst_count <= 0 || nb_old <= 0) { > > > return; > > > } > > > + > > > +// Discard edit list with duration equals to 0 for video streams > with > > > only > > > +// one frame and avoid discarding covers art muxed as a single > frame > > > video > > > +// stream > > > +if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && > > > +msc->chunk_count == 1 && > > > +msc->elst_count == 1 && > > > +msc->elst_data[0].duration == 0) { > > > > > > > This can be false positive since segment_duration=0 could be used for > > implicit segment_duration when movie fragments. The spec explicitly says > > that only when initial movie has no samples but > > w16161-14496-12-DefectReport-R4.docx implies that the 14496-12 spec will > > also apply it to more generic cases. And why msc->chunk_count == 1? The > > chunk_count is the number of chunks but not samples. > > > > If I understand correctly segment_duration=0 means implicit duration for > all cases (fragmented / non-fragmented) ? Does that mean we should > discard the duration but honor the rest of the elst fields ? > > Regarding the use of msc->chunk_count I wrongly assumed that one chunk == > one video frame. I used originally st->nb_index_entries but I'm not sure > if it's right though. > > Thanks, > Matthieu > > [...] > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/8] arm: vp9dsp: Restructure the bpp checks
On Wed, Jan 18, 2017 at 11:45:08PM +0200, Martin Storsjö wrote: > This work is sponsored by, and copyright, Google. > > This is more in line with how it will be extended for more bitdepths. > --- > libavcodec/arm/vp9dsp_init_arm.c | 24 +--- > 1 file changed, 9 insertions(+), 15 deletions(-) fate passes with this patchset under qemu arm [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Let us carefully observe those good qualities wherein our enemies excel us and endeavor to excel them, by avoiding what is faulty, and imitating what is excellent in them. -- Plutarch signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lil typo
0001-lil-typo.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lil typo
On Wed, Jan 18, 2017 at 01:18:54PM +0300, Александр Слободенюк wrote: > avcodec.h |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > 45eeaecafbb396876f70fc1149cb16deb2055c5b 0001-lil-typo.patch > From fe6224103a12fcd48d32f1c8304e66faf6804ab0 Mon Sep 17 00:00:00 2001 > From: Aleksandr Slobodeniuk > Date: Wed, 18 Jan 2017 13:11:48 +0300 > Subject: [PATCH] lil typo applied thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Republics decline into democracies and democracies degenerate into despotisms. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/atrac3: allow 6 channels (non-joint stereo)
From: bnnm Raises max channels to 6 (for non joint-stereo only), there is no difference decoding 1 or N discrete channels. Fixes trac issue #5840 Signed-off-by: bnnm --- libavcodec/atrac3.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index 256990b..ffd93e4 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -49,7 +49,7 @@ #include "atrac3data.h" #define JOINT_STEREO0x12 -#define STEREO 0x2 +#define SINGLE 0x2 #define SAMPLES_PER_FRAME 1024 #define MDCT_SIZE 512 @@ -567,7 +567,7 @@ static void channel_weighting(float *su1, float *su2, int *p3) * @param snd the channel unit to be used * @param outputthe decoded samples before IQMF in float representation * @param channel_num channel number - * @param coding_mode the coding mode (JOINT_STEREO or regular stereo/mono) + * @param coding_mode the coding mode (JOINT_STEREO or single channels) */ static int decode_channel_sound_unit(ATRAC3Context *q, GetBitContext *gb, ChannelUnit *snd, float *output, @@ -702,7 +702,7 @@ static int decode_frame(AVCodecContext *avctx, const uint8_t *databuf, channel_weighting(out_samples[0], out_samples[1], q->weighting_delay); } else { -/* normal stereo mode or mono */ +/* single channels */ /* Decode the channel sound units. */ for (i = 0; i < avctx->channels; i++) { /* Set the bitstream reader at the start of a channel sound unit. */ @@ -797,7 +797,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) const uint8_t *edata_ptr = avctx->extradata; ATRAC3Context *q = avctx->priv_data; -if (avctx->channels <= 0 || avctx->channels > 2) { +if (avctx->channels <= 0 || avctx->channels > 6) { av_log(avctx, AV_LOG_ERROR, "Channel configuration error!\n"); return AVERROR(EINVAL); } @@ -823,7 +823,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) samples_per_frame= SAMPLES_PER_FRAME * avctx->channels; version = 4; delay= 0x88E; -q->coding_mode = q->coding_mode ? JOINT_STEREO : STEREO; +q->coding_mode = q->coding_mode ? JOINT_STEREO : SINGLE; q->scrambled_stream = 0; if (avctx->block_align != 96 * avctx->channels * frame_factor && @@ -855,8 +855,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } -if (samples_per_frame != SAMPLES_PER_FRAME && -samples_per_frame != SAMPLES_PER_FRAME * 2) { +if (samples_per_frame != SAMPLES_PER_FRAME * avctx->channels) { av_log(avctx, AV_LOG_ERROR, "Unknown amount of samples per frame %d.\n", samples_per_frame); return AVERROR_INVALIDDATA; @@ -868,8 +867,8 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } -if (q->coding_mode == STEREO) -av_log(avctx, AV_LOG_DEBUG, "Normal stereo detected.\n"); +if (q->coding_mode == SINGLE) +av_log(avctx, AV_LOG_DEBUG, "Single channels detected.\n"); else if (q->coding_mode == JOINT_STEREO) { if (avctx->channels != 2) { av_log(avctx, AV_LOG_ERROR, "Invalid coding mode\n"); -- 2.10.2.windows.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/3] avcodec: add XMA2 parser
Signed-off-by: Paul B Mahol --- libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/xma_parser.c | 62 + 3 files changed, 64 insertions(+) create mode 100644 libavcodec/xma_parser.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 01ffe07..43a6add 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -950,6 +950,7 @@ OBJS-$(CONFIG_VC1_PARSER) += vc1_parser.o vc1.o vc1data.o \ OBJS-$(CONFIG_VP3_PARSER) += vp3_parser.o OBJS-$(CONFIG_VP8_PARSER) += vp8_parser.o OBJS-$(CONFIG_VP9_PARSER) += vp9_parser.o +OBJS-$(CONFIG_XMA_PARSER) += xma_parser.o # bitstream filters OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o aacadtsdec.o \ diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 703c552..f92b2b7 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -709,4 +709,5 @@ void avcodec_register_all(void) REGISTER_PARSER(VP3,vp3); REGISTER_PARSER(VP8,vp8); REGISTER_PARSER(VP9,vp9); +REGISTER_PARSER(XMA,xma); } diff --git a/libavcodec/xma_parser.c b/libavcodec/xma_parser.c new file mode 100644 index 000..0513679 --- /dev/null +++ b/libavcodec/xma_parser.c @@ -0,0 +1,62 @@ +/* + * 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 + */ + +/** + * @file + * XMA2 audio parser + */ + +#include "parser.h" + +typedef struct XMAParserContext{ +int skip_packets; +} XMAParserContext; + +static int xma_parse(AVCodecParserContext *s1, AVCodecContext *avctx, + const uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size) +{ +XMAParserContext *s = s1->priv_data; + +if (buf_size % 2048 == 0) { +int duration = 0, packet, nb_packets = buf_size / 2048; + +for (packet = 0; packet < nb_packets; packet++) { +if (s->skip_packets == 0) { +duration += buf[packet * 2048] * 128; +s->skip_packets = buf[packet * 2048 + 3] + 1; +} +s->skip_packets--; +} + +s1->duration = duration; +s1->key_frame = !!duration; +} + +/* always return the full packet. this parser isn't doing any splitting or + combining, only packet analysis */ +*poutbuf = buf; +*poutbuf_size = buf_size; +return buf_size; +} + +AVCodecParser ff_xma_parser = { +.codec_ids = { AV_CODEC_ID_XMA2 }, +.priv_data_size = sizeof(XMAParserContext), +.parser_parse = xma_parse, +}; -- 2.9.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/3] avcodec/wmaprodec: add xma_flush for seeking in XMA2
Signed-off-by: Paul B Mahol --- libavcodec/wmaprodec.c | 34 +++--- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index 55a4807..ed9cbcf 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -1858,13 +1858,8 @@ static av_cold int xma_decode_end(AVCodecContext *avctx) return 0; } -/** - *@brief Clear decoder buffers (for seeking). - *@param avctx codec context - */ -static void flush(AVCodecContext *avctx) +static void flush(WMAProDecodeCtx *s) { -WMAProDecodeCtx *s = avctx->priv_data; int i; /** reset output buffer as a part of it is used during the windowing of a new frame */ @@ -1872,6 +1867,30 @@ static void flush(AVCodecContext *avctx) memset(s->channel[i].out, 0, s->samples_per_frame * sizeof(*s->channel[i].out)); s->packet_loss = 1; +s->skip_packets = 0; +} + + +/** + *@brief Clear decoder buffers (for seeking). + *@param avctx codec context + */ +static void wmapro_flush(AVCodecContext *avctx) +{ +WMAProDecodeCtx *s = avctx->priv_data; + +flush(s); +} + +static void xma_flush(AVCodecContext *avctx) +{ +XMADecodeCtx *s = avctx->priv_data; +int i; +for (i = 0; i < (avctx->channels + 1) / 2; i++) +flush(&s->xma[i]); + +memset(s->offset, 0, sizeof(s->offset)); +s->current_stream = 0; } @@ -1888,7 +1907,7 @@ AVCodec ff_wmapro_decoder = { .close = wmapro_decode_end, .decode = wmapro_decode_packet, .capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1, -.flush = flush, +.flush = wmapro_flush, .sample_fmts= (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }, }; @@ -1916,6 +1935,7 @@ AVCodec ff_xma2_decoder = { .init = xma_decode_init, .close = xma_decode_end, .decode = xma_decode_packet, +.flush = xma_flush, .capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DR1, .sample_fmts= (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }, -- 2.9.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/3] avformat/wavdec: enable seeking with XMA2
Signed-off-by: Paul B Mahol --- libavformat/wavdec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c index 4046809..0ca1ef4 100644 --- a/libavformat/wavdec.c +++ b/libavformat/wavdec.c @@ -719,6 +719,7 @@ static int wav_read_seek(AVFormatContext *s, case AV_CODEC_ID_MP3: case AV_CODEC_ID_AC3: case AV_CODEC_ID_DTS: +case AV_CODEC_ID_XMA2: /* use generic seeking with dynamically generated indexes */ return -1; default: -- 2.9.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavf/mov: ignore edit list with duration equals to 0 for covers art
2017-01-19 18:33 GMT+09:00 Matthieu Bouron : > On Thu, Jan 19, 2017 at 04:55:22AM +0900, Yusuke Nakamura wrote: > > 2017-01-18 19:38 GMT+09:00 Matthieu Bouron : > > > > > Discards edit list with duration equals to 0 for video streams with > only > > > one frame and avoid discarding covers art muxed as a single frame video > > > stream. > > > --- > > > Hello, > > > > > > The following patch discards single edit list with duration equals to 0 > > > for video streams with only one frame which prevents discarding covers > art > > > muxed as a single frame video stream. > > > > > > The patch can be extended to make it always discards single edit list > with > > > duration equals to 0 (even if the video streams has more than one > sample). > > > What do you think ? > > > > > > Matthieu > > > --- > > > libavformat/mov.c | 11 +++ > > > 1 file changed, 11 insertions(+) > > > > > > diff --git a/libavformat/mov.c b/libavformat/mov.c > > > index d1b929174d..88ffd0e5f2 100644 > > > --- a/libavformat/mov.c > > > +++ b/libavformat/mov.c > > > @@ -2988,6 +2988,17 @@ static void mov_fix_index(MOVContext *mov, > AVStream > > > *st) > > > if (!msc->elst_data || msc->elst_count <= 0 || nb_old <= 0) { > > > return; > > > } > > > + > > > +// Discard edit list with duration equals to 0 for video streams > with > > > only > > > +// one frame and avoid discarding covers art muxed as a single > frame > > > video > > > +// stream > > > +if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && > > > +msc->chunk_count == 1 && > > > +msc->elst_count == 1 && > > > +msc->elst_data[0].duration == 0) { > > > > > > > This can be false positive since segment_duration=0 could be used for > > implicit segment_duration when movie fragments. The spec explicitly says > > that only when initial movie has no samples but > > w16161-14496-12-DefectReport-R4.docx implies that the 14496-12 spec will > > also apply it to more generic cases. And why msc->chunk_count == 1? The > > chunk_count is the number of chunks but not samples. > > > > If I understand correctly segment_duration=0 means implicit duration for > all cases (fragmented / non-fragmented) ? Does that mean we should > discard the duration but honor the rest of the elst fields ? > Dunno if it also applies to non-fragmented movie but an example of the current spec does not specify it's fragmented or not. Also I noticed the latest File-format Meeting Report, which is found at Mp4-sys ML and a MPEG meeting is held in this week, and it says "Proposal #3, edit list: The question is whether a zero-length edit in a non-empty movie means anything. It probably means an insert of zero duration, which means it needs adjusting if de-fragmenting. This needs saying in the spec.; update the defect report." This time I can't insist which is correct or not. :< > Regarding the use of msc->chunk_count I wrongly assumed that one chunk == > one video frame. I used originally st->nb_index_entries but I'm not sure > if it's right though. > > Thanks, > Matthieu > > [...] > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/fraps: add support for PAL8
Signed-off-by: Paul B Mahol --- libavcodec/fraps.c | 29 +++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c index 57e13f2..5ca6aff 100644 --- a/libavcodec/fraps.c +++ b/libavcodec/fraps.c @@ -146,6 +146,7 @@ static int decode_frame(AVCodecContext *avctx, uint32_t offs[4]; int i, j, ret, is_chroma; const int planes = 3; +int is_pal; uint8_t *out; if (buf_size < 4) { @@ -155,6 +156,7 @@ static int decode_frame(AVCodecContext *avctx, header = AV_RL32(buf); version = header & 0xff; +is_pal = buf[1] == 2 && version == 1; header_size = (header & (1<<30))? 8 : 4; /* bit 30 means pad to 8 bytes */ if (version > 5) { @@ -166,7 +168,16 @@ static int decode_frame(AVCodecContext *avctx, buf += header_size; -if (version < 2) { +if (is_pal) { +unsigned needed_size = avctx->width * avctx->height + 1024; +needed_size += header_size; +if (buf_size != needed_size) { +av_log(avctx, AV_LOG_ERROR, + "Invalid frame length %d (should be %d)\n", + buf_size, needed_size); +return AVERROR_INVALIDDATA; +} +} else if (version < 2) { unsigned needed_size = avctx->width * avctx->height * 3; if (version == 0) needed_size /= 2; needed_size += header_size; @@ -209,7 +220,7 @@ static int decode_frame(AVCodecContext *avctx, f->pict_type = AV_PICTURE_TYPE_I; f->key_frame = 1; -avctx->pix_fmt = version & 1 ? AV_PIX_FMT_BGR24 : AV_PIX_FMT_YUVJ420P; +avctx->pix_fmt = version & 1 ? is_pal ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_BGR24 : AV_PIX_FMT_YUVJ420P; avctx->color_range = version & 1 ? AVCOL_RANGE_UNSPECIFIED : AVCOL_RANGE_JPEG; avctx->colorspace = version & 1 ? AVCOL_SPC_UNSPECIFIED : AVCOL_SPC_BT709; @@ -245,11 +256,25 @@ static int decode_frame(AVCodecContext *avctx, break; case 1: +if (is_pal) { +uint32_t *pal = (uint32_t *)f->data[1]; + +for (y = 0; y < 256; y++) { +pal[y] = AV_RL32(buf) | 0xFF00; +buf += 4; +} + +for (y = 0; y height; y++) +memcpy(&f->data[0][y * f->linesize[0]], + &buf[y * avctx->width], + avctx->width); +} else { /* Fraps v1 is an upside-down BGR24 */ for (y = 0; yheight; y++) memcpy(&f->data[0][(avctx->height - y - 1) * f->linesize[0]], &buf[y * avctx->width * 3], 3 * avctx->width); +} break; case 2: -- 2.9.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavf/mov: ignore edit list with duration equals to 0 for covers art
On Thu, Jan 19, 2017 at 10:33:25AM -0800, Sasi Inguva wrote: > According to spec ( ISO-IEC-15444-12 ) specifying edit list duration 0, > makes sense for MP4F files > "A non‐empty edit may insert a portion of the media timeline that is not > present in the initial movie, and > is present only in subsequent movie fragments. Particularly in an empty > initial movie of a fragmented > movie file (when there are no media samples yet present), the > segment_duration of this edit may be > zero, whereupon the edit provides the offset from media composition time to > movie presentation time, > for the movie and subsequent movie fragments. It is recommended that such > an edit be used to > establish a presentation time of 0 for the first presented sample, when > composition offsets are used" > > I was contacted with such a file previously and I tried playing that in > Quicktime in mac to see its behavior. When I played the video with > Quicktime 10.4 it showed the poster frame. When I played it with Quicktime > 7 , it showed black screen. Even in Quicktime 10.4 when you export the > video to reencode it, the output file has only audio. > > However your hack seems to be specialized enough, so as not to hurt other > edit list cases. You just need to check that the file is not Fragmented MP4 > , and need to check for st->nb_index_entries == 1 instead of > chunk_count==1. I'm looking for a way to check the fragmented case. Would introducing MOVContext.found_moof (like for moov) and set it in mov_read_moof OK ? The other variables from MOVContext.fragment do not look like good candidates to perform the fragmented check against. [...] ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] ffmpeg.c: Add output file index and stream index to vstats file.
Signed-off-by: Sasi Inguva --- ffmpeg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ffmpeg.c b/ffmpeg.c index 977708c069..a566c3fe2a 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1347,7 +1347,7 @@ static void do_video_stats(OutputStream *ost, int frame_size) enc = ost->enc_ctx; if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { frame_number = ost->st->nb_frames; -fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, +fprintf(vstats_file, "out= %2d st= %2d frame= %5d q= %2.1f ", ost->file_index, ost->index, frame_number, ost->quality / (float)FF_QP2LAMBDA); if (ost->error[0]>=0 && (enc->flags & AV_CODEC_FLAG_PSNR)) -- 2.11.0.483.g087da7b7c-goog ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavcodec/nvenc.c Reduce initialization time for gpu id > 0
Yes, this is a simpler logic. Works for me locally. Can you please apply this patch to ffmpeg master. Thanks. -Original Message- From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of Timo Rothenpieler Sent: Wednesday, January 18, 2017 3:01 PM To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] [PATCH] libavcodec/nvenc.c Reduce initialization time for gpu id > 0 Made this into a patch: https://github.com/BtbN/FFmpeg/commit/cbd128a67fc4621c953419dddc5cc17612764a57 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel --- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. --- ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavf/mov: ignore edit list with duration equals to 0 for covers art
The mov_fix_index is executed inside mov_read_trak . Normally 'moof' atom is after the 'trak' atom in mp4f file. So the method of looking whether moof atom exists won't work. On Thu, Jan 19, 2017 at 2:18 PM, Matthieu Bouron wrote: > On Thu, Jan 19, 2017 at 10:33:25AM -0800, Sasi Inguva wrote: > > According to spec ( ISO-IEC-15444-12 ) specifying edit list duration 0, > > makes sense for MP4F files > > "A non‐empty edit may insert a portion of the media timeline that is not > > present in the initial movie, and > > is present only in subsequent movie fragments. Particularly in an empty > > initial movie of a fragmented > > movie file (when there are no media samples yet present), the > > segment_duration of this edit may be > > zero, whereupon the edit provides the offset from media composition time > to > > movie presentation time, > > for the movie and subsequent movie fragments. It is recommended that such > > an edit be used to > > establish a presentation time of 0 for the first presented sample, when > > composition offsets are used" > > > > I was contacted with such a file previously and I tried playing that in > > Quicktime in mac to see its behavior. When I played the video with > > Quicktime 10.4 it showed the poster frame. When I played it with > Quicktime > > 7 , it showed black screen. Even in Quicktime 10.4 when you export the > > video to reencode it, the output file has only audio. > > > > However your hack seems to be specialized enough, so as not to hurt other > > edit list cases. You just need to check that the file is not Fragmented > MP4 > > , and need to check for st->nb_index_entries == 1 instead of > > chunk_count==1. > > I'm looking for a way to check the fragmented case. Would introducing > MOVContext.found_moof (like for moov) and set it in mov_read_moof OK ? > The other variables from MOVContext.fragment do not look like good > candidates to perform the fragmented check against. > > [...] > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavformat/utils: Fix a memleak that st->codec->hw_frames_ctx
From 9ceb2ac6a89246f2e686eb3ad3448fbaff5328f7 Mon Sep 17 00:00:00 2001 From: Zhengxu Date: Fri, 13 Jan 2017 10:33:05 +0800 Subject: [PATCH] lavformat/utils: Fix a memleak that st->codec->hw_frames_ctx is not released. Signed-off-by: ChaoX A Liu Signed-off-by: Huang, Zhengxu Signed-off-by: Andrew, Zhang --- libavformat/utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index d5dfca7..cadec15 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4127,6 +4127,7 @@ static void free_stream(AVStream **pst) FF_DISABLE_DEPRECATION_WARNINGS av_freep(&st->codec->extradata); av_freep(&st->codec->subtitle_header); +av_buffer_unref(&st->codec->hw_frames_ctx); av_freep(&st->codec); FF_ENABLE_DEPRECATION_WARNINGS #endif -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: fix too many open files bug
2017-01-19 11:22 GMT+08:00 殷焦元 : > I test the new patch, it is OK. > > Thanks > > > Yin Jiaoyuan > > > At 2017-01-19 10:20:38, "Steven Liu" wrote: > >When use http method to delete the old segments, > >there is only io_open, hove not io_close yet, > >this patch is used to fix it > > > >Signed-off-by: Steven Liu > >--- > > libavformat/hlsenc.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > >diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > >index 1f4bf8b..85d3955 100644 > >--- a/libavformat/hlsenc.c > >+++ b/libavformat/hlsenc.c > >@@ -300,6 +300,7 @@ static int hls_delete_old_segments(HLSContext *hls) { > > av_dict_set(&options, "method", "DELETE", 0); > > if ((ret = hls->avf->io_open(hls->avf, &out, path, > AVIO_FLAG_WRITE, &options)) < 0) > > goto fail; > >+ff_format_io_close(hls->avf, &out); > > } else if (unlink(path) < 0) { > > av_log(hls, AV_LOG_ERROR, "failed to delete old segment %s: > %s\n", > > path, strerror(errno)); > >@@ -322,6 +323,7 @@ static int hls_delete_old_segments(HLSContext *hls) { > > av_free(sub_path); > > goto fail; > > } > >+ff_format_io_close(hls->avf, &out); > > } else if (unlink(sub_path) < 0) { > > av_log(hls, AV_LOG_ERROR, "failed to delete old segment > %s: %s\n", > > sub_path, strerror(errno)); > >-- > >2.10.1.382.ga23ca1b.dirty > > > > > > > >___ > >ffmpeg-devel mailing list > >ffmpeg-devel@ffmpeg.org > >http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > Applied Thanks ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel