[FFmpeg-devel] [PATCH]Mention webm default codec change in the Changelog
Hi! Better wording welcome! Thank you, Carl Eugen diff --git a/Changelog b/Changelog index 844f5a5..9de156b 100644 --- a/Changelog +++ b/Changelog @@ -36,6 +36,7 @@ version : - waveform filter - hstack and vstack filter - Support DNx100 (1440x1080@8) +- VP9 and Opus new default codecs when encoding webm version 2.7: ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] QSV : Added look ahead rate control mode
> -Ursprüngliche Nachricht- > Von: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] Im Auftrag > von Sven Dueking > Gesendet: Freitag, 21. August 2015 10:18 > An: ffmpeg-devel@ffmpeg.org > Cc: Sven Dueking > Betreff: [FFmpeg-devel] [PATCH] QSV : Added look ahead rate control > mode > > From: Sven Dueking > > --- > libavcodec/qsvenc.c | 31 +-- > libavcodec/qsvenc.h | 8 > libavcodec/qsvenc_h264.c | 12 > 3 files changed, 49 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index > 1532258..1aeab03 100644 > --- a/libavcodec/qsvenc.c > +++ b/libavcodec/qsvenc.c > @@ -107,8 +107,16 @@ static int init_video_param(AVCodecContext *avctx, > QSVEncContext *q) > q->param.mfx.RateControlMethod = MFX_RATECONTROL_CBR; > ratecontrol_desc = "constant bitrate (CBR)"; > } else if (!avctx->rc_max_rate) { > -q->param.mfx.RateControlMethod = MFX_RATECONTROL_AVBR; > -ratecontrol_desc = "average variable bitrate (AVBR)"; > +#if QSV_VERSION_ATLEAST(1,7) > +if (q->look_ahead) { > +q->param.mfx.RateControlMethod = MFX_RATECONTROL_LA; > +ratecontrol_desc = "lookahead (LA)"; > +} else > +#endif > +{ > +q->param.mfx.RateControlMethod = MFX_RATECONTROL_AVBR; > +ratecontrol_desc = "average variable bitrate (AVBR)"; > +} > } else { > q->param.mfx.RateControlMethod = MFX_RATECONTROL_VBR; > ratecontrol_desc = "variable bitrate (VBR)"; @@ -132,6 +140,9 > @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) > > break; > case MFX_RATECONTROL_AVBR: > +#if QSV_VERSION_ATLEAST(1,7) > +case MFX_RATECONTROL_LA: > +#endif > q->param.mfx.TargetKbps = avctx->bit_rate / 1000; > q->param.mfx.Convergence = q->avbr_convergence; > q->param.mfx.Accuracy= q->avbr_accuracy; > @@ -151,6 +162,22 @@ static int init_video_param(AVCodecContext *avctx, > QSVEncContext *q) > > q->extparam[0] = (mfxExtBuffer *)&q->extco; > > +#if QSV_VERSION_ATLEAST(1,6) > +q->extco2.Header.BufferId = MFX_EXTBUFF_CODING_OPTION2; > +q->extco2.Header.BufferSz = sizeof(q->extco2); > + > +#if QSV_VERSION_ATLEAST(1,7) > +// valid value range is from 10 to 100 inclusive > +// to instruct the encoder to use the default value this > should be set to zero > +q->extco2.LookAheadDepth= q->look_ahead_depth != 0 ? > FFMAX(10, q->look_ahead_depth) : 0; > +#endif > +#if QSV_VERSION_ATLEAST(1,8) > +q->extco2.LookAheadDS = q->look_ahead_downsampling; > +#endif > + > +q->extparam[1] = (mfxExtBuffer *)&q->extco2; > + > +#endif > q->param.ExtParam= q->extparam; > q->param.NumExtParam = FF_ARRAY_ELEMS(q->extparam); > } > diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index > 2316488..2a21f82 100644 > --- a/libavcodec/qsvenc.h > +++ b/libavcodec/qsvenc.h > @@ -50,7 +50,12 @@ typedef struct QSVEncContext { > mfxFrameAllocRequest req; > > mfxExtCodingOption extco; > +#if QSV_VERSION_ATLEAST(1,6) > +mfxExtCodingOption2 extco2; > +mfxExtBuffer *extparam[2]; > +#else > mfxExtBuffer *extparam[1]; > +#endif > > AVFifoBuffer *async_fifo; > > @@ -62,6 +67,9 @@ typedef struct QSVEncContext { > int avbr_accuracy; > int avbr_convergence; > int pic_timing_sei; > +int look_ahead; > +int look_ahead_depth; > +int look_ahead_downsampling; > > char *load_plugins; > } QSVEncContext; > diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c index > b15f6b2..b569efe 100644 > --- a/libavcodec/qsvenc_h264.c > +++ b/libavcodec/qsvenc_h264.c > @@ -71,6 +71,18 @@ static const AVOption options[] = { > { "avbr_convergence", "Convergence of the AVBR ratecontrol", > OFFSET(qsv.avbr_convergence), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, > INT_MAX, VE }, > { "pic_timing_sei","Insert picture timing SEI with > pic_struct_syntax element", OFFSET(qsv.pic_timing_sei), > AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE }, > > +#if QSV_VERSION_ATLEAST(1,7) > +{ "look_ahead", "Use VBR algorithm with look ahead", > OFFSET(qsv.look_ahead), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE > }, > +{ "look_ahead_depth", "Depth of look ahead in number frames", > +OFFSET(qsv.look_ahead_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, > VE > +}, #endif > + > +#if QSV_VERSION_ATLEAST(1,8) > +{ "look_ahead_downsampling", NULL, > OFFSET(qsv.look_ahead_downsampling), AV_OPT_TYPE_INT, { .i64 = > MFX_LOOKAHEAD_DS_UNKNOWN }, MFX_LOOKAHEAD_DS_UNKNOWN, > MFX_LOOKAHEAD_DS_2x, VE, "look_ahead_downsampling" }, > +{ "unknown", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = > MFX_LOOKAHEAD_DS_UNKNOWN }, INT_MIN, INT_MAX, VE, > "look_ahead_downsampling" }, > +{ "off", NULL, 0, AV_OPT_TYPE_C
Re: [FFmpeg-devel] Connection timeout to HTTP resource
W dniu 26.08.2015 o 18:27, Stephan Holljes pisze: Hi, On Wed, Aug 26, 2015 at 11:35 AM, Przemysław Sobala wrote: Hi I wanted to configure tcp connection timeout while connecting to eg. http://google.com:81. ffmpeg -i http://google.com:81?timeout=100 doesn't pass "timeout" param to tcp proto, as tcp proto doesn't support URL query string TCP does support some parsing for URL query strings (see tcp.c:tcp_open around line 83 and following), but when used with HTTP the query is not parsed and simply sent with the request as it could/should contain information only relevant to the server handling the request. ffmpeg -timeout 100 -i http://google.com:81 doesn't pass "timeout" param to tcp proto, as tcp proto doestn't support AVDictionary and url_open2 AFAIK this should happen through AVOptions and should work. When I run the command with -loglevel trace the parameter gets set properly. I added logging for s->rw_timeout in tcp.c:tcp_open, and that value also gets set correctly. So I tried to correct the second case, and ended up with patch: diff --git a/libavformat/tcp.c b/libavformat/tcp.c index bee349e..2f7726f 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -59,7 +59,8 @@ static const AVClass tcp_class = { }; /* return non zero if error */ -static int tcp_open(URLContext *h, const char *uri, int flags) +static int tcp_open(URLContext *h, const char *uri, int flags, + AVDictionary **options) { struct addrinfo hints = { 0 }, *ai, *cur_ai; int port, fd = -1; @@ -244,7 +245,7 @@ static int tcp_get_file_handle(URLContext *h) URLProtocol ff_tcp_protocol = { .name= "tcp", -.url_open= tcp_open, +.url_open2 = tcp_open, .url_accept = tcp_accept, .url_read= tcp_read, .url_write = tcp_write, Now it works (ffmpeg -timeout 100 -i http://google.com:81). What do you think about that? If that's the complete patch it doesn't really change anything since options isn't used anywhere in tcp_open() AFAICT. I also couldn't reproduce the behaviour you described. When running: ffmpeg -timeout 100 -i http://google.com:81 with the latest git master the connection properly times out. You're right. I must have missed something. So I got everything I need. One last question: why FFmpeg reports http://google.com:81: Network is unreachable while tcp_open returns AVERROR(ETIMEDOUT) ? -- Regards Przemysław Sobala Główne Spółki Grupy Wirtualna Polska: Wirtualna Polska Holding Spółka Akcyjna z siedzibą w Warszawie, ul. Jutrzenki 137A, 02-231 Warszawa, wpisana do Krajowego Rejestru Sądowego - Rejestru Przedsiębiorców prowadzonego przez Sąd Rejonowy dla m.st. Warszawy w Warszawie pod nr KRS: 407130, kapitał zakładowy: 1 245 651,90 zł (w całości wpłacony), Numer Identyfikacji Podatkowej (NIP): 521-31-11-513 Grupa Wirtualna Polska Spółka z ograniczoną odpowiedzialnością z siedzibą w Warszawie, ul. Jutrzenki 137A, 02-231 Warszawa, wpisana do Krajowego Rejestru Sądowego - Rejestru Przedsiębiorców prowadzonego przez Sąd Rejonowy dla m.st. Warszawy w Warszawie pod nr KRS: 373814, kapitał zakładowy: 311.005.050,00 zł, Numer Identyfikacji Podatkowej (NIP): 527-26-45-593 WP Shopping Spółka z ograniczoną odpowiedzialnością z siedzibą w Gdańsku, ul. Romualda Traugutta 115 C, 80-226 Gdańsk, wpisana do Krajowego Rejestru Sądowego - Rejestru Przedsiębiorców prowadzonego przez Sąd Rejonowy Gdańsk - Północ w Gdańsku pod nr KRS: 546914, kapitał zakładowy: 170.000,00 złotych (w całości wpłacony), Numer Identyfikacji Podatkowej (NIP): 957-07-51-216 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]Mention webm default codec change in the Changelog
Am 27.08.15 um 10:51 schrieb Carl Eugen Hoyos: > Hi! > > Better wording welcome! Switched default encoders for webm to VP9 and Opus -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: remove unused apply() function
On Thu, Aug 27, 2015 at 01:08:34AM -0400, Ganesh Ajjanagadde wrote: > Signed-off-by: Ganesh Ajjanagadde > --- > configure | 6 -- > 1 file changed, 6 deletions(-) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 3 "Rare item" - "Common item with rare defect or maybe just a lie" "Professional" - "'Toy' made in china, not functional except as doorstop" "Experts will know" - "The seller hopes you are not an expert" signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec: Assert on codec->encode2 in encode_audio2
Assert on `avctx->codec->encode2` to avoid a SEGFAULT on the subsequent function call. --- libavcodec/utils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 4da16ee..f51070c 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1953,6 +1953,8 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, } } +av_assert0(avctx->codec->encode2); + ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); if (!ret) { if (*got_packet_ptr) { -- 2.5.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec: Assert on codec->encode2 in encode_audio2
On Thu, 27 Aug 2015 12:40:30 +0200 lummax wrote: > Assert on `avctx->codec->encode2` to avoid a SEGFAULT on the subsequent > function call. > --- > libavcodec/utils.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/libavcodec/utils.c b/libavcodec/utils.c > index 4da16ee..f51070c 100644 > --- a/libavcodec/utils.c > +++ b/libavcodec/utils.c > @@ -1953,6 +1953,8 @@ int attribute_align_arg > avcodec_encode_audio2(AVCodecContext *avctx, > } > } > > +av_assert0(avctx->codec->encode2); > + > ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); > if (!ret) { > if (*got_packet_ptr) { When can this happen? Shouldn't it just return an error somewhere if this is not an encoder? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec: Assert on codec->encode2 in encode_audio2
2015-08-27 12:45 GMT+02:00 wm4 : > [..] > > When can this happen? Shouldn't it just return an error somewhere if > this is not an encoder? I'm working on a Rust wrapper library and apparently am doing something wrong (it segfaulted). `avcodec_encode_video2()` has this assertion, so I thought it might fit here aswell. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec: Assert on codec->encode2 in encode_audio2
On Thu, 27 Aug 2015 12:55:17 +0200 Lukas Blubb wrote: > 2015-08-27 12:45 GMT+02:00 wm4 : > > [..] > > > > When can this happen? Shouldn't it just return an error somewhere if > > this is not an encoder? > > I'm working on a Rust wrapper library and apparently am doing something > wrong (it segfaulted). `avcodec_encode_video2()` has this assertion, so I > thought it might fit here aswell. (Unrelated...:) If you want to hear my opinion on making safe wrappers around libav*: don't try to export the complete API. Instead, provide a way to feed/read AVPackets and AVFrames, and a way to set codec parameters before initialization. This should give pretty robust results, and should be easy to use. (Also make sure you're not committing the mistake of using the libavformat provided AVCodecContext instances for decoding and encoding.) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH]Describe eia_608 as text subtitles
Hi! Attached patch fixes an issue with ffplay here (it tries to scale the text subtitles), please comment, Carl Eugen diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 729e855..c172bf8 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -2670,6 +2670,7 @@ static const AVCodecDescriptor codec_descriptors[] = { .type = AVMEDIA_TYPE_SUBTITLE, .name = "eia_608", .long_name = NULL_IF_CONFIG_SMALL("EIA-608 closed captions"), +.props = AV_CODEC_PROP_TEXT_SUB, }, { .id= AV_CODEC_ID_JACOSUB, ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]Describe eia_608 as text subtitles
On 08/27/2015 05:46 PM, Carl Eugen Hoyos wrote: Hi! Attached patch fixes an issue with ffplay here (it tries to scale the text subtitles), please comment, Any Video sample that work with this patch and do not work without it would be great. At my PC I am not able to play any ClosedCaption Sample from mine own repository with ffplay even with this patch. Command line output would also be welcomed. Though patch looks correct to me, just need more information for testing and documenting it here. -Anshul ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]Describe eia_608 as text subtitles
Anshul gmail.com> writes: > > Attached patch fixes an issue with ffplay here (it > > tries to scale the text subtitles), please comment, > > Any Video sample that work with this patch and do > not work without it would be great. Full Episode 2.mp4 > At my PC I am not able to play any ClosedCaption Sample > from mine own repository with ffplay even with this patch. I suspect you mean ticket #2067, subtitles are not well supported in libavfilter making showing text subtitles difficult. But for the moment, I would suggest we concentrate on ffmpeg, there are still several Closed Captions samples that do not work. > Command line output would also be welcomed. $ ffplay Full\ Episode\ 2.mp4 ffplay version N-74678-g6701c92 Copyright (c) 2003-2015 the FFmpeg developers built with gcc 4.7 (SUSE Linux) configuration: --enable-gpl libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 58.100 / 56. 58.100 libavformat56. 40.101 / 56. 40.101 libavdevice56. 4.100 / 56. 4.100 libavfilter 5. 38.100 / 5. 38.100 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc53. 3.100 / 53. 3.100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f7d1c000920] multiple edit list entries, a/v desync might occur, patch welcome Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Full Episode 2.mp4': Metadata: major_brand : isom minor_version : 1 compatible_brands: isomavc1iso6 creation_time : 2015-08-06 12:12:47 Duration: 00:22:37.82, start: 0.00, bitrate: 483 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1024x576, 357 kb/s, 23.98 fps, 23.98 tbr, 11988 tbn, 47.95 tbc (default) Metadata: creation_time : 2015-08-06 12:12:47 handler_name: h264@GPAC0.5.2-DEV-rev248-g39d5978-master Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 122 kb/s (default) Metadata: creation_time : 2015-08-06 11:48:49 handler_name: Sound Media Handler Stream #0:2(eng): Subtitle: eia_608 (c608 / 0x38303663), 1920x1080, 0 kb/s (default) Metadata: creation_time : 2014-04-03 05:32:25 handler_name: Apple Closed Caption Media Handler [Closed caption Decoder @ 0x7f7d1c40be60] Data Ignored since exceeding screen width Last message repeated 25 times [swscaler @ 0x7f7cec000c60] 0x0 -> 0x0 is invalid scaling dimension Cannot initialize the sub conversion context > Though patch looks correct to me Pushed, thank you! > just need more information for testing > and documenting it here. Of course. Could you comment again on ticket #4616? When I remove the additional bytes in the eia_608 packets from the mov demuxer, I still don't get useful subttiles from the decoder... Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCHv3] configure: warn if GCC 4.2 is being used
Ganesh Ajjanagadde gmail.com> writes: > The wiki, Ticket1464, and Ticket3970 warn about the > usage of GCC 4.2. > This fixes Ticket3970. Pushed. Thank you for working on this issue, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec: Assert on codec->encode2 in encode_audio2
On Thu, Aug 27, 2015 at 12:40:30PM +0200, lummax wrote: > Assert on `avctx->codec->encode2` to avoid a SEGFAULT on the subsequent > function call. > --- > libavcodec/utils.c | 2 ++ > 1 file changed, 2 insertions(+) commit messages extended applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The misfortune of the wise is better than the prosperity of the fool. -- Epicurus signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavf/mpegenc: provide better feedback in case of invalid media type
--- libavformat/mpegenc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 2520f49..b3ee2a0 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -410,7 +410,9 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx) stream->max_buffer_size = 16 * 1024; break; default: -return -1; +av_log(ctx, AV_LOG_ERROR, "Invalid media type %s for output stream #%d\n", + av_get_media_type_string(st->codec->codec_type), i); +return AVERROR(EINVAL); } stream->fifo = av_fifo_alloc(16); if (!stream->fifo) -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] QSV : Added look ahead rate control mode
On Thu, Aug 27, 2015 at 11:02:44AM +0200, Sven Dueking wrote: > > -Ursprüngliche Nachricht- > > Von: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] Im Auftrag > > von Sven Dueking > > Gesendet: Freitag, 21. August 2015 10:18 > > An: ffmpeg-devel@ffmpeg.org > > Cc: Sven Dueking > > Betreff: [FFmpeg-devel] [PATCH] QSV : Added look ahead rate control > > mode > > > > From: Sven Dueking > > > > --- > > libavcodec/qsvenc.c | 31 +-- > > libavcodec/qsvenc.h | 8 > > libavcodec/qsvenc_h264.c | 12 > > 3 files changed, 49 insertions(+), 2 deletions(-) > > > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index > > 1532258..1aeab03 100644 > > --- a/libavcodec/qsvenc.c > > +++ b/libavcodec/qsvenc.c > > @@ -107,8 +107,16 @@ static int init_video_param(AVCodecContext *avctx, > > QSVEncContext *q) > > q->param.mfx.RateControlMethod = MFX_RATECONTROL_CBR; > > ratecontrol_desc = "constant bitrate (CBR)"; > > } else if (!avctx->rc_max_rate) { > > -q->param.mfx.RateControlMethod = MFX_RATECONTROL_AVBR; > > -ratecontrol_desc = "average variable bitrate (AVBR)"; > > +#if QSV_VERSION_ATLEAST(1,7) > > +if (q->look_ahead) { > > +q->param.mfx.RateControlMethod = MFX_RATECONTROL_LA; > > +ratecontrol_desc = "lookahead (LA)"; > > +} else > > +#endif > > +{ > > +q->param.mfx.RateControlMethod = MFX_RATECONTROL_AVBR; > > +ratecontrol_desc = "average variable bitrate (AVBR)"; > > +} > > } else { > > q->param.mfx.RateControlMethod = MFX_RATECONTROL_VBR; > > ratecontrol_desc = "variable bitrate (VBR)"; @@ -132,6 +140,9 > > @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) > > > > break; > > case MFX_RATECONTROL_AVBR: > > +#if QSV_VERSION_ATLEAST(1,7) > > +case MFX_RATECONTROL_LA: > > +#endif > > q->param.mfx.TargetKbps = avctx->bit_rate / 1000; > > q->param.mfx.Convergence = q->avbr_convergence; > > q->param.mfx.Accuracy= q->avbr_accuracy; > > @@ -151,6 +162,22 @@ static int init_video_param(AVCodecContext *avctx, > > QSVEncContext *q) > > > > q->extparam[0] = (mfxExtBuffer *)&q->extco; > > > > +#if QSV_VERSION_ATLEAST(1,6) > > +q->extco2.Header.BufferId = MFX_EXTBUFF_CODING_OPTION2; > > +q->extco2.Header.BufferSz = sizeof(q->extco2); > > + > > +#if QSV_VERSION_ATLEAST(1,7) > > +// valid value range is from 10 to 100 inclusive > > +// to instruct the encoder to use the default value this > > should be set to zero > > +q->extco2.LookAheadDepth= q->look_ahead_depth != 0 ? > > FFMAX(10, q->look_ahead_depth) : 0; > > +#endif > > +#if QSV_VERSION_ATLEAST(1,8) > > +q->extco2.LookAheadDS = q->look_ahead_downsampling; > > +#endif > > + > > +q->extparam[1] = (mfxExtBuffer *)&q->extco2; > > + > > +#endif > > q->param.ExtParam= q->extparam; > > q->param.NumExtParam = FF_ARRAY_ELEMS(q->extparam); > > } > > diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index > > 2316488..2a21f82 100644 > > --- a/libavcodec/qsvenc.h > > +++ b/libavcodec/qsvenc.h > > @@ -50,7 +50,12 @@ typedef struct QSVEncContext { > > mfxFrameAllocRequest req; > > > > mfxExtCodingOption extco; > > +#if QSV_VERSION_ATLEAST(1,6) > > +mfxExtCodingOption2 extco2; > > +mfxExtBuffer *extparam[2]; > > +#else > > mfxExtBuffer *extparam[1]; > > +#endif > > > > AVFifoBuffer *async_fifo; > > > > @@ -62,6 +67,9 @@ typedef struct QSVEncContext { > > int avbr_accuracy; > > int avbr_convergence; > > int pic_timing_sei; > > +int look_ahead; > > +int look_ahead_depth; > > +int look_ahead_downsampling; > > > > char *load_plugins; > > } QSVEncContext; > > diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c index > > b15f6b2..b569efe 100644 > > --- a/libavcodec/qsvenc_h264.c > > +++ b/libavcodec/qsvenc_h264.c > > @@ -71,6 +71,18 @@ static const AVOption options[] = { > > { "avbr_convergence", "Convergence of the AVBR ratecontrol", > > OFFSET(qsv.avbr_convergence), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, > > INT_MAX, VE }, > > { "pic_timing_sei","Insert picture timing SEI with > > pic_struct_syntax element", OFFSET(qsv.pic_timing_sei), > > AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE }, > > > > +#if QSV_VERSION_ATLEAST(1,7) > > +{ "look_ahead", "Use VBR algorithm with look ahead", > > OFFSET(qsv.look_ahead), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE > > }, > > +{ "look_ahead_depth", "Depth of look ahead in number frames", > > +OFFSET(qsv.look_ahead_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, > > VE > > +}, #endif > > + > > +#if QSV_VERSION_ATLEAST(1,8) > > +{ "look_ahead_downsampling", NULL, > > OFFSET(qsv.look_ahead_downsampling), AV_OPT_TYPE_INT, { .i64 = > > MFX_LOOK
Re: [FFmpeg-devel] [PATCH] lavf/mpegenc: provide better feedback in case of invalid media type
On Thu, Aug 27, 2015 at 05:42:55PM +0200, Stefano Sabatini wrote: > --- > libavformat/mpegenc.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c > index 2520f49..b3ee2a0 100644 > --- a/libavformat/mpegenc.c > +++ b/libavformat/mpegenc.c > @@ -410,7 +410,9 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx) > stream->max_buffer_size = 16 * 1024; > break; > default: > -return -1; > +av_log(ctx, AV_LOG_ERROR, "Invalid media type %s for output > stream #%d\n", > + av_get_media_type_string(st->codec->codec_type), i); > +return AVERROR(EINVAL); > } LGTM thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates 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/mpegenc: provide better feedback in case of invalid media type
On date Thursday 2015-08-27 17:59:20 +0200, Michael Niedermayer wrote: > On Thu, Aug 27, 2015 at 05:42:55PM +0200, Stefano Sabatini wrote: > > --- > > libavformat/mpegenc.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c > > index 2520f49..b3ee2a0 100644 > > --- a/libavformat/mpegenc.c > > +++ b/libavformat/mpegenc.c > > @@ -410,7 +410,9 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx) > > stream->max_buffer_size = 16 * 1024; > > break; > > default: > > -return -1; > > +av_log(ctx, AV_LOG_ERROR, "Invalid media type %s for output > > stream #%d\n", > > + av_get_media_type_string(st->codec->codec_type), i); > > +return AVERROR(EINVAL); > > } > > LGTM > > thanks Pushed, thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffplay: remove unused include libavutil/colorspace.h
On Thu, Aug 27, 2015 at 02:00:30PM +0800, Zhang Rui wrote: > --- > ffplay.c | 1 - > 1 file changed, 1 deletion(-) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB DNS cache poisoning attacks, popular search engine, Google internet authority dont be evil, please signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] vaapi: Add hevc hwaccel support
Hi, Sorry, I cannot test until next week. Does it actually work now? Based on some #ffmpeg-devel backlogs :) 2015-08-26 15:15 GMT+02:00 Timo Rothenpieler : > --- > configure | 4 + > libavcodec/Makefile | 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/hevc.c | 5 +- > libavcodec/vaapi_hevc.c | 485 > > 5 files changed, 495 insertions(+), 1 deletion(-) > create mode 100644 libavcodec/vaapi_hevc.c > > diff --git a/configure b/configure > index 6449018..f681bdb 100755 > --- a/configure > +++ b/configure > @@ -2425,6 +2425,8 @@ hevc_d3d11va_hwaccel_select="hevc_decoder" > hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC" > hevc_dxva2_hwaccel_select="hevc_decoder" > hevc_qsv_hwaccel_deps="libmfx" > +hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC" > +hevc_vaapi_hwaccel_select="hevc_decoder" > hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC" > hevc_vdpau_hwaccel_select="hevc_decoder" > mpeg_vdpau_decoder_deps="vdpau" > @@ -5146,6 +5148,8 @@ check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" > -DWINAPI_FAMILY=WINAPI_FAMIL > check_type "windows.h d3d11.h" "ID3D11VideoDecoder" > check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode > -D_WIN32_WINNT=0x0602 > > +check_type "va/va.h" "VAPictureParameterBufferHEVC" > + > check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC" > > if ! disabled w32threads && ! enabled pthreads; then Does this mean vaapi support will be disabled now if the user doesn't have the very latest libva headers and libs? Looks reasonable though, based on existing practice. So, should be ok. > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index 3c50ff8..407c6c3 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -715,6 +715,7 @@ OBJS-$(CONFIG_H264_VDPAU_HWACCEL) += vdpau_h264.o > OBJS-$(CONFIG_H264_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o > OBJS-$(CONFIG_HEVC_D3D11VA_HWACCEL) += dxva2_hevc.o > OBJS-$(CONFIG_HEVC_DXVA2_HWACCEL) += dxva2_hevc.o > +OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_hevc.o > OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) += vdpau_hevc.o > OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL)+= vdpau_mpeg12.o > OBJS-$(CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c > index d4ae497..dbf3927 100644 > --- a/libavcodec/allcodecs.c > +++ b/libavcodec/allcodecs.c > @@ -89,6 +89,7 @@ void avcodec_register_all(void) > REGISTER_HWACCEL(HEVC_D3D11VA, hevc_d3d11va); > REGISTER_HWACCEL(HEVC_DXVA2,hevc_dxva2); > REGISTER_HWACCEL(HEVC_QSV, hevc_qsv); > +REGISTER_HWACCEL(HEVC_VAAPI,hevc_vaapi); > REGISTER_HWACCEL(HEVC_VDPAU,hevc_vdpau); > REGISTER_HWACCEL(MPEG1_XVMC,mpeg1_xvmc); > REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau); > diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c > index 3f1a2bb..e7ac50e 100644 > --- a/libavcodec/hevc.c > +++ b/libavcodec/hevc.c > @@ -328,7 +328,7 @@ static void export_stream_params(AVCodecContext *avctx, > const HEVCParamSets *ps, > > static int set_sps(HEVCContext *s, const HEVCSPS *sps, enum AVPixelFormat > pix_fmt) > { > -#define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + > CONFIG_HEVC_D3D11VA_HWACCEL + CONFIG_HEVC_VDPAU_HWACCEL) > +#define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + > CONFIG_HEVC_D3D11VA_HWACCEL + CONFIG_HEVC_VAAPI_HWACCEL + > CONFIG_HEVC_VDPAU_HWACCEL) > enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts; > int ret, i; > > @@ -352,6 +352,9 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps, > enum AVPixelFormat pix_fm > #if CONFIG_HEVC_D3D11VA_HWACCEL > *fmt++ = AV_PIX_FMT_D3D11VA_VLD; > #endif > +#if CONFIG_HEVC_VAAPI_HWACCEL > +*fmt++ = AV_PIX_FMT_VAAPI; > +#endif > #if CONFIG_HEVC_VDPAU_HWACCEL > *fmt++ = AV_PIX_FMT_VDPAU; > #endif > diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c > new file mode 100644 > index 000..9146816 > --- /dev/null > +++ b/libavcodec/vaapi_hevc.c > @@ -0,0 +1,485 @@ > +/* > + * HEVC HW decode acceleration through VA API > + * > + * Copyright (C) 2015 Timo Rothenpieler > + * > + * 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
Re: [FFmpeg-devel] [PATCH] avfilter/vf_histogram: 9 and 10 bit depth support
On Wed, Aug 26, 2015 at 09:11:34AM +, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > libavfilter/vf_histogram.c | 136 > +++-- > 1 file changed, 106 insertions(+), 30 deletions(-) LGTM thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB There will always be a question for which you do not know the correct answer. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/af_amerge: use the name 's' for the pointer to the private context
On Wed, Aug 26, 2015 at 12:55 PM, Nicolas George wrote: > Le nonidi 9 fructidor, an CCXXIII, Ganesh Ajjanagadde a écrit : >> Signed-off-by: Ganesh Ajjanagadde >> --- >> libavfilter/af_amerge.c | 104 >> >> 1 file changed, 52 insertions(+), 52 deletions(-) > > Ok. Just a reminder: I do not have git write access, so feel free to push. > > Regards, > > -- > Nicolas George > > ___ > 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]Describe eia_608 as text subtitles
On Thu, 27 Aug 2015 19:54:07 +0530 Anshul wrote: > On 08/27/2015 05:46 PM, Carl Eugen Hoyos wrote: > > Hi! > > > > Attached patch fixes an issue with ffplay here (it tries to scale > > the text subtitles), please comment, > Though patch looks correct to me, just need more information for > testing and documenting it here. patch also looks ok to me. i'm not aware of 608 or 708 being anything but text. -compn ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/af_amerge: use the name 's' for the pointer to the private context
On 8/26/15, Nicolas George wrote: > Le nonidi 9 fructidor, an CCXXIII, Ganesh Ajjanagadde a ecrit : >> Signed-off-by: Ganesh Ajjanagadde >> --- >> libavfilter/af_amerge.c | 104 >> >> 1 file changed, 52 insertions(+), 52 deletions(-) > > Ok. applied. > > Regards, > > -- > Nicolas George > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add framerate video filter
Paul B Mahol gmail.com> writes: > +This filter is not designed to function correctly with interlaced media. If > +you wish to change the frame rate of interlaced media then you are required > +to deinterlace before this filter and re-interlace after this filter. Shouldn't this be: ... required to deinterleave before and interleave after this filter. ? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add framerate video filter
Am 27.08.2015 23:24 schrieb "Carl Eugen Hoyos" : > > Paul B Mahol gmail.com> writes: > > > +This filter is not designed to function correctly with interlaced media. If > > +you wish to change the frame rate of interlaced media then you are required > > +to deinterlace before this filter and re-interlace after this filter. > > Shouldn't this be: > ... required to deinterleave before and interleave after > this filter. > ? > Could you elaborate why? I think deinterlace is what is meant and what most users understand. > Carl Eugen > > ___ > 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] avfilter: add framerate video filter
Robert Krüger lesspain.de> writes: > > > you are required to deinterlace before this > > > filter and re-interlace after this filter. > > > > Shouldn't this be: > > ... required to deinterleave before and interleave > > after this filter. > > ? > > Could you elaborate why? > > I think deinterlace is what is meant and what most > users understand. Deinterleaving and interleaving is completely lossless while deinterlacing and interlacing will have an impact on quality. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] configure: colorize warning messages
This patch introduces color warning messages (yellow). Tested with zsh, bash, and sh (bash under --posix). Signed-off-by: Ganesh Ajjanagadde --- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 8840027..7f43572 100755 --- a/configure +++ b/configure @@ -416,6 +416,8 @@ EOF } quotes='""' +warn_color=$'\033[33;1m' +reset_color=$'\033[0m' log(){ echo "$@" >> $logfile @@ -6197,7 +6199,7 @@ echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH cp_if_changed $TMPH libavutil/avconfig.h if test -n "$WARNINGS"; then -printf "\n$WARNINGS" +printf "\n%s$WARNINGS%s" "$warn_color" "$reset_color" enabled fatal_warnings && exit 1 fi -- 2.5.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] PATCH: better message that ffplay is not going to be built
See attached. Basically it was annoying to not be able to tell that ffplay was "skipped" for some reason (like no SDL) but now you can since it prints out what it will build. Thank you. 0001-better-message-that-ffplay-is-not-going-to-be-built-.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] PATCH: better message that ffplay is not going to be built
On Thu, Aug 27, 2015 at 6:18 PM, Roger Pack wrote: > See attached. > Basically it was annoying to not be able to tell that ffplay was > "skipped" for some reason (like no SDL) but now you can since it > prints out what it will build. > Thank you. Please add the area (e.g configure:...) to the commit message. More generally, I suggest a slight cleanup of the commit message: first line-> "configure: print out enabled programs" skip a blank line, body-> "This prints out a better error message that ffplay is not being built by printing out what will be built. Based on patch by Moritz Barsnick." Otherwise, LGTM. > > ___ > 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] vaapi: Add hevc hwaccel support
> Hi, > > Sorry, I cannot test until next week. Does it actually work now? Based > on some #ffmpeg-devel backlogs :) Yes, it works flawlessly, except for samples using ScalingLists. See http://fate-suite.ffmpeg.org/hevc-conformance/ the SLIST_* files. Those files decode with strong artifacts, with both gstreamer and ffmpeg showing the exact same ones. Comparing the trace logs from gst and ffmpeg, they do set the ScalingLists somewhat diffrently. The values ffmpeg sets work fine for vdpau and dxva, so I suspect that the issue here might be at a lower layer. >> +hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC" >> +hevc_vaapi_hwaccel_select="hevc_decoder" >> hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC" >> hevc_vdpau_hwaccel_select="hevc_decoder" >> mpeg_vdpau_decoder_deps="vdpau" >> @@ -5146,6 +5148,8 @@ check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" >> -DWINAPI_FAMILY=WINAPI_FAMIL >> check_type "windows.h d3d11.h" "ID3D11VideoDecoder" >> check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode >> -D_WIN32_WINNT=0x0602 >> >> +check_type "va/va.h" "VAPictureParameterBufferHEVC" >> + >> check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC" >> >> if ! disabled w32threads && ! enabled pthreads; then > > Does this mean vaapi support will be disabled now if the user doesn't > have the very latest libva headers and libs? Looks reasonable though, > based on existing practice. So, should be ok. No, the check_type only enables or disables VAPictureParameterBufferHEVC based on if the type is found, which is then used as dependency for hevc_vaapi_hwaccel. >> +if (h->nal_unit_type >= NAL_BLA_W_LP && h->nal_unit_type <= >> NAL_CRA_NUT) { >> +pp->slice_parsing_fields.bits.RapPicFlag = 1; >> +} else { >> +pp->slice_parsing_fields.bits.RapPicFlag = 0; >> +} > > If IS_IRAP(h) is not suitable (22 & 23 NAL unit types needed?), > couldn't we have some convenient macro that could be helpful to other > hwaccels too? va_dec_hevc.h describes this flag as "current picture with NUT between 16 and 21 inclusive", which is not something I found an existing macro for, and no other hwaccel seems to look for this. >> +if (IS_IDR(h)) { >> +pp->slice_parsing_fields.bits.IdrPicFlag = 1; >> +} else { >> +pp->slice_parsing_fields.bits.IdrPicFlag = 0; >> +} > > IdrPicFlag = IS_IDR(h); ? > >> +if (IS_IRAP(h)) { >> +pp->slice_parsing_fields.bits.IntraPicFlag = 1; >> +} else { >> +pp->slice_parsing_fields.bits.IntraPicFlag = 0; >> +} > > IntraPicFlag = IS_IRAP(h); ? I wasn't sure if setting the result of those macros, which are a logical expression, is guaranteed to be 0 or 1, and how that interacts with bit fields in a struct, so I made sure it's 0 or 1. >> +/* TODO */ >> +pp->pic_fields.bits.NoPicReorderingFlag = 0; >> +pp->pic_fields.bits.NoBiPredFlag = 0; >> +pp->st_rps_bits = 0; >> +} > > Could this be done? :) Or this first round is good enough for now? st_rps_bits is implemented in the current version, not sure about the other two. signature.asc Description: OpenPGP digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: colorize warning messages
On Thu, Aug 27, 2015 at 06:17:32PM -0400, Ganesh Ajjanagadde wrote: > This patch introduces color warning messages (yellow). > Tested with zsh, bash, and sh (bash under --posix). > > Signed-off-by: Ganesh Ajjanagadde > --- > configure | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) I'm concerned that this would trash the configure output when it is viewed with something not supporting ANSI support codes. For example, when one pipes the output to a file. Timothy ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] PATCH: better message that ffplay is not going to be built
On Thu, Aug 27, 2015 at 06:36:00PM -0400, Ganesh Ajjanagadde wrote: > Please add the area (e.g configure:...) to the commit message. > More generally, I suggest a slight cleanup of the commit message: > first line-> "configure: print out enabled programs" > skip a blank line, body-> "This prints out a better error message that > ffplay is not being built by printing out what will be built. Based on > patch by Moritz Barsnick." Done. > Otherwise, LGTM. Patch applied. Thanks to all. Timothy ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: colorize warning messages
sent from my phone On Aug 27, 2015 7:26 PM, "Timothy Gu" wrote: > > On Thu, Aug 27, 2015 at 06:17:32PM -0400, Ganesh Ajjanagadde wrote: > > This patch introduces color warning messages (yellow). > > Tested with zsh, bash, and sh (bash under --posix). > > > > Signed-off-by: Ganesh Ajjanagadde > > --- > > configure | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > I'm concerned that this would trash the configure output when it is > viewed with something not supporting ANSI support codes. For example, > when one pipes the output to a file. I can do tests for this, to make sure it writes to a tty, tty supports colors, etc. Forgot to mention this was a minimal first cut; want to see whether there are objections to the idea as a whole. > > Timothy > ___ > 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 2/2] lavf/file: check for dirent.h support
On Tue, Aug 25, 2015 at 2:36 PM, Michael Niedermayer wrote: > On Tue, Aug 25, 2015 at 02:18:22AM -0300, James Almer wrote: > > On 24/08/15 10:02 PM, Michael Niedermayer wrote: > > > On Fri, Aug 21, 2015 at 02:18:34AM +0200, Mariusz Szczepańczyk wrote: > > >> On Thu, Jun 25, 2015 at 12:09 PM, Michael Niedermayer < > michae...@gmx.at> > > >> wrote: > > >> > > >>> On Wed, Jun 24, 2015 at 03:25:18AM +0200, Mariusz Szczepańczyk wrote: > > On Tue, Jun 23, 2015 at 8:34 PM, Michael Niedermayer < > michae...@gmx.at> > > wrote: > > > > > On Mon, Jun 22, 2015 at 12:01:33AM +0200, Mariusz Szczepańczyk > wrote: > > >> --- > > >> configure | 2 ++ > > >> libavformat/file.c | 34 ++ > > >> 2 files changed, 36 insertions(+) > > > > > > this and the previous patch fails to build > > > > > > make distclean ; ./configure --disable-sdl && make -j12 > > > > > > libavformat/file.c: In function ‘file_read_dir’: > > > libavformat/file.c:302:10: error: ‘DT_FIFO’ undeclared (first use > in > > >>> this > > > function) > > > libavformat/file.c:302:10: note: each undeclared identifier is > reported > > > only once for each function it appears in > > > libavformat/file.c:305:10: error: ‘DT_CHR’ undeclared (first use in > > >>> this > > > function) > > > libavformat/file.c:308:10: error: ‘DT_DIR’ undeclared (first use in > > >>> this > > > function) > > > libavformat/file.c:311:10: error: ‘DT_BLK’ undeclared (first use in > > >>> this > > > function) > > > libavformat/file.c:314:10: error: ‘DT_REG’ undeclared (first use in > > >>> this > > > function) > > > libavformat/file.c:317:10: error: ‘DT_LNK’ undeclared (first use in > > >>> this > > > function) > > > libavformat/file.c:320:10: error: ‘DT_SOCK’ undeclared (first use > in > > >>> this > > > function) > > > libavformat/file.c:323:10: error: ‘DT_UNKNOWN’ undeclared (first > use in > > > this function) > > > make: *** [libavformat/file.o] Error 1 > > > make: *** Waiting for unfinished jobs > > > > > > sdl disable is needed to reproduce as sdls pkgcnonfig adds > > > GNU_SOURCE i suspect > > > > > > > Added contraint on _GNU_SOURCE and now it compiles fine on my linux > in > > >>> both > > cases (with or without sdl). > > >>> > > >>> The code probably should #ifdef DT_... like DT_FIFO > > >>> also are both variants needed ? > > >>> are there systems lacking some of the S_IS*() ? or is there some > > >>> disadvantage in their use ? (i dont know, just asking ...) > > >>> > > >>> testing for _GNU_SOURCE is not correct, nothing gurantees that the > > >>> compiler or headers know or react to _GNU_SOURCE > > >>> > > >> > > >> Yet another try. > > >> > > >> Completely removed reliance on DT_* and added definitions for some > S_* that > > >> can be missing. > > > > > >> configure |2 + > > >> libavformat/file.c | 80 > ++--- > > >> 2 files changed, 54 insertions(+), 28 deletions(-) > > >> 47af9bc90efe51f1d94455bdf7e3eafaec6e61e2 > 0002-lavf-file-check-for-dirent.h-support.patch > > >> From 820bd4aa5b064861935f8ef9e37a19bf459620c8 Mon Sep 17 00:00:00 2001 > > >> From: =?UTF-8?q?Mariusz=20Szczepa=C5=84czyk?= < > mszczepanc...@gmail.com> > > >> Date: Mon, 29 Jun 2015 00:13:43 +0200 > > >> Subject: [PATCH 2/2] lavf/file: check for dirent.h support > > > > > > both patches applied > > > > > > thanks > > > > This broke mingw-w64 (x86_32 and x86_64) and mingw32. > > > http://fate.ffmpeg.org/report.cgi?time=20150825040408&slot=x86_32-mingw-w64-dll-windows-native > > > http://fate.ffmpeg.org/report.cgi?time=20150822201317&slot=x86_64-freebsd10-mingw32 > > > http://fate.ffmpeg.org/report.cgi?time=20150825012347&slot=x86_64-mingw-w64-windows-native > > > > /src/libavformat/file.c: In function 'file_read_dir': > > /src/libavformat/file.c:289:9: error: implicit declaration of function > 'lstat' [-Werror=implicit-function-declaration] > > should be fixed > didint see your mail before runing into the failure myself > > Sorry about this and thanks for fixing it. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavf/http: implement directory listing callbacks for Apache
On Mon, Aug 24, 2015 at 12:39 PM, Michael Niedermayer < mich...@niedermayer.cc> wrote: > On Fri, Aug 21, 2015 at 01:17:20AM +0200, Mariusz Szczepańczyk wrote: > [...] > > > +static int http_open_dir(URLContext *h) > > +{ > > +HTTPContext *s = h->priv_data; > > +xmlSAXHandler handlers = {}; > > +int ret; > > + > > > +if (ret = http_open(h, h->filename, 0, NULL) < 0) > > +goto fail; > > missing () > fixed From c002eff8559d90664d18e670528bbeabcb486a05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariusz=20Szczepa=C5=84czyk?= Date: Wed, 19 Aug 2015 23:51:20 +0200 Subject: [PATCH] lavf/http: implement callbacks for directory listings from Apache --- configure | 3 + libavformat/http.c | 194 + 2 files changed, 197 insertions(+) diff --git a/configure b/configure index 5913090..ef81f00 100755 --- a/configure +++ b/configure @@ -265,6 +265,7 @@ External library support: --enable-libxcb-shm enable X11 grabbing shm communication [autodetect] --enable-libxcb-xfixes enable X11 grabbing mouse rendering [autodetect] --enable-libxcb-shapeenable X11 grabbing shape rendering [autodetect] + --enable-libxml2 enable HTML parsing via libxml2 [no] --enable-libxvid enable Xvid encoding via xvidcore, native MPEG-4/Xvid encoder exists [no] --enable-libzmq enable message passing via libzmq [no] @@ -1422,6 +1423,7 @@ EXTERNAL_LIBRARY_LIST=" libxcb_shm libxcb_shape libxcb_xfixes +libxml2 libxvid libzmq libzvbi @@ -5320,6 +5322,7 @@ enabled libx265 && require_pkg_config x265 x265.h x265_api_get && { check_cpp_condition x265.h "X265_BUILD >= 57" || die "ERROR: libx265 version must be >= 57."; } enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs +enabled libxml2 && require_pkg_config libxml-2.0 libxml/parser.h xmlInitParser enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore enabled libzmq&& require_pkg_config libzmq zmq.h zmq_ctx_new enabled libzvbi && require libzvbi libzvbi.h vbi_decoder_new -lzvbi diff --git a/libavformat/http.c b/libavformat/http.c index d3c0b7e..d3dc16f 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -21,6 +21,10 @@ #include "config.h" +#if CONFIG_LIBXML2 +#include +#endif /* CONFIG_LIBXML2 */ + #if CONFIG_ZLIB #include #endif /* CONFIG_ZLIB */ @@ -54,6 +58,16 @@ typedef enum { FINISH }HandshakeState; +typedef struct AVIODirEntryQueueNode { +struct AVIODirEntry *entry; +struct AVIODirEntryQueueNode *next; +} AVIODirEntryQueueNode; + +typedef struct AVIODirEntryQueue { +struct AVIODirEntryQueueNode *front; +struct AVIODirEntryQueueNode *rear; +} AVIODirEntryQueue; + typedef struct HTTPContext { const AVClass *class; URLContext *hd; @@ -70,6 +84,7 @@ typedef struct HTTPContext { char *mime_type; char *user_agent; char *content_type; +char *server; /* Set if the server correctly handles Connection: close and will close * the connection after feeding us the content. */ int willclose; @@ -111,6 +126,11 @@ typedef struct HTTPContext { int is_multi_client; HandshakeState handshake_step; int is_connected_server; +#if CONFIG_LIBXML2 +htmlParserCtxtPtr html_parser; +AVIODirEntryQueue *entry_queue; +AVIODirEntry *entry; +#endif /* CONFIG_LIBXML2 */ } HTTPContext; #define OFFSET(x) offsetof(HTTPContext, x) @@ -808,6 +828,8 @@ static int process_line(URLContext *h, char *line, int line_count, if (!strcmp(p, "close")) s->willclose = 1; } else if (!av_strcasecmp(tag, "Server")) { +av_free(s->server); +s->server = av_strdup(p); if (!av_strcasecmp(p, "AkamaiGHost")) { s->is_akamai = 1; } else if (!av_strncasecmp(p, "MediaGateway", 12)) { @@ -1409,6 +1431,7 @@ static int http_close(URLContext *h) if (s->hd) ffurl_closep(&s->hd); av_dict_free(&s->chained_options); +av_freep(&s->server); return ret; } @@ -1471,6 +1494,167 @@ static int http_get_file_handle(URLContext *h) return ffurl_get_file_handle(s->hd); } +#if CONFIG_LIBXML2 +static void avio_dir_entry_queue_push(AVIODirEntryQueue *queue, AVIODirEntry *entry) +{ +AVIODirEntryQueueNode *node; + +if (!queue) +return; + +node = av_mallocz(sizeof(AVIODirEntryQueueNode)); +node->entry = entry; +if (!queue->front) { +queue->front = queue->rear = node; +} else { +queue->rear->next = node; +queue->rear = node; +} +} + +static AVIODirEntry *avio_dir_entry_queue_pop(AVIODirEntryQueue *queue) +{ +AVIODirEntry *entry; +AVIODirEntryQueueNode *tmp; + +if (!queue || !queue->front) +return NULL; +
[FFmpeg-devel] ffplay buffer
I am trying to reduce the size of the buffer for ffplay, it looks like the default is around 500 ms. I have been looking through the code but unfortunately, I’m struggling with understanding it as I’m not too familiar with c yet. Can somebody point me in the right direction on how to reduce this default value? Thanks ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] apng: Support inter-frame compression
On Wed, Aug 19, 2015 at 06:41:23AM +, Donny Yang wrote: > The current algorithm is just "try all the combinations, and pick the best". > It's not very fast either, probably due to a lot of copying, but will do for > an initial implementation. > > Signed-off-by: Donny Yang > --- > libavcodec/pngenc.c | 420 > +++- > 1 file changed, 384 insertions(+), 36 deletions(-) applied if you want git write access, send me you public ssh key also if you want to maintain the code in the future, feel free to add yourself to the MAINTAINERs file thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The bravest are surely those who have the clearest vision of what is before them, glory and danger alike, and yet notwithstanding go out to meet it. -- Thucydides signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: colorize warning messages
On Thu, Aug 27, 2015 at 7:23 PM, Timothy Gu wrote: > On Thu, Aug 27, 2015 at 06:17:32PM -0400, Ganesh Ajjanagadde wrote: >> This patch introduces color warning messages (yellow). >> Tested with zsh, bash, and sh (bash under --posix). >> >> Signed-off-by: Ganesh Ajjanagadde >> --- >> configure | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) > > I'm concerned that this would trash the configure output when it is > viewed with something not supporting ANSI support codes. For example, > when one pipes the output to a file. FWIW, config.log (by default) stores the configure output (including the warnings). Note that this patch does not affect the writes to logs, only the stdout (which may be piped as you pointed out). Thus this patch is not too bad in this aspect. > > Timothy > ___ > 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] [PATCHv2] configure: colorize warning messages
This patch introduces color warning messages (yellow). They are enabled whenever available. Tested with zsh, bash, and sh (bash under --posix). Signed-off-by: Ganesh Ajjanagadde --- configure | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 5913090..4f712c1 100755 --- a/configure +++ b/configure @@ -416,6 +416,13 @@ EOF } quotes='""' +if test -t 1; then +ncolors=$(tput colors) +if test -n "$ncolors" && test $ncolors -ge 8; then +warn_color=$'\033[33;1m' +reset_color=$'\033[0m' +fi +fi log(){ echo "$@" >> $logfile @@ -6201,7 +6208,7 @@ echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH cp_if_changed $TMPH libavutil/avconfig.h if test -n "$WARNINGS"; then -printf "\n$WARNINGS" +printf "\n%s$WARNINGS%s" "$warn_color" "$reset_color" enabled fatal_warnings && exit 1 fi -- 2.5.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: colorize warning messages
On Thu, Aug 27, 2015 at 11:02 PM, Ganesh Ajjanagadde wrote: > On Thu, Aug 27, 2015 at 7:23 PM, Timothy Gu wrote: >> On Thu, Aug 27, 2015 at 06:17:32PM -0400, Ganesh Ajjanagadde wrote: >>> This patch introduces color warning messages (yellow). >>> Tested with zsh, bash, and sh (bash under --posix). >>> >>> Signed-off-by: Ganesh Ajjanagadde >>> --- >>> configure | 4 +++- >>> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> I'm concerned that this would trash the configure output when it is >> viewed with something not supporting ANSI support codes. For example, >> when one pipes the output to a file. > > FWIW, config.log (by default) stores the configure output (including > the warnings). > Note that this patch does not affect the writes to logs, only the > stdout (which may be piped as you pointed out). > Thus this patch is not too bad in this aspect. Please see new version which should not trash under piping. It also checks if the terminal supports colors in a POSIX compliant way. > >> >> Timothy >> ___ >> 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]Mention webm default codec change in the Changelog
Thilo Borgmann mail.de> writes: > Am 27.08.15 um 10:51 schrieb Carl Eugen Hoyos: > > Hi! > > > > Better wording welcome! > > Switched default encoders for webm to VP9 and Opus Pushed with this wording. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add framerate video filter
On Fri, Aug 28, 2015 at 12:01 AM, Carl Eugen Hoyos wrote: > Robert Krüger lesspain.de> writes: > > > > > you are required to deinterlace before this > > > > filter and re-interlace after this filter. > > > > > > Shouldn't this be: > > > ... required to deinterleave before and interleave > > > after this filter. > > > ? > > > > Could you elaborate why? > > > > I think deinterlace is what is meant and what most > > users understand. > > Deinterleaving and interleaving is completely lossless > while deinterlacing and interlacing will have an > impact on quality. > > From my understanding what the filter does and what the visual results of each option would be, I would guess the text is meant as it is written, especially since Mark is both a native english speaker and a very competent broadcast professional but that's just my 2c. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/5] avcodec/samidec: use ff_htmlmarkup_to_ass()
--- libavcodec/Makefile | 2 +- libavcodec/samidec.c| 35 +-- tests/ref/fate/sub-sami | 18 +- 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index d1ffb12..1045d7a 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -450,7 +450,7 @@ OBJS-$(CONFIG_RV20_DECODER)+= rv10.o OBJS-$(CONFIG_RV20_ENCODER)+= rv20enc.o OBJS-$(CONFIG_RV30_DECODER)+= rv30.o rv34.o rv30dsp.o OBJS-$(CONFIG_RV40_DECODER)+= rv40.o rv34.o rv40dsp.o -OBJS-$(CONFIG_SAMI_DECODER)+= samidec.o ass.o +OBJS-$(CONFIG_SAMI_DECODER)+= samidec.o ass.o htmlsubtitles.o OBJS-$(CONFIG_S302M_DECODER) += s302m.o OBJS-$(CONFIG_S302M_ENCODER) += s302menc.o OBJS-$(CONFIG_SANM_DECODER)+= sanm.o diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c index 47850e2..8b036a0 100644 --- a/libavcodec/samidec.c +++ b/libavcodec/samidec.c @@ -27,10 +27,13 @@ #include "ass.h" #include "libavutil/avstring.h" #include "libavutil/bprint.h" +#include "htmlsubtitles.h" typedef struct { AVBPrint source; AVBPrint content; +AVBPrint encoded_source; +AVBPrint encoded_content; AVBPrint full; } SAMIContext; @@ -41,8 +44,12 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src) char *tag = NULL; char *dupsrc = av_strdup(src); char *p = dupsrc; +AVBPrint *dst_content = &sami->encoded_content; +AVBPrint *dst_source = &sami->encoded_source; +av_bprint_clear(&sami->encoded_content); av_bprint_clear(&sami->content); +av_bprint_clear(&sami->encoded_source); for (;;) { char *saveptr = NULL; int prev_chr_is_space = 0; @@ -82,18 +89,11 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src) if (*p == '<') { if (!av_strncasecmp(p, "full); -if (sami->source.len) -av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->source.str); -av_bprintf(&sami->full, "%s", sami->content.str); +if (sami->source.len) { +ff_htmlmarkup_to_ass(avctx, dst_source, sami->source.str); +av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->encoded_source.str); +} +ff_htmlmarkup_to_ass(avctx, dst_content, sami->content.str); +av_bprintf(&sami->full, "%s", sami->encoded_content.str); end: av_free(dupsrc); @@ -136,6 +139,8 @@ static av_cold int sami_init(AVCodecContext *avctx) SAMIContext *sami = avctx->priv_data; av_bprint_init(&sami->source, 0, 2048); av_bprint_init(&sami->content, 0, 2048); +av_bprint_init(&sami->encoded_source, 0, 2048); +av_bprint_init(&sami->encoded_content, 0, 2048); av_bprint_init(&sami->full,0, 2048); return ff_ass_subtitle_header_default(avctx); } @@ -145,6 +150,8 @@ static av_cold int sami_close(AVCodecContext *avctx) SAMIContext *sami = avctx->priv_data; av_bprint_finalize(&sami->source, NULL); av_bprint_finalize(&sami->content, NULL); +av_bprint_finalize(&sami->encoded_source, NULL); +av_bprint_finalize(&sami->encoded_content, NULL); av_bprint_finalize(&sami->full,NULL); return 0; } diff --git a/tests/ref/fate/sub-sami b/tests/ref/fate/sub-sami index caa85a2..9eabbd7 100644 --- a/tests/ref/fate/sub-sami +++ b/tests/ref/fate/sub-sami @@ -10,12 +10,12 @@ Style: Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10 [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text -Dialogue: 0,0:00:00.00,0:00:00.01,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\N -Dialogue: 0,0:00:00.01,0:00:08.80,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\NLet the word go forth, from this time and place to friend and foe alike that the torch -Dialogue: 0,0:00:08.80,0:00:19.50,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nhas been passed to a new generation of Americans, born in this century, tempered by war, -Dialogue: 0,0:00:19.50,0:00:28.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Ndisciplined by a hard and bitter peace, proud of our ancient heritage, and unwilling to witness -Dialogue: 0,0:00:28.00,0:00:38.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nor permit the slow undoing of those human rights to which this nation has always -Dialogue: 0,0:00:38.00,0:00:46.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nbeen committed and to which we are committed today at home and around the world. -Dialogue: 0,0:00:46.00,0:01:01.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\NLet every nation know, whether it wishes us well or ill, that we shall pay any price, bear any burden, -Dialogue: 0,0:01:01.00,0:01:13.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nmeet any hardship, support any friend, oppose any foe, to ensure the survival and success of liberty. -Dialogue: 0,0:01:13.00
[FFmpeg-devel] [PATCH 3/5] libavcodec/htmlsubtitles:Add parsing for sami
--- libavcodec/htmlsubtitles.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libavcodec/htmlsubtitles.c b/libavcodec/htmlsubtitles.c index a138955..c1324d6 100644 --- a/libavcodec/htmlsubtitles.c +++ b/libavcodec/htmlsubtitles.c @@ -54,7 +54,7 @@ static void rstrip_spaces_buf(AVBPrint *buf) void ff_htmlmarkup_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *in) { char *param, buffer[128], tmp[128]; -int len, tag_close, sptr = 1, line_start = 1, an = 0, end = 0, count; +int len, tag_close, sptr = 1, line_start = 1, an = 0, end = 0; SrtStack stack[16]; stack[0].tag[0] = 0; @@ -90,6 +90,13 @@ void ff_htmlmarkup_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *in) av_bprint_chars(dst, *in, 1); break; case '<': +if (!av_strncasecmp(in, "]>%n", buffer, &len) >= 1 && len > 0) { -- 1.8.5.2 (Apple Git-48) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 5/5] fate/subtitles: add a new test for SAMI demuxer
and decoder --- tests/fate/subtitles.mak | 3 ++ tests/ref/fate/sub-sami2 | 91 2 files changed, 94 insertions(+) create mode 100644 tests/ref/fate/sub-sami2 diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak index d8b2034..f5270ea 100644 --- a/tests/fate/subtitles.mak +++ b/tests/fate/subtitles.mak @@ -46,6 +46,9 @@ fate-sub-realtext: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/RealText_capabil FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami fate-sub-sami: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SAMI_capability_tester.smi +FATE_SUBTITLES_ASS-$(call DEMDEC, SAMI, SAMI) += fate-sub-sami2 +fate-sub-sami2: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SAMI_multilang_tweak_tester.smi + FATE_SUBTITLES_ASS-$(call DEMDEC, SRT, SUBRIP) += fate-sub-srt fate-sub-srt: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt diff --git a/tests/ref/fate/sub-sami2 b/tests/ref/fate/sub-sami2 new file mode 100644 index 000..5703652 --- /dev/null +++ b/tests/ref/fate/sub-sami2 @@ -0,0 +1,91 @@ +[Script Info] +; Script generated by FFmpeg/Lavc +ScriptType: v4.00+ +PlayResX: 384 +PlayResY: 288 + +[V4+ Styles] +Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding +Style: Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0 + +[Events] +Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text +Dialogue: 0,0:00:01.51,0:00:01.51,Default,,0,0,0,,by Psyence Fictionist\npsyencefiction...@gmail.com +Dialogue: 0,0:00:01.51,0:00:08.61,Default,,0,0,0,,Sync by: honeybunny and Kerensky\Nwww.Addic7ed.com +Dialogue: 0,0:00:10.11,0:00:10.11,Default,,0,0,0,,\N{\b1}사랑과 배신\N탐욕과 살육의 이야기죠{\b0} +Dialogue: 0,0:00:10.11,0:00:13.98,Default,,0,0,0,,\N{\c&H800080&}The{\c}{\c&HCBC0FF&}re{\c} {\c&HFF&}is{\c} {\c&HA5FF&}lo{\c}{\c&H&}ve{\c} {\c&H8000&}and{\c}{\c&H00&} bet{\c}{\c&HFF&}rayal{\c},\N{\b1}{\c&H808080&}g{\c}r{\c&H808080&}e{\c}e{\c&H808080&}d{\c} and {\c&HFF&}m{\c}{\c&H808080&}u{\c}{\c&HFF&}rder{\c}{\b0}. +Dialogue: 0,0:00:17.67,0:00:17.67,Default,,0,0,0,,\N{\c&H&}선악의 정의에 대해서\N대립하는 가치관을 가진{\c} +Dialogue: 0,0:00:17.67,0:00:21.72,Default,,0,0,0,,\N{\c&HCBC0FF&}{\fs6}It's{\fs} {\fs8}set{\fs}{\fs10} in {\fs}{\fs12}this{\fs}{\fs14} intere{\fs}{\fs14}sting{\fs}\N{\fs16} world{\fs}{\fs18} of{\fs} {\fs20}cont{\fs}{\fs22}rasting{\fs}{\fs24} ideology{\fs}{\c} +Dialogue: 0,0:00:21.84,0:00:21.84,Default,,0,0,0,,\N{\u1}매력적인 세계에서\N이 모든 것이 펼쳐집니다{\u1} +Dialogue: 0,0:00:21.84,0:00:23.58,Default,,0,0,0,,\N{\i1}{\c&H9966CC&}of{\c}{\c&HC2A3E0&} what's{\c} {\c&HE0D1F0&}right{\c} {\c&HFCFAFE&}and{\c} wrong.{\i0} +Dialogue: 0,0:00:23.69,0:00:23.69,Default,,0,0,0,,\N{\i1}이 주제를 심오한 철학으로\N담아내고 있어요{\i0} +Dialogue: 0,0:00:23.69,0:00:25.67,Default,,0,0,0,,\N{\fs20}{\c&HFF&}{\s1}It{\s0}{\c}{\fs} has {\fs15}{\c&H00&}a{\c}{\fs} great {\fs16}{\c&HFFCC00&}philosophy{\c}{\fs} about it. +Dialogue: 0,0:00:40.22,0:00:40.22,Default,,0,0,0,,\N{\s1}"왕좌의 게임"은 웨스테로스라는 가상왕국의\N권력 분쟁 이야기입니다{\s0} +Dialogue: 0,0:00:40.22,0:00:47.94,Default,,0,0,0,,\N{\c&HA5FF&}{\fs26}"Game of Thrones"{\fs}{\c} {\c&H2A2AA5&}{\b1}is{\b0}{\c}{\c&H&}{\fs24}{\i1} about{\i0}{\fs}{\c} {\c&H336699&}{\fs14}power{\fs}{\c}{\c&HFF&} struggles{\c}\N{\c&HA5FF&}{\fs8}in a fantasy{\fs}{\c&HCBC0FF&} kingdom{\c&HA5FF&}, called {\fs6}Westeros.{\fs}{\c} +Dialogue: 0,0:00:48.06,0:00:48.06,Default,,0,0,0,,\N철의 왕좌를 둘러싼\N권력 분쟁이죠 +Dialogue: 0,0:00:48.06,0:00:50.76,Default,,0,0,0,,\N{\c&H8000&}And it's a power struggle\Nfor the Iron Throne,{\c} +Dialogue: 0,0:00:50.88,0:00:50.88,Default,,0,0,0,,\N{\fs20}왕국의 권력 정점이라고\N할 수 있는 자리에요{\fs} +Dialogue: 0,0:00:50.88,0:00:53.13,Default,,0,0,0,,\Nwhich is the seat of power\Nin this kingdom. +Dialogue: 0,0:00:53.25,0:00:53.25,Default,,0,0,0,,\N전운이 감도네, 네드 +Dialogue: 0,0:00:53.25,0:00:55.07,Default,,0,0,0,,\NThere's a war coming, Ned. +Dialogue: 0,0:00:56.01,0:00:56.01,Default,,0,0,0,,\N\N언제 누구와 싸우게 될지는 몰라\N하지만 분명 전쟁이 일어날걸세 +Dialogue: 0,0:00:56.01,0:01:00.09,Default,,0,0,0,,\NI don't know when, I don't know who\Nwould be fighting, but it's coming. +Dialogue: 0,0:01:01.10,0:01:01.10,Default,,0,0,0,,\N이야기의 핵심은 두 주요 가문의\N권력을 둘러싼 갈등입니다 +Dialogue: 0,0:01:01.10,0:01:07.04,Default,,0,0,0,,\N{\i1}At the core of it there's a conflict for\Npower between two great houses initially.{\i0} +Dialogue: 0,0:01:07.16,0:01:07.16,Default,,0,0,0,,\N스타크 가문과 라니스터 가문이죠 +Dialogue: 0,0:01:07.16,0:01:10.04,Default,,0,0,0,,\NHouse Stark and House Lannister. +Dialogue: 0,0:01:10.16,0:01:10.16,Default,,0,0,0,,\N그 외에 여러 가문이\N서로 경쟁합니다 +Dialogue: 0,0:01:10.16,0:01:13.25,Default,,0,0,0,,\NThe other major houses are\Nall contenders as well. +Dialogue: 0,0:01:13.37,0:01:13.37,Default,,0,0,0,,\N흥미진진하게 정치적으로\N얽혀있는 상황이죠
[FFmpeg-devel] [PATCH 1/5] avcodec/srtdec: factor out HTML parsing code
This code will be used in SAMI decoder in a later commit. --- libavcodec/Makefile| 2 +- libavcodec/htmlsubtitles.c | 177 + libavcodec/htmlsubtitles.h | 29 libavcodec/srtdec.c| 149 +- 4 files changed, 209 insertions(+), 148 deletions(-) create mode 100644 libavcodec/htmlsubtitles.c create mode 100644 libavcodec/htmlsubtitles.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 407c6c3..d1ffb12 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -474,7 +474,7 @@ OBJS-$(CONFIG_SONIC_DECODER) += sonic.o OBJS-$(CONFIG_SONIC_ENCODER) += sonic.o OBJS-$(CONFIG_SONIC_LS_ENCODER)+= sonic.o OBJS-$(CONFIG_SP5X_DECODER)+= sp5xdec.o -OBJS-$(CONFIG_SRT_DECODER) += srtdec.o ass.o +OBJS-$(CONFIG_SRT_DECODER) += srtdec.o ass.o htmlsubtitles.o OBJS-$(CONFIG_SRT_ENCODER) += srtenc.o ass_split.o OBJS-$(CONFIG_STL_DECODER) += textdec.o ass.o OBJS-$(CONFIG_SUBRIP_DECODER) += srtdec.o ass.o diff --git a/libavcodec/htmlsubtitles.c b/libavcodec/htmlsubtitles.c new file mode 100644 index 000..a138955 --- /dev/null +++ b/libavcodec/htmlsubtitles.c @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2010 Aurelien Jacobs + * + * 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 "libavutil/avstring.h" +#include "libavutil/common.h" +#include "libavutil/parseutils.h" +#include "avcodec.h" +#include "htmlsubtitles.h" + +static int html_color_parse(AVCodecContext *avctx, const char *str) +{ +uint8_t rgba[4]; +if (av_parse_color(rgba, str, strcspn(str, "\" >"), avctx) < 0) +return -1; +return rgba[0] | rgba[1] << 8 | rgba[2] << 16; +} + +enum { +PARAM_UNKNOWN = -1, +PARAM_SIZE, +PARAM_COLOR, +PARAM_FACE, +PARAM_NUMBER +}; + +typedef struct SrtStack { +char tag[128]; +char param[PARAM_NUMBER][128]; +} SrtStack; + +static void rstrip_spaces_buf(AVBPrint *buf) +{ +while (buf->len > 0 && buf->str[buf->len - 1] == ' ') +buf->str[--buf->len] = 0; +} + +void ff_htmlmarkup_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *in) +{ +char *param, buffer[128], tmp[128]; +int len, tag_close, sptr = 1, line_start = 1, an = 0, end = 0, count; +SrtStack stack[16]; + +stack[0].tag[0] = 0; +strcpy(stack[0].param[PARAM_SIZE], "{\\fs}"); +strcpy(stack[0].param[PARAM_COLOR], "{\\c}"); +strcpy(stack[0].param[PARAM_FACE], "{\\fn}"); + +for (; !end && *in; in++) { +switch (*in) { +case '\r': +break; +case '\n': +if (line_start) { +end = 1; +break; +} +rstrip_spaces_buf(dst); +av_bprintf(dst, "\\N"); +line_start = 1; +break; +case ' ': +if (!line_start) +av_bprint_chars(dst, *in, 1); +break; +case '{':/* skip all {\xxx} substrings except for {\an%d} +and all microdvd like styles such as {Y:xxx} */ +len = 0; +an += sscanf(in, "{\\an%*1u}%n", &len) >= 0 && len > 0; +if ((an != 1 && (len = 0, sscanf(in, "{\\%*[^}]}%n", &len) >= 0 && len > 0)) || +(len = 0, sscanf(in, "{%*1[CcFfoPSsYy]:%*[^}]}%n", &len) >= 0 && len > 0)) { +in += len - 1; +} else +av_bprint_chars(dst, *in, 1); +break; +case '<': +tag_close = in[1] == '/'; +len = 0; +if (sscanf(in+tag_close+1, "%127[^>]>%n", buffer, &len) >= 1 && len > 0) { +if ((param = strchr(buffer, ' '))) +*param++ = 0; +if ((!tag_close && sptr < FF_ARRAY_ELEMS(stack)) || +( tag_close && sptr > 0 && !strcmp(stack[sptr-1].tag, buffer))) { +int i, j, unknown = 0; +in += len + tag_close; +if (!tag_close) +memset(stack+sptr, 0, sizeof(*stack)); +if (!strcmp(buffer, "font")) { +if (tag_close) { +
[FFmpeg-devel] [PATCH 4/5] avformat/samidec:do not include trailing sami
footer in the last packet --- libavformat/samidec.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavformat/samidec.c b/libavformat/samidec.c index 948e1ed..bc9b745 100644 --- a/libavformat/samidec.c +++ b/libavformat/samidec.c @@ -68,11 +68,17 @@ static int sami_read_header(AVFormatContext *s) while (!ff_text_eof(&tr)) { AVPacket *sub; const int64_t pos = ff_text_pos(&tr) - (c != 0); -int is_sync, n = ff_smil_extract_next_text_chunk(&tr, &buf, &c); +int is_sync, is_body, n = ff_smil_extract_next_text_chunk(&tr, &buf, &c); if (n == 0) break; +is_body = !av_strncasecmp(buf.str, "http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/4] avcodec/strdec: factor out HTML parsing code
On Sat, Aug 15, 2015 at 11:08 AM, Clément Bœsch wrote: > On Sat, Aug 08, 2015 at 12:52:04PM -0700, Yayoi Ukai wrote: > [...] >> >> -while (dst->len >= 2 && !strncmp(&dst->str[dst->len - 2], "\\N", 2)) >> >> -dst->len -= 2; >> >> -dst->str[dst->len] = 0; >> >> -rstrip_spaces_buf(dst); >> > >> > why did you completely remove this chunk? >> >> It appeared to me that it didn't do anything even in original code. >> But I can put it back. >> (It didn't make any difference in fate test or other simple test >> whether I commented it out or not.) >> > > This commit is supposed to be factoring out the code, not do any > functional change. If you want to do such changes it belongs in a separate > commit (but you probably don't want to because it's likely wrong). > > Anyway, I had to have a look to the diff again to check if you hadn't > added more unwanted changes. And unfortunately, you did. So first of all, > this following diff I extracted belongs in a separated commit (typically > squashed in the one where you make SAMI use it, or eventually just > before). > > Here is a review of that part assuming it is extracted/moved: > > diff --git a/libavcodec/htmlsubtitles.c b/libavcodec/htmlsubtitles.c > index a138955..b2f2273 100644 > --- a/libavcodec/htmlsubtitles.c > +++ b/libavcodec/htmlsubtitles.c > @@ -71,6 +71,21 @@ void ff_htmlmarkup_to_ass(AVCodecContext *avctx, AVBPrint > *dst, const char *in) > end = 1; > break; > } > + > +/* check if it is end of the paragraph or not*/ > +in++; > +count = 1; > +while(*in == ' ') { > +in++; > +count++; > +} > +if (*in == '\0' || *in == '\n'){ > +in = in - count; > +break; > +} > +in = in - count; > + > +/*if not the end of the paragraph, add line break */ > > Why? What are you trying to do here that isn't already handled by the code > already? Yes removed. > > There is no concept of "paragraph" in SubRip markup, so it probably > doesn't belong here, assuming it's necessary. > > rstrip_spaces_buf(dst); > av_bprintf(dst, "\\N"); > line_start = 1; > @@ -90,6 +105,15 @@ void ff_htmlmarkup_to_ass(AVCodecContext *avctx, AVBPrint > *dst, const char *in) > av_bprint_chars(dst, *in, 1); > break; > case '<': > +if (!av_strncasecmp(in, " > here and below, check your style > > +av_bprintf(dst, "\\N"); > +len = 3; > +while (in[len] != '>' && (av_isspace(in[len]) || in[len] == > '/')){ > > if in[len] is a space or a '/', it's obviously different than '>', so the > condition is redundant. > > +len++; > > wrong indent > > +} > > +in += len + 1; > > this +1 is very dangerous, there is a risk of overread. Well, I was not sure what it could be replaced for checking the closed '>' for the tag.. So this one stayed... Please let me know if you have any suggestion. Thank you! > > +} > + > tag_close = in[1] == '/'; > len = 0; > if (sscanf(in+tag_close+1, "%127[^>]>%n", buffer, &len) >= 1 && > len > 0) { > > [...] > > -- > Clément B. > > ___ > 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 2/4] avcodec/samidec: use ff_htmlmarkup_to_ass()
Thank you for the suggestion.. It took me a while to get it but I think it looks much better now. Please let me know what you think! Cheers, On Sat, Aug 15, 2015 at 11:24 AM, Clément Bœsch wrote: > On Sat, Aug 08, 2015 at 09:24:03PM -0700, Yayoi Ukai wrote: >> On Sat, Aug 8, 2015 at 8:23 AM, Clément Bœsch wrote: >> > On Fri, Aug 07, 2015 at 11:03:29PM -0700, Yayoi wrote: >> >> --- >> >> libavcodec/samidec.c| 59 >> >> + >> >> tests/ref/fate/sub-sami | 18 +++ >> >> 2 files changed, 44 insertions(+), 33 deletions(-) >> >> >> >> diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c >> >> index 47850e2..41826a7 100644 >> >> --- a/libavcodec/samidec.c >> >> +++ b/libavcodec/samidec.c >> >> @@ -27,6 +27,7 @@ >> >> #include "ass.h" >> >> #include "libavutil/avstring.h" >> >> #include "libavutil/bprint.h" >> >> +#include "htmlsubtitles.h" >> >> >> >> typedef struct { >> >> AVBPrint source; >> >> @@ -41,11 +42,12 @@ static int sami_paragraph_to_ass(AVCodecContext >> >> *avctx, const char *src) >> >> char *tag = NULL; >> >> char *dupsrc = av_strdup(src); >> >> char *p = dupsrc; >> >> +char *pcopy = NULL; >> >> +int index = 0; >> >> +int second_paragraph = 0; >> >> >> >> -av_bprint_clear(&sami->content); >> >> for (;;) { >> >> char *saveptr = NULL; >> >> -int prev_chr_is_space = 0; >> >> AVBPrint *dst = &sami->content; >> >> >> >> /* parse & extract paragraph tag */ >> >> @@ -77,37 +79,46 @@ static int sami_paragraph_to_ass(AVCodecContext >> >> *avctx, const char *src) >> >> goto end; >> >> } >> >> >> > >> >> -/* extract the text, stripping most of the tags */ >> >> +/* check for the second paragrph */ >> > >> > Why change the comment? What does "check" mean here? What is the "second >> > paragraph"? >> >> >> I answer it below with the other questions you have because you are >> basically asking the same things. >> And I will document better too. >> >> > >> >> +pcopy = av_strdup(p); >> >> while (*p) { >> >> if (*p == '<') { >> >> -if (!av_strncasecmp(p, "> >> av_isspace(p[2]))) >> >> +if (!av_strncasecmp(p, "> >> av_isspace(p[2]))) { >> >> +second_paragraph = 1; >> >> break; >> >> -if (!av_strncasecmp(p, "> >> -av_bprintf(dst, "\\N"); >> >> -p++; >> >> -while (*p && *p != '>') >> >> -p++; >> >> -if (!*p) >> >> -break; >> >> -if (*p == '>') >> >> -p++; >> >> -continue; >> >> +} >> >> } >> >> -if (!av_isspace(*p)) >> >> -av_bprint_chars(dst, *p, 1); >> >> -else if (!prev_chr_is_space) >> >> -av_bprint_chars(dst, ' ', 1); >> >> -prev_chr_is_space = av_isspace(*p); >> >> p++; >> >> +index++; >> >> +} >> >> +p = p - index; >> >> +if (second_paragraph) { >> >> +p[index] = 0; >> >> } >> >> -} >> >> >> >> -av_bprint_clear(&sami->full); >> >> -if (sami->source.len) >> >> -av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", sami->source.str); >> >> -av_bprintf(&sami->full, "%s", sami->content.str); >> >> +ff_htmlmarkup_to_ass(avctx, dst, p); >> >> + >> >> +/* add the source if there are any. */ >> >> +av_bprint_clear(&sami->full); >> >> +if (sami->source.len) { >> >> +av_bprintf(&sami->full, "{\\i1}%s{\\i0}\\N", >> >> sami->source.str); >> >> +av_bprintf(&sami->full, "%s", sami->content.str); >> >> +if (second_paragraph) { >> >> +second_paragraph = 0; >> >> +p = pcopy; >> >> +p += index; >> >> +index = 0; >> >> +continue; >> >> +} >> >> +} else { >> >> +av_bprintf(&sami->full, "%s", sami->content.str); >> >> +} >> >> +av_bprint_clear(&sami->content); >> >> + >> >> +} >> >> >> > >> > This looks clumsy at best: you are finalizing the subtitle event inside >> > the paragraph loop when it should be outside. It also seems there is a >> > duplicating "second paragraph" logic even though the loop is supposed to >> > handle one paragraph at a time. >> >> I know. It is clumsy.. I explain it below as well. >> >> > >> > If you are uncomfortable with the current logic or believe it's badly >> > designed for the logic you're trying to mangle, feel free to rewrite it; >> > it's better than trying to inhibit the old behaviour with hacks. >> >> It's not that your code was badly designed to begin with. I feel like >> it is the nature >> of this format. >> >> So let me explain what was going on your o