Re: [FFmpeg-devel] [PATCH 1/4] lavf: add directory listing API
On Mon, Mar 30, 2015 at 12:36:34AM +0200, Lukasz Marek wrote: On 29.03.2015 01:14, Mariusz Szczepańczyk wrote: diff --git a/doc/APIchanges b/doc/APIchanges index 3f153e9..814f752 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,15 @@ libavutil: 2014-08-09 API changes, most recent first: +2015-03-27 - 184084c - lavf 56.27.100 - avio.h url.h + New directory listing API. + + Add AVIODirEntryType enum. + Add AVIODirEntry, AVIODirContext structures. + Add avio_open_dir(), avio_read_dir(), avio_close_dir(), avio_free_directory_entry(). + Add ff_alloc_dir_entry(). + Extend URLProtocol with url_open_dir(), url_read_dir(), url_close_dir(). It can be simple add url_open_dir()..., but it is OK I think + 8 - FFmpeg 2.6 was cut here 8 - 2015-03-04 - cca4476 - lavf 56.25.100 diff --git a/libavformat/version.h b/libavformat/version.h index a183d7f..ff85227 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -30,7 +30,7 @@ #include libavutil/version.h #define LIBAVFORMAT_VERSION_MAJOR 56 -#define LIBAVFORMAT_VERSION_MINOR 26 +#define LIBAVFORMAT_VERSION_MINOR 27 Michaels, do you gonna merge it? this one still had a minor issue in the version number but if the next looks fine to you or you want to correct it yourself dont hesitate to apply it [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 3 Rare item - Common item with rare defect or maybe just a lie Professional - 'Toy' made in china, not functional except as doorstop Experts will know - The seller hopes you are not an expert signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/4] lavf: add directory listing API
On Sun, Mar 29, 2015 at 01:14:54AM +0100, Mariusz Szczepańczyk wrote: On Fri, Mar 27, 2015 at 6:52 PM, Michael Niedermayer michae...@gmx.at wrote: On Thu, Mar 26, 2015 at 03:31:27PM +0100, Mariusz Szczepańczyk wrote: On Thu, Mar 26, 2015 at 2:31 PM, Michael Niedermayer michae...@gmx.at wrote: On Thu, Mar 26, 2015 at 01:25:17AM +0100, Mariusz Szczepańczyk wrote: From: Lukasz Marek lukasz.m.lu...@gmail.com API allows protocol implementations to provide API that allows to list directory content. API is similar to POSIX opendir/readdir/closedir. --- libavformat/avio.c | 74 +++ libavformat/avio.h | 84 +- libavformat/url.c | 16 +++ libavformat/url.h | 10 +++ 4 files changed, 183 insertions(+), 1 deletion(-) diff --git a/libavformat/avio.c b/libavformat/avio.c index 4896782..51419cc 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -23,6 +23,7 @@ #include libavutil/dict.h #include libavutil/opt.h #include libavutil/time.h +#include libavutil/avassert.h #include os_support.h #include avformat.h #if CONFIG_NETWORK @@ -418,6 +419,79 @@ int avio_check(const char *url, int flags) return ret; } +int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options) +{ +URLContext *h = NULL; +AVIODirContext *ctx = NULL; +int ret; +av_assert0(s); + +ctx = av_mallocz(sizeof(*ctx)); +if (!ctx) { +ret = AVERROR(ENOMEM); +goto fail; +} + +if ((ret = ffurl_alloc(h, url, AVIO_FLAG_READ, NULL)) 0) +goto fail; + +if (h-prot-url_open_dir h-prot-url_read_dir h-prot-url_close_dir) { +if (options h-prot-priv_data_class +(ret = av_opt_set_dict(h-priv_data, options)) 0) +goto fail; +ret = h-prot-url_open_dir(h); +} else +ret = AVERROR(ENOSYS); +if (ret 0) +goto fail; + +ctx-url_context = h; +*s = ctx; +return 0; + + fail: +av_free(ctx); +*s = NULL; +ffurl_close(h); +return ret; +} + +int avio_read_dir(AVIODirContext *s, AVIODirEntry **next) +{ +URLContext *h; +int ret; + +if (!s || !s-url_context) +return EINVAL; i assume this is intended to be AVERROR(EINVAL) Yes, of course! Fixed. +h = s-url_context; +if ((ret = h-prot-url_read_dir(h, next)) 0) +avio_free_directory_entry(next); +return ret; +} + +int avio_close_dir(AVIODirContext **s) +{ +URLContext *h; + +av_assert0(s); +if (!(*s) || !(*s)-url_context) +return EINVAL; same as previous ditto [...] Mariusz avio.c | 74 + avio.h | 84 - url.c | 16 url.h | 10 +++ 4 files changed, 183 insertions(+), 1 deletion(-) 0289391026b4d7c3d698b7b47bd18045e9f14460 0001-lavf-add-directory-listing-API.patch From 628fa295d2710da56ba672ac0cb8502cafc27f82 Mon Sep 17 00:00:00 2001 From: Lukasz Marek lukasz.m.lu...@gmail.com Date: Sat, 5 Jul 2014 18:11:59 +0200 Subject: [PATCH 1/4] lavf: add directory listing API API allows protocol implementations to provide API that allows to list directory content. API is similar to POSIX opendir/readdir/closedir. --- libavformat/avio.c | 74 +++ libavformat/avio.h | 84 +- libavformat/url.c | 16 +++ libavformat/url.h | 10 +++ 4 files changed, 183 insertions(+), 1 deletion(-) theres no update to version.h and APIChanges but i think its actually good to wait with these a few days so if more comments come in we could still change the API but please add a patch that updates them I'm attaching the patch but I'm not completely sure whether it's correct. Please check it. applied this one thanks Regards, Mariusz doc/APIchanges|9 + libavformat/version.h |2 +- 2 files changed, 10 insertions(+), 1 deletion(-) 7830b83a5a5ae55f5f9189b0de95252c136499db 0001-lavf-Bump-minor-version-and-document-directory-listi.patch From 04da63e473b181d72dba909968ce28671ee5e5ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariusz=20Szczepa=C5=84czyk?= mszczepanc...@gmail.com Date: Sun, 29 Mar 2015 00:54:46 +0100
Re: [FFmpeg-devel] [PATCH 5/5] apng: Add a basic APNG muxer
On 29 March 2015 at 14:02, Carl Eugen Hoyos ceho...@ag.or.at wrote: Donny Yang work at kota.moe writes: +{ final_delay_num, Force delay numerator after the last frame, OFFSET(last_delay_num), + AV_OPT_TYPE_INT, { .i64 = 0 }, 0, USHRT_MAX, ENC }, +{ final_delay_den, Force delay denominator after the last frame, OFFSET(last_delay_den), + AV_OPT_TYPE_INT, { .i64 = 0 }, 0, USHRT_MAX, ENC }, Wouldn't AV_OPT_TYPE_RATIONAL help here? Yes ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavformat/hls: add an option to start from a given segment in a live stream
On Sat, Mar 28, 2015 at 06:27:35PM -0600, Rodger Combs wrote: --- libavformat/hls.c | 28 1 file changed, 24 insertions(+), 4 deletions(-) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Democracy is the form of government in which you can choose your dictator 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] libavformat/segment: add an option to write the header to a separate file
On Sat, Mar 28, 2015 at 07:25:20PM -0600, Rodger Combs wrote: This permits some interesting segmenting techniques with formats like Matroska, where you can concatenate the header and segments [N, nb_segments) and get a working file that starts at segment N's start time. --- libavformat/segment.c | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The educated differ from the uneducated as much as the living from the dead. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/8] png: Don't fail when a packet is larger than INT_MAX
On Sun, Mar 29, 2015 at 11:05:41AM +, Donny Yang wrote: Signed-off-by: Donny Yang w...@kota.moe --- libavcodec/pngenc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 3697dbb..bd3aae5 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -373,8 +373,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, enc_row_size + 12 * (((int64_t)enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) // 12 * ceil(enc_row_size / IOBUF_SIZE) ); -if (max_packet_size INT_MAX) -return AVERROR(ENOMEM); the check is neccessary to prevent potential integer overflows [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Republics decline into democracies and democracies degenerate into despotisms. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/8] png: Clear up the calculation of max packet size
On Sun, 29 Mar 2015 11:05:40 + Donny Yang w...@kota.moe wrote: Signed-off-by: Donny Yang w...@kota.moe --- libavcodec/pngenc.c | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index d6233d0..3697dbb 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -360,12 +360,23 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, return -1; enc_row_size= deflateBound(s-zstream, row_size); -max_packet_size = avctx-height * (int64_t)(enc_row_size + - ((enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) * 12) - + FF_MIN_BUFFER_SIZE; +max_packet_size = +8 + // PNGSIG +13 + 12 + // IHDR +9 + 12 +// pHYs +1 + 12 +// sRGB +32 + 12 + // cHRM +4 + 12 +// gAMA +256 * 3 + 12 + // PLTE +256 + 12 + // tRNS +avctx-height * ( +enc_row_size + +12 * (((int64_t)enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) // 12 * ceil(enc_row_size / IOBUF_SIZE) +); This looks extremely painful and unmaintainable. (I know, the previous code is not much better.) if (max_packet_size INT_MAX) return AVERROR(ENOMEM); -if ((ret = ff_alloc_packet2(avctx, pkt, max_packet_size)) 0) +ret = ff_alloc_packet2(avctx, pkt, max_packet_size FF_MIN_BUFFER_SIZE ? FF_MIN_BUFFER_SIZE : max_packet_size); +if (ret) return ret; s-bytestream_start = ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [GSoC] Proof-of-concept HTTP Server
On Sun, 29 Mar 2015 04:13:18 +0200 Stephan Holljes klaxa1...@googlemail.com wrote: I hope this addresses the issues mentioned. I added a new label in case of failure in http_open() in favor of duplicated code (i.e. calling av_dict_free() multiple times). I copied the style from the other functions. Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- doc/protocols.texi | 3 +++ libavformat/http.c | 26 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/doc/protocols.texi b/doc/protocols.texi index 2a19b41..5b7b6cf 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -277,6 +277,9 @@ Set initial byte offset. @item end_offset Try to limit the request to bytes preceding this offset. + +@item listen +If set to 1 enables experimental HTTP server. @end table @subsection HTTP Cookies diff --git a/libavformat/http.c b/libavformat/http.c index da3c9be..c769918 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -96,6 +96,7 @@ typedef struct HTTPContext { int send_expect_100; char *method; int reconnect; +int listen; } HTTPContext; #define OFFSET(x) offsetof(HTTPContext, x) @@ -127,6 +128,7 @@ static const AVOption options[] = { { end_offset, try to limit the request to bytes preceding this offset, OFFSET(end_off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, D }, { method, Override the HTTP method, OFFSET(method), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E }, { reconnect, auto reconnect after disconnect before EOF, OFFSET(reconnect), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D }, +{ listen, listen on HTTP, OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, E }, { NULL } }; @@ -321,9 +323,31 @@ static int http_open(URLContext *h, const char *uri, int flags, No trailing CRLF found in HTTP header.\n); } +if (s-listen) { +static const char header[] = HTTP/1.1 200 OK\r\nContent-Type: application/octet-stream\r\nTransfer-Encoding: chunked\r\n\r\n; +char hostname[1024]; +char lower_url[100]; +int port; +av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), port, + NULL, 0, uri); +ff_url_join(lower_url, sizeof(lower_url), tcp, NULL, hostname, port, +NULL); +av_dict_set(options, listen, 1, 0); +ret = ffurl_open(s-hd, lower_url, AVIO_FLAG_READ_WRITE, + h-interrupt_callback, options); +if (ret 0) +goto fail; +if (ret = ffurl_write(s-hd, header, strlen(header)) 0) +goto fail; +return 0; +} ret = http_open_cnx(h, options); if (ret 0) -av_dict_free(s-chained_options); +goto fail; +return ret; + +fail: +av_dict_free(s-chained_options); return ret; } Maybe this should be in a separate function at least. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/8] png: Return slightly more meaningful error codes
On Sun, Mar 29, 2015 at 11:05:42AM +, Donny Yang wrote: Signed-off-by: Donny Yang w...@kota.moe --- libavcodec/pngenc.c | 22 ++ 1 file changed, 10 insertions(+), 12 deletions(-) applied thanks [...] -- 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: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Fwd: GSoC: APNG
On Sun, Mar 29, 2015 at 04:30:27AM +, Donny Yang wrote: On 29 March 2015 at 03:15, Michael Niedermayer michae...@gmx.at wrote: you can try AVCodecContext-frame_number, if that doesnt work you need to keep track of if you already had received a frame I've tried both, but it turns out that AVCodecContext-frame_number seems to be thread-specific. That is, it starts with 0 for each thread rather than the actual frame number. One possible option is to disable threading support though... APNG isnt intra only so threading will not be so easy once there is non intra support in the encoder [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many things microsoft did are stupid, but not doing something just because microsoft did it is even more stupid. If everything ms did were stupid they would be bankrupt already. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/8] png: Clear up the calculation of max packet size
On Sun, Mar 29, 2015 at 11:05:40AM +, Donny Yang wrote: Signed-off-by: Donny Yang w...@kota.moe --- libavcodec/pngenc.c | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index d6233d0..3697dbb 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -360,12 +360,23 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, return -1; enc_row_size= deflateBound(s-zstream, row_size); -max_packet_size = avctx-height * (int64_t)(enc_row_size + - ((enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) * 12) - + FF_MIN_BUFFER_SIZE; +max_packet_size = +8 + // PNGSIG +13 + 12 + // IHDR +9 + 12 +// pHYs +1 + 12 +// sRGB +32 + 12 + // cHRM +4 + 12 +// gAMA +256 * 3 + 12 + // PLTE +256 + 12 + // tRNS +avctx-height * ( +enc_row_size + +12 * (((int64_t)enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) // 12 * ceil(enc_row_size / IOBUF_SIZE) +); if (max_packet_size INT_MAX) return AVERROR(ENOMEM); -if ((ret = ff_alloc_packet2(avctx, pkt, max_packet_size)) 0) +ret = ff_alloc_packet2(avctx, pkt, max_packet_size FF_MIN_BUFFER_SIZE ? FF_MIN_BUFFER_SIZE : max_packet_size); i understand the change is well meant and it makes the allocated size closer to what is actually written but this would require the list of sizes to be kept in sync with what is actually written. This is a additional maintaince burden and has serious consequence if one makes a change and then forgets updating the size as it could result in out of array writes becoming possible and then theres a possibly exploitable security issues if that happens so i suggest to leave the + FF_MIN_BUFFER_SIZE in there unless there is something else that protects against more data being written than what is listed here +if (ret) (ret 0) [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If a bugfix only changes things apparently unrelated to the bug with no further explanation, that is a good sign that the bugfix is wrong. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/4] libavformat/segment: don't leave the list pb open when not in use
On Sat, Mar 28, 2015 at 07:25:18PM -0600, Rodger Combs wrote: --- libavformat/segment.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) applied i wonder if it would make sense to leave it open and update its content thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 2 100% positive feedback - All either got their money back or didnt complain Best seller ever, very honest - Seller refunded buyer after failed scam signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]Add an ignore_delay option to the gif demuxer
Michael Niedermayer michaelni at gmx.at writes: On Sat, Mar 28, 2015 at 05:54:49PM +, Carl Eugen Hoyos wrote: Michael Niedermayer michaelni at gmx.at writes: was this the intent of the creator of the sample file we have ? i mean that the frames display more then 10 minutes There is no indication that anything else was intended. To the best of my knowledge, the file is not invalid (and there is no bug except that our mov muxer has deficiencies which are unrelated to gif). if the goal is to transcode this file while maintaining the huge frame delay then -vsync vfr could be used Sure but this is unrelated to the patch afaict. otoh if you really want to limit the max delay the patch sure is ok The patch was merged, thank you. i thought the file was not supposed to have such huge delays I did not find an application that didn't play the sample for 18 hours and I did not find any hint in the specification that 0x should be handled specifically. I did find several places where the maximum gif frame duration was mentioned as 0x. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/4] lavf/segment: Mark output contexts as non-seekable
On Sat, Mar 28, 2015 at 07:25:19PM -0600, Rodger Combs wrote: This prevents sub-muxers from trying to seek back to the beginning of the whole stream, only to find themselves overwriting some video data in the current (often last) segment. --- libavformat/segment.c | 3 +++ 1 file changed, 3 insertions(+) this breaks the case where each segment has its own header trailer and needs seeking, for example: ./ffmpeg -i matrixbench_mpeg2.mpg -f segment -segment_time 2 -t 5 -an file%03d.mp4 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavf/segment: Mark output contexts as non-seekable when applicable
On Sun, Mar 29, 2015 at 10:57:09AM -0600, Rodger Combs wrote: This prevents sub-muxers from trying to seek back to the beginning of the whole stream, only to find themselves overwriting some video data in the current (often last) segment. We only do this when not writing individual header/trailers. --- libavformat/segment.c | 6 ++ 1 file changed, 6 insertions(+) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User questions about the command line tools should be sent to the ffmpeg-user ML. And questions about how to use libav* should be sent to the libav-user ML. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/4] lavf/matroskaenc: don't try to end the segment when the output isn't seekable
In the case of most calls to end_ebml_master, the target is within the current segment, but in this case, it's in the first segment or header file, so if the context was marked as non-seekable manually (as in segment.c), avio_seek will ignore that and execute it anyway. This is fine in other uses of end_ebml_master, since both the current and target position are within the current segment, but breaks when ending mkv-segment, since `master.pos` refers to an offset in the first segment. So instead of failing the seek and returning, we end up seeking to an early point in the last segment, overwriting 8 unrelated bytes, and jumping back. On Mar 29, 2015, at 11:29, Michael Niedermayer michae...@gmx.at wrote: On Sat, Mar 28, 2015 at 07:25:21PM -0600, Rodger Combs wrote: --- libavformat/matroskaenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 6b2e390..c242a0e 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1948,9 +1948,9 @@ static int mkv_write_trailer(AVFormatContext *s) put_ebml_float(pb, MATROSKA_ID_DURATION, mkv-duration); avio_seek(pb, currentpos, SEEK_SET); +end_ebml_master(pb, mkv-segment); } -end_ebml_master(pb, mkv-segment); the change should be ok but why exactly does this fail ? if the output isnt seekable avio_seek() would fail and end_ebml_master would return with just the failed seek. why does this cause a problem ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB During times of universal deceit, telling the truth becomes a revolutionary act. -- George Orwell ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org mailto:ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression (drc_scale) is now 0 by default
2015-03-29 20:06 GMT+02:00 Kieran Kunhya kier...@obe.tv: On 29 March 2015 at 18:01, Wiebe Cazemier wi...@halfgaar.net wrote: Signed-off-by: Wiebe Cazemier wi...@halfgaar.net Why can't you just set this in your application? Not everyone is listening on a full setup where they can hear the dynamic range. There are 2 possible situations: 1) Either the software using ffmpeg is aware of the drc_scale option. If that is the case, the software is likely to set the option to the desired value. So in this case it doesn't matter which value we set the default to. 2) Or the software using ffmpeg is not aware of the drc_scale option. In this case currently ffmpeg defaults to applying range compression, which severely damages audio quality. Which is a very bad idea. So basically this patch tells ffmpeg to produce full decoding quality, unless it's asked to do otherwise. Which is the only sane setup, IMHO. If you think that range compression should be turned on by default, then we should patch all other decoders to also do that by default. Why only AC3? Makes no sense. Best regards, Mathias. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/8] png: Calculate pixel format information only once
On Sun, Mar 29, 2015 at 11:05:42AM +, Donny Yang wrote: Signed-off-by: Donny Yang w...@kota.moe --- libavcodec/pngenc.c | 124 +++- 1 file changed, 65 insertions(+), 59 deletions(-) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Avoid a single point of failure, be that a person or equipment. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 5/8] png: Only init zlib once
On Sun, Mar 29, 2015 at 11:05:43AM +, Donny Yang wrote: Signed-off-by: Donny Yang w...@kota.moe --- libavcodec/pngenc.c | 27 ++- 1 file changed, 14 insertions(+), 13 deletions(-) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB While the State exists there can be no freedom; when there is freedom there will be no State. -- Vladimir Lenin signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavf/segment: Mark output contexts as non-seekable when applicable
This prevents sub-muxers from trying to seek back to the beginning of the whole stream, only to find themselves overwriting some video data in the current (often last) segment. We only do this when not writing individual header/trailers. --- libavformat/segment.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libavformat/segment.c b/libavformat/segment.c index c36d812..7b8fdad 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -237,6 +237,8 @@ static int segment_start(AVFormatContext *s, int write_header) av_log(s, AV_LOG_ERROR, Failed to open segment '%s'\n, oc-filename); return err; } +if (!seg-individual_header_trailer) +oc-pb-seekable = 0; if (oc-oformat-priv_class oc-priv_data) av_opt_set(oc-priv_data, mpegts_flags, +resend_headers, 0); @@ -680,6 +682,8 @@ static int seg_write_header(AVFormatContext *s) av_log(s, AV_LOG_ERROR, Failed to open segment '%s'\n, oc-filename); goto fail; } +if (!seg-individual_header_trailer) +oc-pb-seekable = 0; } else { if ((ret = open_null_ctx(oc-pb)) 0) goto fail; @@ -720,6 +724,8 @@ static int seg_write_header(AVFormatContext *s) if ((ret = avio_open2(oc-pb, oc-filename, AVIO_FLAG_WRITE, s-interrupt_callback, NULL)) 0) goto fail; +if (!seg-individual_header_trailer) +oc-pb-seekable = 0; } fail: -- 2.3.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression (drc_scale) is now 0 by default
On 29 March 2015 at 18:01, Wiebe Cazemier wi...@halfgaar.net wrote: Signed-off-by: Wiebe Cazemier wi...@halfgaar.net Why can't you just set this in your application? Not everyone is listening on a full setup where they can hear the dynamic range. Kieran ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression (drc_scale) is now 0 by default
Signed-off-by: Wiebe Cazemier wi...@halfgaar.net --- Changelog | 1 + doc/decoders.texi | 2 +- libavcodec/ac3dec_fixed.c | 2 +- libavcodec/ac3dec_float.c | 2 +- libavutil/version.h | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Changelog b/Changelog index 109a1b8..0bd9875 100644 --- a/Changelog +++ b/Changelog @@ -11,6 +11,7 @@ version next: - nvenc H265 encoder - Detelecine filter - Intel QSV-accelerated H.264 encoding +- Dolby Digital dynamic range compression disabled by default version 2.6: diff --git a/doc/decoders.texi b/doc/decoders.texi index 01fca9f..ba78a31 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -72,7 +72,7 @@ from the AC-3 stream. This factor is applied exponentially. There are 3 notable scale factor ranges: @table @option @item drc_scale == 0 -DRC disabled. Produces full range audio. +DRC disabled. Produces full range audio. Default value. @item 0 drc_scale = 1 DRC enabled. Applies a fraction of the stream DRC value. Audio reproduction is between full range and full compression. diff --git a/libavcodec/ac3dec_fixed.c b/libavcodec/ac3dec_fixed.c index b4beee6..e3c8ce8 100644 --- a/libavcodec/ac3dec_fixed.c +++ b/libavcodec/ac3dec_fixed.c @@ -168,7 +168,7 @@ static void ac3_downmix_c_fixed16(int16_t **samples, int16_t (*matrix)[2], #include ac3dec.c static const AVOption options[] = { -{ drc_scale, percentage of dynamic range compression to apply, OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 6.0, PAR }, +{ drc_scale, percentage of dynamic range compression to apply, OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, 0.0, 6.0, PAR }, { heavy_compr, heavy dynamic range compression enabled, OFFSET(heavy_compression), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, PAR }, { NULL}, }; diff --git a/libavcodec/ac3dec_float.c b/libavcodec/ac3dec_float.c index d74a0df..5c45c49 100644 --- a/libavcodec/ac3dec_float.c +++ b/libavcodec/ac3dec_float.c @@ -32,7 +32,7 @@ #include ac3dec.c static const AVOption options[] = { -{ drc_scale, percentage of dynamic range compression to apply, OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 6.0, PAR }, +{ drc_scale, percentage of dynamic range compression to apply, OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, 0.0, 6.0, PAR }, { heavy_compr, heavy dynamic range compression enabled, OFFSET(heavy_compression), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, PAR }, { target_level, target level in -dBFS (0 not applied), OFFSET(target_level), AV_OPT_TYPE_INT, {.i64 = 0 }, -31, 0, PAR }, diff --git a/libavutil/version.h b/libavutil/version.h index 897384a..0d8c065 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -57,7 +57,7 @@ #define LIBAVUTIL_VERSION_MAJOR 54 #define LIBAVUTIL_VERSION_MINOR 20 -#define LIBAVUTIL_VERSION_MICRO 101 +#define LIBAVUTIL_VERSION_MICRO 102 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Default dynamic range compression on AC3
- Original Message - From: Michael Niedermayer michae...@gmx.at To: FFmpeg development discussions and patches ffmpeg-devel@ffmpeg.org Sent: Thursday, 26 March, 2015 12:40:45 PM Subject: Re: [FFmpeg-devel] Default dynamic range compression on AC3 and yes, please post a patch, this also should bump the version number and add a note in the Changelog file Patch posted. Perhaps I should have added a code comment saying that even though the ATSC standard says DRC should be applied by default, allowing users it to be off, ffmpeg, being a back-end library, should have it off by default, because if developers don't know about the DRC meta data, DRC will be applied without the ability to turn it off, as is the case with Kodi and VLC. I'm (somewhat) OK with it if writers/manufacturers of media players include it and enable it by default, but by doing so, they are aware of what they're doing, and will very likely include it as a user option. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/4] lavf/matroskaenc: don't try to end the segment when the output isn't seekable
On Sat, Mar 28, 2015 at 07:25:21PM -0600, Rodger Combs wrote: --- libavformat/matroskaenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 6b2e390..c242a0e 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1948,9 +1948,9 @@ static int mkv_write_trailer(AVFormatContext *s) put_ebml_float(pb, MATROSKA_ID_DURATION, mkv-duration); avio_seek(pb, currentpos, SEEK_SET); +end_ebml_master(pb, mkv-segment); } -end_ebml_master(pb, mkv-segment); the change should be ok but why exactly does this fail ? if the output isnt seekable avio_seek() would fail and end_ebml_master would return with just the failed seek. why does this cause a problem ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB During times of universal deceit, telling the truth becomes a revolutionary act. -- George Orwell signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] tiff: Return more meaningful error codes
James Almer jamrial at gmail.com writes: case TIFF_LZW: return ff_lzw_encode(s-lzws, src, n); default: -return -1; +return AVERROR_BUG; AVERROR(EINVAL) here. If i do ffmpeg -i INPUT -compression_algo 2 OUTPUT.tiff I'm not triggering a bug, I'm passing an invalid/unsupported argument to the encoder. Additionally, please print an appropriate message. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 5/8] png: Only init zlib once
Signed-off-by: Donny Yang w...@kota.moe --- libavcodec/pngenc.c | 27 ++- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 0a215f2..410a829 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -299,7 +299,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, int y, len, row_size, ret; int pass_row_size, enc_row_size; int64_t max_packet_size; -int compression_level; uint8_t *ptr, *top, *crow_buf, *crow; uint8_t *crow_base = NULL; uint8_t *progressive_buf = NULL; @@ -307,17 +306,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, row_size = (avctx-width * s-bits_per_pixel + 7) 3; -s-zstream.zalloc = ff_png_zalloc; -s-zstream.zfree = ff_png_zfree; -s-zstream.opaque = NULL; -compression_level = avctx-compression_level == FF_COMPRESSION_DEFAULT - ? Z_DEFAULT_COMPRESSION - : av_clip(avctx-compression_level, 0, 9); -ret = deflateInit2(s-zstream, compression_level, - Z_DEFLATED, 15, 8, Z_DEFAULT_STRATEGY); -if (ret != Z_OK) -return -1; - enc_row_size= deflateBound(s-zstream, row_size); max_packet_size = 8 + // PNGSIG @@ -484,13 +472,14 @@ the_end: av_freep(crow_base); av_freep(progressive_buf); av_freep(top_buf); -deflateEnd(s-zstream); +deflateReset(s-zstream); return ret; } static av_cold int png_enc_init(AVCodecContext *avctx) { PNGEncContext *s = avctx-priv_data; +int compression_level; switch (avctx-pix_fmt) { case AV_PIX_FMT_RGBA: @@ -578,11 +567,23 @@ static av_cold int png_enc_init(AVCodecContext *avctx) } s-bits_per_pixel = ff_png_get_nb_channels(s-color_type) * s-bit_depth; +s-zstream.zalloc = ff_png_zalloc; +s-zstream.zfree = ff_png_zfree; +s-zstream.opaque = NULL; +compression_level = avctx-compression_level == FF_COMPRESSION_DEFAULT + ? Z_DEFAULT_COMPRESSION + : av_clip(avctx-compression_level, 0, 9); +if (deflateInit2(s-zstream, compression_level, Z_DEFLATED, 15, 8, Z_DEFAULT_STRATEGY) != Z_OK) +return -1; + return 0; } static av_cold int png_enc_close(AVCodecContext *avctx) { +PNGEncContext *s = avctx-priv_data; + +deflateEnd(s-zstream); av_frame_free(avctx-coded_frame); return 0; } -- 2.3.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 6/8] png: Clearly separate encoding header and frames
Signed-off-by: Donny Yang w...@kota.moe --- libavcodec/pngenc.c | 146 +++- 1 file changed, 86 insertions(+), 60 deletions(-) diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 410a829..0264575 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -291,58 +291,9 @@ static int png_get_gama(enum AVColorTransferCharacteristic trc, uint8_t *buf) return 1; } -static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, -const AVFrame *pict, int *got_packet) +static int encode_headers(AVCodecContext *avctx, const AVFrame *pict) { -PNGEncContext *s = avctx-priv_data; -const AVFrame *const p = pict; -int y, len, row_size, ret; -int pass_row_size, enc_row_size; -int64_t max_packet_size; -uint8_t *ptr, *top, *crow_buf, *crow; -uint8_t *crow_base = NULL; -uint8_t *progressive_buf = NULL; -uint8_t *top_buf = NULL; - -row_size = (avctx-width * s-bits_per_pixel + 7) 3; - -enc_row_size= deflateBound(s-zstream, row_size); -max_packet_size = -8 + // PNGSIG -13 + 12 + // IHDR -9 + 12 +// pHYs -1 + 12 +// sRGB -32 + 12 + // cHRM -4 + 12 +// gAMA -256 * 3 + 12 + // PLTE -256 + 12 + // tRNS -avctx-height * ( -enc_row_size + -12 * (((int64_t)enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) // 12 * ceil(enc_row_size / IOBUF_SIZE) -); -ret = ff_alloc_packet2(avctx, pkt, max_packet_size FF_MIN_BUFFER_SIZE ? FF_MIN_BUFFER_SIZE : max_packet_size); -if (ret) -return ret; - -s-bytestream_start = -s-bytestream = pkt-data; -s-bytestream_end = pkt-data + pkt-size; - -crow_base = av_malloc((row_size + 32) (s-filter_type == PNG_FILTER_VALUE_MIXED)); -if (!crow_base) { -ret = AVERROR(ENOMEM); -goto the_end; -} -// pixel data should be aligned, but there's a control byte before it -crow_buf = crow_base + 15; -if (s-is_progressive) { -progressive_buf = av_malloc(row_size + 1); -top_buf = av_malloc(row_size + 1); -if (!progressive_buf || !top_buf) { -ret = AVERROR(ENOMEM); -goto the_end; -} -} +PNGEncContext *s = avctx-priv_data; /* write png header */ AV_WB64(s-bytestream, PNGSIG); @@ -386,9 +337,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, int has_alpha, alpha, i; unsigned int v; uint32_t *palette; -uint8_t *alpha_ptr; +uint8_t *ptr, *alpha_ptr; -palette = (uint32_t *)p-data[1]; +palette = (uint32_t *)pict-data[1]; ptr = s-buf; alpha_ptr = s-buf + 256 * 3; has_alpha = 0; @@ -408,7 +359,39 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, } } -/* now put each row */ +return 0; +} + +static int encode_frame(AVCodecContext *avctx, const AVFrame *pict) +{ +PNGEncContext *s = avctx-priv_data; +const AVFrame *const p = pict; +int y, len, ret; +int row_size, pass_row_size; +uint8_t *ptr, *top, *crow_buf, *crow; +uint8_t *crow_base = NULL; +uint8_t *progressive_buf = NULL; +uint8_t *top_buf = NULL; + +row_size = (avctx-width * s-bits_per_pixel + 7) 3; + +crow_base = av_malloc((row_size + 32) (s-filter_type == PNG_FILTER_VALUE_MIXED)); +if (!crow_base) { +ret = AVERROR(ENOMEM); +goto the_end; +} +// pixel data should be aligned, but there's a control byte before it +crow_buf = crow_base + 15; +if (s-is_progressive) { +progressive_buf = av_malloc(row_size + 1); +top_buf = av_malloc(row_size + 1); +if (!progressive_buf || !top_buf) { +ret = AVERROR(ENOMEM); +goto the_end; +} +} + +/* put each row */ s-zstream.avail_out = IOBUF_SIZE; s-zstream.next_out = s-buf; if (s-is_progressive) { @@ -461,12 +444,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, goto the_end; } } -png_write_chunk(s-bytestream, MKTAG('I', 'E', 'N', 'D'), NULL, 0); -pkt-size = s-bytestream - s-bytestream_start; -pkt-flags |= AV_PKT_FLAG_KEY; -*got_packet = 1; -ret = 0; +ret = 0; the_end: av_freep(crow_base); @@ -476,6 +455,53 @@ the_end: return ret; } +static int encode(AVCodecContext *avctx, AVPacket *pkt, +const AVFrame *pict, int *got_packet) +{ +PNGEncContext *s = avctx-priv_data; +int ret; +int enc_row_size; +size_t max_packet_size; + +enc_row_size = deflateBound(s-zstream, (avctx-width * s-bits_per_pixel + 7) 3); +max_packet_size = +8 + // PNGSIG +13 + 12 + // IHDR +9 + 12 +
[FFmpeg-devel] [PATCH 2/8] png: Don't fail when a packet is larger than INT_MAX
Signed-off-by: Donny Yang w...@kota.moe --- libavcodec/pngenc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 3697dbb..bd3aae5 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -373,8 +373,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, enc_row_size + 12 * (((int64_t)enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) // 12 * ceil(enc_row_size / IOBUF_SIZE) ); -if (max_packet_size INT_MAX) -return AVERROR(ENOMEM); ret = ff_alloc_packet2(avctx, pkt, max_packet_size FF_MIN_BUFFER_SIZE ? FF_MIN_BUFFER_SIZE : max_packet_size); if (ret) return ret; -- 2.3.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 7/8] apng: Make PNG encoder only write headers once in APNG mode
Signed-off-by: Donny Yang w...@kota.moe --- configure | 1 + libavcodec/Makefile| 1 + libavcodec/allcodecs.c | 2 +- libavcodec/pngenc.c| 53 ++ 4 files changed, 52 insertions(+), 5 deletions(-) diff --git a/configure b/configure index e1849a2..eb37aa5 100755 --- a/configure +++ b/configure @@ -2098,6 +2098,7 @@ amv_decoder_select=sp5x_decoder exif amv_encoder_select=aandcttables mpegvideoenc ape_decoder_select=bswapdsp llauddsp apng_decoder_select=zlib +apng_encoder_select=huffyuvencdsp zlib 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 91a40ad..c1b7390 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -144,6 +144,7 @@ OBJS-$(CONFIG_ANM_DECODER) += anm.o OBJS-$(CONFIG_ANSI_DECODER)+= ansi.o cga_data.o OBJS-$(CONFIG_APE_DECODER) += apedec.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 ass_split.o OBJS-$(CONFIG_SSA_ENCODER) += assenc.o ass.o OBJS-$(CONFIG_ASS_DECODER) += assdec.o ass.o ass_split.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 89acac1..ef3558a 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -108,7 +108,7 @@ void avcodec_register_all(void) REGISTER_ENCDEC (AMV, amv); REGISTER_DECODER(ANM, anm); REGISTER_DECODER(ANSI, ansi); -REGISTER_DECODER(APNG, apng); +REGISTER_ENCDEC (APNG, apng); REGISTER_ENCDEC (ASV1, asv1); REGISTER_ENCDEC (ASV2, asv2); REGISTER_DECODER(AURA, aura); diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 0264575..116ebc5 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -53,6 +53,8 @@ typedef struct PNGEncContext { int bit_depth; int color_type; int bits_per_pixel; + +uint32_t palette_checksum; // Used to ensure a single unique palette in APNG mode } PNGEncContext; static void png_get_interlaced_row(uint8_t *dst, int row_size, @@ -463,6 +465,18 @@ static int encode(AVCodecContext *avctx, AVPacket *pkt, int enc_row_size; size_t max_packet_size; +if (avctx-codec_id == AV_CODEC_ID_APNG s-color_type == PNG_COLOR_TYPE_PALETTE) { +uint32_t checksum = crc32(crc32(0, Z_NULL, 0), pict-data[1], 256 * sizeof(uint32_t)); + +if (avctx-frame_number == 0) { +s-palette_checksum = checksum; +} else if (checksum != s-palette_checksum) { +av_log(avctx, AV_LOG_ERROR, + Input contains more than one unique palette. APNG does not support multiple palettes.\n); +return -1; +} +} + enc_row_size = deflateBound(s-zstream, (avctx-width * s-bits_per_pixel + 7) 3); max_packet_size = 8 + // PNGSIG @@ -485,15 +499,19 @@ static int encode(AVCodecContext *avctx, AVPacket *pkt, s-bytestream = pkt-data; s-bytestream_end = pkt-data + pkt-size; -ret = encode_headers(avctx, pict); -if (ret) -return ret; +if (avctx-codec_id == AV_CODEC_ID_PNG || avctx-frame_number == 0) { +ret = encode_headers(avctx, pict); +if (ret) +return ret; +} ret = encode_frame(avctx, pict); if (ret) return ret; -png_write_chunk(s-bytestream, MKTAG('I', 'E', 'N', 'D'), NULL, 0); +if (avctx-codec_id == AV_CODEC_ID_PNG) { +png_write_chunk(s-bytestream, MKTAG('I', 'E', 'N', 'D'), NULL, 0); +} pkt-size = s-bytestream - s-bytestream_start; pkt-flags |= AV_PKT_FLAG_KEY; @@ -629,6 +647,13 @@ static const AVClass pngenc_class = { .version= LIBAVUTIL_VERSION_INT, }; +static const AVClass apngenc_class = { +.class_name = APNG encoder, +.item_name = av_default_item_name, +.option = options, +.version= LIBAVUTIL_VERSION_INT, +}; + AVCodec ff_png_encoder = { .name = png, .long_name = NULL_IF_CONFIG_SMALL(PNG (Portable Network Graphics) image), @@ -649,3 +674,23 @@ AVCodec ff_png_encoder = { }, .priv_class = pngenc_class, }; + +AVCodec ff_apng_encoder = { +.name = apng, +.long_name = NULL_IF_CONFIG_SMALL(APNG (Animated Portable Network Graphics) image), +.type = AVMEDIA_TYPE_VIDEO, +.id = AV_CODEC_ID_APNG, +.priv_data_size = sizeof(PNGEncContext), +.init = png_enc_init, +.close = png_enc_close, +.encode2= encode, +.pix_fmts = (const enum AVPixelFormat[]) { +AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA, +AV_PIX_FMT_RGB48BE,
[FFmpeg-devel] [PATCH 4/8] png: Calculate pixel format information only once
Signed-off-by: Donny Yang w...@kota.moe --- libavcodec/pngenc.c | 124 +++- 1 file changed, 65 insertions(+), 59 deletions(-) diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 6c8fec2..0a215f2 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -48,6 +48,11 @@ typedef struct PNGEncContext { uint8_t buf[IOBUF_SIZE]; int dpi; /// Physical pixel density, in dots per inch, if set int dpm; /// Physical pixel density, in dots per meter, if set + +int is_progressive; +int bit_depth; +int color_type; +int bits_per_pixel; } PNGEncContext; static void png_get_interlaced_row(uint8_t *dst, int row_size, @@ -291,8 +296,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, { PNGEncContext *s = avctx-priv_data; const AVFrame *const p = pict; -int bit_depth, color_type, y, len, row_size, ret, is_progressive; -int bits_per_pixel, pass_row_size, enc_row_size; +int y, len, row_size, ret; +int pass_row_size, enc_row_size; int64_t max_packet_size; int compression_level; uint8_t *ptr, *top, *crow_buf, *crow; @@ -300,53 +305,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, uint8_t *progressive_buf = NULL; uint8_t *top_buf = NULL; -is_progressive = !!(avctx-flags CODEC_FLAG_INTERLACED_DCT); -switch (avctx-pix_fmt) { -case AV_PIX_FMT_RGBA64BE: -bit_depth = 16; -color_type = PNG_COLOR_TYPE_RGB_ALPHA; -break; -case AV_PIX_FMT_RGB48BE: -bit_depth = 16; -color_type = PNG_COLOR_TYPE_RGB; -break; -case AV_PIX_FMT_RGBA: -bit_depth = 8; -color_type = PNG_COLOR_TYPE_RGB_ALPHA; -break; -case AV_PIX_FMT_RGB24: -bit_depth = 8; -color_type = PNG_COLOR_TYPE_RGB; -break; -case AV_PIX_FMT_GRAY16BE: -bit_depth = 16; -color_type = PNG_COLOR_TYPE_GRAY; -break; -case AV_PIX_FMT_GRAY8: -bit_depth = 8; -color_type = PNG_COLOR_TYPE_GRAY; -break; -case AV_PIX_FMT_GRAY8A: -bit_depth = 8; -color_type = PNG_COLOR_TYPE_GRAY_ALPHA; -break; -case AV_PIX_FMT_YA16BE: -bit_depth = 16; -color_type = PNG_COLOR_TYPE_GRAY_ALPHA; -break; -case AV_PIX_FMT_MONOBLACK: -bit_depth = 1; -color_type = PNG_COLOR_TYPE_GRAY; -break; -case AV_PIX_FMT_PAL8: -bit_depth = 8; -color_type = PNG_COLOR_TYPE_PALETTE; -break; -default: -return -1; -} -bits_per_pixel = ff_png_get_nb_channels(color_type) * bit_depth; -row_size = (avctx-width * bits_per_pixel + 7) 3; +row_size = (avctx-width * s-bits_per_pixel + 7) 3; s-zstream.zalloc = ff_png_zalloc; s-zstream.zfree = ff_png_zfree; @@ -388,7 +347,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, } // pixel data should be aligned, but there's a control byte before it crow_buf = crow_base + 15; -if (is_progressive) { +if (s-is_progressive) { progressive_buf = av_malloc(row_size + 1); top_buf = av_malloc(row_size + 1); if (!progressive_buf || !top_buf) { @@ -403,11 +362,11 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, AV_WB32(s-buf, avctx-width); AV_WB32(s-buf + 4, avctx-height); -s-buf[8] = bit_depth; -s-buf[9] = color_type; +s-buf[8] = s-bit_depth; +s-buf[9] = s-color_type; s-buf[10] = 0; /* compression type */ s-buf[11] = 0; /* filter type */ -s-buf[12] = is_progressive; /* interlace type */ +s-buf[12] = s-is_progressive; /* interlace type */ png_write_chunk(s-bytestream, MKTAG('I', 'H', 'D', 'R'), s-buf, 13); /* write physical information */ @@ -435,7 +394,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, png_write_chunk(s-bytestream, MKTAG('g', 'A', 'M', 'A'), s-buf, 4); /* put the palette if needed */ -if (color_type == PNG_COLOR_TYPE_PALETTE) { +if (s-color_type == PNG_COLOR_TYPE_PALETTE) { int has_alpha, alpha, i; unsigned int v; uint32_t *palette; @@ -464,13 +423,13 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, /* now put each row */ s-zstream.avail_out = IOBUF_SIZE; s-zstream.next_out = s-buf; -if (is_progressive) { +if (s-is_progressive) { int pass; for (pass = 0; pass NB_PASSES; pass++) { /* NOTE: a pass is completely omitted if no pixels would be * output */ -pass_row_size = ff_png_pass_row_size(pass, bits_per_pixel, avctx-width); +pass_row_size = ff_png_pass_row_size(pass, s-bits_per_pixel, avctx-width); if (pass_row_size 0) { top = NULL; for (y = 0; y
[FFmpeg-devel] [PATCH 8/8] apng: Add a basic APNG muxer
Additionally, update some documentation with support for APNG Signed-off-by: Donny Yang w...@kota.moe --- Changelog| 1 + doc/general.texi | 2 + libavformat/Makefile | 1 + libavformat/allformats.c | 2 +- libavformat/apngenc.c| 250 +++ libavformat/version.h| 4 +- 6 files changed, 257 insertions(+), 3 deletions(-) create mode 100644 libavformat/apngenc.c diff --git a/Changelog b/Changelog index dcddca4..3264341 100644 --- a/Changelog +++ b/Changelog @@ -12,6 +12,7 @@ version next: - Detelecine filter - Intel QSV-accelerated H.264 encoding - MMAL-accelerated H.264 decoding +- basic APNG encoder and muxer version 2.6: diff --git a/doc/general.texi b/doc/general.texi index 85ee219..589b423 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -222,6 +222,7 @@ library: @tab Audio format used on the Nintendo Gamecube. @item AFC @tab @tab X @tab Audio format used on the Nintendo Gamecube. +@item APNG @tab X @tab X @item ASF @tab X @tab X @item AST @tab X @tab X @tab Audio format used on the Nintendo Wii. @@ -508,6 +509,7 @@ following image formats are supported: @item Alias PIX@tab X @tab X @tab Alias/Wavefront PIX image format @item animated GIF @tab X @tab X +@item APNG @tab X @tab X @item BMP @tab X @tab X @tab Microsoft BMP image @item BRender PIX @tab @tab X diff --git a/libavformat/Makefile b/libavformat/Makefile index 2118ff2..5082101 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -80,6 +80,7 @@ OBJS-$(CONFIG_ANM_DEMUXER) += anm.o OBJS-$(CONFIG_APC_DEMUXER) += apc.o OBJS-$(CONFIG_APE_DEMUXER) += ape.o apetag.o img2.o OBJS-$(CONFIG_APNG_DEMUXER) += apngdec.o +OBJS-$(CONFIG_APNG_MUXER)+= apngenc.o OBJS-$(CONFIG_AQTITLE_DEMUXER) += aqtitledec.o subtitles.o OBJS-$(CONFIG_ASF_DEMUXER) += asfdec.o asf.o asfcrypt.o \ avlanguage.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 26ccc27..ca45db8 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -74,7 +74,7 @@ void av_register_all(void) REGISTER_DEMUXER (ANM, anm); REGISTER_DEMUXER (APC, apc); REGISTER_DEMUXER (APE, ape); -REGISTER_DEMUXER (APNG, apng); +REGISTER_MUXDEMUX(APNG, apng); REGISTER_DEMUXER (AQTITLE, aqtitle); REGISTER_MUXDEMUX(ASF, asf); REGISTER_MUXDEMUX(ASS, ass); diff --git a/libavformat/apngenc.c b/libavformat/apngenc.c new file mode 100644 index 000..5190453 --- /dev/null +++ b/libavformat/apngenc.c @@ -0,0 +1,250 @@ +/* + * APNG muxer + * Copyright (c) 2015 Donny Yang + * + * first version by Donny Yang w...@kota.moe + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include stdarg.h +#include zlib.h + +#include avformat.h +#include internal.h +#include libavutil/avassert.h +#include libavutil/intreadwrite.h +#include libavutil/log.h +#include libavutil/opt.h +#include libavcodec/png.h +#include libavcodec/apng.h + +static void apng_write_chunk(AVIOContext *io_context, uint32_t tag, + uint8_t* buf, size_t length) +{ +uint32_t crc; +uint8_t tagbuf[4]; + +avio_wb32(io_context, length); +crc = crc32(0, Z_NULL, 0); +AV_WB32(tagbuf, tag); +crc = crc32(crc, tagbuf, 4); +avio_wb32(io_context, tag); +if (length 0) { +crc = crc32(crc, buf, length); +avio_write(io_context, buf, length); +} +avio_wb32(io_context, crc); +} + +typedef struct APNGMuxContext { +AVClass *class; +uint32_t plays; +AVRational last_delay; + +uint64_t acTL_offset; +uint32_t sequence_number; +uint32_t frame_number; + +AVPacket *prev_packet; +AVRational prev_delay; +} APNGMuxContext; + +static int apng_write_header(AVFormatContext *format_context) +{ +APNGMuxContext *apng = format_context-priv_data; +AVStream *codec_stream; + +if
[FFmpeg-devel] [PATCH 3/8] png: Return slightly more meaningful error codes
Signed-off-by: Donny Yang w...@kota.moe --- libavcodec/pngenc.c | 22 ++ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index bd3aae5..6c8fec2 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -382,19 +382,19 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, s-bytestream_end = pkt-data + pkt-size; crow_base = av_malloc((row_size + 32) (s-filter_type == PNG_FILTER_VALUE_MIXED)); -if (!crow_base) -goto fail; +if (!crow_base) { +ret = AVERROR(ENOMEM); +goto the_end; +} // pixel data should be aligned, but there's a control byte before it crow_buf = crow_base + 15; if (is_progressive) { progressive_buf = av_malloc(row_size + 1); -if (!progressive_buf) -goto fail; -} -if (is_progressive) { top_buf = av_malloc(row_size + 1); -if (!top_buf) -goto fail; +if (!progressive_buf || !top_buf) { +ret = AVERROR(ENOMEM); +goto the_end; +} } /* write png header */ @@ -510,7 +510,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, if (ret == Z_STREAM_END) break; } else { -goto fail; +ret = -1; +goto the_end; } } png_write_chunk(s-bytestream, MKTAG('I', 'E', 'N', 'D'), NULL, 0); @@ -526,9 +527,6 @@ the_end: av_freep(top_buf); deflateEnd(s-zstream); return ret; -fail: -ret = -1; -goto the_end; } static av_cold int png_enc_init(AVCodecContext *avctx) -- 2.3.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/8] png: Clear up the calculation of max packet size
Signed-off-by: Donny Yang w...@kota.moe --- libavcodec/pngenc.c | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index d6233d0..3697dbb 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -360,12 +360,23 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, return -1; enc_row_size= deflateBound(s-zstream, row_size); -max_packet_size = avctx-height * (int64_t)(enc_row_size + - ((enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) * 12) - + FF_MIN_BUFFER_SIZE; +max_packet_size = +8 + // PNGSIG +13 + 12 + // IHDR +9 + 12 +// pHYs +1 + 12 +// sRGB +32 + 12 + // cHRM +4 + 12 +// gAMA +256 * 3 + 12 + // PLTE +256 + 12 + // tRNS +avctx-height * ( +enc_row_size + +12 * (((int64_t)enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) // 12 * ceil(enc_row_size / IOBUF_SIZE) +); if (max_packet_size INT_MAX) return AVERROR(ENOMEM); -if ((ret = ff_alloc_packet2(avctx, pkt, max_packet_size)) 0) +ret = ff_alloc_packet2(avctx, pkt, max_packet_size FF_MIN_BUFFER_SIZE ? FF_MIN_BUFFER_SIZE : max_packet_size); +if (ret) return ret; s-bytestream_start = -- 2.3.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/libdcadec: remove av_assert and check bits_per_sample more completely
Signed-off-by: Michael Niedermayer michae...@gmx.at --- libavcodec/libdcadec.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavcodec/libdcadec.c b/libavcodec/libdcadec.c index 6e89262..3ac4bcb 100644 --- a/libavcodec/libdcadec.c +++ b/libavcodec/libdcadec.c @@ -21,7 +21,6 @@ #include libdcadec/dca_context.h -#include libavutil/avassert.h #include libavutil/channel_layout.h #include libavutil/common.h #include libavutil/opt.h @@ -80,10 +79,9 @@ static int dcadec_decode_frame(AVCodecContext *avctx, void *data, avctx-channel_layout = channel_mask; avctx-sample_rate= sample_rate; -av_assert0(bits_per_sample = 16); if (bits_per_sample == 16) avctx-sample_fmt = AV_SAMPLE_FMT_S16P; -else if (bits_per_sample = 24) +else if (bits_per_sample 16 bits_per_sample = 24) avctx-sample_fmt = AV_SAMPLE_FMT_S32P; else { av_log(avctx, AV_LOG_ERROR, Unsupported number of bits per sample: %d\n, -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/4] lavf/matroskaenc: don't try to end the segment when the output isn't seekable
On Sun, Mar 29, 2015 at 11:54:59AM -0600, Rodger Combs wrote: In the case of most calls to end_ebml_master, the target is within the current segment, but in this case, it's in the first segment or header file, so if the context was marked as non-seekable manually (as in segment.c), avio_seek will ignore that and execute it anyway. This is fine in other uses of end_ebml_master, since both the current and target position are within the current segment, but breaks when ending mkv-segment, since `master.pos` refers to an offset in the first segment. So instead of failing the seek and returning, we end up seeking to an early point in the last segment, overwriting 8 unrelated bytes, and jumping back. maybe it would be better to add a private option to the matroska muxer that keeps it from messing with past segments and set this from the segment muxer a non seekable file thats small enough could before this patch be written with mkv-segment properly closed but i think the patch would break this. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If a bugfix only changes things apparently unrelated to the bug with no further explanation, that is a good sign that the bugfix is wrong. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/4] lavf/matroskaenc: don't try to end the segment when the output isn't seekable
On Sun, Mar 29, 2015 at 02:56:00PM -0600, Rodger Combs wrote: I can see the reasoning here, but as small enough here means 32K, my concern was that some app might use a single large buffer without seek function. 32k is too small i agree I don't think this would be worth doing on a per-muxer basis. Maybe if we had a more general way to tell the muxer about segment boundaries, That can be done by adding a field to AVFormatContext or AVFormatInternal or if segment.c provided a single AVIOContext, with a write() function that passes through to a sub-context and a seek() function that reopened (and seeked within) previous segments if necessary? (Though we'd need an option to disable seeks into previous files to avoid inter-process read/write races). that sounds like the ideal solution if developer time is no factor On Mar 29, 2015, at 14:04, Michael Niedermayer michae...@gmx.at wrote: On Sun, Mar 29, 2015 at 11:54:59AM -0600, Rodger Combs wrote: In the case of most calls to end_ebml_master, the target is within the current segment, but in this case, it's in the first segment or header file, so if the context was marked as non-seekable manually (as in segment.c), avio_seek will ignore that and execute it anyway. This is fine in other uses of end_ebml_master, since both the current and target position are within the current segment, but breaks when ending mkv-segment, since `master.pos` refers to an offset in the first segment. So instead of failing the seek and returning, we end up seeking to an early point in the last segment, overwriting 8 unrelated bytes, and jumping back. maybe it would be better to add a private option to the matroska muxer that keeps it from messing with past segments and set this from the segment muxer a non seekable file thats small enough could before this patch be written with mkv-segment properly closed but i think the patch would break this. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If a bugfix only changes things apparently unrelated to the bug with no further explanation, that is a good sign that the bugfix is wrong. ___ 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 -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB it is not once nor twice but times without number that the same ideas make their appearance in the world. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/4] lavf/matroskaenc: don't try to end the segment when the output isn't seekable
I can see the reasoning here, but as small enough here means 32K, I don't think this would be worth doing on a per-muxer basis. Maybe if we had a more general way to tell the muxer about segment boundaries, or if segment.c provided a single AVIOContext, with a write() function that passes through to a sub-context and a seek() function that reopened (and seeked within) previous segments if necessary? (Though we'd need an option to disable seeks into previous files to avoid inter-process read/write races). On Mar 29, 2015, at 14:04, Michael Niedermayer michae...@gmx.at wrote: On Sun, Mar 29, 2015 at 11:54:59AM -0600, Rodger Combs wrote: In the case of most calls to end_ebml_master, the target is within the current segment, but in this case, it's in the first segment or header file, so if the context was marked as non-seekable manually (as in segment.c), avio_seek will ignore that and execute it anyway. This is fine in other uses of end_ebml_master, since both the current and target position are within the current segment, but breaks when ending mkv-segment, since `master.pos` refers to an offset in the first segment. So instead of failing the seek and returning, we end up seeking to an early point in the last segment, overwriting 8 unrelated bytes, and jumping back. maybe it would be better to add a private option to the matroska muxer that keeps it from messing with past segments and set this from the segment muxer a non seekable file thats small enough could before this patch be written with mkv-segment properly closed but i think the patch would break this. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If a bugfix only changes things apparently unrelated to the bug with no further explanation, that is a good sign that the bugfix is wrong. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 4/4] lavf/matroskaenc: don't try to end the segment when the output isn't seekable
On Sun, Mar 29, 2015 at 11:08:51PM +0200, Michael Niedermayer wrote: On Sun, Mar 29, 2015 at 02:56:00PM -0600, Rodger Combs wrote: I can see the reasoning here, but as small enough here means 32K, my concern was that some app might use a single large buffer without seek function. 32k is too small i agree I don't think this would be worth doing on a per-muxer basis. Maybe if we had a more general way to tell the muxer about segment boundaries, That can be done by adding a field to AVFormatContext or AVFormatInternal or if segment.c provided a single AVIOContext, with a write() function that passes through to a sub-context and a seek() function that reopened (and seeked within) previous segments if necessary? (Though we'd need an option to disable seeks into previous files to avoid inter-process read/write races). that sounds like the ideal solution if developer time is no factor one additional disadvantage of this though would be that if the header does get updated at the end this would mismatch if only a subset of segments get concatenated [...] -- 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: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression (drc_scale) is now 0 by default
- Original Message - From: Kieran Kunhya kier...@obe.tv To: Wiebe Cazemier wi...@halfgaar.net Cc: Kieran Kunhya kier...@obe.tv Sent: Sunday, 29 March, 2015 10:03:05 PM Subject: Re: [FFmpeg-devel] [PATCH] Dolby Digital dynamic range compression (drc_scale) is now 0 by default There was another thread about it (discussed with Michael Niedermayer, among others). In short, developers don't seem to know about or don't implement the feature. Kodi developers denied that it applied DRC on AC3, not knowing that ffmpeg did it. This meant that DRC couldn't be turned off. VLC also lacks the option, but does apply it. If applications want DRC, they should set the drc_scale option. Having ffmpeg do it creates mystery behavior. DRC is in the spec, if you want to violate the spec, then turn it off yourself. How? It's in the spec as an *option*, to cater to those who have bad sound systems. If ffmpeg already applies DRC, and software using ffmpeg doesn't set 'drc_scale', it's no longer an option, it becomes mandatory. That's the issue. Madshi's explanation is spot on. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] lavu/avstring: add av_append_path_component() funcion
On Thu, Mar 26, 2015 at 05:39:49PM +0100, Mariusz Szczepańczyk wrote: On Thu, Mar 26, 2015 at 3:40 PM, Michael Niedermayer michae...@gmx.at wrote: On Thu, Mar 26, 2015 at 01:25:19AM +0100, Mariusz Szczepańczyk wrote: From: Lukasz Marek lukasz.m.lu...@gmail.com Convinient function to build paths. --- libavutil/avstring.c| 43 +++ libavutil/avstring.h| 10 ++ tests/ref/fate/avstring | 9 + 3 files changed, 62 insertions(+) diff --git a/libavutil/avstring.c b/libavutil/avstring.c index 25c65b4..f105aa7 100644 --- a/libavutil/avstring.c +++ b/libavutil/avstring.c @@ -269,6 +269,35 @@ const char *av_dirname(char *path) return path; } +char *av_append_path_component(const char *path, const char *component) +{ +size_t p_len, c_len; +char *fullpath; + +if (!path) +return component ? av_strdup(component) : NULL; +if (!component) +return av_strdup(path); + +p_len = strlen(path); +c_len = strlen(component); +fullpath = malloc(p_len + c_len + 2); av_malloc() fixed +if (fullpath) { +if (p_len) { +strcpy(fullpath, path); av_strlcpy() is more robust/secure fixed +if (c_len) { +if (fullpath[p_len - 1] != '/' component[0] != '/') +fullpath[p_len++] = '/'; +else if (fullpath[p_len - 1] == '/' component[0] == '/') +p_len--; +} +} +strcpy(fullpath[p_len], component); av_strlcpy() fixed Mariusz libavutil/avstring.c| 43 +++ libavutil/avstring.h| 10 ++ tests/ref/fate/avstring |9 + 3 files changed, 62 insertions(+) 63e9d3c9f993fff81fbbb734a1e4d2728ebf85eb 0003-lavu-avstring-add-av_append_path_component-funcion.patch From a79c0aceef2d3c9f51973958910bed773462fdd8 Mon Sep 17 00:00:00 2001 From: Lukasz Marek lukasz.m.lu...@gmail.com Date: Sat, 5 Jul 2014 18:12:02 +0200 Subject: [PATCH 3/4] lavu/avstring: add av_append_path_component() funcion Convinient function to build paths. --- libavutil/avstring.c| 43 +++ libavutil/avstring.h| 10 ++ tests/ref/fate/avstring | 9 + 3 files changed, 62 insertions(+) diff --git a/libavutil/avstring.c b/libavutil/avstring.c index 25c65b4..24bc23a 100644 --- a/libavutil/avstring.c +++ b/libavutil/avstring.c @@ -269,6 +269,35 @@ const char *av_dirname(char *path) return path; } +char *av_append_path_component(const char *path, const char *component) +{ +size_t p_len, c_len; +char *fullpath; + +if (!path) +return component ? av_strdup(component) : NULL; the NULL check before av_strdup should not be needed +if (!component) +return av_strdup(path); + +p_len = strlen(path); +c_len = strlen(component); +fullpath = av_malloc(p_len + c_len + 2); this needs a check for potential integer overflow of the additions [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many that live deserve death. And some that die deserve life. Can you give it to them? Then do not be too eager to deal out death in judgement. For even the very wise cannot see all ends. -- Gandalf signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/4] avfilter/tinterlace: Change enum to int, which is accessed via AVOption as int
On Sat, Mar 28, 2015 at 10:28:54PM +0100, Michael Niedermayer wrote: This fixes depending on implementation defined behavior Signed-off-by: Michael Niedermayer michae...@gmx.at --- libavfilter/tinterlace.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) patchset applied [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 3 Rare item - Common item with rare defect or maybe just a lie Professional - 'Toy' made in china, not functional except as doorstop Experts will know - The seller hopes you are not an expert signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/4] lavf: add directory listing API
On 29.03.2015 01:14, Mariusz Szczepańczyk wrote: diff --git a/doc/APIchanges b/doc/APIchanges index 3f153e9..814f752 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,15 @@ libavutil: 2014-08-09 API changes, most recent first: +2015-03-27 - 184084c - lavf 56.27.100 - avio.h url.h + New directory listing API. + + Add AVIODirEntryType enum. + Add AVIODirEntry, AVIODirContext structures. + Add avio_open_dir(), avio_read_dir(), avio_close_dir(), avio_free_directory_entry(). + Add ff_alloc_dir_entry(). + Extend URLProtocol with url_open_dir(), url_read_dir(), url_close_dir(). It can be simple add url_open_dir()..., but it is OK I think + 8 - FFmpeg 2.6 was cut here 8 - 2015-03-04 - cca4476 - lavf 56.25.100 diff --git a/libavformat/version.h b/libavformat/version.h index a183d7f..ff85227 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -30,7 +30,7 @@ #include libavutil/version.h #define LIBAVFORMAT_VERSION_MAJOR 56 -#define LIBAVFORMAT_VERSION_MINOR 26 +#define LIBAVFORMAT_VERSION_MINOR 27 Michaels, do you gonna merge it? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel