Re: [FFmpeg-devel] avcodec/rkmpp : Fix broken build and remove some useless code
Here are two updated patches. I have added the current version check to 1.3.7 and removed the header check for control operation. On 05/01/2018 20:51, LongChair . wrote: > Yes this was bound to very old versions afaik. > > Mpp repo was squashed and we didn't have any version requirement > > Current version is 1.3.7, if i trust my repo fork, previous version was > 1.0.0, so we could add that as a requirement. > > > On 05/01/2018 20:30, wm4 wrote: >> On Fri, 5 Jan 2018 19:22:00 + >> "LongChair ." wrote: >> >>> Yes the newly used control operation seems to have always been there >>> anyways, so there shouldn't be much compatibility issues. >> I mean the second patch removes a workaround for some old misbehavior, >> right? So it should probably be made sure that the user can't use an >> old version. >> >> Also please avoid https://en.wikipedia.org/wiki/Top_posting#Top-posting >> on the list. >> ___ >> 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 From 0be5095d9858ca0bc28ba8392b7127cef88667df Mon Sep 17 00:00:00 2001 From: LongChair Date: Sat, 6 Jan 2018 09:36:58 +0100 Subject: [PATCH] avcodec/rkmpp : Fix broken build due to missing control operation This patch is taking care of https://trac.ffmpeg.org/ticket/6834. It seems that one of the control operations that was available to get the free decoders input slots was removed. There is another control operation to retrieve the used slots. Given that the input slot count is hardcoded to 4 in mpp at this point, replacing the old control operation by the other one. This was tested on Rockchip ROCK64. --- configure | 6 ++ libavcodec/rkmppdec.c | 10 ++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/configure b/configure index 86d81e3cc3..455f9dc3fe 100755 --- a/configure +++ b/configure @@ -5993,10 +5993,8 @@ enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OP check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 || check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || die "ERROR: openssl not found"; } -enabled rkmpp && { { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create || - die "ERROR : Rockchip MPP was not found."; } && - { check_func_headers rockchip/rk_mpi_cmd.h "MPP_DEC_GET_FREE_PACKET_SLOT_COUNT" || - die "ERROR: Rockchip MPP is outdated, please get a more recent one."; } && +enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create && + require_pkg_config rockchip_mpp "rockchip_mpp >= 1.3.7" rockchip/rk_mpi.h mpp_create && { enabled libdrm || die "ERROR: rkmpp requires --enable-libdrm"; } } diff --git a/libavcodec/rkmppdec.c b/libavcodec/rkmppdec.c index c57a6ded38..946b827918 100644 --- a/libavcodec/rkmppdec.c +++ b/libavcodec/rkmppdec.c @@ -40,6 +40,7 @@ #define RECEIVE_FRAME_TIMEOUT 100 #define FRAMEGROUP_MAX_FRAMES 16 +#define INPUT_MAX_PACKETS 4 typedef struct { MppCtx ctx; @@ -515,16 +516,17 @@ static int rkmpp_receive_frame(AVCodecContext *avctx, AVFrame *frame) RKMPPDecoder *decoder = (RKMPPDecoder *)rk_context->decoder_ref->data; int ret = MPP_NOK; AVPacket pkt = {0}; -RK_S32 freeslots; +RK_S32 usedslots, freeslots; if (!decoder->eos_reached) { // we get the available slots in decoder -ret = decoder->mpi->control(decoder->ctx, MPP_DEC_GET_FREE_PACKET_SLOT_COUNT, &freeslots); +ret = decoder->mpi->control(decoder->ctx, MPP_DEC_GET_STREAM_COUNT, &usedslots); if (ret != MPP_OK) { -av_log(avctx, AV_LOG_ERROR, "Failed to get decoder free slots (code = %d).\n", ret); +av_log(avctx, AV_LOG_ERROR, "Failed to get decoder used slots (code = %d).\n", ret); return ret; } +freeslots = INPUT_MAX_PACKETS - usedslots; if (freeslots > 0) { ret = ff_decode_get_packet(avctx, &pkt); if (ret < 0 && ret != AVERROR_EOF) { @@ -541,7 +543,7 @@ static int rkmpp_receive_frame(AVCodecContext *avctx, AVFrame *frame) } // make sure we keep decoder full -if (freeslots > 1 && decoder->first_frame) +if (freeslots > 1) return AVERROR(EAGAIN); } -- 2.14.1 From 9b42a3c7f1230d001743099e9930f26a06ca6cf5 Mon Sep 17 00:00:00 2001 From: LongChair Date: Tue, 2 Jan 2018 12:38:01 +0100 Subject: [PATCH] av
[FFmpeg-devel] [PATCH 1/4] avformat/libopenmpt: Fix mixed code and declarations
Signed-off-by: Jörn Heusipp --- libavformat/libopenmpt.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libavformat/libopenmpt.c b/libavformat/libopenmpt.c index af6eb1a..2e22290 100644 --- a/libavformat/libopenmpt.c +++ b/libavformat/libopenmpt.c @@ -72,13 +72,14 @@ static int read_header_openmpt(AVFormatContext *s) { AVStream *st; OpenMPTContext *openmpt = s->priv_data; -int64_t size = avio_size(s->pb); -if (size <= 0) -return AVERROR_INVALIDDATA; -char *buf = av_malloc(size); +int64_t size; +char *buf; int ret; - +size = avio_size(s->pb); +if (size <= 0) +return AVERROR_INVALIDDATA; +buf = av_malloc(size); if (!buf) return AVERROR(ENOMEM); size = avio_read(s->pb, buf, size); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/4] avformat/libopenmpt: Update file extensions list for libopenmpt 0.3
Signed-off-by: Jörn Heusipp --- libavformat/libopenmpt.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/libopenmpt.c b/libavformat/libopenmpt.c index 30c3d6e..5efbdc4 100644 --- a/libavformat/libopenmpt.c +++ b/libavformat/libopenmpt.c @@ -234,5 +234,9 @@ AVInputFormat ff_libopenmpt_demuxer = { .read_close = read_close_openmpt, .read_seek = read_seek_openmpt, .priv_class = &class_openmpt, -.extensions = "669,amf,ams,dbm,digi,dmf,dsm,far,gdm,imf,it,j2b,m15,mdl,med,mmcmp,mms,mo3,mod,mptm,mt2,mtm,nst,okt,plm,ppm,psm,pt36,ptm,s3m,sfx,sfx2,stk,stm,ult,umx,wow,xm,xpk", +#if OPENMPT_API_VERSION_AT_LEAST(0,3,0) +.extensions = "669,amf,ams,dbm,digi,dmf,dsm,dtm,far,gdm,ice,imf,it,j2b,m15,mdl,med,mmcmp,mms,mo3,mod,mptm,mt2,mtm,nst,okt,plm,ppm,psm,pt36,ptm,s3m,sfx,sfx2,st26,stk,stm,stp,ult,umx,wow,xm,xpk", +#else +.extensions = "669,amf,ams,dbm,digi,dmf,dsm,far,gdm,ice,imf,it,j2b,m15,mdl,med,mmcmp,mms,mo3,mod,mptm,mt2,mtm,nst,okt,plm,ppm,psm,pt36,ptm,s3m,sfx,sfx2,st26,stk,stm,ult,umx,wow,xm,xpk", +#endif }; -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/4] avformat/libopenmpt: Update to libopenmpt 0.3 API
libopenmpt 0.3 deprecates openmpt_module_create_from_memory() and provides a replacement function openmpt_module_create_from_memory2(). Detecting libopenmpt 0.3 can be done at build time via the API version macros provided by libopenmpt. libopenmpt 0.2 did not provide all required macros, however libopenmpt documents the required #define shims that can be safely added for libopenmpt 0.2. Using openmpt_module_create_from_memory2() instead of openmpt_module_create_from_memory() avoids the deprecation warning when building ffmpeg with libopenmpt 0.3. openmpt_module_create_from_memory2() provides more fine-grained error reporting and in particular allows distinguishing out-of-memory from input file parsing errors. Return appropriate ffmpeg errors accordingly. libopenmpt 0.3 is ABI and API compatible with applications built against libopenmpt 0.2. Building ffmpeg with libopenmpt 0.2 is still supported. Signed-off-by: Jörn Heusipp --- libavformat/libopenmpt.c | 25 + 1 file changed, 25 insertions(+) diff --git a/libavformat/libopenmpt.c b/libavformat/libopenmpt.c index 2e22290..30c3d6e 100644 --- a/libavformat/libopenmpt.c +++ b/libavformat/libopenmpt.c @@ -21,6 +21,14 @@ #include #include +#include +/* Shims to support libopenmpt < 0.3.0 (as documented by libopenmpt) */ +#if !defined(OPENMPT_API_VERSION_MAKE) +#define OPENMPT_API_VERSION_MAKE(major, minor, patch) (((major)<<24)|((minor)<<16)|((patch)<<0)) +#endif +#if !defined(OPENMPT_API_VERSION_AT_LEAST) +#define OPENMPT_API_VERSION_AT_LEAST(major, minor, patch) (OPENMPT_API_VERSION >= OPENMPT_API_VERSION_MAKE((major), (minor), (patch))) +#endif #include "libavutil/avstring.h" #include "libavutil/opt.h" @@ -74,6 +82,9 @@ static int read_header_openmpt(AVFormatContext *s) OpenMPTContext *openmpt = s->priv_data; int64_t size; char *buf; +#if OPENMPT_API_VERSION_AT_LEAST(0,3,0) +int error; +#endif int ret; size = avio_size(s->pb); @@ -89,10 +100,24 @@ static int read_header_openmpt(AVFormatContext *s) return size; } +#if OPENMPT_API_VERSION_AT_LEAST(0,3,0) +error = OPENMPT_ERROR_OK; +openmpt->module = openmpt_module_create_from_memory2(buf, size, openmpt_logfunc, s, NULL, NULL, &error, NULL, NULL); +av_freep(&buf); +if (!openmpt->module) { +if (error == OPENMPT_ERROR_OUT_OF_MEMORY) +return AVERROR(ENOMEM); +else if (error >= OPENMPT_ERROR_GENERAL) +return AVERROR_INVALIDDATA; +else +return AVERROR_UNKNOWN; +} +#else openmpt->module = openmpt_module_create_from_memory(buf, size, openmpt_logfunc, s, NULL); av_freep(&buf); if (!openmpt->module) return AVERROR_INVALIDDATA; +#endif openmpt->channels = av_get_channel_layout_nb_channels(openmpt->layout); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/4] avformat/libopenmpt: Probe file format from file data if possible
When building with libopenmpt 0.3, use the libopenmpt file header probing functions for probing. libopenmpt probing functions are allocation-free and designed to be as fast as possible. For libopenmpt 0.2, or when libopenmpt 0.3 file header probing cannot probe successfully due to too small probe buffer, test the filename against the file extensions supported by the libopenmpt library that is actually linked, instead of relying on a hard-coded file extension list. File extension testing is also allocation-free and designed to be fast in libopenmpt. Avoiding a hard-coded file extension list is useful because later libopenmpt versions will likely add support for more module file formats. libopenmpt file header probing is tested regularly against the FATE suite and other diverse file collections by libopenmpt upstream in order to avoid false positives. FATE passes with './configure --enable-libopenmpt' as well as with './configure --enable-libopenmpt --enable-libmodplug'. As expected, I did not see any measurable performance difference caused by libopenmpt file header probing when compared to the previous pure file extension based format probing (using the following synthetic test program (which tries to do nothing but exercise file probing) on the complete FATE suite). // find ../fate/ -type f | xargs --no-run-if-empty ./probetest #include #include "libavformat/avformat.h" #define BUFSIZE 2048 static char buf[BUFSIZE + AVPROBE_PADDING_SIZE]; int main(int argc, const char * * argv) { av_log_set_level(AV_LOG_WARNING); av_register_all(); for (int i = 1; i < argc; ++i) { AVProbeData pd; FILE * f; size_t size; memset(&pd, 0, sizeof(AVProbeData)); pd.filename = argv[i]; memset(buf, 0, sizeof(buf)); f = fopen(pd.filename, "rb"); size = fread(buf, 1, BUFSIZE, f); fclose(f); pd.buf_size = size; av_probe_input_format(&pd, 1); } return 0; } Signed-off-by: Jörn Heusipp --- libavformat/libopenmpt.c | 59 1 file changed, 59 insertions(+) diff --git a/libavformat/libopenmpt.c b/libavformat/libopenmpt.c index 5efbdc4..a663b2e 100644 --- a/libavformat/libopenmpt.c +++ b/libavformat/libopenmpt.c @@ -218,6 +218,64 @@ static int read_seek_openmpt(AVFormatContext *s, int stream_idx, int64_t ts, int return 0; } +static int read_probe_openmpt(AVProbeData * p) +{ +const int score_data = AVPROBE_SCORE_MIME + 1; /* 76 */ +const int score_ext = AVPROBE_SCORE_EXTENSION; /* 50 */ +const int score_ext_retry = AVPROBE_SCORE_RETRY; /* 25 */ +const int score_retry = AVPROBE_SCORE_RETRY / 2; /* 12 */ +const int score_fail = 0;/* 0 */ + +const char *ext; +int probe_result; +int score = score_fail; + +if (p->filename) { +ext = strrchr(p->filename, '.'); +if (ext && strlen(ext + 1) > 0) { +ext++; /* skip '.' */ +if (openmpt_is_extension_supported(ext) == 1) +score = FFMAX(score, score_ext); +} +} + +#if OPENMPT_API_VERSION_AT_LEAST(0,3,0) +if (p->buf && p->buf_size > 0) { +probe_result = openmpt_probe_file_header_without_filesize( + OPENMPT_PROBE_FILE_HEADER_FLAGS_DEFAULT, + p->buf, p->buf_size, + &openmpt_logfunc, NULL, NULL, NULL, NULL, NULL); +if (probe_result == OPENMPT_PROBE_FILE_HEADER_RESULT_FAILURE) { +score = score_fail; +} else if (probe_result == OPENMPT_PROBE_FILE_HEADER_RESULT_SUCCESS) { +score = FFMAX(score, score_data); +} else if (probe_result == OPENMPT_PROBE_FILE_HEADER_RESULT_WANTMOREDATA) { +if (score > score_fail) { +/* known file extension */ +score = FFMAX(score, score_ext_retry); +} else { +/* unknown file extension */ +if (p->buf_size >= openmpt_probe_file_header_get_recommended_size()) { +/* We have already received the recommended amount of data + * and still cannot decide. Return a rather low score. + */ +score = FFMAX(score, score_retry); +} else { +/* The file extension is unknown and we have very few data + * bytes available. libopenmpt cannot decide anything here, + * and returning any score > 0 would result in successfull + * probing of random data. + */ +score = score_fail; +} +} +} +} +#endif + +return score; +} + static const AVClass class_openmpt = { .class_name = "libopenmpt", .item_name = av_defau
Re: [FFmpeg-devel] Chinese DTMB streams playback issue
2018-01-05 14:11 GMT-05:00 Moritz Barsnick : > > On Thu, Jan 04, 2018 at 20:42:33 -0500, Abylay Ospan wrote: > > I have made dump of DTMB streams (digital TV standard in China, like > > DVB-T in Europe, etc). > [...] > > Should I create ticket in https://trac.ffmpeg.org ? > > Yes, please. done - https://trac.ffmpeg.org/ticket/6948 thanks ! -- Abylay Ospan, JokerSys http://jokersys.com ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavf/rtpdec_jpeg: Treat stream type 64 like 0.
2018-01-06 2:45 GMT+01:00 Michael Niedermayer : > On Fri, Jan 05, 2018 at 05:43:01AM +0100, Carl Eugen Hoyos wrote: >> Hi! >> >> Attached patch intends to fix ticket #5975, rfc 2435 says stream type >> 64 should be treated like 0. >> >> Please review, Carl Eugen > >> rtpdec_jpeg.c |2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> 6c39ed6cee670ad983250a1dd2566d9aa58b7abf >> 0001-lavf-rtpdec_jpeg-Treat-jpeg-type-64-like-0.patch >> From 690f2fccf766f3cbb23a1ef45e235e25c355b197 Mon Sep 17 00:00:00 2001 >> From: Carl Eugen Hoyos >> Date: Fri, 5 Jan 2018 05:40:30 +0100 >> Subject: [PATCH] lavf/rtpdec_jpeg: Treat jpeg type 64 like 0. >> >> Fixes ticket #5975. >> --- >> libavformat/rtpdec_jpeg.c |2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/libavformat/rtpdec_jpeg.c b/libavformat/rtpdec_jpeg.c >> index 465d9bc..3a33e3a 100644 >> --- a/libavformat/rtpdec_jpeg.c >> +++ b/libavformat/rtpdec_jpeg.c >> @@ -162,7 +162,7 @@ static int jpeg_create_header(uint8_t *buf, int size, >> uint32_t type, uint32_t w, >> bytestream2_put_be16(&pbc, w); >> bytestream2_put_byte(&pbc, 3); /* number of components */ >> bytestream2_put_byte(&pbc, 1); /* component number */ >> -bytestream2_put_byte(&pbc, (2 << 4) | (type ? 2 : 1)); /* >> hsample/vsample */ >> +bytestream2_put_byte(&pbc, (2 << 4) | (type & ~64 ? 2 : 1)); /* >> hsample/vsample */ > > isnt 64 masked out already ? > "type &= ~0x40;" > > am i missing something ? No, the reporter of ticket #5975 and I missed my commit... Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] avfilter: deprecate avfilter_link_get_channels()
James Almer (2018-01-05): > Subject: Re: [FFmpeg-devel] [PATCH 1/2] avfilter: deprecate > avfilter_link_get_channels() Ok. > And move the channels field to the public section of the struct. Not necessary, and potentially harmful. See my comment on the other patch. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] tools/uncoded_frame: remove usage of avfilter_link_get_channels()
James Almer (2018-01-05): > Signed-off-by: James Almer > --- > tools/uncoded_frame.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/uncoded_frame.c b/tools/uncoded_frame.c > index 3ca2ba4bbe..c044741701 100644 > --- a/tools/uncoded_frame.c > +++ b/tools/uncoded_frame.c > @@ -178,7 +178,7 @@ int main(int argc, char **argv) > break; > case AVMEDIA_TYPE_AUDIO: > st->stream->codec->channel_layout = st->link->channel_layout; > -st->stream->codec->channels = > avfilter_link_get_channels(st->link); > +st->stream->codec->channels = st->link->channels; > st->stream->codec->sample_rate = st->link->sample_rate; > st->stream->codec->sample_fmt = st->link->format; > st->stream->codec->codec_id = Counter-proposal attached. With the evolution of lavfi, AVFilterLink should have been made private entirely, but it never happened. Still, the API to do without it exists. Regards, -- Nicolas George From 6abecbd60f63a3a235e64d2c9a29d8d2e191a399 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Sat, 6 Jan 2018 14:14:04 +0100 Subject: [PATCH] tools/uncoded_frame: use buffersink accessors. No longer access buffersink's link structure directly. Signed-off-by: Nicolas George --- tools/uncoded_frame.c | 26 -- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/tools/uncoded_frame.c b/tools/uncoded_frame.c index 3ca2ba4bbe..f346b21916 100644 --- a/tools/uncoded_frame.c +++ b/tools/uncoded_frame.c @@ -11,7 +11,6 @@ typedef struct { AVFormatContext *mux; AVStream *stream; AVFilterContext *sink; -AVFilterLink *link; } Stream; static int create_sink(Stream *st, AVFilterGraph *graph, @@ -36,7 +35,6 @@ static int create_sink(Stream *st, AVFilterGraph *graph, ret = avfilter_link(f, idx, st->sink, 0); if (ret < 0) return ret; -st->link = st->sink->inputs[0]; return 0; } @@ -163,24 +161,24 @@ int main(int argc, char **argv) av_log(NULL, AV_LOG_ERROR, "Failed to create output stream\n"); goto fail; } -st->stream->codec->codec_type = st->link->type; +st->stream->codec->codec_type = av_buffersink_get_type(st->sink); st->stream->time_base = st->stream->codec->time_base = -st->link->time_base; -switch (st->link->type) { +av_buffersink_get_time_base(st->sink); +switch (av_buffersink_get_type(st->sink)) { case AVMEDIA_TYPE_VIDEO: st->stream->codec->codec_id = AV_CODEC_ID_RAWVIDEO; st->stream->avg_frame_rate = st->stream-> r_frame_rate = av_buffersink_get_frame_rate(st->sink); -st->stream->codec->width = st->link->w; -st->stream->codec->height = st->link->h; -st->stream->codec->sample_aspect_ratio = st->link->sample_aspect_ratio; -st->stream->codec->pix_fmt = st->link->format; +st->stream->codec->width = av_buffersink_get_w(st->sink); +st->stream->codec->height = av_buffersink_get_h(st->sink); +st->stream->codec->sample_aspect_ratio = av_buffersink_get_sample_aspect_ratio(st->sink); +st->stream->codec->pix_fmt = av_buffersink_get_format(st->sink); break; case AVMEDIA_TYPE_AUDIO: -st->stream->codec->channel_layout = st->link->channel_layout; -st->stream->codec->channels = avfilter_link_get_channels(st->link); -st->stream->codec->sample_rate = st->link->sample_rate; -st->stream->codec->sample_fmt = st->link->format; +st->stream->codec->channel_layout = av_buffersink_get_channel_layout(st->sink); +st->stream->codec->channels = av_buffersink_get_channels(st->sink); +st->stream->codec->sample_rate= av_buffersink_get_sample_rate(st->sink); +st->stream->codec->sample_fmt = av_buffersink_get_format(st->sink); st->stream->codec->codec_id = av_get_pcm_codec(st->stream->codec->sample_fmt, -1); break; @@ -240,7 +238,7 @@ int main(int argc, char **argv) } if (frame->pts != AV_NOPTS_VALUE) frame->pts = av_rescale_q(frame->pts, - st->link ->time_base, + av_buffersink_get_time_base(st->sink), st->stream->time_base); ret = av_interleaved_write_uncoded_frame(st->mux, st->stream->index, -- 2.15.1 signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-dev
Re: [FFmpeg-devel] [PATCH 2/2] tools/uncoded_frame: remove usage of avfilter_link_get_channels()
And while we're at it, let's fix a bunch of warnings. Note that I (or somebody else) need to check if this is still relevant with the "wrapped AVFrame" API from the fork, but that is another issue entirely. Regards, -- Nicolas George From 7a3a21108fca8e039ae4d5623ae18f828dc23f5e Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Sat, 6 Jan 2018 14:34:00 +0100 Subject: [PATCH] tools/uncoded_frame: remove use of AVStream.codec. Signed-off-by: Nicolas George --- tools/uncoded_frame.c | 28 +--- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/tools/uncoded_frame.c b/tools/uncoded_frame.c index f346b21916..606bdb746a 100644 --- a/tools/uncoded_frame.c +++ b/tools/uncoded_frame.c @@ -161,26 +161,24 @@ int main(int argc, char **argv) av_log(NULL, AV_LOG_ERROR, "Failed to create output stream\n"); goto fail; } -st->stream->codec->codec_type = av_buffersink_get_type(st->sink); -st->stream->time_base = st->stream->codec->time_base = -av_buffersink_get_time_base(st->sink); +st->stream->codecpar->codec_type = av_buffersink_get_type(st->sink); +st->stream->time_base = av_buffersink_get_time_base(st->sink); switch (av_buffersink_get_type(st->sink)) { case AVMEDIA_TYPE_VIDEO: -st->stream->codec->codec_id = AV_CODEC_ID_RAWVIDEO; +st->stream->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; st->stream->avg_frame_rate = st->stream-> r_frame_rate = av_buffersink_get_frame_rate(st->sink); -st->stream->codec->width = av_buffersink_get_w(st->sink); -st->stream->codec->height = av_buffersink_get_h(st->sink); -st->stream->codec->sample_aspect_ratio = av_buffersink_get_sample_aspect_ratio(st->sink); -st->stream->codec->pix_fmt = av_buffersink_get_format(st->sink); +st->stream->codecpar->width = av_buffersink_get_w(st->sink); +st->stream->codecpar->height = av_buffersink_get_h(st->sink); +st->stream->codecpar->sample_aspect_ratio = av_buffersink_get_sample_aspect_ratio(st->sink); +st->stream->codecpar->format = av_buffersink_get_format(st->sink); break; case AVMEDIA_TYPE_AUDIO: -st->stream->codec->channel_layout = av_buffersink_get_channel_layout(st->sink); -st->stream->codec->channels = av_buffersink_get_channels(st->sink); -st->stream->codec->sample_rate= av_buffersink_get_sample_rate(st->sink); -st->stream->codec->sample_fmt = av_buffersink_get_format(st->sink); -st->stream->codec->codec_id = -av_get_pcm_codec(st->stream->codec->sample_fmt, -1); +st->stream->codecpar->channel_layout = av_buffersink_get_channel_layout(st->sink); +st->stream->codecpar->channels = av_buffersink_get_channels(st->sink); +st->stream->codecpar->sample_rate= av_buffersink_get_sample_rate(st->sink); +st->stream->codecpar->format = av_buffersink_get_format(st->sink); +st->stream->codecpar->codec_id = av_get_pcm_codec(st->stream->codecpar->format, -1); break; default: av_assert0(!"reached"); @@ -245,7 +243,7 @@ int main(int argc, char **argv) frame); frame = NULL; if (ret < 0) { -av_log(st->stream->codec, AV_LOG_ERROR, +av_log(st->mux, AV_LOG_ERROR, "Error writing frame: %s\n", av_err2str(ret)); goto fail; } -- 2.15.1 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: make avformat_network_init() explicitly optional
On Thu, 4 Jan 2018 17:02:41 +0100 wm4 wrote: > It was sort of optional before - if you didn't call it, networking was > initialized on demand, and an ugly warning was logged. Also, the doxygen > comments threatened that it would be made strictly required one day. > > Make it explicitly optional. I would prefer to deprecate it fully, but > there might still be legitimate reasons to use this. But the average > user won't need it. > > This is needed only for two reasons: to initialize TLS libraries like > OpenSSL and GnuTLS, and winsock. > > OpenSSL and GnuTLS were already silently initialized on demand if the > global network init function was not called. They also have various > thread-safety acrobatics, which make concurrent initialization within > libavformat safe. In addition, the libraries are moving towards making > their global init functions safe, which removes all need for central > global init. In particular, GnuTLS 3.5.16 and OpenSSL 1.1.0g have been > found to have safe init functions. In all cases, they use internal > reference counters to avoid that the global uninit functions interfere > with concurrent uses of the library by other API users who called global > init. > > winsock should be thread-safe as well, and maintains an internal > reference counter as well. > > Since we still support ancient TLS libraries, which do not have this > fixed, and since it's unknown whether winsock and GnuTLS > reinitialization is costly in any way, don't deprecate the libavformat > functions yet. > --- > doc/APIchanges | 6 ++ > libavformat/avformat.h | 19 +-- > libavformat/network.c | 9 - > libavformat/network.h | 1 - > libavformat/utils.c| 2 -- > libavformat/version.h | 2 +- > 6 files changed, 20 insertions(+), 19 deletions(-) > > diff --git a/doc/APIchanges b/doc/APIchanges > index 38c1be61c7..87ff51bdc2 100644 > --- a/doc/APIchanges > +++ b/doc/APIchanges > @@ -15,6 +15,12 @@ libavutil: 2017-10-21 > > API changes, most recent first: > > +2017-xx-xx - xxx - lavf 58.3.101 - avformat.h > + Explicitly make avformat_network_init() and avformat_network_deinit() > optional. > + If these are not called, network initialization and deinitialization is > + automatic, and unlike in older versions, fully supported, unless > libavformat > + is linked to ancient GnuTLS and OpenSSL. > + > 2017-xx-xx - xxx - lavr 4.0.0 - avresample.h >Deprecate the entire library. Merged years ago to provide compatibility >with Libav, it remained unmaintained by the FFmpeg project and duplicated > diff --git a/libavformat/avformat.h b/libavformat/avformat.h > index 4f2798a871..9de851fcc5 100644 > --- a/libavformat/avformat.h > +++ b/libavformat/avformat.h > @@ -1993,17 +1993,24 @@ void av_register_input_format(AVInputFormat *format); > void av_register_output_format(AVOutputFormat *format); > > /** > - * Do global initialization of network components. This is optional, > - * but recommended, since it avoids the overhead of implicitly > - * doing the setup for each session. > + * Do global initialization of network libraries. This is optional, > + * and not recommended anymore. > * > - * Calling this function will become mandatory if using network > - * protocols at some major version bump. > + * This functions only exists to work around thread-safety issues > + * with older GnuTLS or OpenSSL libraries. If libavformat is linked > + * to newer versions of those libraries, or if you do not use them, > + * calling this function is unnecessary. Otherwise, you need to call > + * this function before any other threads using them are started. > + * > + * This function will be deprecated once support for older GnuTLS and > + * OpenSSL libraries is removed, and this function has no purpose > + * anymore. > */ > int avformat_network_init(void); > > /** > - * Undo the initialization done by avformat_network_init. > + * Undo the initialization done by avformat_network_init. Call it only > + * once for each time you called avformat_network_init. > */ > int avformat_network_deinit(void); > > diff --git a/libavformat/network.c b/libavformat/network.c > index e9eb4b443a..d5c82e9ab9 100644 > --- a/libavformat/network.c > +++ b/libavformat/network.c > @@ -54,20 +54,11 @@ void ff_tls_deinit(void) > #endif > } > > -int ff_network_inited_globally; > - > int ff_network_init(void) > { > #if HAVE_WINSOCK2_H > WSADATA wsaData; > -#endif > > -if (!ff_network_inited_globally) > -av_log(NULL, AV_LOG_WARNING, "Using network protocols without global > " > - "network initialization. Please use " > - "avformat_network_init(), this will " > - "become mandatory later.\n"); > -#if HAVE_WINSOCK2_H > if (WSAStartup(MAKEWORD(1,1), &wsaData)) > return 0; > #endif > diff --git a/libavformat/network.h b/libavformat/network
Re: [FFmpeg-devel] [PATCH 1/2] avfilter: deprecate avfilter_link_get_channels()
On 1/6/2018 10:06 AM, Nicolas George wrote: > James Almer (2018-01-05): >> Subject: Re: [FFmpeg-devel] [PATCH 1/2] avfilter: deprecate >> avfilter_link_get_channels() > > Ok. > >> And move the channels field to the public section of the struct. > > Not necessary, and potentially harmful. See my comment on the other > patch. > > Regards, Applied the deprecation part only then. Thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] tools/uncoded_frame: remove usage of avfilter_link_get_channels()
On 1/6/2018 10:38 AM, Nicolas George wrote: > And while we're at it, let's fix a bunch of warnings. > > Note that I (or somebody else) need to check if this is still relevant > with the "wrapped AVFrame" API from the fork, but that is another issue > entirely. > > Regards, > > -- Nicolas George > > > 0001-tools-uncoded_frame-remove-use-of-AVStream.codec.patch > > > From 7a3a21108fca8e039ae4d5623ae18f828dc23f5e Mon Sep 17 00:00:00 2001 > From: Nicolas George > Date: Sat, 6 Jan 2018 14:34:00 +0100 > Subject: [PATCH] tools/uncoded_frame: remove use of AVStream.codec. > > Signed-off-by: Nicolas George > --- > tools/uncoded_frame.c | 28 +--- > 1 file changed, 13 insertions(+), 15 deletions(-) > > diff --git a/tools/uncoded_frame.c b/tools/uncoded_frame.c > index f346b21916..606bdb746a 100644 > --- a/tools/uncoded_frame.c > +++ b/tools/uncoded_frame.c > @@ -161,26 +161,24 @@ int main(int argc, char **argv) > av_log(NULL, AV_LOG_ERROR, "Failed to create output stream\n"); > goto fail; > } > -st->stream->codec->codec_type = av_buffersink_get_type(st->sink); > -st->stream->time_base = st->stream->codec->time_base = > -av_buffersink_get_time_base(st->sink); > +st->stream->codecpar->codec_type = av_buffersink_get_type(st->sink); > +st->stream->time_base = av_buffersink_get_time_base(st->sink); > switch (av_buffersink_get_type(st->sink)) { > case AVMEDIA_TYPE_VIDEO: > -st->stream->codec->codec_id = AV_CODEC_ID_RAWVIDEO; > +st->stream->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; > st->stream->avg_frame_rate = > st->stream-> r_frame_rate = > av_buffersink_get_frame_rate(st->sink); > -st->stream->codec->width = > av_buffersink_get_w(st->sink); > -st->stream->codec->height = > av_buffersink_get_h(st->sink); > -st->stream->codec->sample_aspect_ratio = > av_buffersink_get_sample_aspect_ratio(st->sink); > -st->stream->codec->pix_fmt = > av_buffersink_get_format(st->sink); > +st->stream->codecpar->width = > av_buffersink_get_w(st->sink); > +st->stream->codecpar->height = > av_buffersink_get_h(st->sink); > +st->stream->codecpar->sample_aspect_ratio = > av_buffersink_get_sample_aspect_ratio(st->sink); > +st->stream->codecpar->format = > av_buffersink_get_format(st->sink); > break; > case AVMEDIA_TYPE_AUDIO: > -st->stream->codec->channel_layout = > av_buffersink_get_channel_layout(st->sink); > -st->stream->codec->channels = > av_buffersink_get_channels(st->sink); > -st->stream->codec->sample_rate= > av_buffersink_get_sample_rate(st->sink); > -st->stream->codec->sample_fmt = > av_buffersink_get_format(st->sink); > -st->stream->codec->codec_id = > -av_get_pcm_codec(st->stream->codec->sample_fmt, -1); > +st->stream->codecpar->channel_layout = > av_buffersink_get_channel_layout(st->sink); > +st->stream->codecpar->channels = > av_buffersink_get_channels(st->sink); > +st->stream->codecpar->sample_rate= > av_buffersink_get_sample_rate(st->sink); > +st->stream->codecpar->format = > av_buffersink_get_format(st->sink); > +st->stream->codecpar->codec_id = > av_get_pcm_codec(st->stream->codecpar->format, -1); > break; > default: > av_assert0(!"reached"); > @@ -245,7 +243,7 @@ int main(int argc, char **argv) > frame); > frame = NULL; > if (ret < 0) { > -av_log(st->stream->codec, AV_LOG_ERROR, > +av_log(st->mux, AV_LOG_ERROR, > "Error writing frame: %s\n", av_err2str(ret)); > goto fail; > } > -- 2.15.1 Both patches should be ok. Thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] tools/uncoded_frame: remove usage of avfilter_link_get_channels()
James Almer (2018-01-06): > Both patches should be ok. Thanks. Thanks, pushed. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] avformat/libopenmpt: Update file extensions list for libopenmpt 0.3
2018-01-06 11:07 GMT+01:00 Jörn Heusipp : > Signed-off-by: Jörn Heusipp > --- > libavformat/libopenmpt.c | 6 +- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/libavformat/libopenmpt.c b/libavformat/libopenmpt.c > index 30c3d6e..5efbdc4 100644 > --- a/libavformat/libopenmpt.c > +++ b/libavformat/libopenmpt.c > @@ -234,5 +234,9 @@ AVInputFormat ff_libopenmpt_demuxer = { > .read_close = read_close_openmpt, > .read_seek = read_seek_openmpt, > .priv_class = &class_openmpt, > -.extensions = > "669,amf,ams,dbm,digi,dmf,dsm,far,gdm,imf,it,j2b,m15,mdl,med,mmcmp,mms,mo3,mod,mptm,mt2,mtm,nst,okt,plm,ppm,psm,pt36,ptm,s3m,sfx,sfx2,stk,stm,ult,umx,wow,xm,xpk", > +#if OPENMPT_API_VERSION_AT_LEAST(0,3,0) > +.extensions = > "669,amf,ams,dbm,digi,dmf,dsm,dtm,far,gdm,ice,imf,it,j2b,m15,mdl,med,mmcmp,mms,mo3,mod,mptm,mt2,mtm,nst,okt,plm,ppm,psm,pt36,ptm,s3m,sfx,sfx2,st26,stk,stm,stp,ult,umx,wow,xm,xpk", > +#else > +.extensions = > "669,amf,ams,dbm,digi,dmf,dsm,far,gdm,ice,imf,it,j2b,m15,mdl,med,mmcmp,mms,mo3,mod,mptm,mt2,mtm,nst,okt,plm,ppm,psm,pt36,ptm,s3m,sfx,sfx2,st26,stk,stm,ult,umx,wow,xm,xpk", > +#endif I believe this change can be made without the version check. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/4] avformat/libopenmpt: Probe file format from file data if possible
2018-01-06 11:07 GMT+01:00 Jörn Heusipp : > When building with libopenmpt 0.3, use the libopenmpt file header > probing functions for probing. libopenmpt probing functions are > allocation-free and designed to be as fast as possible. > > For libopenmpt 0.2, or when libopenmpt 0.3 file header probing cannot > probe successfully due to too small probe buffer, test the filename > against the file extensions supported by the libopenmpt library that > is actually linked, instead of relying on a hard-coded file extension > list. File extension testing is also allocation-free and designed to > be fast in libopenmpt. Avoiding a hard-coded file extension list is > useful because later libopenmpt versions will likely add support for > more module file formats. > > libopenmpt file header probing is tested regularly against the FATE > suite and other diverse file collections by libopenmpt upstream in > order to avoid false positives. You could also test tools/probetest > FATE passes with './configure --enable-libopenmpt' as well as with > './configure --enable-libopenmpt --enable-libmodplug'. > > As expected, I did not see any measurable performance difference > caused by libopenmpt file header probing when compared to the previous > pure file extension based format probing (using the following > synthetic test program (which tries to do nothing but exercise file > probing) on the complete FATE suite). > > // find ../fate/ -type f | xargs --no-run-if-empty ./probetest > #include > #include "libavformat/avformat.h" > #define BUFSIZE 2048 > static char buf[BUFSIZE + AVPROBE_PADDING_SIZE]; > int main(int argc, const char * * argv) { > av_log_set_level(AV_LOG_WARNING); > av_register_all(); > for (int i = 1; i < argc; ++i) { > AVProbeData pd; > FILE * f; > size_t size; > memset(&pd, 0, sizeof(AVProbeData)); > pd.filename = argv[i]; > memset(buf, 0, sizeof(buf)); > f = fopen(pd.filename, "rb"); > size = fread(buf, 1, BUFSIZE, f); > fclose(f); > pd.buf_size = size; > av_probe_input_format(&pd, 1); > } > return 0; > } > > Signed-off-by: Jörn Heusipp > --- > libavformat/libopenmpt.c | 59 > > 1 file changed, 59 insertions(+) > > diff --git a/libavformat/libopenmpt.c b/libavformat/libopenmpt.c > index 5efbdc4..a663b2e 100644 > --- a/libavformat/libopenmpt.c > +++ b/libavformat/libopenmpt.c > @@ -218,6 +218,64 @@ static int read_seek_openmpt(AVFormatContext *s, int > stream_idx, int64_t ts, int > return 0; > } > > +static int read_probe_openmpt(AVProbeData * p) > +{ > +const int score_data = AVPROBE_SCORE_MIME + 1; /* 76 */ > +const int score_ext = AVPROBE_SCORE_EXTENSION; /* 50 */ > +const int score_ext_retry = AVPROBE_SCORE_RETRY; /* 25 */ > +const int score_retry = AVPROBE_SCORE_RETRY / 2; /* 12 */ > +const int score_fail = 0;/* 0 */ > + > +const char *ext; > +int probe_result; > +int score = score_fail; > + > +if (p->filename) { > +ext = strrchr(p->filename, '.'); > +if (ext && strlen(ext + 1) > 0) { > +ext++; /* skip '.' */ > +if (openmpt_is_extension_supported(ext) == 1) > +score = FFMAX(score, score_ext); > +} > +} > + > +#if OPENMPT_API_VERSION_AT_LEAST(0,3,0) > +if (p->buf && p->buf_size > 0) { > +probe_result = openmpt_probe_file_header_without_filesize( > + OPENMPT_PROBE_FILE_HEADER_FLAGS_DEFAULT, > + p->buf, p->buf_size, > + &openmpt_logfunc, NULL, NULL, NULL, NULL, NULL); > +if (probe_result == OPENMPT_PROBE_FILE_HEADER_RESULT_FAILURE) { > +score = score_fail; What's wrong with return 0;? > +} else if (probe_result == OPENMPT_PROBE_FILE_HEADER_RESULT_SUCCESS) > { > +score = FFMAX(score, score_data); What does OPENMPT_PROBE_FILE_HEADER_RESULT_SUCCESS mean? Why not return MAX? > +} else if (probe_result == > OPENMPT_PROBE_FILE_HEADER_RESULT_WANTMOREDATA) { I believe this should return 0 but maybe you found that this is bad? > +if (score > score_fail) { > +/* known file extension */ > +score = FFMAX(score, score_ext_retry); > +} else { > +/* unknown file extension */ > +if (p->buf_size >= > openmpt_probe_file_header_get_recommended_size()) { > +/* We have already received the recommended amount of > data > + * and still cannot decide. Return a rather low score. > + */ > +score = FFMAX(score, score_retry); > +} else { > +/* The file extension is unknown and we h
Re: [FFmpeg-devel] [PATCH 1/3] avformat/mov: Increase support for common encryption.
2018-01-05 20:49 GMT+01:00 Jacob Trimble : > +if (!frag_stream_info->encryption_index) { > +frag_stream_info->encryption_index = > av_mallocz(sizeof(MOVEncryptionIndex)); sizeof(variable), please. [...] > +sample_count = avio_rb32(pb); > + > +encryption_index->encrypted_samples = > av_mallocz_array(sizeof(AVEncryptionInfo*), sample_count); This should be avoided if possible, see below. > +if (!encryption_index->encrypted_samples) { > return AVERROR(ENOMEM); > } > +encryption_index->nb_encrypted_samples = sample_count; > > -return av_aes_ctr_init(sc->cenc.aes_ctr, c->decryption_key); > +for (i = 0; i < sample_count; i++) { Please check here for eof... > +ret = mov_read_sample_encryption_info(c, pb, sc, > &encryption_index->encrypted_samples[i], use_subsamples); ... and insert a realloc here to avoid the large allocation above, see 1112ba01. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] FFV1: make RGB48 support as non-experimental
On 06/01/2018 02:05, Michael Niedermayer wrote: ffv1enc.c |4 1 file changed, 4 deletions(-) acfc60c913b311b148f2eeef2d2d6ea9e37afcf7 0001-avcodec-ffv1enc-mark-RGB48-support-as-non-experiment.patch From 303f63fb7e6172fdb7de66da1f8a4006b79a535f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Martinez?= Date: Fri, 5 Jan 2018 11:09:01 +0100 Subject: [PATCH] avcodec/ffv1enc: mark RGB48 support as non-experimental Resulting bitstream was tested with a conformance checker using the last draft of FFV1 specifications. But has the way this is stored been optimized ? Once its marked as non exerimental all future decoders must support the exact way. Although this is considered experimental in the encoder, the implementation adheres to the description in the specification. The bitstream specification does not provide a bitdepth limit so with the current draft of the specification, another FFV1 encoder could already encode 16-bit (and more) content. The work on the specification has been careful to not break compatibility with former drafts and at this point the FFV1 bitstream specification for versions 0, 1, and 3 should be considered already non-experimental for all bit depths. All current decoders should already support the exact way it is currently specified. To make a change in the specification at this point would have cascading consequences as we’d have to retract the part of the specification which states that micro_version 4 of version 3 is the first stable variant. Worse, it is impossible to indicate a bitstream change in FFV1 version 1, which permits RGB 16-bit content too, so it would be difficult for a decoder to detect a bitstream not conforming to the bitstream created by the current version of FFmpeg encoder. It can no longer then be changed, so we need to be really sure the design is optimal first. Are we ? who has checked alternatives? what where the reasons why the alternatives were not choosen? for example consider get_context(), what it does with >8bit may or may not be optimal iam interrested to work on that in fact, ive a quite long and growing list of other volunteer jobs to do though ... bitdepths >8bit have been well-used for years since many of them have long been marked as non-experimental (for instance 10bit is frequently used with lossless encoding of broadcast media and video from analog tape sources). In my opinion get_context() is specified for all bitdpeths and non-experimental for FFV1 versions 0, 1, and 3 by the specification work and it should not be changed in these versions. For the encoder there may still be an opportunity to optimize while continuing to conform to the FFV1 versions 0, 1, and 3 bitstream specification, even if the encoder marks RGB48 as non-experimental. Additionally FFV1 version 4 or later could consider further optimization requesting a change in the FFV1 bitstream as version 4 has no stable micro_version and the entire version is in an experimental status. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] FFV1: make RGB48 support as non-experimental
Michael Niedermayer wrote: >>Resulting bitstream was tested with a conformance checker >>using the last draft of FFV1 specifications. > >But has the way this is stored been optimized ? > >Once its marked as non exerimental all future decoders must >support the exact way. It can no longer then be changed, so we >need to be really sure the design is optimal first. >Are we ? >who has checked alternatives? what where the reasons why the >alternatives were not choosen? >for example consider get_context(), what it does with >8bit may >or may not be optimal >iam interrested to work on that in fact, ive a quite long and >growing list of other volunteer jobs to do though ... Hmm... I am a little surprised about this, as I paid EUR 2000 in 2016 for implementing the RGB48 support in FFV1. And I didn't it just for having less money in my pocket, but explicitly for the benefit of the community. As I already said in other contexts, the experimental flag is actually avoiding a larger use of FFV1 in the archival community. As long as this flag is present, many film archives simply cannot adopt FFV1 for film preservation. That's my point. Therefore I support making the RGB48 support non-experimental. For the wider context regarding an important category of FFmpeg users, I wrote this – and I apologise for mentioning myself: https://retokromer.ch/publications/JFP_96.html Best regards, Reto ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/5] aptx: simplify by pre-calculating factor_max
--- libavcodec/aptx.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/libavcodec/aptx.c b/libavcodec/aptx.c index a35d2861c1..7b9556ce42 100644 --- a/libavcodec/aptx.c +++ b/libavcodec/aptx.c @@ -188,7 +188,7 @@ typedef const struct { const int32_t *quantize_dither_factors; const int16_t *quantize_factor_select_offset; int tables_size; -int32_t quantized_bits; +int32_t factor_max; int32_t prediction_order; } ConstTables; @@ -198,25 +198,25 @@ static ConstTables tables[NB_SUBBANDS] = { quantize_dither_factors_LF, quantize_factor_select_offset_LF, FF_ARRAY_ELEMS(quantize_intervals_LF), - 7, 24 }, + 0x11FF, 24 }, [MLF] = { quantize_intervals_MLF, invert_quantize_dither_factors_MLF, quantize_dither_factors_MLF, quantize_factor_select_offset_MLF, FF_ARRAY_ELEMS(quantize_intervals_MLF), - 4, 12 }, + 0x14FF, 12 }, [MHF] = { quantize_intervals_MHF, invert_quantize_dither_factors_MHF, quantize_dither_factors_MHF, quantize_factor_select_offset_MHF, FF_ARRAY_ELEMS(quantize_intervals_MHF), - 2, 6 }, + 0x16FF, 6 }, [HF] = { quantize_intervals_HF, invert_quantize_dither_factors_HF, quantize_dither_factors_HF, quantize_factor_select_offset_HF, FF_ARRAY_ELEMS(quantize_intervals_HF), - 3, 12 }, + 0x15FF, 12 }, }; static const int16_t quantization_factors[32] = { @@ -530,16 +530,14 @@ static void aptx_invert_quantization(InvertQuantize *invert_quantize, qr = rshift64_clip24(((int64_t)qr<<32) + MUL64(dither, tables->invert_quantize_dither_factors[idx]), 32); invert_quantize->reconstructed_difference = MUL64(invert_quantize->quantization_factor, qr) >> 19; -shift = 24 - tables->quantized_bits; - /* update factor_select */ factor_select = 32620 * invert_quantize->factor_select; factor_select = rshift32(factor_select + (tables->quantize_factor_select_offset[idx] << 15), 15); -invert_quantize->factor_select = av_clip(factor_select, 0, (shift << 8) | 0xFF); +invert_quantize->factor_select = av_clip(factor_select, 0, tables->factor_max); /* update quantization factor */ idx = (invert_quantize->factor_select & 0xFF) >> 3; -shift -= invert_quantize->factor_select >> 8; +shift = (tables->factor_max - invert_quantize->factor_select) >> 8; invert_quantize->quantization_factor = (quantization_factors[idx] << 11) >> shift; } -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/5] aptx: do some clipping to match original codec in extreme cases
--- libavcodec/aptx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/aptx.c b/libavcodec/aptx.c index 64a63a7d5b..4173402d03 100644 --- a/libavcodec/aptx.c +++ b/libavcodec/aptx.c @@ -466,6 +466,7 @@ static void aptx_quantize_difference(Quantize *quantize, int64_t error; sample_difference_abs = FFABS(sample_difference); +sample_difference_abs = FFMIN(sample_difference_abs, (1 << 23) - 1); quantized_sample = aptx_bin_search(sample_difference_abs >> 4, quantization_factor, @@ -478,7 +479,7 @@ static void aptx_quantize_difference(Quantize *quantize, mean = (intervals[1] + intervals[0]) / 2; interval = (intervals[1] - intervals[0]) * (-(sample_difference < 0) | 1); -dithered_sample = rshift64_clip24(MUL64(dither, interval) + ((int64_t)(mean + d) << 32), 32); +dithered_sample = rshift64_clip24(MUL64(dither, interval) + ((int64_t)av_clip_intp2(mean + d, 23) << 32), 32); error = ((int64_t)sample_difference_abs << 20) - MUL64(dithered_sample, quantization_factor); quantize->error = FFABS(rshift64(error, 23)); -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] (no subject)
This patchset add support for the aptX HD codec. This codec is a variation of the aptX codec using less aggressive quantization and thus producing higher bitrate and higher quality. The first 3 patches are simple cleanup / preparatory work. [PATCH 1/5] aptx: simplify by pre-calculating factor_max [PATCH 2/5] aptx: factorize FFABS calculation [PATCH 3/5] aptx: do some clipping to match original codec in extreme cases [PATCH 4/5] aptx: implement the aptX HD bluetooth codec [PATCH 5/5] aptx: add raw muxer and demuxer for aptX HD ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/5] aptx: implement the aptX HD bluetooth codec
--- Changelog | 2 +- configure | 2 + libavcodec/Makefile | 2 + libavcodec/allcodecs.c | 1 + libavcodec/aptx.c | 352 libavcodec/avcodec.h| 1 + libavcodec/codec_desc.c | 7 + 7 files changed, 339 insertions(+), 28 deletions(-) diff --git a/Changelog b/Changelog index 3d966c202b..9349bf1e8d 100644 --- a/Changelog +++ b/Changelog @@ -11,7 +11,7 @@ version : - TiVo ty/ty+ demuxer - Intel QSV-accelerated MJPEG encoding - PCE support for extended channel layouts in the AAC encoder -- native aptX encoder and decoder +- native aptX and aptX HD encoder and decoder - Raw aptX muxer and demuxer - NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-1/2/4, VC1, VP8/9 hwaccel decoding - Intel QSV-accelerated overlay filter diff --git a/configure b/configure index 1d2fffa132..c496346a06 100755 --- a/configure +++ b/configure @@ -2459,6 +2459,8 @@ apng_encoder_deps="zlib" apng_encoder_select="llvidencdsp" aptx_decoder_select="audio_frame_queue" aptx_encoder_select="audio_frame_queue" +aptx_hd_decoder_select="audio_frame_queue" +aptx_hd_encoder_select="audio_frame_queue" asv1_decoder_select="blockdsp bswapdsp idctdsp" asv1_encoder_select="bswapdsp fdctdsp pixblockdsp" asv2_decoder_select="blockdsp bswapdsp idctdsp" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index cfacd6b70c..a9ecf7ea5e 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -190,6 +190,8 @@ OBJS-$(CONFIG_ANSI_DECODER)+= ansi.o cga_data.o OBJS-$(CONFIG_APE_DECODER) += apedec.o OBJS-$(CONFIG_APTX_DECODER)+= aptx.o OBJS-$(CONFIG_APTX_ENCODER)+= aptx.o +OBJS-$(CONFIG_APTX_HD_DECODER) += aptx.o +OBJS-$(CONFIG_APTX_HD_ENCODER) += aptx.o OBJS-$(CONFIG_APNG_DECODER)+= png.o pngdec.o pngdsp.o OBJS-$(CONFIG_APNG_ENCODER)+= png.o pngenc.o OBJS-$(CONFIG_SSA_DECODER) += assdec.o ass.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index ed1e7ab06e..93d31f8688 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -333,6 +333,7 @@ static void register_all(void) REGISTER_DECODER(AMRWB, amrwb); REGISTER_DECODER(APE, ape); REGISTER_ENCDEC (APTX, aptx); +REGISTER_ENCDEC (APTX_HD, aptx_hd); REGISTER_DECODER(ATRAC1,atrac1); REGISTER_DECODER(ATRAC3,atrac3); REGISTER_DECODER(ATRAC3AL, atrac3al); diff --git a/libavcodec/aptx.c b/libavcodec/aptx.c index 4173402d03..6c0f3d35a9 100644 --- a/libavcodec/aptx.c +++ b/libavcodec/aptx.c @@ -89,6 +89,8 @@ typedef struct { } Channel; typedef struct { +int hd; +int block_size; int32_t sync_idx; Channel channels[NB_CHANNELS]; AudioFrameQueue afq; @@ -182,6 +184,205 @@ static const int16_t quantize_factor_select_offset_HF[5] = { 0, -8, 33, 95, 262, }; + +static const int32_t hd_quantize_intervals_LF[257] = { + -2436,2436,7308, 12180, 17054, 21930, 26806, 31686, + 36566, 41450, 46338, 51230, 56124, 61024, 65928, 70836, + 75750, 80670, 85598, 90530, 95470, 100418, 105372, 110336, + 115308, 120288, 125278, 130276, 135286, 140304, 145334, 150374, + 155426, 160490, 165566, 170654, 175756, 180870, 185998, 191138, + 196294, 201466, 206650, 211850, 217068, 222300, 227548, 232814, + 238096, 243396, 248714, 254050, 259406, 264778, 270172, 275584, + 281018, 286470, 291944, 297440, 302956, 308496, 314056, 319640, + 325248, 330878, 336532, 342212, 347916, 353644, 359398, 365178, + 370986, 376820, 382680, 388568, 394486, 400430, 406404, 412408, + 418442, 424506, 430600, 436726, 442884, 449074, 455298, 461554, + 467844, 474168, 480528, 486922, 493354, 499820, 506324, 512866, + 519446, 526064, 532722, 539420, 546160, 552940, 559760, 566624, + 573532, 580482, 587478, 594520, 601606, 608740, 615920, 623148, + 630426, 637754, 645132, 652560, 660042, 667576, 675164, 682808, + 690506, 698262, 706074, 713946, 721876, 729868, 737920, 746036, + 754216, 762460, 770770, 779148, 787594, 796108, 804694, 813354, + 822086, 830892, 839774, 848736, 857776, 866896, 876100, 885386, + 894758, 904218, 913766, 923406, 933138, 942964, 952886, 962908, + 973030, 983254, 993582, 1004020, 1014566, 1025224, 1035996, 1046886, +1057894, 1069026, 1080284, 1091670, 1103186, 1114838, 1126628, 1138558, +1150634, 1162858, 1175236, 1187768, 1200462, 1213320, 1226346, 1239548, +1252928, 1266490, 1280242, 1294188, 1308334, 1322688, 1337252, 1352034, +1367044, 1382284, 1397766, 1413494, 1429478, 1445728, 1462252, 1479058, +1496158, 1513562, 1531280, 1549326, 1567710, 1586446, 1605550, 1625034, +1644914, 1665208, 1685932, 17071
[FFmpeg-devel] [PATCH 5/5] aptx: add raw muxer and demuxer for aptX HD
--- Changelog| 2 +- libavformat/Makefile | 2 ++ libavformat/allformats.c | 1 + libavformat/aptxdec.c| 51 libavformat/rawenc.c | 13 5 files changed, 64 insertions(+), 5 deletions(-) diff --git a/Changelog b/Changelog index 9349bf1e8d..3a97b0b02e 100644 --- a/Changelog +++ b/Changelog @@ -12,7 +12,7 @@ version : - Intel QSV-accelerated MJPEG encoding - PCE support for extended channel layouts in the AAC encoder - native aptX and aptX HD encoder and decoder -- Raw aptX muxer and demuxer +- Raw aptX and aptX HD muxer and demuxer - NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-1/2/4, VC1, VP8/9 hwaccel decoding - Intel QSV-accelerated overlay filter - mcompand audio filter diff --git a/libavformat/Makefile b/libavformat/Makefile index cb70eac920..dbe2890297 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -96,6 +96,8 @@ OBJS-$(CONFIG_APNG_DEMUXER) += apngdec.o OBJS-$(CONFIG_APNG_MUXER)+= apngenc.o OBJS-$(CONFIG_APTX_DEMUXER) += aptxdec.o rawdec.o OBJS-$(CONFIG_APTX_MUXER)+= rawenc.o +OBJS-$(CONFIG_APTX_HD_DEMUXER) += aptxdec.o rawdec.o +OBJS-$(CONFIG_APTX_HD_MUXER) += rawenc.o OBJS-$(CONFIG_AQTITLE_DEMUXER) += aqtitledec.o subtitles.o OBJS-$(CONFIG_ASF_DEMUXER) += asfdec_f.o asf.o asfcrypt.o \ avlanguage.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 6a9b9883c9..b70b7463b9 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -70,6 +70,7 @@ static void register_all(void) REGISTER_DEMUXER (APE, ape); REGISTER_MUXDEMUX(APNG, apng); REGISTER_MUXDEMUX(APTX, aptx); +REGISTER_MUXDEMUX(APTX_HD, aptx_hd); REGISTER_DEMUXER (AQTITLE, aqtitle); REGISTER_MUXDEMUX(ASF, asf); REGISTER_DEMUXER (ASF_O,asf_o); diff --git a/libavformat/aptxdec.c b/libavformat/aptxdec.c index 3b8fae1b55..18c2d76b71 100644 --- a/libavformat/aptxdec.c +++ b/libavformat/aptxdec.c @@ -26,26 +26,49 @@ #define APTX_BLOCK_SIZE 4 #define APTX_PACKET_SIZE (256*APTX_BLOCK_SIZE) +#define APTX_HD_BLOCK_SIZE 6 +#define APTX_HD_PACKET_SIZE (256*APTX_HD_BLOCK_SIZE) + typedef struct AptXDemuxerContext { AVClass *class; int sample_rate; } AptXDemuxerContext; -static int aptx_read_header(AVFormatContext *s) +static AVStream *aptx_read_header_common(AVFormatContext *s) { AptXDemuxerContext *s1 = s->priv_data; AVStream *st = avformat_new_stream(s, NULL); if (!st) -return AVERROR(ENOMEM); +return NULL; st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; -st->codecpar->codec_id = AV_CODEC_ID_APTX; st->codecpar->format = AV_SAMPLE_FMT_S32P; st->codecpar->channels = 2; st->codecpar->sample_rate = s1->sample_rate; +st->start_time = 0; +return st; +} + +static int aptx_read_header(AVFormatContext *s) +{ +AVStream *st = aptx_read_header_common(s); +if (!st) +return AVERROR(ENOMEM); +st->codecpar->codec_id = AV_CODEC_ID_APTX; st->codecpar->bits_per_coded_sample = 4; st->codecpar->block_align = APTX_BLOCK_SIZE; st->codecpar->frame_size = APTX_PACKET_SIZE; -st->start_time = 0; +return 0; +} + +static int aptx_hd_read_header(AVFormatContext *s) +{ +AVStream *st = aptx_read_header_common(s); +if (!st) +return AVERROR(ENOMEM); +st->codecpar->codec_id = AV_CODEC_ID_APTX_HD; +st->codecpar->bits_per_coded_sample = 6; +st->codecpar->block_align = APTX_HD_BLOCK_SIZE; +st->codecpar->frame_size = APTX_HD_PACKET_SIZE; return 0; } @@ -54,6 +77,11 @@ static int aptx_read_packet(AVFormatContext *s, AVPacket *pkt) return av_get_packet(s->pb, pkt, APTX_PACKET_SIZE); } +static int aptx_hd_read_packet(AVFormatContext *s, AVPacket *pkt) +{ +return av_get_packet(s->pb, pkt, APTX_HD_PACKET_SIZE); +} + static const AVOption aptx_options[] = { { "sample_rate", "", offsetof(AptXDemuxerContext, sample_rate), AV_OPT_TYPE_INT, {.i64 = 48000}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, { NULL }, @@ -66,6 +94,7 @@ static const AVClass aptx_demuxer_class = { .version= LIBAVUTIL_VERSION_INT, }; +#if CONFIG_APTX_MUXER AVInputFormat ff_aptx_demuxer = { .name = "aptx", .long_name = NULL_IF_CONFIG_SMALL("raw aptX"), @@ -76,3 +105,17 @@ AVInputFormat ff_aptx_demuxer = { .flags = AVFMT_GENERIC_INDEX, .priv_class = &aptx_demuxer_class, }; +#endif + +#if CONFIG_APTX_HD_DEMUXER +AVInputFormat ff_aptx_hd_demuxer = { +.name = "aptx_hd", +.long_name = NULL_IF_CONFIG_SMALL("raw aptX HD"), +.extensions = "aptxhd", +.priv_data_size = sizeof(AptXDemuxerContext), +.read_header= aptx_hd_read_header, +.read_pa
[FFmpeg-devel] [PATCH 2/5] aptx: factorize FFABS calculation
--- libavcodec/aptx.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavcodec/aptx.c b/libavcodec/aptx.c index 7b9556ce42..64a63a7d5b 100644 --- a/libavcodec/aptx.c +++ b/libavcodec/aptx.c @@ -462,10 +462,12 @@ static void aptx_quantize_difference(Quantize *quantize, { const int32_t *intervals = tables->quantize_intervals; int32_t quantized_sample, dithered_sample, parity_change; -int32_t d, mean, interval, inv; +int32_t d, mean, interval, inv, sample_difference_abs; int64_t error; -quantized_sample = aptx_bin_search(FFABS(sample_difference) >> 4, +sample_difference_abs = FFABS(sample_difference); + +quantized_sample = aptx_bin_search(sample_difference_abs >> 4, quantization_factor, intervals, tables->tables_size); @@ -477,7 +479,7 @@ static void aptx_quantize_difference(Quantize *quantize, interval = (intervals[1] - intervals[0]) * (-(sample_difference < 0) | 1); dithered_sample = rshift64_clip24(MUL64(dither, interval) + ((int64_t)(mean + d) << 32), 32); -error = ((int64_t)FFABS(sample_difference) << 20) - MUL64(dithered_sample, quantization_factor); +error = ((int64_t)sample_difference_abs << 20) - MUL64(dithered_sample, quantization_factor); quantize->error = FFABS(rshift64(error, 23)); parity_change = quantized_sample; -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] avcodec/rkmpp : Fix broken build and remove some useless code
On Sat, 6 Jan 2018 08:46:26 + "LongChair ." wrote: > Here are two updated patches. > > I have added the current version check to 1.3.7 and removed the header > check for control operation. Pushed the 2 patches. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/6] Patchset to remove ffserver
On 21 October 2017 at 19:54, Rostislav Pehlivanov wrote: > This patchset removes the long-deprecated ffserver program and all > its privately exposed things from libavformat. > > Rostislav Pehlivanov (6): > Remove the ffserver program > libavformat: remove the ffmenc and ffmdec muxer and demuxers > libavformat: unexpose the ff_inet_aton function > libavformat: remove the ff_rtp_get_local_rtcp_port function > libavformat: unexpose private ff_ functions needed by ffserver > libavformat/mpjpeg: use "ffmpeg" instead of "ffserver" as boundary tag > > .gitignore|1 - > Changelog |2 + > MAINTAINERS |3 - > README.md |2 - > configure |4 - > doc/ffmpeg-bitstream-filters.texi |4 +- > doc/ffmpeg-codecs.texi|4 +- > doc/ffmpeg-devices.texi |4 +- > doc/ffmpeg-filters.texi |4 +- > doc/ffmpeg-formats.texi |4 +- > doc/ffmpeg-protocols.texi |4 +- > doc/ffmpeg-resampler.texi |4 +- > doc/ffmpeg-scaler.texi|4 +- > doc/ffmpeg-utils.texi |4 +- > doc/ffmpeg.texi | 18 +- > doc/ffplay.texi |4 +- > doc/ffprobe.texi |4 +- > doc/ffserver.conf | 372 > doc/ffserver.texi | 923 - > doc/issue_tracker.txt |3 - > doc/libavcodec.texi |4 +- > doc/libavdevice.texi |4 +- > doc/libavfilter.texi |4 +- > doc/libavformat.texi |4 +- > doc/libavutil.texi|4 +- > doc/libswresample.texi|4 +- > doc/libswscale.texi |4 +- > doc/mailing-list-faq.texi |3 +- > doc/protocols.texi|2 +- > fftools/Makefile |4 +- > fftools/ffmpeg_opt.c | 96 +- > fftools/ffserver.c| 4026 -- > --- > fftools/ffserver_config.c | 1325 > fftools/ffserver_config.h | 155 -- > libavformat/Makefile |2 - > libavformat/allformats.c |1 - > libavformat/ffm.h | 62 - > libavformat/ffmdec.c | 878 > libavformat/ffmenc.c | 362 > libavformat/libavformat.v | 11 - > libavformat/mpjpeg.c |2 +- > libavformat/network.h |2 - > libavformat/os_support.c |6 +- > libavformat/rtpproto.c|6 - > libavformat/rtpproto.h|1 - > tests/Makefile| 10 - > tests/ffserver-regression.sh | 45 - > tests/ffserver.conf | 311 --- > tests/ffserver.regression.ref | 11 - > tools/bisect-create |2 +- > 50 files changed, 49 insertions(+), 8674 deletions(-) > delete mode 100644 doc/ffserver.conf > delete mode 100644 doc/ffserver.texi > delete mode 100644 fftools/ffserver.c > delete mode 100644 fftools/ffserver_config.c > delete mode 100644 fftools/ffserver_config.h > delete mode 100644 libavformat/ffm.h > delete mode 100644 libavformat/ffmdec.c > delete mode 100644 libavformat/ffmenc.c > delete mode 100755 tests/ffserver-regression.sh > delete mode 100644 tests/ffserver.conf > delete mode 100644 tests/ffserver.regression.ref > > -- > 2.15.0.rc1.287.g2b38de12cc > > Rebased and pushed, thanks for the reviews ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/6] Patchset to remove ffserver
On 6 January 2018 at 18:42, Rostislav Pehlivanov wrote: > > > On 21 October 2017 at 19:54, Rostislav Pehlivanov > wrote: > >> This patchset removes the long-deprecated ffserver program and all >> its privately exposed things from libavformat. >> >> Rostislav Pehlivanov (6): >> Remove the ffserver program >> libavformat: remove the ffmenc and ffmdec muxer and demuxers >> libavformat: unexpose the ff_inet_aton function >> libavformat: remove the ff_rtp_get_local_rtcp_port function >> libavformat: unexpose private ff_ functions needed by ffserver >> libavformat/mpjpeg: use "ffmpeg" instead of "ffserver" as boundary tag >> >> .gitignore|1 - >> Changelog |2 + >> MAINTAINERS |3 - >> README.md |2 - >> configure |4 - >> doc/ffmpeg-bitstream-filters.texi |4 +- >> doc/ffmpeg-codecs.texi|4 +- >> doc/ffmpeg-devices.texi |4 +- >> doc/ffmpeg-filters.texi |4 +- >> doc/ffmpeg-formats.texi |4 +- >> doc/ffmpeg-protocols.texi |4 +- >> doc/ffmpeg-resampler.texi |4 +- >> doc/ffmpeg-scaler.texi|4 +- >> doc/ffmpeg-utils.texi |4 +- >> doc/ffmpeg.texi | 18 +- >> doc/ffplay.texi |4 +- >> doc/ffprobe.texi |4 +- >> doc/ffserver.conf | 372 >> doc/ffserver.texi | 923 - >> doc/issue_tracker.txt |3 - >> doc/libavcodec.texi |4 +- >> doc/libavdevice.texi |4 +- >> doc/libavfilter.texi |4 +- >> doc/libavformat.texi |4 +- >> doc/libavutil.texi|4 +- >> doc/libswresample.texi|4 +- >> doc/libswscale.texi |4 +- >> doc/mailing-list-faq.texi |3 +- >> doc/protocols.texi|2 +- >> fftools/Makefile |4 +- >> fftools/ffmpeg_opt.c | 96 +- >> fftools/ffserver.c| 4026 -- >> --- >> fftools/ffserver_config.c | 1325 >> fftools/ffserver_config.h | 155 -- >> libavformat/Makefile |2 - >> libavformat/allformats.c |1 - >> libavformat/ffm.h | 62 - >> libavformat/ffmdec.c | 878 >> libavformat/ffmenc.c | 362 >> libavformat/libavformat.v | 11 - >> libavformat/mpjpeg.c |2 +- >> libavformat/network.h |2 - >> libavformat/os_support.c |6 +- >> libavformat/rtpproto.c|6 - >> libavformat/rtpproto.h|1 - >> tests/Makefile| 10 - >> tests/ffserver-regression.sh | 45 - >> tests/ffserver.conf | 311 --- >> tests/ffserver.regression.ref | 11 - >> tools/bisect-create |2 +- >> 50 files changed, 49 insertions(+), 8674 deletions(-) >> delete mode 100644 doc/ffserver.conf >> delete mode 100644 doc/ffserver.texi >> delete mode 100644 fftools/ffserver.c >> delete mode 100644 fftools/ffserver_config.c >> delete mode 100644 fftools/ffserver_config.h >> delete mode 100644 libavformat/ffm.h >> delete mode 100644 libavformat/ffmdec.c >> delete mode 100644 libavformat/ffmenc.c >> delete mode 100755 tests/ffserver-regression.sh >> delete mode 100644 tests/ffserver.conf >> delete mode 100644 tests/ffserver.regression.ref >> >> -- >> 2.15.0.rc1.287.g2b38de12cc >> >> > Rebased and pushed, thanks for the reviews > btw I suggest people to take a look at klaxa's mkvserver_mk2 https://github.com/klaxa/mkvserver_mk2 Its pretty basic and unstable but look promising. You give it a matroska input and it'll stream it out to clients. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/6] Patchset to remove ffserver
On Sat, Jan 6, 2018, at 9:42 AM, Rostislav Pehlivanov wrote: > > Rebased and pushed, thanks for the reviews Would you add a news entry for this? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/6] Patchset to remove ffserver
On 1/6/2018 4:55 PM, Lou Logan wrote: > On Sat, Jan 6, 2018, at 9:42 AM, Rostislav Pehlivanov wrote: >> >> Rebased and pushed, thanks for the reviews > > Would you add a news entry for this? The news was written like a year and a half ago before the removal was postponed a year ago, stating ffserver would be removed in an upcoming release. There's a line in Changelog for the next release about it, so it will be mentioned in the news entry for said release as the Changelog is quoted in those. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/7] avformat/hlsenc: use av_bprintf without buffer limit in replace_int_data_in_filename
In preparation for the deprecation of AVFormatContext->filename. Signed-off-by: Marton Balint --- libavformat/hlsenc.c | 113 ++- 1 file changed, 58 insertions(+), 55 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index e36120c320..20a3ab5758 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -290,14 +290,17 @@ static void set_http_options(AVFormatContext *s, AVDictionary **options, HLSCont } -static int replace_int_data_in_filename(char *buf, int buf_size, const char *filename, char placeholder, int64_t number) +static int replace_int_data_in_filename(char **s, const char *filename, char placeholder, int64_t number) { const char *p; -char *q, buf1[20], c; -int nd, len, addchar_count; +char *new_filename; +char c; +int nd, addchar_count; int found_count = 0; +AVBPrint buf; + +av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED); -q = buf; p = filename; for (;;) { c = *p; @@ -314,13 +317,7 @@ static int replace_int_data_in_filename(char *buf, int buf_size, const char *fil } if (*(p + addchar_count) == placeholder) { -len = snprintf(buf1, sizeof(buf1), "%0*"PRId64, (number < 0) ? nd : nd++, number); -if (len < 1) // returned error or empty buf1 -goto fail; -if ((q - buf + len) > buf_size - 1) -goto fail; -memcpy(q, buf1, len); -q += len; +av_bprintf(&buf, "%0*"PRId64, (number < 0) ? nd : nd++, number); p += (addchar_count + 1); addchar_count = 0; found_count++; @@ -329,17 +326,17 @@ static int replace_int_data_in_filename(char *buf, int buf_size, const char *fil } else addchar_count = 1; -while (addchar_count--) -if ((q - buf) < buf_size - 1) -*q++ = *p++; -else -goto fail; +av_bprint_append_data(&buf, p, addchar_count); +p += addchar_count; } -*q = '\0'; +if (!av_bprint_is_complete(&buf)) { +av_bprint_finalize(&buf, NULL); +return -1; +} +if (av_bprint_finalize(&buf, &new_filename) < 0 || !new_filename) +return -1; +*s = new_filename; return found_count; -fail: -*q = '\0'; -return -1; } static void write_styp(AVIOContext *pb) @@ -751,13 +748,8 @@ static int sls_flags_filename_process(struct AVFormatContext *s, HLSContext *hls strlen(vs->current_segment_final_filename_fmt)) { av_strlcpy(vs->avf->filename, vs->current_segment_final_filename_fmt, sizeof(vs->avf->filename)); if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_SIZE) { -char * filename = av_strdup(vs->avf->filename); // %%s will be %s after strftime -if (!filename) { -av_free(en); -return AVERROR(ENOMEM); -} -if (replace_int_data_in_filename(vs->avf->filename, sizeof(vs->avf->filename), -filename, 's', pos + size) < 1) { +char *filename = NULL; +if (replace_int_data_in_filename(&filename, vs->avf->filename, 's', pos + size) < 1) { av_log(hls, AV_LOG_ERROR, "Invalid second level segment filename template '%s', " "you can try to remove second_level_segment_size flag\n", @@ -766,16 +758,13 @@ static int sls_flags_filename_process(struct AVFormatContext *s, HLSContext *hls av_free(en); return AVERROR(EINVAL); } +av_strlcpy(vs->avf->filename, filename, sizeof(vs->avf->filename)); av_free(filename); } if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_DURATION) { -char * filename = av_strdup(vs->avf->filename); // %%t will be %t after strftime -if (!filename) { -av_free(en); -return AVERROR(ENOMEM); -} -if (replace_int_data_in_filename(vs->avf->filename, sizeof(vs->avf->filename), -filename, 't', (int64_t)round(duration * HLS_MICROSECOND_UNIT)) < 1) { +char *filename = NULL; +if (replace_int_data_in_filename(&filename, vs->avf->filename, +'t', (int64_t)round(duration * HLS_MICROSECOND_UNIT)) < 1) { av_log(hls, AV_LOG_ERROR, "Invalid second level segment filename template '%s', " "you can try to remove second_level_segment_time flag\n", @@ -784,6 +773,7 @@ static int sls_flags_filename_process(struct AVFormatContext *s, HLSContext *hls av_free(en); return AVERROR(EINVAL); } +av_strlcpy(vs->avf->filename, filename, sizeof(vs->avf->filename)); av_free(file
[FFmpeg-devel] [PATCH 5/7] avformat/hls: migrate to AVFormatContext->url
Signed-off-by: Marton Balint --- libavformat/hls.c| 4 +- libavformat/hlsenc.c | 166 +-- 2 files changed, 96 insertions(+), 74 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index 950cc4c3bd..559b8c3391 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -1676,7 +1676,7 @@ static int nested_io_open(AVFormatContext *s, AVIOContext **pb, const char *url, av_log(s, AV_LOG_ERROR, "A HLS playlist item '%s' referred to an external file '%s'. " "Opening this file was forbidden for security reasons\n", - s->filename, url); + s->url, url); return AVERROR(EPERM); } @@ -1814,7 +1814,7 @@ static int hls_read_header(AVFormatContext *s) update_options(&c->http_proxy, "http_proxy", u); } -if ((ret = parse_playlist(c, s->filename, NULL, s->pb)) < 0) +if ((ret = parse_playlist(c, s->url, NULL, s->pb)) < 0) goto fail; if ((ret = save_avio_options(s)) < 0) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 20a3ab5758..c5a5681605 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -275,7 +275,7 @@ static void hlsenc_io_close(AVFormatContext *s, AVIOContext **pb, char *filename static void set_http_options(AVFormatContext *s, AVDictionary **options, HLSContext *c) { -int http_base_proto = ff_is_http_proto(s->filename); +int http_base_proto = ff_is_http_proto(s->url); if (c->method) { av_dict_set(options, "method", c->method, 0); @@ -405,7 +405,7 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls, if (hls->segment_filename) { dirname = av_strdup(hls->segment_filename); } else { -dirname = av_strdup(vs->avf->filename); +dirname = av_strdup(vs->avf->url); } if (!dirname) { ret = AVERROR(ENOMEM); @@ -432,7 +432,7 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls, av_strlcat(path, segment->filename, path_size); } -proto = avio_find_protocol_name(s->filename); +proto = avio_find_protocol_name(s->url); if (hls->method || (proto && !av_strcasecmp(proto, "http"))) { av_dict_set(&options, "method", "DELETE", 0); if ((ret = vs->avf->io_open(vs->avf, &out, path, AVIO_FLAG_WRITE, &options)) < 0) @@ -502,12 +502,12 @@ static int do_encrypt(AVFormatContext *s, VariantStream *vs) AVIOContext *pb; uint8_t key[KEYSIZE]; -len = strlen(s->filename) + 4 + 1; +len = strlen(s->url) + 4 + 1; hls->key_basename = av_mallocz(len); if (!hls->key_basename) return AVERROR(ENOMEM); -av_strlcpy(hls->key_basename, s->filename, len); +av_strlcpy(hls->key_basename, s->url, len); av_strlcat(hls->key_basename, ".key", len); if (hls->key_url) { @@ -637,7 +637,10 @@ static int hls_mux_init(AVFormatContext *s, VariantStream *vs) return ret; oc = vs->avf; -oc->filename[0]= '\0'; +oc->url= av_strdup(""); +if (!oc->url) +return AVERROR(ENOMEM); + oc->oformat= vs->oformat; oc->interrupt_callback = s->interrupt_callback; oc->max_delay = s->max_delay; @@ -746,35 +749,38 @@ static int sls_flags_filename_process(struct AVFormatContext *s, HLSContext *hls { if ((hls->flags & (HLS_SECOND_LEVEL_SEGMENT_SIZE | HLS_SECOND_LEVEL_SEGMENT_DURATION)) && strlen(vs->current_segment_final_filename_fmt)) { -av_strlcpy(vs->avf->filename, vs->current_segment_final_filename_fmt, sizeof(vs->avf->filename)); +char * new_url = av_strdup(vs->current_segment_final_filename_fmt); +if (!new_url) { +av_free(en); +return AVERROR(ENOMEM); +} +ff_format_set_url(vs->avf, new_url); if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_SIZE) { char *filename = NULL; -if (replace_int_data_in_filename(&filename, vs->avf->filename, 's', pos + size) < 1) { +if (replace_int_data_in_filename(&filename, vs->avf->url, 's', pos + size) < 1) { av_log(hls, AV_LOG_ERROR, "Invalid second level segment filename template '%s', " "you can try to remove second_level_segment_size flag\n", - filename); + vs->avf->url); av_free(filename); av_free(en); return AVERROR(EINVAL); } -av_strlcpy(vs->avf->filename, filename, sizeof(vs->avf->filename)); -av_free(filename); +ff_format_set_url(vs->avf, filename); } if (hls->flags & HLS_SECOND_LEVEL_SEGMENT_DURATION) { char *filename = NULL; -if (replace_int_data_in_filename(&filename, vs->avf->filename, +if (replace
[FFmpeg-devel] [PATCH 4/7] avdevice: migrate to AVFormatContext->url
Signed-off-by: Marton Balint --- libavdevice/alsa.c | 4 ++-- libavdevice/avfoundation.m | 2 +- libavdevice/bktr.c | 2 +- libavdevice/caca.c | 2 +- libavdevice/decklink_common.cpp | 2 +- libavdevice/decklink_dec.cpp| 4 ++-- libavdevice/decklink_enc.cpp| 4 ++-- libavdevice/dshow.c | 2 +- libavdevice/fbdev_dec.c | 4 ++-- libavdevice/fbdev_enc.c | 4 ++-- libavdevice/gdigrab.c | 2 +- libavdevice/iec61883.c | 8 libavdevice/jack.c | 6 +++--- libavdevice/lavfi.c | 2 +- libavdevice/libcdio.c | 6 +++--- libavdevice/libndi_newtek_dec.c | 2 +- libavdevice/libndi_newtek_enc.c | 4 ++-- libavdevice/openal-dec.c| 2 +- libavdevice/opengl_enc.c| 2 +- libavdevice/oss_dec.c | 2 +- libavdevice/oss_enc.c | 2 +- libavdevice/pulse_audio_dec.c | 4 ++-- libavdevice/pulse_audio_enc.c | 4 ++-- libavdevice/sdl2.c | 2 +- libavdevice/sndio_dec.c | 2 +- libavdevice/sndio_enc.c | 2 +- libavdevice/v4l2.c | 16 +--- libavdevice/v4l2enc.c | 4 ++-- libavdevice/vfwcap.c| 4 ++-- libavdevice/xcbgrab.c | 8 libavdevice/xv.c| 2 +- 31 files changed, 59 insertions(+), 57 deletions(-) diff --git a/libavdevice/alsa.c b/libavdevice/alsa.c index 1bbff30d5c..1b21beb6d5 100644 --- a/libavdevice/alsa.c +++ b/libavdevice/alsa.c @@ -177,8 +177,8 @@ av_cold int ff_alsa_open(AVFormatContext *ctx, snd_pcm_stream_t mode, snd_pcm_uframes_t buffer_size, period_size; uint64_t layout = ctx->streams[0]->codecpar->channel_layout; -if (ctx->filename[0] == 0) audio_device = "default"; -else audio_device = ctx->filename; +if (ctx->url[0] == 0) audio_device = "default"; +else audio_device = ctx->url; if (*codec_id == AV_CODEC_ID_NONE) *codec_id = DEFAULT_CODEC_ID; diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m index e2ddf47dbe..a540f6a079 100644 --- a/libavdevice/avfoundation.m +++ b/libavdevice/avfoundation.m @@ -259,7 +259,7 @@ static void destroy_context(AVFContext* ctx) static void parse_device_name(AVFormatContext *s) { AVFContext *ctx = (AVFContext*)s->priv_data; -char *tmp = av_strdup(s->filename); +char *tmp = av_strdup(s->url); char *save; if (tmp[0] != ':') { diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c index 418247dc4e..993cc19ac7 100644 --- a/libavdevice/bktr.c +++ b/libavdevice/bktr.c @@ -294,7 +294,7 @@ static int grab_read_header(AVFormatContext *s1) st->codecpar->height = s->height; st->avg_frame_rate = framerate; -if (bktr_init(s1->filename, s->width, s->height, s->standard, +if (bktr_init(s1->url, s->width, s->height, s->standard, &s->video_fd, &s->tuner_fd, -1, 0.0) < 0) { ret = AVERROR(EIO); goto out; diff --git a/libavdevice/caca.c b/libavdevice/caca.c index 93cc0ffd25..47de8247dc 100644 --- a/libavdevice/caca.c +++ b/libavdevice/caca.c @@ -178,7 +178,7 @@ static int caca_write_header(AVFormatContext *s) } if (!c->window_title) -c->window_title = av_strdup(s->filename); +c->window_title = av_strdup(s->url); caca_set_display_title(c->display, c->window_title); caca_set_display_time(c->display, av_rescale_q(1, st->codec->time_base, AV_TIME_BASE_Q)); diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp index 6ef2c529f4..d0c043cfc6 100644 --- a/libavdevice/decklink_common.cpp +++ b/libavdevice/decklink_common.cpp @@ -393,7 +393,7 @@ int ff_decklink_list_formats(AVFormatContext *avctx, decklink_direction_t direct } av_log(avctx, AV_LOG_INFO, "Supported formats for '%s':\n\tformat_code\tdescription", - avctx->filename); + avctx->url); while (itermode->Next(&mode) == S_OK) { BMDTimeValue tb_num, tb_den; mode->GetFrameRate(&tb_num, &tb_den); diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp index 94dae26003..62bf52bfde 100644 --- a/libavdevice/decklink_dec.cpp +++ b/libavdevice/decklink_dec.cpp @@ -939,7 +939,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) cctx->raw_format = MKBETAG('v','2','1','0'); } -strcpy (fname, avctx->filename); +av_strlcpy(fname, avctx->url, sizeof(fname)); tmp=strchr (fname, '@'); if (tmp != NULL) { av_log(avctx, AV_LOG_WARNING, "The @mode syntax is deprecated and will be removed. Please use the -format_code option.\n"); @@ -954,7 +954,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) /* Get input device. */ if (ctx->dl->QueryInterface(IID_IDeckLinkInput, (void **) &ctx->dli) != S_OK) { av_log(avctx, AV_LOG_ERROR, "Could not open input device f
[FFmpeg-devel] [PATCH 3/7] fftools, tools, examples: migrate to AVFormatContext->url
Signed-off-by: Marton Balint --- doc/examples/transcode_aac.c | 7 +-- fftools/ffmpeg.c | 16 fftools/ffmpeg_opt.c | 8 fftools/ffplay.c | 6 +++--- fftools/ffprobe.c| 2 +- tools/uncoded_frame.c| 2 +- 6 files changed, 22 insertions(+), 19 deletions(-) diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c index 9fd5c00d60..3c7688cd33 100644 --- a/doc/examples/transcode_aac.c +++ b/doc/examples/transcode_aac.c @@ -171,8 +171,11 @@ static int open_output_file(const char *filename, goto cleanup; } -av_strlcpy((*output_format_context)->filename, filename, - sizeof((*output_format_context)->filename)); +if (!((*output_format_context)->url = av_strdup(filename))) { +fprintf(stderr, "Could not allocate url.\n"); +error = AVERROR(ENOMEM); +goto cleanup; +} /* Find the encoder to be used by its name. */ if (!(output_codec = avcodec_find_encoder(AV_CODEC_ID_AAC))) { diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 528849a2c6..cded5afebb 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1560,7 +1560,7 @@ static void print_final_stats(int64_t total_size) uint64_t total_packets = 0, total_size = 0; av_log(NULL, AV_LOG_VERBOSE, "Input file #%d (%s):\n", - i, f->ctx->filename); + i, f->ctx->url); for (j = 0; j < f->nb_streams; j++) { InputStream *ist = input_streams[f->ist_index + j]; @@ -1594,7 +1594,7 @@ static void print_final_stats(int64_t total_size) uint64_t total_packets = 0, total_size = 0; av_log(NULL, AV_LOG_VERBOSE, "Output file #%d (%s):\n", - i, of->ctx->filename); + i, of->ctx->url); for (j = 0; j < of->ctx->nb_streams; j++) { OutputStream *ost = output_streams[of->ost_index + j]; @@ -2102,7 +2102,7 @@ static void check_decode_result(InputStream *ist, int *got_output, int ret) if (exit_on_error && *got_output && ist) { if (ist->decoded_frame->decode_error_flags || (ist->decoded_frame->flags & AV_FRAME_FLAG_CORRUPT)) { -av_log(NULL, AV_LOG_FATAL, "%s: corrupt decoded frame in stream %d\n", input_files[ist->file_index]->ctx->filename, ist->st->index); +av_log(NULL, AV_LOG_FATAL, "%s: corrupt decoded frame in stream %d\n", input_files[ist->file_index]->ctx->url, ist->st->index); exit_program(1); } } @@ -2986,7 +2986,7 @@ static int check_init_output_file(OutputFile *of, int file_index) //assert_avoptions(of->opts); of->header_written = 1; -av_dump_format(of->ctx, file_index, of->ctx->filename, 1); +av_dump_format(of->ctx, file_index, of->ctx->url, 1); if (sdp_filename || want_sdp) print_sdp(); @@ -4249,7 +4249,7 @@ static int process_input(int file_index) } if (ret < 0) { if (ret != AVERROR_EOF) { -print_error(is->filename, ret); +print_error(is->url, ret); if (exit_on_error) exit_program(1); } @@ -4298,7 +4298,7 @@ static int process_input(int file_index) goto discard_packet; if (exit_on_error && (pkt.flags & AV_PKT_FLAG_CORRUPT)) { -av_log(NULL, AV_LOG_FATAL, "%s: corrupt input packet in stream %d\n", is->filename, pkt.stream_index); +av_log(NULL, AV_LOG_FATAL, "%s: corrupt input packet in stream %d\n", is->url, pkt.stream_index); exit_program(1); } @@ -4665,11 +4665,11 @@ static int transcode(void) av_log(NULL, AV_LOG_ERROR, "Nothing was written into output file %d (%s), because " "at least one of its streams received no packets.\n", - i, os->filename); + i, os->url); continue; } if ((ret = av_write_trailer(os)) < 0) { -av_log(NULL, AV_LOG_ERROR, "Error writing trailer of %s: %s\n", os->filename, av_err2str(ret)); +av_log(NULL, AV_LOG_ERROR, "Error writing trailer of %s: %s\n", os->url, av_err2str(ret)); if (exit_on_error) exit_program(1); } diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 4fe78fa757..8d3e49c4b3 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1271,7 +1271,7 @@ static int choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream *o if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO || type == AVMEDIA_TYPE_SUBTITLE) { MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, ost->st); if (!codec_name) { -ost->st->codecpar->codec_id = av_guess_codec(s->oformat, NULL, s->filename, +ost->st->codecpar->codec_id = av_guess_codec(s->oformat, NULL, s->url, NULL, ost->st->codecpar->codec_type
[FFmpeg-devel] [PATCH 6/7] avformat: migrate to AVFormatContext->url
Signed-off-by: Marton Balint --- libavformat/concatdec.c | 4 ++-- libavformat/dashenc.c| 16 libavformat/fifo.c | 8 libavformat/flvenc.c | 4 ++-- libavformat/gxfenc.c | 4 ++-- libavformat/hdsenc.c | 24 libavformat/img2dec.c| 4 ++-- libavformat/img2enc.c| 4 ++-- libavformat/matroskadec.c| 4 ++-- libavformat/mlvdec.c | 4 ++-- libavformat/mov.c| 2 +- libavformat/movenc.c | 10 +- libavformat/mpeg.c | 4 ++-- libavformat/mpegtsenc.c | 2 +- libavformat/options.c| 2 +- libavformat/rtsp.c | 18 -- libavformat/rtspdec.c| 4 ++-- libavformat/rtspenc.c| 4 +++- libavformat/sapdec.c | 2 +- libavformat/sapenc.c | 10 -- libavformat/sdp.c| 4 ++-- libavformat/segment.c| 36 +--- libavformat/smoothstreamingenc.c | 12 ++-- libavformat/tee.c| 4 ++-- libavformat/utils.c | 2 +- libavformat/webm_chunk.c | 10 +- 26 files changed, 111 insertions(+), 91 deletions(-) diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index bd5174ada2..178fac86cb 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -126,10 +126,10 @@ static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile, url = filename; filename = NULL; } else { -url_len = strlen(avf->filename) + strlen(filename) + 16; +url_len = strlen(avf->url) + strlen(filename) + 16; if (!(url = av_malloc(url_len))) FAIL(AVERROR(ENOMEM)); -ff_make_absolute_url(url, url_len, avf->filename, filename); +ff_make_absolute_url(url, url_len, avf->url, filename); av_freep(&filename); } diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 3345b89118..59c55cc8b7 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -685,7 +685,7 @@ static int write_manifest(AVFormatContext *s, int final) AVIOContext *out; char temp_filename[1024]; int ret, i; -const char *proto = avio_find_protocol_name(s->filename); +const char *proto = avio_find_protocol_name(s->url); int use_rename = proto && !strcmp(proto, "file"); static unsigned int warned_non_file = 0; AVDictionaryEntry *title = av_dict_get(s->metadata, "title", NULL, 0); @@ -694,7 +694,7 @@ static int write_manifest(AVFormatContext *s, int final) if (!use_rename && !warned_non_file++) av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this may lead to races and temporary partial files\n"); -snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : "%s", s->filename); +snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : "%s", s->url); set_http_options(&opts, c); ret = dashenc_io_open(s, &c->mpd_out, temp_filename, &opts); if (ret < 0) { @@ -771,7 +771,7 @@ static int write_manifest(AVFormatContext *s, int final) dashenc_io_close(s, &c->mpd_out, temp_filename); if (use_rename) { -if ((ret = avpriv_io_move(temp_filename, s->filename)) < 0) +if ((ret = avpriv_io_move(temp_filename, s->url)) < 0) return ret; } @@ -852,14 +852,14 @@ static int dash_init(AVFormatContext *s) if (c->single_file) c->use_template = 0; -av_strlcpy(c->dirname, s->filename, sizeof(c->dirname)); +av_strlcpy(c->dirname, s->url, sizeof(c->dirname)); ptr = strrchr(c->dirname, '/'); if (ptr) { av_strlcpy(basename, &ptr[1], sizeof(basename)); ptr[1] = '\0'; } else { c->dirname[0] = '\0'; -av_strlcpy(basename, s->filename, sizeof(basename)); +av_strlcpy(basename, s->url, sizeof(basename)); } ptr = strrchr(basename, '.'); @@ -1018,7 +1018,7 @@ static int dash_write_header(AVFormatContext *s) } ret = write_manifest(s, 0); if (!ret) -av_log(s, AV_LOG_VERBOSE, "Manifest written to: %s\n", s->filename); +av_log(s, AV_LOG_VERBOSE, "Manifest written to: %s\n", s->url); return ret; } @@ -1117,7 +1117,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream) DASHContext *c = s->priv_data; int i, ret = 0; -const char *proto = avio_find_protocol_name(s->filename); +const char *proto = avio_find_protocol_name(s->url); int use_rename = proto && !strcmp(proto, "file"); int cur_flush_segment_index = 0; @@ -1325,7 +1325,7 @@ static int dash_write_trailer(AVFormatContext *s) snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile); unlink(filename); } -unlink(s->filename); +
[FFmpeg-devel] [PATCH 2/7] avformat: add url field to AVFormatContext
This will replace the 1024 character limited filename field. Compatiblity for output contexts are provided by copying filename field to URL if URL is unset and by providing an internal function for muxers to set both url and filename at once. Signed-off-by: Marton Balint --- doc/APIchanges | 3 +++ libavformat/avformat.h | 15 +++ libavformat/internal.h | 7 +++ libavformat/mux.c | 11 ++- libavformat/utils.c| 14 ++ libavformat/version.h | 2 +- 6 files changed, 50 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index d66c842521..4a91b7460a 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2017-10-21 API changes, most recent first: +2018-xx-xx - xxx - lavf 58.4.100 - avformat.h + Add url field to AVFormatContext and add ff_format_set_url helper function. + 2018-01-xx - xxx - lavfi 7.11.101 - avfilter.h Deprecate avfilter_link_get_channels(). Use av_buffersink_get_channels(). diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 4f2798a871..9fa25abd90 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1391,6 +1391,21 @@ typedef struct AVFormatContext { char filename[1024]; /** + * input or output URL. Unlike the old filename field, this field has no + * length restriction. + * + * - demuxing: set by avformat_open_input(), initialized to an empty + * string if url parameter was NULL in avformat_open_input(). + * - muxing: may be set by the caller before calling avformat_write_header() + * (or avformat_init_output() if that is called first) to a string + * which is freeable by av_free(). Set to an empty string if it + * was NULL in avformat_init_output(). + * + * Freed by libavformat in avformat_free_context(). + */ +char *url; + +/** * Position of the first frame of the component, in * AV_TIME_BASE fractional seconds. NEVER set this value directly: * It is deduced from the AVStream values. diff --git a/libavformat/internal.h b/libavformat/internal.h index 0cd0556dc7..1e2a3e05a1 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -696,4 +696,11 @@ int ff_interleaved_peek(AVFormatContext *s, int stream, int ff_lock_avformat(void); int ff_unlock_avformat(void); +/** + * Set AVFormatContext url field to the provided pointer. The pointer must + * point to a valid string. The existing url field is freed if necessary. Also + * set the legacy filename field to the same string which was provided in url. + */ +void ff_format_set_url(AVFormatContext *s, char *url); + #endif /* AVFORMAT_INTERNAL_H */ diff --git a/libavformat/mux.c b/libavformat/mux.c index ea9f13fdf5..de63f2ca25 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -186,8 +186,12 @@ int avformat_alloc_output_context2(AVFormatContext **avctx, AVOutputFormat *ofor } else s->priv_data = NULL; -if (filename) +if (filename) { av_strlcpy(s->filename, filename, sizeof(s->filename)); +if (!(s->url = av_strdup(filename))) +goto nomem; + +} *avctx = s; return 0; nomem: @@ -251,6 +255,11 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options) (ret = av_opt_set_dict2(s->priv_data, &tmp, AV_OPT_SEARCH_CHILDREN)) < 0) goto fail; +if (!s->url && !(s->url = av_strdup(s->filename))) { +ret = AVERROR(ENOMEM); +goto fail; +} + #if FF_API_LAVF_AVCTX FF_DISABLE_DEPRECATION_WARNINGS if (s->nb_streams && s->streams[0]->codec->flags & AV_CODEC_FLAG_BITEXACT) { diff --git a/libavformat/utils.c b/libavformat/utils.c index 2185a6f05b..fdfd3a088d 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -551,6 +551,11 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, if ((ret = av_opt_set_dict(s, &tmp)) < 0) goto fail; +if (!(s->url = av_strdup(filename ? filename : ""))) { +ret = AVERROR(ENOMEM); +goto fail; +} + av_strlcpy(s->filename, filename ? filename : "", sizeof(s->filename)); if ((ret = init_input(s, filename, &tmp)) < 0) goto fail; @@ -4357,6 +4362,7 @@ void avformat_free_context(AVFormatContext *s) av_freep(&s->streams); flush_packet_queue(s); av_freep(&s->internal); +av_freep(&s->url); av_free(s); } @@ -5624,3 +5630,11 @@ FF_ENABLE_DEPRECATION_WARNINGS return st->internal->avctx->time_base; #endif } + +void ff_format_set_url(AVFormatContext *s, char *url) +{ +av_assert0(url); +av_freep(&s->url); +s->url = url; +av_strlcpy(s->filename, url, sizeof(s->filename)); +} diff --git a/libavformat/version.h b/libavformat/version.h index 5ced041f0a..49b9906a20 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -32,7 +32,7 @@ // Major bumping may affect Ticket5467, 5421, 5451(c
[FFmpeg-devel] [PATCH 7/7] avformat: deprecate AVFormatContext filename field
Signed-off-by: Marton Balint --- doc/APIchanges | 4 libavformat/avformat.h | 5 + libavformat/mux.c | 10 ++ libavformat/utils.c| 8 libavformat/version.h | 3 +++ 5 files changed, 30 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index 4a91b7460a..9593f647cc 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -16,6 +16,10 @@ libavutil: 2017-10-21 API changes, most recent first: 2018-xx-xx - xxx - lavf 58.4.100 - avformat.h + Deprecate AVFormatContext filename field which had limited length, use the + new dynamically allocated url field instead. + +2018-xx-xx - xxx - lavf 58.4.100 - avformat.h Add url field to AVFormatContext and add ff_format_set_url helper function. 2018-01-xx - xxx - lavfi 7.11.101 - avfilter.h diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 9fa25abd90..05f742f46c 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1382,13 +1382,18 @@ typedef struct AVFormatContext { */ AVStream **streams; +#if FF_API_FORMAT_FILENAME /** * input or output filename * * - demuxing: set by avformat_open_input() * - muxing: may be set by the caller before avformat_write_header() + * + * @deprecated Use url instead. */ +attribute_deprecated char filename[1024]; +#endif /** * input or output URL. Unlike the old filename field, this field has no diff --git a/libavformat/mux.c b/libavformat/mux.c index de63f2ca25..a13f0e3a1b 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -187,7 +187,11 @@ int avformat_alloc_output_context2(AVFormatContext **avctx, AVOutputFormat *ofor s->priv_data = NULL; if (filename) { +#if FF_API_FORMAT_FILENAME +FF_DISABLE_DEPRECATION_WARNINGS av_strlcpy(s->filename, filename, sizeof(s->filename)); +FF_ENABLE_DEPRECATION_WARNINGS +#endif if (!(s->url = av_strdup(filename))) goto nomem; @@ -255,7 +259,13 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options) (ret = av_opt_set_dict2(s->priv_data, &tmp, AV_OPT_SEARCH_CHILDREN)) < 0) goto fail; +#if FF_API_FORMAT_FILENAME +FF_DISABLE_DEPRECATION_WARNINGS if (!s->url && !(s->url = av_strdup(s->filename))) { +FF_ENABLE_DEPRECATION_WARNINGS +#else +if (!s->url && !(s->url = av_strdup(""))) { +#endif ret = AVERROR(ENOMEM); goto fail; } diff --git a/libavformat/utils.c b/libavformat/utils.c index a74046591e..c9136a3a3b 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -556,7 +556,11 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, goto fail; } +#if FF_API_FORMAT_FILENAME +FF_DISABLE_DEPRECATION_WARNINGS av_strlcpy(s->filename, filename ? filename : "", sizeof(s->filename)); +FF_ENABLE_DEPRECATION_WARNINGS +#endif if ((ret = init_input(s, filename, &tmp)) < 0) goto fail; s->probe_score = ret; @@ -5636,5 +5640,9 @@ void ff_format_set_url(AVFormatContext *s, char *url) av_assert0(url); av_freep(&s->url); s->url = url; +#if FF_API_FORMAT_FILENAME +FF_DISABLE_DEPRECATION_WARNINGS av_strlcpy(s->filename, url, sizeof(s->filename)); +FF_ENABLE_DEPRECATION_WARNINGS +#endif } diff --git a/libavformat/version.h b/libavformat/version.h index 49b9906a20..72ae400636 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -82,6 +82,9 @@ #ifndef FF_API_OLD_AVIO_EOF_0 #define FF_API_OLD_AVIO_EOF_0 (LIBAVFORMAT_VERSION_MAJOR < 59) #endif +#ifndef FF_API_FORMAT_FILENAME +#define FF_API_FORMAT_FILENAME (LIBAVFORMAT_VERSION_MAJOR < 59) +#endif #ifndef FF_API_R_FRAME_RATE -- 2.13.6 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avfilter/formats: remove support for deprecated channel count specification
Signed-off-by: Marton Balint --- libavfilter/formats.c | 12 ++-- tests/ref/fate/filter-formats | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 20a2c89719..31ee445c49 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -662,20 +662,12 @@ int ff_parse_sample_rate(int *ret, const char *arg, void *log_ctx) int ff_parse_channel_layout(int64_t *ret, int *nret, const char *arg, void *log_ctx) { -char *tail; int64_t chlayout; int nb_channels; if (av_get_extended_channel_layout(arg, &chlayout, &nb_channels) < 0) { -/* [TEMPORARY 2016-12 -> 2017-12]*/ -nb_channels = strtol(arg, &tail, 10); -if (!errno && *tail == 'c' && *(tail + 1) == '\0' && nb_channels > 0 && nb_channels < 64) { -chlayout = 0; -av_log(log_ctx, AV_LOG_WARNING, "Deprecated channel count specification '%s'. This will stop working in releases made in 2018 and after.\n", arg); -} else { -av_log(log_ctx, AV_LOG_ERROR, "Invalid channel layout '%s'\n", arg); -return AVERROR(EINVAL); -} +av_log(log_ctx, AV_LOG_ERROR, "Invalid channel layout '%s'\n", arg); +return AVERROR(EINVAL); } if (!chlayout && !nret) { av_log(log_ctx, AV_LOG_ERROR, "Unknown channel layout '%s' is not supported.\n", arg); diff --git a/tests/ref/fate/filter-formats b/tests/ref/fate/filter-formats index ea85eed23d..17ff5b222f 100644 --- a/tests/ref/fate/filter-formats +++ b/tests/ref/fate/filter-formats @@ -75,7 +75,7 @@ quad(side) 0 = ff_parse_channel_layout(0004, 1, 1c); 0 = ff_parse_channel_layout(0003, 2, 2c); -1 = ff_parse_channel_layout(, -1, -1c); -0 = ff_parse_channel_layout(, 60, 60c); +-1 = ff_parse_channel_layout(, -1, 60c); -1 = ff_parse_channel_layout(, -1, 65c); 0 = ff_parse_channel_layout(, 2, 2C); 0 = ff_parse_channel_layout(, 60, 60C); -- 2.13.6 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/mediacodecdec: remove mediacodec_process_data() indirection
On Wed, Jan 03, 2018 at 04:53:07PM -0800, Aman Gupta wrote: > On Wed, Jan 3, 2018 at 4:17 AM, Matthieu Bouron > wrote: > > > --- > > libavcodec/mediacodecdec.c | 11 +-- > > 1 file changed, 1 insertion(+), 10 deletions(-) > > > > diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c > > index b698ceaef9..c0e91c9429 100644 > > --- a/libavcodec/mediacodecdec.c > > +++ b/libavcodec/mediacodecdec.c > > @@ -415,15 +415,6 @@ done: > > return ret; > > } > > > > - > > -static int mediacodec_process_data(AVCodecContext *avctx, AVFrame *frame, > > - int *got_frame, AVPacket *pkt) > > -{ > > -MediaCodecH264DecContext *s = avctx->priv_data; > > - > > -return ff_mediacodec_dec_decode(avctx, s->ctx, frame, got_frame, > > pkt); > > -} > > - > > static int mediacodec_decode_frame(AVCodecContext *avctx, void *data, > > int *got_frame, AVPacket *avpkt) > > { > > @@ -489,7 +480,7 @@ static int mediacodec_decode_frame(AVCodecContext > > *avctx, void *data, > > av_fifo_generic_read(s->fifo, &s->buffered_pkt, > > sizeof(s->buffered_pkt), NULL); > > } > > > > -ret = mediacodec_process_data(avctx, frame, got_frame, > > &s->buffered_pkt); > > +ret = ff_mediacodec_dec_decode(avctx, s->ctx, frame, got_frame, > > &s->buffered_pkt); > > if (ret < 0) > > return ret; > > > > LGTM Patch applied. -- Matthieu B. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/mediacodec_wrapper: allocate MediaCodec.BufferInfo once
On Wed, Jan 03, 2018 at 04:53:39PM -0800, Aman Gupta wrote: > On Wed, Jan 3, 2018 at 6:05 AM, Matthieu Bouron > wrote: > > > --- > > libavcodec/mediacodec_wrapper.c | 61 +++--- > > --- > > 1 file changed, 34 insertions(+), 27 deletions(-) > > > > diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_ > > wrapper.c > > index d9f0e27a7d..dbc37bf463 100644 > > --- a/libavcodec/mediacodec_wrapper.c > > +++ b/libavcodec/mediacodec_wrapper.c > > @@ -274,6 +274,7 @@ struct FFAMediaCodec { > > struct JNIAMediaCodecFields jfields; > > > > jobject object; > > +jobject buffer_info; > > > > jobject input_buffers; > > jobject output_buffers; > > @@ -1143,6 +1144,7 @@ static inline FFAMediaCodec *codec_create(int > > method, const char *arg) > > FFAMediaCodec *codec = NULL; > > jstring jarg = NULL; > > jobject object = NULL; > > +jobject buffer_info = NULL; > > jmethodID create_id = NULL; > > > > codec = av_mallocz(sizeof(FFAMediaCodec)); > > @@ -1195,6 +1197,16 @@ static inline FFAMediaCodec *codec_create(int > > method, const char *arg) > > codec->has_get_i_o_buffer = 1; > > } > > > > +buffer_info = (*env)->NewObject(env, codec->jfields.mediainfo_class, > > codec->jfields.init_id); > > +if (ff_jni_exception_check(env, 1, codec) < 0) { > > +goto fail; > > +} > > + > > +codec->buffer_info = (*env)->NewGlobalRef(env, buffer_info); > > +if (!codec->buffer_info) { > > +goto fail; > > +} > > + > > ret = 0; > > fail: > > if (jarg) { > > @@ -1205,10 +1217,19 @@ fail: > > (*env)->DeleteLocalRef(env, object); > > } > > > > +if (buffer_info) { > > +(*env)->DeleteLocalRef(env, buffer_info); > > +} > > + > > if (ret < 0) { > > if (codec->object) { > > (*env)->DeleteGlobalRef(env, codec->object); > > } > > + > > +if (codec->buffer_info) { > > +(*env)->DeleteGlobalRef(env, codec->buffer_info); > > +} > > + > > ff_jni_reset_jfields(env, &codec->jfields, > > jni_amediacodec_mapping, 1, codec); > > av_freep(&codec); > > } > > @@ -1246,6 +1267,9 @@ int ff_AMediaCodec_delete(FFAMediaCodec* codec) > > (*env)->DeleteGlobalRef(env, codec->object); > > codec->object = NULL; > > > > +(*env)->DeleteGlobalRef(env, codec->buffer_info); > > +codec->buffer_info = NULL; > > + > > ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, > > 1, codec); > > > > av_freep(&codec); > > @@ -1413,48 +1437,31 @@ ssize_t > > ff_AMediaCodec_dequeueOutputBuffer(FFAMediaCodec* > > codec, FFAMediaCodecBu > > int ret = 0; > > JNIEnv *env = NULL; > > > > -jobject mediainfo = NULL; > > - > > JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL); > > > > -mediainfo = (*env)->NewObject(env, codec->jfields.mediainfo_class, > > codec->jfields.init_id); > > +ret = (*env)->CallIntMethod(env, codec->object, > > codec->jfields.dequeue_output_buffer_id, codec->buffer_info, timeoutUs); > > if (ff_jni_exception_check(env, 1, codec) < 0) { > > -ret = AVERROR_EXTERNAL; > > -goto fail; > > +return AVERROR_EXTERNAL; > > } > > > > -ret = (*env)->CallIntMethod(env, codec->object, > > codec->jfields.dequeue_output_buffer_id, mediainfo, timeoutUs); > > +info->flags = (*env)->GetIntField(env, codec->buffer_info, > > codec->jfields.flags_id); > > if (ff_jni_exception_check(env, 1, codec) < 0) { > > -ret = AVERROR_EXTERNAL; > > -goto fail; > > +return AVERROR_EXTERNAL; > > } > > > > -info->flags = (*env)->GetIntField(env, mediainfo, > > codec->jfields.flags_id); > > +info->offset = (*env)->GetIntField(env, codec->buffer_info, > > codec->jfields.offset_id); > > if (ff_jni_exception_check(env, 1, codec) < 0) { > > -ret = AVERROR_EXTERNAL; > > -goto fail; > > +return AVERROR_EXTERNAL; > > } > > > > -info->offset = (*env)->GetIntField(env, mediainfo, > > codec->jfields.offset_id); > > +info->presentationTimeUs = (*env)->GetLongField(env, > > codec->buffer_info, codec->jfields.presentation_time_us_id); > > if (ff_jni_exception_check(env, 1, codec) < 0) { > > -ret = AVERROR_EXTERNAL; > > -goto fail; > > +return AVERROR_EXTERNAL; > > } > > > > -info->presentationTimeUs = (*env)->GetLongField(env, mediainfo, > > codec->jfields.presentation_time_us_id); > > +info->size = (*env)->GetIntField(env, codec->buffer_info, > > codec->jfields.size_id); > > if (ff_jni_exception_check(env, 1, codec) < 0) { > > -ret = AVERROR_EXTERNAL; > > -goto fail; > > -} > > - > > -info->size = (*env)->GetIntField(env, mediainfo, > > codec->jfields.size_id); > > -if (ff_jni_exception_check(env, 1, codec) < 0) { > > -ret = AVERROR_EXTERNAL; > > -goto fail; > > -
Re: [FFmpeg-devel] [PATCH v2] libavcodec/mediacodecdec: switch to new decoder api
On Wed, Jan 03, 2018 at 04:54:28PM -0800, Aman Gupta wrote: > On Wed, Jan 3, 2018 at 3:25 AM, Matthieu Bouron > wrote: > > > On Thu, Dec 28, 2017 at 05:33:14PM -0800, Aman Gupta wrote: > > > From: Aman Gupta > > > > > > Using the new API gives the decoder the ability to produce > > > N frames per input packet. This is particularly useful with > > > mpeg2 decoders on some android devices, which automatically > > > deinterlace video and produce one frame per field. > > > > > > Signed-off-by: Aman Gupta > > > --- > > > libavcodec/mediacodecdec.c | 77 +++--- > > > > > 1 file changed, 45 insertions(+), 32 deletions(-) > > > > Hi, > > > > Thanks for the patch. > > > > I'm attaching a new version of your patch. The new version fixes some > > issues that appear while seeking or when the decoder reaches EOF. > > > > The following comments correspond to the changes I made in the new patch > > (except for a few minor cosmetics like = {0}; -> = { 0 };). > > > > > > > > diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c > > > index b698ceaef9..90497c64da 100644 > > > --- a/libavcodec/mediacodecdec.c > > > +++ b/libavcodec/mediacodecdec.c > > > @@ -31,6 +31,7 @@ > > > #include "libavutil/pixfmt.h" > > > > > > #include "avcodec.h" > > > +#include "decode.h" > > > #include "h264_parse.h" > > > #include "hevc_parse.h" > > > #include "hwaccel.h" > > > @@ -424,29 +425,13 @@ static int mediacodec_process_data(AVCodecContext > > *avctx, AVFrame *frame, > > > return ff_mediacodec_dec_decode(avctx, s->ctx, frame, got_frame, > > pkt); > > > } > > > > > > -static int mediacodec_decode_frame(AVCodecContext *avctx, void *data, > > > - int *got_frame, AVPacket *avpkt) > > > +static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame > > *frame) > > > { > > > MediaCodecH264DecContext *s = avctx->priv_data; > > > -AVFrame *frame= data; > > > int ret; > > > - > > > -/* buffer the input packet */ > > > -if (avpkt->size) { > > > -AVPacket input_pkt = { 0 }; > > > - > > > -if (av_fifo_space(s->fifo) < sizeof(input_pkt)) { > > > -ret = av_fifo_realloc2(s->fifo, > > > - av_fifo_size(s->fifo) + > > sizeof(input_pkt)); > > > -if (ret < 0) > > > -return ret; > > > -} > > > - > > > -ret = av_packet_ref(&input_pkt, avpkt); > > > -if (ret < 0) > > > -return ret; > > > -av_fifo_generic_write(s->fifo, &input_pkt, sizeof(input_pkt), > > NULL); > > > -} > > > +int got_frame = 0; > > > +int is_eof = 0; > > > +AVPacket pkt = {0}; > > > > > > /* > > > * MediaCodec.flush() discards both input and output buffers, thus > > we > > > @@ -470,26 +455,51 @@ static int mediacodec_decode_frame(AVCodecContext > > *avctx, void *data, > > > */ > > > if (ff_mediacodec_dec_is_flushing(avctx, s->ctx)) { > > > if (!ff_mediacodec_dec_flush(avctx, s->ctx)) { > > > -return avpkt->size; > > > +return 0; > > > } > > > +return AVERROR(EAGAIN); > > > > You should only return AVERROR(EAGAIN) if ff_mediacodec_dec_flush returns > > 0: > > if (ff_mediacodec_dec_is_flushing(avctx, s->ctx)) { > > if (!ff_mediacodec_dec_flush(avctx, s->ctx)) { > > return AVERROR(EAGAIN); > > } > > } > > > > > +} > > > + > > > +ret = ff_decode_get_packet(avctx, &pkt); > > > +if (ret == AVERROR_EOF) > > > +is_eof = 1; > > > +else if (ret == AVERROR(EAGAIN)) > > > +; // no input packet, but fallthrough to check for pending > > frames > > > +else if (ret < 0) > > > +return ret; > > > + > > > +/* buffer the input packet */ > > > +if (pkt.size) { > > > +if (av_fifo_space(s->fifo) < sizeof(pkt)) { > > > +ret = av_fifo_realloc2(s->fifo, > > > + av_fifo_size(s->fifo) + sizeof(pkt)); > > > +if (ret < 0) { > > > +av_packet_unref(&pkt); > > > +return ret; > > > +} > > > +} > > > +av_fifo_generic_write(s->fifo, &pkt, sizeof(pkt), NULL); > > > } > > > > > > /* process buffered data */ > > > -while (!*got_frame) { > > > +while (!got_frame) { > > > /* prepare the input data */ > > > if (s->buffered_pkt.size <= 0) { > > > av_packet_unref(&s->buffered_pkt); > > > > > > /* no more data */ > > > if (av_fifo_size(s->fifo) < sizeof(AVPacket)) { > > > -return avpkt->size ? avpkt->size : > > > -ff_mediacodec_dec_decode(avctx, s->ctx, frame, > > got_frame, avpkt); > > > +AVPacket null_pkt = {0}; > > > +if (is_eof) > > > +return ff_mediacodec_dec_decode(avctx, s->ctx, > > frame, > > > +
Re: [FFmpeg-devel] [PATCH] FFV1: make RGB48 support as non-experimental
On Sat, Jan 06, 2018 at 04:54:18PM +0100, Jerome Martinez wrote: > On 06/01/2018 02:05, Michael Niedermayer wrote: > > > >> ffv1enc.c |4 > >> 1 file changed, 4 deletions(-) > >>acfc60c913b311b148f2eeef2d2d6ea9e37afcf7 > >>0001-avcodec-ffv1enc-mark-RGB48-support-as-non-experiment.patch > >> From 303f63fb7e6172fdb7de66da1f8a4006b79a535f Mon Sep 17 00:00:00 2001 > >>From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Martinez?= > >>Date: Fri, 5 Jan 2018 11:09:01 +0100 > >>Subject: [PATCH] avcodec/ffv1enc: mark RGB48 support as non-experimental > >> > >>Resulting bitstream was tested with a conformance checker > >>using the last draft of FFV1 specifications. > >But has the way this is stored been optimized ? > > > >Once its marked as non exerimental all future decoders must support the exact > >way. > > Although this is considered experimental in the encoder, the implementation > adheres to the description in the specification. The bitstream specification > does not provide a bitdepth limit so with the current draft of the > specification, another FFV1 encoder could already encode 16-bit (and more) > content. The work on the specification has been careful to not break > compatibility with former drafts and at this point the FFV1 bitstream > specification for versions 0, 1, and 3 should be considered already > non-experimental for all bit depths. All current decoders should already > support the exact way it is currently specified. > > To make a change in the specification at this point would have cascading > consequences as we’d have to retract the part of the specification which > states that micro_version 4 of version 3 is the first stable variant. Worse, > it is impossible to indicate a bitstream change in FFV1 version 1, which > permits RGB 16-bit content too, so it would be difficult for a decoder to > detect a bitstream not conforming to the bitstream created by the current > version of FFmpeg encoder. Are you not making this look alot more complex than it is ? Or maybe we talk about slightly different things here with the next version we can introduce any method of storing 16bit or 9-15 bit and we certainly do not support in the implementation all possible bit depths From what i remember I had always wanted to improve the way that more than 8bit is handled, not just 16. Although 16 is a bit special Consider this: If we improve get_context() in the next version for >8bit we still have to support 9-15 bit with the old definition if we now declare 16bit non experimental then we also must support that with an old get_context() in the decoder. the 16bit path is seperate from the lower bit depth. So this is an Additional codepath that we have to carry in the future isnt it smarter now that if we want to improve get_context() that we dont now extend what can be generated with the current get_context ? or are such current get_context() style files already widespread ? if so then its probably best to accept it and keep supporting it > > > > > It can no longer then be changed, so we need to be really sure the design > >is optimal first. > >Are we ? > >who has checked alternatives? what where the reasons why the alternatives > >were not choosen? > >for example consider get_context(), what it does with >8bit may or may not > >be optimal > >iam interrested to work on that in fact, ive a quite long and growing list > >of other volunteer jobs to do though ... > > bitdepths >8bit have been well-used for years since many of them have long > been marked as non-experimental (for instance 10bit is frequently used with > lossless encoding of broadcast media and video from analog tape sources). In > my opinion get_context() is specified for all bitdpeths and non-experimental > for FFV1 versions 0, 1, and 3 by the specification work and it should not be > changed in these versions. what get_context does was designed for 8bit, it should still be good enough for 10bit and maybe 12 but as the bit depth gets larger i suspect get_context becomes less optimal and there is more potential to improve compression by changing it. > > For the encoder there may still be an opportunity to optimize while > continuing to conform to the FFV1 versions 0, 1, and 3 bitstream > specification, even if the encoder marks RGB48 as non-experimental. > Additionally FFV1 version 4 or later could consider further optimization > requesting a change in the FFV1 bitstream as version 4 has no stable > micro_version and the entire version is in an experimental status. > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Asymptotically faster algorithms should always be preferred if you have asymptotical amounts of data signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http:
Re: [FFmpeg-devel] [PATCH] FFV1: make RGB48 support as non-experimental
On Sat, Jan 06, 2018 at 05:01:42PM +0100, Reto Kromer wrote: > Michael Niedermayer wrote: > > >>Resulting bitstream was tested with a conformance checker > >>using the last draft of FFV1 specifications. > > > >But has the way this is stored been optimized ? > > > >Once its marked as non exerimental all future decoders must > >support the exact way. It can no longer then be changed, so we > >need to be really sure the design is optimal first. > >Are we ? > >who has checked alternatives? what where the reasons why the > >alternatives were not choosen? > >for example consider get_context(), what it does with >8bit may > >or may not be optimal > >iam interrested to work on that in fact, ive a quite long and > >growing list of other volunteer jobs to do though ... > > Hmm... I am a little surprised about this, as I paid EUR 2000 in > 2016 for implementing the RGB48 support in FFV1. And I didn't it > just for having less money in my pocket, but explicitly for the > benefit of the community. > > As I already said in other contexts, the experimental flag is > actually avoiding a larger use of FFV1 in the archival > community. As long as this flag is present, many film archives > simply cannot adopt FFV1 for film preservation. That's my point. > Therefore I support making the RGB48 support non-experimental. Yes, the flag is annoying. I kind of want to make teh design perfect before removing the experimental check but maybe thats not reasonable i dont know [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Elect your leaders based on what they did after the last election, not based on what they say before an election. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 5/5] aptx: add raw muxer and demuxer for aptX HD
On Sat, Jan 06, 2018 at 05:48:08PM +0100, Aurelien Jacobs wrote: > --- > Changelog| 2 +- > libavformat/Makefile | 2 ++ > libavformat/allformats.c | 1 + > libavformat/aptxdec.c| 51 > > libavformat/rawenc.c | 13 > 5 files changed, 64 insertions(+), 5 deletions(-) [...] > @@ -66,6 +94,7 @@ static const AVClass aptx_demuxer_class = { > .version= LIBAVUTIL_VERSION_INT, > }; > > +#if CONFIG_APTX_MUXER > AVInputFormat ff_aptx_demuxer = { > .name = "aptx", > .long_name = NULL_IF_CONFIG_SMALL("raw aptX"), > @@ -76,3 +105,17 @@ AVInputFormat ff_aptx_demuxer = { > .flags = AVFMT_GENERIC_INDEX, > .priv_class = &aptx_demuxer_class, [...] > +.priv_class = &aptx_demuxer_class, this cause the code (for example fate) to infinite loop [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you think the mosad wants you dead since a long time then you are either wrong or dead since a long time. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/5] aptx: simplify by pre-calculating factor_max
On Sat, Jan 06, 2018 at 05:48:04PM +0100, Aurelien Jacobs wrote: > --- > libavcodec/aptx.c | 16 +++- > 1 file changed, 7 insertions(+), 9 deletions(-) LGTM btw MAINTAINERS has no entry for aptx.c, you might want to post a patch that adds you to it [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Freedom in capitalist society always remains about the same as it was in ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/5] aptx: factorize FFABS calculation
On Sat, Jan 06, 2018 at 05:48:05PM +0100, Aurelien Jacobs wrote: > --- > libavcodec/aptx.c | 8 +--- > 1 file changed, 5 insertions(+), 3 deletions(-) LGTM thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/4] avformat/libopenmpt: Fix mixed code and declarations
On Sat, Jan 06, 2018 at 11:07:05AM +0100, Jörn Heusipp wrote: > Signed-off-by: Jörn Heusipp > --- > libavformat/libopenmpt.c | 11 ++- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/libavformat/libopenmpt.c b/libavformat/libopenmpt.c > index af6eb1a..2e22290 100644 > --- a/libavformat/libopenmpt.c > +++ b/libavformat/libopenmpt.c > @@ -72,13 +72,14 @@ static int read_header_openmpt(AVFormatContext *s) > { > AVStream *st; > OpenMPTContext *openmpt = s->priv_data; > -int64_t size = avio_size(s->pb); > -if (size <= 0) > -return AVERROR_INVALIDDATA; > -char *buf = av_malloc(size); > +int64_t size; > +char *buf; > int ret; > > - > +size = avio_size(s->pb); you dont have to split this but LGTM either way [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you fake or manipulate statistics in a paper in physics you will never get a job again. If you fake or manipulate statistics in a paper in medicin you will get a job for life at the pharma industry. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avcodec/h264_slice: Do not attempt to render into frames already output
On Wed, Jan 03, 2018 at 11:42:01PM +0100, Michael Niedermayer wrote: > Fixes: null pointer dereference > Fixes: 4698/clusterfuzz-testcase-minimized-5096956322906112 > > This testcase does not reproduce the issue before > 03b82b3ab9883cef017e513c7d0b3b986b3b3e7b > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/h264_slice.c | 6 ++ > 1 file changed, 6 insertions(+) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Observe your enemies, for they first find out your faults. -- Antisthenes signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/opus_parser: Check payload_len in parse_opus_ts_header()
Fixes: clusterfuzz-testcase-minimized-6134545979277312 Fixes: crbug 797469 Reported-by: Matt Wolenetz Signed-off-by: Michael Niedermayer --- libavcodec/opus_parser.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/libavcodec/opus_parser.c b/libavcodec/opus_parser.c index 893573eb82..28b0933900 100644 --- a/libavcodec/opus_parser.c +++ b/libavcodec/opus_parser.c @@ -43,6 +43,7 @@ static const uint8_t *parse_opus_ts_header(const uint8_t *start, int *payload_le const uint8_t *buf = start + 1; int start_trim_flag, end_trim_flag, control_extension_flag, control_extension_length; uint8_t flags; +uint64_t payload_len_tmp; GetByteContext gb; bytestream2_init(&gb, buf, buf_len); @@ -52,11 +53,11 @@ static const uint8_t *parse_opus_ts_header(const uint8_t *start, int *payload_le end_trim_flag = (flags >> 3) & 1; control_extension_flag = (flags >> 2) & 1; -*payload_len = 0; +payload_len_tmp = *payload_len = 0; while (bytestream2_peek_byte(&gb) == 0xff) -*payload_len += bytestream2_get_byte(&gb); +payload_len_tmp += bytestream2_get_byte(&gb); -*payload_len += bytestream2_get_byte(&gb); +payload_len_tmp += bytestream2_get_byte(&gb); if (start_trim_flag) bytestream2_skip(&gb, 2); @@ -67,6 +68,11 @@ static const uint8_t *parse_opus_ts_header(const uint8_t *start, int *payload_le bytestream2_skip(&gb, control_extension_length); } +if (bytestream2_tell(&gb) + payload_len_tmp > buf_len) +return NULL; + +*payload_len = payload_len_tmp; + return buf + bytestream2_tell(&gb); } @@ -104,6 +110,10 @@ static int opus_find_frame_end(AVCodecParserContext *ctx, AVCodecContext *avctx, state = (state << 8) | payload[i]; if ((state & OPUS_TS_MASK) == OPUS_TS_HEADER) { payload = parse_opus_ts_header(payload, &payload_len, buf_size - i); +if (!payload) { +av_log(avctx, AV_LOG_ERROR, "Error parsing Ogg TS header.\n"); +return AVERROR_INVALIDDATA; +} *header_len = payload - buf; start_found = 1; break; -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: check SDL2 function with a header
Ping ? KO Myung-Hun wrote: > Hi/2. > > Derek Buitenhuis wrote: >> On 12/29/2017 6:36 AM, KO Myung-Hun wrote: >>> Sorry about that. >>> >>> SDL2 uses SDLCALL to specify a calling convention. On OS/2, it's defined >>> to `_System' which is similar to `_cdecl' but does not prepend '_'. >>> >>> After all, without a header, a function is used without `_System'. And >>> linker will try to `_func' but fail because the function is `func' not >>> `_func'. >> >> Thanks for the explanation. Patch LGTM with this added to the commit message. >> > > Updated. > > > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel -- KO Myung-Hun Using Mozilla SeaMonkey 2.7.2 Under OS/2 Warp 4 for Korean with FixPak #15 In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM Korean OS/2 User Community : http://www.os2.kr/ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: check SDL2 function with a header
On 1/7/2018 12:07 AM, KO Myung-Hun wrote: > Ping ? > > KO Myung-Hun wrote: >> Hi/2. >> >> Derek Buitenhuis wrote: >>> On 12/29/2017 6:36 AM, KO Myung-Hun wrote: Sorry about that. SDL2 uses SDLCALL to specify a calling convention. On OS/2, it's defined to `_System' which is similar to `_cdecl' but does not prepend '_'. After all, without a header, a function is used without `_System'. And linker will try to `_func' but fail because the function is `func' not `_func'. >>> >>> Thanks for the explanation. Patch LGTM with this added to the commit >>> message. >>> >> >> Updated. Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] kavcodec/jpeg2000dsp: Fix integer overflows in ict_int()
Fixes: signed integer overflow: 46802 * -71230 cannot be represented in type 'int' Fixes: 4756/clusterfuzz-testcase-minimized-4812495563784192 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/jpeg2000dsp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/jpeg2000dsp.c b/libavcodec/jpeg2000dsp.c index 85a12d0e9b..90e73b1e20 100644 --- a/libavcodec/jpeg2000dsp.c +++ b/libavcodec/jpeg2000dsp.c @@ -64,9 +64,9 @@ static void ict_int(void *_src0, void *_src1, void *_src2, int csize) int i; for (i = 0; i < csize; i++) { -i0 = *src0 + *src2 + (((26345 * *src2) + (1 << 15)) >> 16); +i0 = *src0 + *src2 + ((int)((26345U * *src2) + (1 << 15)) >> 16); i1 = *src0 - ((int)(((unsigned)i_ict_params[1] * *src1) + (1 << 15)) >> 16) - - (((i_ict_params[2] * *src2) + (1 << 15)) >> 16); + - ((int)(((unsigned)i_ict_params[2] * *src2) + (1 << 15)) >> 16); i2 = *src0 + (2 * *src1) + ((int)((-14942U * *src1) + (1 << 15)) >> 16); *src0++ = i0; *src1++ = i1; -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] compat/os2threads: support static mutexes
Ping ? KO Myung-Hun wrote: > --- > compat/os2threads.h | 14 -- > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/compat/os2threads.h b/compat/os2threads.h > index 40a119ffe1..2177a033ec 100644 > --- a/compat/os2threads.h > +++ b/compat/os2threads.h > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 2011 KO Myung-Hun > + * Copyright (c) 2011-2017 KO Myung-Hun > * > * This file is part of FFmpeg. > * > @@ -46,9 +46,11 @@ typedef struct { > > typedef void pthread_attr_t; > > -typedef HMTX pthread_mutex_t; > +typedef _fmutex pthread_mutex_t; > typedef void pthread_mutexattr_t; > > +#define PTHREAD_MUTEX_INITIALIZER _FMUTEX_INITIALIZER > + > typedef struct { > HEV event_sem; > HEV ack_sem; > @@ -98,28 +100,28 @@ static av_always_inline int pthread_join(pthread_t > thread, void **value_ptr) > static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, > const pthread_mutexattr_t > *attr) > { > -DosCreateMutexSem(NULL, (PHMTX)mutex, 0, FALSE); > +_fmutex_create(mutex, 0); > > return 0; > } > > static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex) > { > -DosCloseMutexSem(*(PHMTX)mutex); > +_fmutex_close(mutex); > > return 0; > } > > static av_always_inline int pthread_mutex_lock(pthread_mutex_t *mutex) > { > -DosRequestMutexSem(*(PHMTX)mutex, SEM_INDEFINITE_WAIT); > +_fmutex_request(mutex, 0); > > return 0; > } > > static av_always_inline int pthread_mutex_unlock(pthread_mutex_t *mutex) > { > -DosReleaseMutexSem(*(PHMTX)mutex); > +_fmutex_release(mutex); > > return 0; > } -- KO Myung-Hun Using Mozilla SeaMonkey 2.7.2 Under OS/2 Warp 4 for Korean with FixPak #15 In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM Korean OS/2 User Community : http://www.os2.kr/ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] avcodec/h264addpx_template: Fixes integer overflows
Fixes: signed integer overflow: 512 + 2147483491 cannot be represented in type 'int' Fixes: 4780/clusterfuzz-testcase-minimized-4709066174627840 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/h264addpx_template.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libavcodec/h264addpx_template.c b/libavcodec/h264addpx_template.c index b71aaea439..9a1e6a2f2f 100644 --- a/libavcodec/h264addpx_template.c +++ b/libavcodec/h264addpx_template.c @@ -35,10 +35,10 @@ static void FUNCC(ff_h264_add_pixels4)(uint8_t *_dst, int16_t *_src, int stride) stride /= sizeof(pixel); for (i = 0; i < 4; i++) { -dst[0] += src[0]; -dst[1] += src[1]; -dst[2] += src[2]; -dst[3] += src[3]; +dst[0] += (unsigned)src[0]; +dst[1] += (unsigned)src[1]; +dst[2] += (unsigned)src[2]; +dst[3] += (unsigned)src[3]; dst += stride; src += 4; @@ -55,14 +55,14 @@ static void FUNCC(ff_h264_add_pixels8)(uint8_t *_dst, int16_t *_src, int stride) stride /= sizeof(pixel); for (i = 0; i < 8; i++) { -dst[0] += src[0]; -dst[1] += src[1]; -dst[2] += src[2]; -dst[3] += src[3]; -dst[4] += src[4]; -dst[5] += src[5]; -dst[6] += src[6]; -dst[7] += src[7]; +dst[0] += (unsigned)src[0]; +dst[1] += (unsigned)src[1]; +dst[2] += (unsigned)src[2]; +dst[3] += (unsigned)src[3]; +dst[4] += (unsigned)src[4]; +dst[5] += (unsigned)src[5]; +dst[6] += (unsigned)src[6]; +dst[7] += (unsigned)src[7]; dst += stride; src += 8; -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] compat/os2threads: support static mutexes
On 1/7/2018 12:07 AM, KO Myung-Hun wrote: > Ping ? > > KO Myung-Hun wrote: >> --- >> compat/os2threads.h | 14 -- >> 1 file changed, 8 insertions(+), 6 deletions(-) >> Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] kavcodec/jpeg2000dsp: Fix integer overflows in ict_int()
2018-01-07 4:12 GMT+01:00 Michael Niedermayer : > Fixes: signed integer overflow: 46802 * -71230 cannot be represented in type > 'int' > Fixes: 4756/clusterfuzz-testcase-minimized-4812495563784192 First letter of commit message... Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] fate/filter-video: fix 12 bit framerate filter tests on big endian targets
Signed-off-by: James Almer --- tests/fate/filter-video.mak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index 39442f6717..bf6e2c6f84 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -114,8 +114,8 @@ fate-filter-framerate-up: CMD = framecrc -lavfi testsrc2=r=2:d=10,framerate=fps= fate-filter-framerate-down: CMD = framecrc -lavfi testsrc2=r=2:d=10,framerate=fps=1 -t 1 FATE_FILTER-$(call ALLYES, FRAMERATE_FILTER TESTSRC2_FILTER FORMAT_FILTER) += fate-filter-framerate-12bit-up fate-filter-framerate-12bit-down -fate-filter-framerate-12bit-up: CMD = framecrc -lavfi testsrc2=r=50:d=1,format=pix_fmts=yuv422p12,framerate=fps=60 -t 1 -fate-filter-framerate-12bit-down: CMD = framecrc -lavfi testsrc2=r=60:d=1,format=pix_fmts=yuv422p12,framerate=fps=50 -t 1 +fate-filter-framerate-12bit-up: CMD = framecrc -lavfi testsrc2=r=50:d=1,format=pix_fmts=yuv422p12le,framerate=fps=60 -t 1 -pix_fmt yuv422p12le +fate-filter-framerate-12bit-down: CMD = framecrc -lavfi testsrc2=r=60:d=1,format=pix_fmts=yuv422p12le,framerate=fps=50 -t 1 -pix_fmt yuv422p12le FATE_FILTER_VSYNTH-$(CONFIG_BOXBLUR_FILTER) += fate-filter-boxblur fate-filter-boxblur: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf boxblur=2:1 -- 2.15.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec: increase AV_INPUT_BUFFER_PADDING_SIZE to 64
AVX-512 support has been introduced, and even if no functions currently use zmm registers (able to load as much as 64 bytes of consecutive data per instruction), they will be added eventually. Signed-off-by: James Almer --- Same rationale as when it was increased to 32 back in commit 67d29da4bd23057a1f646568442a77b844cb2d1b. libavcodec/avcodec.h | 2 +- libavcodec/x86/hevc_sao.asm | 2 +- libavcodec/x86/hevc_sao_10bit.asm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index c13deb599f..8fbbc798a2 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -767,7 +767,7 @@ typedef struct AVCodecDescriptor { * Note: If the first 23 bits of the additional bytes are not 0, then damaged * MPEG bitstreams could cause overread and segfault. */ -#define AV_INPUT_BUFFER_PADDING_SIZE 32 +#define AV_INPUT_BUFFER_PADDING_SIZE 64 /** * @ingroup lavc_encoding diff --git a/libavcodec/x86/hevc_sao.asm b/libavcodec/x86/hevc_sao.asm index 888a28afa7..756adfee57 100644 --- a/libavcodec/x86/hevc_sao.asm +++ b/libavcodec/x86/hevc_sao.asm @@ -198,7 +198,7 @@ HEVC_SAO_BAND_FILTER 64, 2 ;** %define MAX_PB_SIZE 64 -%define PADDING_SIZE 32 ; AV_INPUT_BUFFER_PADDING_SIZE +%define PADDING_SIZE 64 ; AV_INPUT_BUFFER_PADDING_SIZE %define EDGE_SRCSTRIDE 2 * MAX_PB_SIZE + PADDING_SIZE %macro HEVC_SAO_EDGE_FILTER_INIT 0 diff --git a/libavcodec/x86/hevc_sao_10bit.asm b/libavcodec/x86/hevc_sao_10bit.asm index f81e2d5033..b30583dd2f 100644 --- a/libavcodec/x86/hevc_sao_10bit.asm +++ b/libavcodec/x86/hevc_sao_10bit.asm @@ -190,7 +190,7 @@ HEVC_SAO_BAND_FILTER 12, 64, 4 ;** %define MAX_PB_SIZE 64 -%define PADDING_SIZE 32 ; AV_INPUT_BUFFER_PADDING_SIZE +%define PADDING_SIZE 64 ; AV_INPUT_BUFFER_PADDING_SIZE %define EDGE_SRCSTRIDE 2 * MAX_PB_SIZE + PADDING_SIZE %macro PMINUW 4 -- 2.15.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel