Re: [FFmpeg-devel] [PATCH 1/4] concatdec: add support for specifying inpoint of files
L'octidi 18 messidor, an CCXXIII, Marton Balint a écrit : I chose the in and out keywords because for intra frame (and exactly interleaved) content (where packet based cutting actually works without additional magic) it matches the semantics of inpoint and outpoint in an EDL list. I can change it if you still prefer seek. I suppose inpoint and outpoint in full could satisfy us both, could it not? If the documentations contains the words seek and skip, it should be enough that all users should be able to find it. Are you referring to file_start_time or file_inpoint? I was referring to file_start_time: currently, it is recomputed for each packet, but that is fine since the computation is very simple. Your patch makes it a bit more complex, it becomes useful to share it. You did some of it in get_cur_file_inpoint(), but I suspect it could be even simpler. In particular, a single field in the structure would make it easier to see that it is constant. But as I said, I do not object the patch just because of that. 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] snow: remove strange av_assert2
Hi, On Tue, Jul 7, 2015 at 7:22 PM, Michael Niedermayer michae...@gmx.at wrote: On Tue, Jul 07, 2015 at 11:32:59PM +0200, Andreas Cadhalpun wrote: On 06.07.2015 02:40, Michael Niedermayer wrote: On Sun, Jul 05, 2015 at 09:11:44PM +0200, Andreas Cadhalpun wrote: Can you explain how elements can be too larger to fit? emulated_edge_mc() writes a block of width x height, More precisely that's block_w x block_h. if stride width this will not work as intended Then an assert for stride block_w might make sense in emulated_edge_mc, but not in add_yblock. ok, added I don't think this makes sense: - first of all, it should be =; - second of all, are we going to add asserts to each and every function that takes a stride argument? - third of all, if people want to call if with stride = 0 or negative stride or whatever, why not? The function still does what it does, just overwrites its own data. Not our problem. - last of all, I want to remind you guys that we haven't done a very thorough code analysis to see if this can actually be triggered. As an example, look at commit 458446acfa1441d283dacf9e6e545beb083b8bb0. Before that, vp8 files smaller than 16x16 or vp9 files smaller than 64x64 could cause aborts. The vp9 ones I noticed due to some fate files being so small. I doubt you'll ever find such vp8 files, but they're valid. Let's not add silly checks to replace other silly ones. Ronald ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] concatdec: add support for specifying outpoint of files
L'octidi 18 messidor, an CCXXIII, Marton Balint a écrit : Yeah, i know. Actually I don't see how would it be possible to give a stronger kind of guarantee efficiently and reliably to the user. That is why I suppose this could be done by discarding the packets beyond outpoint until either all streams have had one or one packets exceeds outpoint+epsilon. But that makes the code more complex, and there still is the issue of B-frames. I sticked to the simplest-to-implement method. For the moment - if the user will use this directive to cut parts in an interleaved video, he should know his interleaving delays (and his GOP sizes :)) I suppose it can do with the proper documentation. 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 4/4] concatdec: add support for injecting packet metadata
Le nonidi 19 messidor, an CCXXIII, Marton Balint a écrit : Actually I have one more patch I have not yet sent to the list, which adds support to select frames by metadata to the select filters. With that, you can cut frame accurately from XDCAM HD files if you overshoot outpoint a bit and store the useful timecodes in the packet metadata: ffconcat version 1.0 file 'XDCAMHD.mxf' in 01:04.00 out 01:05.12 metadata select.from=0 metadata select.until=0.96 duration 1 file 'XDCAMHD.mxf' in 01:06.00 out 01:07.12 duration 1 metadata select.from=1 metadata select.until=1.96 ./ffmpeg -copyts -vsync 0 -i test.concat -vf select='between(t,meta(0),meta(1)):meta_keys=select.from|select.until' -af aselect='between(t,meta(0),meta(1)):meta_keys=select.from|select.until' Interesting. I suppose at some point some kind of edltrim filter would be nice, avoiding the need for a formula in the filters, but as is it does the work. One issue I had not thought of in my previous mail: per-packet metadata is unusual (so much so it uses side data instead of a field), so maybe the name of the directive should reflect that, so that just metadata would be available for per-stream or per-file metadata. I have no really good name for it, though: all_packets_metadata is all that comes to mind. 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]Error out if mjpeg over rtp is not 4:2:0
On 7/8/15, Carl Eugen Hoyos ceho...@ag.or.at wrote: Hi! Looking at tickets #3823 and #4317 it seems to me that FFmpeg currently only supports 4:2:0 subsampling when sending jpeg over rtp. I believe an error should be shown if 4:2:2 or 4:4:4 are provided. Please comment, Carl Eugen Looking at rtpenc_jpeg: 422 is mentioned there. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH]Error out if mjpeg over rtp is not 4:2:0
Hi! Looking at tickets #3823 and #4317 it seems to me that FFmpeg currently only supports 4:2:0 subsampling when sending jpeg over rtp. I believe an error should be shown if 4:2:2 or 4:4:4 are provided. Please comment, Carl Eugen diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index 31569d6..ab50ebb 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -102,6 +102,13 @@ static int rtp_write_header(AVFormatContext *s1) return -1; } +if ( st-codec-codec_id == AV_CODEC_ID_MJPEG + st-codec-pix_fmt != AV_PIX_FMT_YUVJ420P + st-codec-pix_fmt != AV_PIX_FMT_YUV420P) { +av_log(s1, AV_LOG_ERROR, + Only 4:2:0 subsampling supported for (M)JPEG over rtp\n); +return AVERROR_PATCHWELCOME; +} if (s-payload_type 0) { /* Re-validate non-dynamic payload types */ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] library.mak: add rpath to shared libraries
On Tue, Jul 07, 2015 at 09:55:00PM -0400, Ganesh Ajjanagadde wrote: On Sun, Jul 5, 2015 at 1:01 PM, Michael Niedermayer michae...@gmx.at wrote: On Sat, Jul 04, 2015 at 10:21:47AM -0400, Ganesh Ajjanagadde wrote: On Sat, Jun 27, 2015 at 7:18 PM, Ganesh Ajjanagadde gajja...@mit.edu wrote: On Sat, Jun 27, 2015 at 9:49 AM, Ganesh Ajjanagadde gajja...@mit.edu wrote: On Sat, Jun 27, 2015 at 2:22 AM, Hendrik Leppkes h.lepp...@gmail.com wrote: On Sat, Jun 27, 2015 at 3:09 AM, Ganesh Ajjanagadde gajjanaga...@gmail.com wrote: Fixes Ticket4673 Signed-off-by: Ganesh Ajjanagadde gajjanaga...@gmail.com --- library.mak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.mak b/library.mak index 29460b8..401da7c 100644 --- a/library.mak +++ b/library.mak @@ -58,7 +58,7 @@ $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR) $(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SLIBOBJS) $(SUBDIR)lib$(NAME).ver $(SLIB_CREATE_DEF_CMD) - $$(LD) $(SHFLAGS) $(LDFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS) + $$(LD) $(SHFLAGS) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS) $(SLIB_EXTRA_CMD) LDEXEFLAGS is clearly not the appropriate way to go about this. These flags are for executables, not for shared libraries. - Hendrik Ok, so is it fine if this gets added to LDFLAGS instead? Or should a separate e.g LDLIBFLAGS be used? Attached is new patch that creates a LDLIBFLAGS. Ping. breaks build with mingw make ffmpeg/library.mak:111: *** commands commence before first target. Stop. So I did a successful cross-compile (as per the guide online) using my patch and configure line: ./configure --enable-rpath --prefix=/opt/ffmpeg --enable-shared --enable-memalign-hack --arch=x86 --target-os=mingw32 --cross-prefix=i686-w64-mingw32- --pkg-config=pkg-config I do not get any such build error. Is it a problem with native mingw build? i tried again and it works now, i am not sure but i think git maybe had removed a tab when applying and i missed that patch applied thanks [...] -- 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 4/4] concatdec: add support for injecting packet metadata
On Wed, 8 Jul 2015, Nicolas George wrote: Le nonidi 19 messidor, an CCXXIII, Marton Balint a écrit : Actually I have one more patch I have not yet sent to the list, which adds support to select frames by metadata to the select filters. With that, you can cut frame accurately from XDCAM HD files if you overshoot outpoint a bit and store the useful timecodes in the packet metadata: ffconcat version 1.0 file 'XDCAMHD.mxf' in 01:04.00 out 01:05.12 metadata select.from=0 metadata select.until=0.96 duration 1 file 'XDCAMHD.mxf' in 01:06.00 out 01:07.12 duration 1 metadata select.from=1 metadata select.until=1.96 ./ffmpeg -copyts -vsync 0 -i test.concat -vf select='between(t,meta(0),meta(1)):meta_keys=select.from|select.until' -af aselect='between(t,meta(0),meta(1)):meta_keys=select.from|select.until' Interesting. I suppose at some point some kind of edltrim filter would be nice, avoiding the need for a formula in the filters, but as is it does the work. One issue I had not thought of in my previous mail: per-packet metadata is unusual (so much so it uses side data instead of a field), so maybe the name of the directive should reflect that, so that just metadata would be available for per-stream or per-file metadata. I have no really good name for it, though: all_packets_metadata is all that comes to mind. I'd still use the metadata directive. If someone needs per-stream, or per-packet metadata, he can implement selector directives for that. Like metadata_stream or metadata_interval which will change the scope of the following metadata directives. How about that? Thanks, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] snow: remove strange av_assert2
On Wed, Jul 08, 2015 at 07:24:13AM -0400, Ronald S. Bultje wrote: Hi, On Tue, Jul 7, 2015 at 7:22 PM, Michael Niedermayer michae...@gmx.at wrote: On Tue, Jul 07, 2015 at 11:32:59PM +0200, Andreas Cadhalpun wrote: On 06.07.2015 02:40, Michael Niedermayer wrote: On Sun, Jul 05, 2015 at 09:11:44PM +0200, Andreas Cadhalpun wrote: Can you explain how elements can be too larger to fit? emulated_edge_mc() writes a block of width x height, More precisely that's block_w x block_h. if stride width this will not work as intended Then an assert for stride block_w might make sense in emulated_edge_mc, but not in add_yblock. ok, added I don't think this makes sense: - first of all, it should be =; that is what i added, i had just forgot mentioning that in my reply - second of all, are we going to add asserts to each and every function that takes a stride argument? - third of all, if people want to call if with stride = 0 or negative stride or whatever, why not? The function still does what it does, just overwrites its own data. Not our problem. my commit already handled negative strides. - last of all, I want to remind you guys that we haven't done a very thorough code analysis to see if this can actually be triggered. As an example, look at commit 458446acfa1441d283dacf9e6e545beb083b8bb0. Before that, vp8 files smaller than 16x16 or vp9 files smaller than 64x64 could cause aborts. The vp9 ones I noticed due to some fate files being so small. I doubt you'll ever find such vp8 files, but they're valid. Let's not add silly checks to replace other silly ones. if people prefer i ca revert b8c438e7623644edcfdb508c946a723a3b79b893 or add a check for stride == 0 what do people prefer ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The bravest are surely those who have the clearest vision of what is before them, glory and danger alike, and yet notwithstanding go out to meet it. -- Thucydides signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] fix mime-types in movenc.c
https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/CreatingContentforSafarioniPhone/CreatingContentforSafarioniPhone.html says video/mp4 suggested by BBB on irc. -compndiff --git a/libavformat/movenc.c b/libavformat/movenc.c index 42529ec..a95fbde 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -5594,7 +5594,7 @@ MOV_CLASS(mp4) AVOutputFormat ff_mp4_muxer = { .name = mp4, .long_name = NULL_IF_CONFIG_SMALL(MP4 (MPEG-4 Part 14)), -.mime_type = application/mp4, +.mime_type = video/mp4, .extensions= mp4, .priv_data_size= sizeof(MOVMuxContext), .audio_codec = AV_CODEC_ID_AAC, @@ -5648,7 +5648,7 @@ MOV_CLASS(ipod) AVOutputFormat ff_ipod_muxer = { .name = ipod, .long_name = NULL_IF_CONFIG_SMALL(iPod H.264 MP4 (MPEG-4 Part 14)), -.mime_type = application/mp4, +.mime_type = video/mp4, .extensions= m4v,m4a, .priv_data_size= sizeof(MOVMuxContext), .audio_codec = AV_CODEC_ID_AAC, @@ -5666,7 +5666,7 @@ MOV_CLASS(ismv) AVOutputFormat ff_ismv_muxer = { .name = ismv, .long_name = NULL_IF_CONFIG_SMALL(ISMV/ISMA (Smooth Streaming)), -.mime_type = application/mp4, +.mime_type = video/mp4, .extensions= ismv,isma, .priv_data_size= sizeof(MOVMuxContext), .audio_codec = AV_CODEC_ID_AAC, ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/9] lavf/tcp: add tcp_accept
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- libavformat/tcp.c | 18 ++ 1 file changed, 18 insertions(+) Changes since first version: - Add av_assert0() check for sc-listen - Add bitmask for s-flags in ffurl_alloc - Use ff_accept() instead of accept() diff --git a/libavformat/tcp.c b/libavformat/tcp.c index f24cad2..6f5e175 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include avformat.h +#include libavutil/avassert.h #include libavutil/parseutils.h #include libavutil/opt.h #include libavutil/time.h @@ -163,6 +164,22 @@ static int tcp_open(URLContext *h, const char *uri, int flags) return ret; } +static int tcp_accept(URLContext *s, URLContext **c) +{ +TCPContext *sc = s-priv_data; +TCPContext *cc; +int ret; +av_assert0(sc-listen); +if ((ret = ffurl_alloc(c, s-filename, s-flags AVIO_FLAG_READ_WRITE, s-interrupt_callback)) 0) +return ret; +cc = (*c)-priv_data; +ret = ff_accept(sc-fd, sc-listen_timeout, s); +if (ret 0) +return ff_neterrno(); +cc-fd = ret; +return 0; +} + static int tcp_read(URLContext *h, uint8_t *buf, int size) { TCPContext *s = h-priv_data; @@ -223,6 +240,7 @@ static int tcp_get_file_handle(URLContext *h) URLProtocol ff_tcp_protocol = { .name= tcp, .url_open= tcp_open, +.url_accept = tcp_accept, .url_read= tcp_read, .url_write = tcp_write, .url_close = tcp_close, -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 5/9] lavf/tcp: increase range for listen and call the underlying socket operations accordingly
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- libavformat/tcp.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) Changes since first version: - Set ret when ff_listen_bind() fails diff --git a/libavformat/tcp.c b/libavformat/tcp.c index 6f5e175..5505945 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -45,7 +45,7 @@ typedef struct TCPContext { #define D AV_OPT_FLAG_DECODING_PARAM #define E AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { -{ listen, Listen for incoming connections, OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = D|E }, +{ listen, Listen for incoming connections, OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, .flags = D|E }, { timeout, set timeout (in microseconds) of socket I/O operations, OFFSET(rw_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, { listen_timeout, Connection awaiting timeout (in milliseconds), OFFSET(listen_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, { NULL } @@ -126,12 +126,18 @@ static int tcp_open(URLContext *h, const char *uri, int flags) goto fail; } -if (s-listen) { -if ((ret = ff_listen_bind(fd, cur_ai-ai_addr, cur_ai-ai_addrlen, - s-listen_timeout, h)) 0) { +if (s-listen == 2) { +// multi-client +if ((ret = ff_listen(fd, cur_ai-ai_addr, cur_ai-ai_addrlen)) 0) { +goto fail1; +} +} else if (s-listen == 1) { +// single client +if ((fd = ff_listen_bind(fd, cur_ai-ai_addr, cur_ai-ai_addrlen, + s-listen_timeout, h)) 0) { +ret = fd; goto fail1; } -fd = ret; } else { if ((ret = ff_listen_connect(fd, cur_ai-ai_addr, cur_ai-ai_addrlen, s-open_timeout / 1000, h, !!cur_ai-ai_next)) 0) { -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 6/9] lavf/http: add http_accept
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- libavformat/http.c | 19 +++ 1 file changed, 19 insertions(+) Changes since first version: - Add av_assert0() check for sc-listen - Add bitmask for s-flags in ffurl_alloc diff --git a/libavformat/http.c b/libavformat/http.c index 676bfd5..3c1ec35 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -25,6 +25,7 @@ #include zlib.h #endif /* CONFIG_ZLIB */ +#include libavutil/avassert.h #include libavutil/avstring.h #include libavutil/opt.h @@ -382,6 +383,24 @@ static int http_open(URLContext *h, const char *uri, int flags, return ret; } +static int http_accept(URLContext *s, URLContext **c) +{ +int ret; +HTTPContext *sc = s-priv_data; +HTTPContext *cc; +URLContext *sl = sc-hd; +URLContext *cl; +av_assert0(sc-listen); +if ((ret = ffurl_alloc(c, s-filename, s-flags AVIO_FLAG_READ_WRITE, sl-interrupt_callback)) 0) +goto fail; +cc = (*c)-priv_data; +if ((ret = ffurl_accept(sl, cl)) 0) +goto fail; +cc-hd = cl; +fail: +return ret; +} + static int http_getc(HTTPContext *s) { int len; -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 8/9] doc/protocols: document experimental mutli-client api
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- doc/protocols.texi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/protocols.texi b/doc/protocols.texi index 453dbcf..39a132a 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -292,6 +292,8 @@ autodetection in the future. If set to 1 enables experimental HTTP server. This can be used to send data when used as an output option, or read data from a client with HTTP POST when used as an input option. +If set to 2 enables experimental mutli-client HTTP server. This is not yet implemented +in ffmpeg.c or ffserver.c and thus must not be used as a command line option. @example # Server side (sending): ffmpeg -i somefile.ogg -c copy -listen 1 -f ogg http://@var{server}:@var{port} -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 9/9] doc/example: Add http multi-client example code
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- doc/examples/Makefile | 1 + doc/examples/http_multiclient.c | 120 2 files changed, 121 insertions(+) create mode 100644 doc/examples/http_multiclient.c Changes since first version: - Move client handling code in separate function - Close filedescriptors earlier diff --git a/doc/examples/Makefile b/doc/examples/Makefile index 9699f11..8c9501b 100644 --- a/doc/examples/Makefile +++ b/doc/examples/Makefile @@ -18,6 +18,7 @@ EXAMPLES= avio_list_dir \ extract_mvs\ filtering_video\ filtering_audio\ +http_multiclient \ metadata \ muxing \ remuxing \ diff --git a/doc/examples/http_multiclient.c b/doc/examples/http_multiclient.c new file mode 100644 index 000..a780321 --- /dev/null +++ b/doc/examples/http_multiclient.c @@ -0,0 +1,120 @@ +/* + * copyright (c) 2015 Stephan Holljes + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * libavformat multi-client network API usage example. + * + * @example http_multiclient.c + * This example will serve a file without decoding or demuxing it over http. + * Multiple clients can connect and will receive the same file. + */ + +#include libavformat/avformat.h +#include unistd.h + +void process_client(AVIOContext *client, const char* in_uri) +{ +AVIOContext *input =NULL; +uint8_t buf[1024]; +int ret, n; +avio_handshake(client); +fprintf(stderr, Handshake performed.\n); +fprintf(stderr, Opening input file.\n); +if ((ret = avio_open2(input, in_uri, AVIO_FLAG_READ, NULL, NULL)) 0) { +av_log(input, AV_LOG_ERROR, Failed to open input: %s\n, in_uri); +return; +} +for(;;) { +n = avio_read(input, buf, sizeof(buf)); +if (n 0) { +if (n == AVERROR_EOF) +break; +av_log(input, AV_LOG_ERROR, Error reading from input: %s.\n, + av_err2str(n)); +ret = n; +break; +} +avio_write(client, buf, n); +avio_flush(client); +} +fprintf(stderr, Flushing client\n); +avio_flush(client); +fprintf(stderr, Closing client\n); +avio_close(client); +fprintf(stderr, Closing input\n); +avio_close(input); +} + +int main(int argc, char **argv) +{ +AVDictionary *options = NULL; +AVIOContext *client = NULL, *server = NULL; +const char *in_uri, *out_uri; +int ret, pid; +if (argc 3) { +printf(usage: %s input http://hostname[:port]\n; + API example program to serve http to multiple clients.\n + \n, argv[0]); +return 1; +} + +in_uri = argv[1]; +out_uri = argv[2]; + +av_register_all(); +avformat_network_init(); + +if ((ret = av_dict_set(options, listen, 2, 0)) 0) +goto end; +if ((ret = avio_open2(server, out_uri, AVIO_FLAG_READ_WRITE, NULL, options)) 0) +goto end; +fprintf(stderr, Entering main loop.\n); +for(;;) { +if ((ret = avio_accept(server, client)) 0) +goto end; +fprintf(stderr, Accepted client, forking process.\n); +// XXX: Since we don't reap our children and don't ignore signals +// this produces zombie processes. +pid = fork(); +if (pid 0) { +fprintf(stderr, Fork failed.\n); +ret = AVERROR(errno); +goto end; +} +if (pid == 0) { +fprintf(stderr, In child.\n); +process_client(client, in_uri); +avio_close(server); +exit(0); +} +if (pid 0) +avio_close(client); +} + +end: +avio_close(server); +if (ret 0 ret != AVERROR_EOF) { +fprintf(stderr, Some errors occured: ); +fprintf(stderr, %s\n, av_err2str(ret)); +return 1; +} +return 0; +} -- 2.1.0 ___
[FFmpeg-devel] [PATCH 2/9] lavf/avio: add ffurl_accept and ffurl_handshake
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- libavformat/avio.c | 19 +++ libavformat/url.h | 18 ++ 2 files changed, 37 insertions(+) Changes since first version: - Add documentation - Let url_accept() allocate contexts - ffurl_handshake only takes one URLContext diff --git a/libavformat/avio.c b/libavformat/avio.c index c188adc..1182336 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -211,6 +211,25 @@ int ffurl_connect(URLContext *uc, AVDictionary **options) return 0; } +int ffurl_accept(URLContext *s, URLContext **c) +{ +if (s-prot-url_accept) +return s-prot-url_accept(s, c); +return 0; +} + +int ffurl_handshake(URLContext *c) +{ +int ret; +if (c-prot-url_handshake) { +ret = c-prot-url_handshake(c); +if (ret) +return ret; +} +c-is_connected = 1; +return 0; +} + #define URL_SCHEME_CHARS\ abcdefghijklmnopqrstuvwxyz\ ABCDEFGHIJKLMNOPQRSTUVWXYZ\ diff --git a/libavformat/url.h b/libavformat/url.h index 99a3201..d010a77 100644 --- a/libavformat/url.h +++ b/libavformat/url.h @@ -58,6 +58,8 @@ typedef struct URLProtocol { * for those nested protocols. */ int (*url_open2)(URLContext *h, const char *url, int flags, AVDictionary **options); +int (*url_accept)(URLContext *s, URLContext **c); +int (*url_handshake)(URLContext *c); /** * Read data from the protocol. @@ -140,6 +142,22 @@ int ffurl_open(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options); /** + * Accept an URLContext c on an URLContext s + * @param s server context + * @param c client context + * @return = 0 on success, ff_neterrno() on failure. + */ +int ffurl_accept(URLContext *s, URLContext **c); + +/** + * Perform a protocol handshake on the passed client context. + * @param c the client context + * @return = 0 on success or a negative value corresponding + * to an AVERROR code on failure + */ +int ffurl_handshake(URLContext *c); + +/** * Read up to size bytes from the resource accessed by h, and store * the read bytes in buf. * -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/9] lavf/network: split ff_listen_bind into ff_listen and ff_accept
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- libavformat/network.c | 27 +-- libavformat/network.h | 20 2 files changed, 41 insertions(+), 6 deletions(-) Changes since first version: - Added documentation - Restore previous behaviour of not closing server socket if accept() fails diff --git a/libavformat/network.c b/libavformat/network.c index 47ade8c..7a326d2 100644 --- a/libavformat/network.c +++ b/libavformat/network.c @@ -187,12 +187,11 @@ int ff_socket(int af, int type, int proto) return fd; } -int ff_listen_bind(int fd, const struct sockaddr *addr, - socklen_t addrlen, int timeout, URLContext *h) +int ff_listen(int fd, const struct sockaddr *addr, + socklen_t addrlen) { int ret; int reuse = 1; -struct pollfd lp = { fd, POLLIN, 0 }; if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, reuse, sizeof(reuse))) { av_log(NULL, AV_LOG_WARNING, setsockopt(SO_REUSEADDR) failed\n); } @@ -203,6 +202,13 @@ int ff_listen_bind(int fd, const struct sockaddr *addr, ret = listen(fd, 1); if (ret) return ff_neterrno(); +return ret; +} + +int ff_accept(int fd, int timeout, URLContext *h) +{ +int ret; +struct pollfd lp = { fd, POLLIN, 0 }; ret = ff_poll_interrupt(lp, 1, timeout, h-interrupt_callback); if (ret 0) @@ -211,15 +217,24 @@ int ff_listen_bind(int fd, const struct sockaddr *addr, ret = accept(fd, NULL, NULL); if (ret 0) return ff_neterrno(); - -closesocket(fd); - if (ff_socket_nonblock(ret, 1) 0) av_log(NULL, AV_LOG_DEBUG, ff_socket_nonblock failed\n); return ret; } +int ff_listen_bind(int fd, const struct sockaddr *addr, + socklen_t addrlen, int timeout, URLContext *h) +{ +int ret; +if ((ret = ff_listen(fd, addr, addrlen)) 0) +return ret; +if ((ret = ff_accept(fd, timeout, h)) 0) +return ret; +closesocket(fd); +return ret; +} + int ff_listen_connect(int fd, const struct sockaddr *addr, socklen_t addrlen, int timeout, URLContext *h, int will_try_next) diff --git a/libavformat/network.h b/libavformat/network.h index 86fb656..f83c796 100644 --- a/libavformat/network.h +++ b/libavformat/network.h @@ -255,6 +255,26 @@ int ff_listen_bind(int fd, const struct sockaddr *addr, URLContext *h); /** + * Bind to a file descriptor to an address without accepting connections. + * @param fd First argument of bind(). + * @param addrSecond argument of bind(). + * @param addrlen Third argument of bind(). + * @return0 on success or an AVERROR on failure. + */ +int ff_listen(int fd, const struct sockaddr *addr, socklen_t addrlen); + +/** + * Poll for a single connection on the passed file descriptor. + * @param fd The listening socket file descriptor. + * @param timeout Polling timeout in milliseconds. + * @param h URLContext providing interrupt check + *callback and logging context. + * @returnA non-blocking file descriptor on success + *or an AVERROR on failure. + */ +int ff_accept(int fd, int timeout, URLContext *h); + +/** * Connect to a file descriptor and poll for result. * * @param fd First argument of connect(), -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/9] lavf/avio: add avio_accept and avio_handshake
Signed-off-by: Stephan Holljes klaxa1...@googlemail.com --- libavformat/avio.h| 16 libavformat/aviobuf.c | 17 + 2 files changed, 33 insertions(+) Changes since first version: - Add documentation diff --git a/libavformat/avio.h b/libavformat/avio.h index d3d9bbd..b7a4fa8 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -648,4 +648,20 @@ struct AVBPrint; */ int avio_read_to_bprint(AVIOContext *h, struct AVBPrint *pb, size_t max_size); +/** + * Accept and allocate a client context on a server context. + * @param s the server context + * @param c the client context + * @return = 0 on success or a negative value corresponding + * to an AVERROR on failure + */ +int avio_accept(AVIOContext *s, AVIOContext **c); + +/** + * Perform a protocol dependent handshake + * @param c the client context to perform the handshake on + * @return = 0 on success or a negative value corresponding + * to an AVERROR on failure + */ +int avio_handshake(AVIOContext *c); #endif /* AVFORMAT_AVIO_H */ diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index ff85081..ce05c5d 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -1021,6 +1021,23 @@ int avio_read_to_bprint(AVIOContext *h, AVBPrint *pb, size_t max_size) return 0; } +int avio_accept(AVIOContext *s, AVIOContext **c) +{ +int ret; +URLContext *sc = s-opaque; +URLContext *cc; +ret = ffurl_accept(sc, cc); +if (ret 0) +return ret; +return ffio_fdopen(c, cc); +} + +int avio_handshake(AVIOContext *c) +{ +URLContext *cc = c-opaque; +return ffurl_handshake(cc); +} + /* output in a dynamic buffer */ typedef struct DynBuffer { -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] GSoC update
Hi, I have moved the client code in the sample application into a separate function, I hope I did this correctly. I also annotated the patch files with the changes that occurred over the past few iterations of these exchanges. They will be sent shortly as git send-email patches. I also tested the sample application numerous times with wget, nc and siege. I also constantly tested that sending data as a POST client still works (with wget). Regards, Stephan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg needs a new host
Hi On Wed, Jul 08, 2015 at 10:54:39AM +0300, Ilya Ustinov wrote: Dear Sir/Madam, I wanted to get in touch with the right person to address the need of FFmpeg project. What exact server / hosting do you want to offer ? We already hastly moved things to a box rented by ubitux in germany and a free box in england provided by kieran There also have been another offer for a free box and i think its quite plausible we will move again as free is better than paid by us i guess. Question is what exactly do you want / can you offer ? Thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB There will always be a question for which you do not know the correct answer. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg needs a new host
Hi Michael, thanks for getting back to me on the matter. Our company (CDNvideo) is CDN service provider therefore we do provide storage and delivery services to our customers. What I wanted to do is to get more info regarding your requirements as there could be something specific not just 4TB of storage and 4TB per month of traffic and after that speak with my boss to check whether we can provide those services to FFmpeg community free of charge. We do have POPs across Europe, North America, Russia CIS, and South-East Asia so there may be some benefits for community to host with us. So please let me know all the requirements and I'll do the rest. Thanks! Ilya On 08 июля 2015 г., at 22:33, Michael Niedermayer michae...@gmx.at wrote: Hi On Wed, Jul 08, 2015 at 10:54:39AM +0300, Ilya Ustinov wrote: Dear Sir/Madam, I wanted to get in touch with the right person to address the need of FFmpeg project. What exact server / hosting do you want to offer ? We already hastly moved things to a box rented by ubitux in germany and a free box in england provided by kieran There also have been another offer for a free box and i think its quite plausible we will move again as free is better than paid by us i guess. Question is what exactly do you want / can you offer ? Thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB There will always be a question for which you do not know the correct answer. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/libx265: allow 12bit input formats, update warnings
The range extension profiles have been fully ratified so there is no reason to require -strict experimental for them. However Main12 support in x265 is experimental so I check for that instead. --- libavcodec/libx265.c | 26 ++ 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index e9240f9..f67eb72 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -84,10 +84,9 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) if (!ctx-api) ctx-api = x265_api_get(0); -if (avctx-strict_std_compliance FF_COMPLIANCE_EXPERIMENTAL -!av_pix_fmt_desc_get(avctx-pix_fmt)-log2_chroma_w) { +if (avctx-strict_std_compliance FF_COMPLIANCE_EXPERIMENTAL ctx-api-bit_depth == 12) { av_log(avctx, AV_LOG_ERROR, - 4:2:2 and 4:4:4 support is not fully defined for HEVC yet. + Main12 support in x265 still experimental. Set -strict experimental to encode anyway.\n); return AVERROR(ENOSYS); } @@ -162,14 +161,17 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) switch (avctx-pix_fmt) { case AV_PIX_FMT_YUV420P: case AV_PIX_FMT_YUV420P10: +case AV_PIX_FMT_YUV420P12: ctx-params-internalCsp = X265_CSP_I420; break; case AV_PIX_FMT_YUV422P: case AV_PIX_FMT_YUV422P10: +case AV_PIX_FMT_YUV422P12: ctx-params-internalCsp = X265_CSP_I422; break; case AV_PIX_FMT_YUV444P: case AV_PIX_FMT_YUV444P10: +case AV_PIX_FMT_YUV444P12: ctx-params-internalCsp = X265_CSP_I444; break; } @@ -330,6 +332,16 @@ static const enum AVPixelFormat x265_csp_eight[] = { AV_PIX_FMT_NONE }; +static const enum AVPixelFormat x265_csp_ten[] = { +AV_PIX_FMT_YUV420P, +AV_PIX_FMT_YUV422P, +AV_PIX_FMT_YUV444P, +AV_PIX_FMT_YUV420P10, +AV_PIX_FMT_YUV422P10, +AV_PIX_FMT_YUV444P10, +AV_PIX_FMT_NONE +}; + static const enum AVPixelFormat x265_csp_twelve[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, @@ -337,13 +349,19 @@ static const enum AVPixelFormat x265_csp_twelve[] = { AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10, +AV_PIX_FMT_YUV420P12, +AV_PIX_FMT_YUV422P12, +AV_PIX_FMT_YUV444P12, AV_PIX_FMT_NONE }; + static av_cold void libx265_encode_init_csp(AVCodec *codec) { -if (x265_api_get(10)) +if (x265_api_get(12)) codec-pix_fmts = x265_csp_twelve; +else if (x265_api_get(10)) +codec-pix_fmts = x265_csp_ten; else if (x265_api_get(8)) codec-pix_fmts = x265_csp_eight; } -- 2.1.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] oggparsedirac: check return value of init_get_bits
On Tue, Jul 07, 2015 at 05:32:17PM +, Chris Watkins wrote: On Mon, Apr 20, 2015 at 7:25 PM Clément Bœsch u...@pkh.me wrote: On Mon, Apr 20, 2015 at 02:29:54PM -0700, Christopher Watkins wrote: From a93fa19467ac2568cfe32332b789b315e37dbdf1 Mon Sep 17 00:00:00 2001 From: Chris Watkins w...@chromium.org Date: Mon, 20 Apr 2015 14:23:57 -0700 Subject: [PATCH] oggparsedirac: check return value of init_get_bits If init_get_bits fails the GetBitContext is invalid and must not be used. Check the return value in dirac_header and propogate the error. Signed-off-by: Chris Watkins w...@chromium.org --- libavformat/oggparsedirac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/oggparsedirac.c b/libavformat/oggparsedirac.c index 10fb07e..35be655 100644 --- a/libavformat/oggparsedirac.c +++ b/libavformat/oggparsedirac.c @@ -36,7 +36,9 @@ static int dirac_header(AVFormatContext *s, int idx) if (st-codec-codec_id == AV_CODEC_ID_DIRAC) return 0; -init_get_bits(gb, os-buf + os-pstart + 13, (os-psize - 13) * 8); +if (init_get_bits(gb, os-buf + os-pstart + 13, (os-psize - 13) * 8) 0) +return -1; int ret; // ... ret = init_get_bits(...); if (ret 0) return ret; You can also use init_get_bits8() while at it Thanks, done. I also used this pattern for the following call to avpriv_dirac_parse_sequence_header too. Sorry for the delay. -- Clément B. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel oggparsedirac.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) da246725f28ee17366c568d2def1ccd2f376cbce 0001-oggparsedirac-check-return-value-of-init_get_bits.patch From 4ec8999352db4af876d521d12d8d387ba278a127 Mon Sep 17 00:00:00 2001 From: Chris Watkins w...@chromium.org Date: Tue, 7 Jul 2015 10:23:44 -0700 Subject: [PATCH] oggparsedirac: check return value of init_get_bits applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB He who knows, does not speak. He who speaks, does not know. -- Lao Tsu signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/hevc_ps: Move return code setting code to the error cases
Iam not sure this is better or worse than before What do people prefer ? Signed-off-by: Michael Niedermayer michae...@gmx.at --- libavcodec/hevc_ps.c |9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 1038516..372081a 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -998,7 +998,6 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, sps, 0)) 0) goto err; } -ret = AVERROR_INVALIDDATA; sps-long_term_ref_pics_present_flag = get_bits1(gb); if (sps-long_term_ref_pics_present_flag) { @@ -1006,6 +1005,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, if (sps-num_long_term_ref_pics_sps 31U) { av_log(avctx, AV_LOG_ERROR, num_long_term_ref_pics_sps %d is out of range.\n, sps-num_long_term_ref_pics_sps); +ret = AVERROR_INVALIDDATA; goto err; } for (i = 0; i sps-num_long_term_ref_pics_sps; i++) { @@ -1096,6 +1096,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, if (sps-log2_ctb_size MAX_LOG2_CTB_SIZE) { av_log(avctx, AV_LOG_ERROR, CTB size out of range: 2^%d\n, sps-log2_ctb_size); +ret = AVERROR_INVALIDDATA; goto err; } if (sps-log2_ctb_size 4) { @@ -1104,6 +1105,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, log2_ctb_size %d differs from the bounds of any known profile\n, sps-log2_ctb_size); avpriv_request_sample(avctx, log2_ctb_size %d, sps-log2_ctb_size); +ret = AVERROR_INVALIDDATA; goto err; } @@ -1124,29 +1126,34 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, if (av_mod_uintp2(sps-width, sps-log2_min_cb_size) || av_mod_uintp2(sps-height, sps-log2_min_cb_size)) { av_log(avctx, AV_LOG_ERROR, Invalid coded frame dimensions.\n); +ret = AVERROR_INVALIDDATA; goto err; } if (sps-max_transform_hierarchy_depth_inter sps-log2_ctb_size - sps-log2_min_tb_size) { av_log(avctx, AV_LOG_ERROR, max_transform_hierarchy_depth_inter out of range: %d\n, sps-max_transform_hierarchy_depth_inter); +ret = AVERROR_INVALIDDATA; goto err; } if (sps-max_transform_hierarchy_depth_intra sps-log2_ctb_size - sps-log2_min_tb_size) { av_log(avctx, AV_LOG_ERROR, max_transform_hierarchy_depth_intra out of range: %d\n, sps-max_transform_hierarchy_depth_intra); +ret = AVERROR_INVALIDDATA; goto err; } if (sps-log2_max_trafo_size FFMIN(sps-log2_ctb_size, 5)) { av_log(avctx, AV_LOG_ERROR, max transform block size out of range: %d\n, sps-log2_max_trafo_size); +ret = AVERROR_INVALIDDATA; goto err; } if (get_bits_left(gb) 0) { av_log(avctx, AV_LOG_ERROR, Overread SPS by %d bits\n, -get_bits_left(gb)); +ret = AVERROR_INVALIDDATA; goto err; } -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/hevc_ps: Move return code setting code to the error cases
On 09/07/15 12:26 AM, Michael Niedermayer wrote: Iam not sure this is better or worse than before What do people prefer ? Signed-off-by: Michael Niedermayer michae...@gmx.at --- libavcodec/hevc_ps.c |9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 1038516..372081a 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -998,7 +998,6 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, sps, 0)) 0) goto err; } -ret = AVERROR_INVALIDDATA; sps-long_term_ref_pics_present_flag = get_bits1(gb); if (sps-long_term_ref_pics_present_flag) { @@ -1006,6 +1005,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, if (sps-num_long_term_ref_pics_sps 31U) { av_log(avctx, AV_LOG_ERROR, num_long_term_ref_pics_sps %d is out of range.\n, sps-num_long_term_ref_pics_sps); +ret = AVERROR_INVALIDDATA; goto err; } for (i = 0; i sps-num_long_term_ref_pics_sps; i++) { @@ -1096,6 +1096,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, if (sps-log2_ctb_size MAX_LOG2_CTB_SIZE) { av_log(avctx, AV_LOG_ERROR, CTB size out of range: 2^%d\n, sps-log2_ctb_size); +ret = AVERROR_INVALIDDATA; goto err; } if (sps-log2_ctb_size 4) { @@ -1104,6 +1105,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, log2_ctb_size %d differs from the bounds of any known profile\n, sps-log2_ctb_size); avpriv_request_sample(avctx, log2_ctb_size %d, sps-log2_ctb_size); +ret = AVERROR_INVALIDDATA; goto err; } @@ -1124,29 +1126,34 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, if (av_mod_uintp2(sps-width, sps-log2_min_cb_size) || av_mod_uintp2(sps-height, sps-log2_min_cb_size)) { av_log(avctx, AV_LOG_ERROR, Invalid coded frame dimensions.\n); +ret = AVERROR_INVALIDDATA; goto err; } if (sps-max_transform_hierarchy_depth_inter sps-log2_ctb_size - sps-log2_min_tb_size) { av_log(avctx, AV_LOG_ERROR, max_transform_hierarchy_depth_inter out of range: %d\n, sps-max_transform_hierarchy_depth_inter); +ret = AVERROR_INVALIDDATA; goto err; } if (sps-max_transform_hierarchy_depth_intra sps-log2_ctb_size - sps-log2_min_tb_size) { av_log(avctx, AV_LOG_ERROR, max_transform_hierarchy_depth_intra out of range: %d\n, sps-max_transform_hierarchy_depth_intra); +ret = AVERROR_INVALIDDATA; goto err; } if (sps-log2_max_trafo_size FFMIN(sps-log2_ctb_size, 5)) { av_log(avctx, AV_LOG_ERROR, max transform block size out of range: %d\n, sps-log2_max_trafo_size); +ret = AVERROR_INVALIDDATA; goto err; } if (get_bits_left(gb) 0) { av_log(avctx, AV_LOG_ERROR, Overread SPS by %d bits\n, -get_bits_left(gb)); +ret = AVERROR_INVALIDDATA; goto err; } Why not just replace every goto err with a return AVERROR_INVALIDDATA? The gotos seem pointless considering the only code after it is return ret. No memory being freed and nothing being uninitialized to justify them. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avcodev/libdcadec: implement request_channel_layout
On Tue, Jul 07, 2015 at 03:06:24AM -0300, James Almer wrote: Signed-off-by: James Almer jamr...@gmail.com --- libavcodec/libdcadec.c | 34 ++ 1 file changed, 34 insertions(+) diff --git a/libavcodec/libdcadec.c b/libavcodec/libdcadec.c index 4bc3765..796826e 100644 --- a/libavcodec/libdcadec.c +++ b/libavcodec/libdcadec.c @@ -36,6 +36,8 @@ typedef struct DCADecContext { int buffer_size; } DCADecContext; +static int downmix_warned = 0; in an application running a long time like something with a a list of media files, the warning would only be showen for the first file to which it applies i think it should rater be in the context and displayed once for each file it applies to [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Its not that you shouldnt use gotos but rather that you should write readable code and code with gotos often but not always is less readable signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodev/libdcadec: implement request_channel_layout
Signed-off-by: James Almer jamr...@gmail.com --- libavcodec/libdcadec.c | 33 + 1 file changed, 33 insertions(+) diff --git a/libavcodec/libdcadec.c b/libavcodec/libdcadec.c index 2d807a2..7cc1e95 100644 --- a/libavcodec/libdcadec.c +++ b/libavcodec/libdcadec.c @@ -34,6 +34,7 @@ typedef struct DCADecContext { struct dcadec_context *ctx; uint8_t *buffer; int buffer_size; +int downmix_warned; } DCADecContext; static int dcadec_decode_frame(AVCodecContext *avctx, void *data, @@ -132,6 +133,17 @@ static int dcadec_decode_frame(AVCodecContext *avctx, void *data, if (exss = dcadec_context_get_exss_info(s-ctx)) { enum AVMatrixEncoding matrix_encoding = AV_MATRIX_ENCODING_NONE; +if (!s-downmix_warned) { +uint64_t layout = avctx-request_channel_layout; + +if (((layout == AV_CH_LAYOUT_STEREO_DOWNMIX || layout == AV_CH_LAYOUT_STEREO) !exss-embedded_stereo) || +( layout == AV_CH_LAYOUT_5POINT1 !exss-embedded_6ch)) +av_log(avctx, AV_LOG_WARNING, %s downmix was requested but no custom coefficients are available, + this may result in clipping\n, + layout == AV_CH_LAYOUT_5POINT1 ? 5.1 : Stereo); +s-downmix_warned = 1; +} + switch(exss-matrix_encoding) { case DCADEC_MATRIX_ENCODING_SURROUND: matrix_encoding = AV_MATRIX_ENCODING_DOLBY; @@ -197,6 +209,27 @@ static av_cold int dcadec_init(AVCodecContext *avctx) if (avctx-flags CODEC_FLAG_BITEXACT) flags |= DCADEC_FLAG_CORE_BIT_EXACT; +if (avctx-request_channel_layout 0 avctx-request_channel_layout != AV_CH_LAYOUT_NATIVE) { +switch (avctx-request_channel_layout) { +case AV_CH_LAYOUT_STEREO: +case AV_CH_LAYOUT_STEREO_DOWNMIX: +/* libdcadec ignores the 2ch flag if used alone when no custom downmix coefficients + are available, silently outputting a 5.1 downmix if possible instead. + Using both the 2ch and 6ch flags together forces a 2ch downmix using default + coefficients in such cases. This matches the behavior of the 6ch flag when used + alone, where a 5.1 downmix is generated if possible, regardless of custom + coefficients being available or not. */ +flags |= DCADEC_FLAG_KEEP_DMIX_2CH | DCADEC_FLAG_KEEP_DMIX_6CH; +break; +case AV_CH_LAYOUT_5POINT1: +flags |= DCADEC_FLAG_KEEP_DMIX_6CH; +break; +default: +av_log(avctx, AV_LOG_WARNING, Invalid request_channel_layout\n); +break; +} +} + s-ctx = dcadec_context_create(flags); if (!s-ctx) return AVERROR(ENOMEM); -- 2.4.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] concatdec: add support for specifying outpoint of files
On Wed, 8 Jul 2015, Nicolas George wrote: L'octidi 18 messidor, an CCXXIII, Marton Balint a écrit : Yeah, i know. Actually I don't see how would it be possible to give a stronger kind of guarantee efficiently and reliably to the user. That is why I suppose this could be done by discarding the packets beyond outpoint until either all streams have had one or one packets exceeds outpoint+epsilon. But that makes the code more complex, and there still is the issue of B-frames. I gave it a thought, and if we ensure that the decoding timestamp reaches outpoint instead of the presentation timestamp, can't we overcome the B-frame issue? It's a simple change and seems to do the right thing. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] GSoC Weely report (libswscale)
Hi, Last week I worked on adding the ring buffer logic into SwsSlice and fixing some seg faults. As I'm having some problems with git send-email through gmail I've attached the patch. From cb66ff7f4cfe1879fe9303a84efe49fca40c6d46 Mon Sep 17 00:00:00 2001 From: Pedro Arthur bygran...@gmail.com Date: Fri, 3 Jul 2015 10:55:45 -0300 Subject: [PATCH 1/4] swscale: fix seg fault when accessing src slice --- libswscale/slice.c| 79 ++- libswscale/swscale.c | 5 ++- libswscale/swscale_internal.h | 3 +- 3 files changed, 54 insertions(+), 33 deletions(-) diff --git a/libswscale/slice.c b/libswscale/slice.c index 770b974..8cc071e 100644 --- a/libswscale/slice.c +++ b/libswscale/slice.c @@ -1,7 +1,7 @@ #include swscale_internal.h -static int alloc_slice(SwsSlice * s, enum AVPixelFormat fmt, int lumLines, int chrLines, int h_sub_sample, int v_sub_sample) +static int alloc_slice(SwsSlice * s, enum AVPixelFormat fmt, int lumLines, int chrLines, int h_sub_sample, int v_sub_sample, int ring) { int i; int err = 0; @@ -15,10 +15,11 @@ static int alloc_slice(SwsSlice * s, enum AVPixelFormat fmt, int lumLines, int c s-h_chr_sub_sample = h_sub_sample; s-v_chr_sub_sample = v_sub_sample; s-fmt = fmt; +s-is_ring = ring; for (i = 0; i 4; ++i) { -s-plane[i].line = av_malloc_array(sizeof(uint8_t*), size[i]); +s-plane[i].line = av_malloc_array(sizeof(uint8_t*), size[i] * ( ring == 0 ? 1 : 2)); if (!s-plane[i].line) { err = AVERROR(ENOMEM); @@ -45,7 +46,7 @@ static void free_slice(SwsSlice *s) av_freep(s-plane[i].line); } -int ff_init_slice_from_src(SwsSlice * s, uint8_t *src[4], int stride[4], int srcW, int lumY, int lumH, int chrY, int chrH, int skip) +int ff_init_slice_from_src(SwsSlice * s, uint8_t *src[4], int stride[4], int srcW, int lumY, int lumH, int chrY, int chrH) { int i = 0; @@ -53,30 +54,39 @@ int ff_init_slice_from_src(SwsSlice * s, uint8_t *src[4], int stride[4], int src chrY, chrY, lumY}; - -const int stride1[4] = {stride[0], - stride[1] skip, - stride[2] skip, - stride[3]}; - -const int height[4] = {lumH, -chrH, -chrH, -lumH}; + +const int end[4] = {lumY +lumH, +chrY + chrH, +chrY + chrH, +lumY + lumH}; s-width = srcW; for (i = 0; i 4; ++i) { int j; -int lines = height[i]; +int lines = end[i]; lines = s-plane[i].available_lines lines ? s-plane[i].available_lines : lines; -s-plane[i].sliceY = start[i]; -s-plane[i].sliceH = lines; +if (end[i] s-plane[i].sliceY+s-plane[i].sliceH) +{ +if (start[i] = s-plane[i].sliceY+1) +s-plane[i].sliceY = FFMIN(start[i], s-plane[i].sliceY); +else +s-plane[i].sliceY = start[i]; +s-plane[i].sliceH = end[i] - s-plane[i].sliceY; +} +else +{ +if (end[i] = s-plane[i].sliceY) +s-plane[i].sliceH = s-plane[i].sliceY + s-plane[i].sliceH - start[i]; +else +s-plane[i].sliceH = end[i] - start[i]; +s-plane[i].sliceY = start[i]; +} -for (j = 0; j lines; j+= 1 skip) -s-plane[i].line[j] = src[i] + (start[i] + j) * stride1[i]; +for (j = start[i]; j lines; j+= 1) +s-plane[i].line[j] = src[i] + (start[i] + j) * stride[i]; } @@ -191,13 +201,14 @@ static int lum_convert(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int ConvertInstance * instance = desc-instance; uint32_t * pal = instance-pal; -int sp = sliceY - desc-src-plane[0].sliceY; +int sp0 = sliceY - desc-src-plane[0].sliceY; +int sp1 = (sliceY desc-src-v_chr_sub_sample) - desc-src-plane[1].sliceY; int dp = sliceY - desc-dst-plane[0].sliceY; -const uint8_t * src[4] = { desc-src-plane[0].line[sp], -desc-src-plane[1].line[sp], -desc-src-plane[2].line[sp], -desc-src-plane[3].line[sp]}; +const uint8_t * src[4] = { desc-src-plane[0].line[sp0], +desc-src-plane[1].line[sp1], +desc-src-plane[2].line[sp1], +desc-src-plane[3].line[sp0]}; uint8_t * dst = desc-dst-plane[0].line[0/*dp*/]; desc-dst-plane[0].sliceY = sliceY; @@ -304,13 +315,15 @@ static int chr_convert(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int ConvertInstance * instance = desc-instance; uint32_t * pal = instance-pal; -int sp = sliceY - desc-src-plane[1].sliceY; +int sp0 = (sliceY - (desc-src-plane[0].sliceY
Re: [FFmpeg-devel] [PATCH]lavf/matroskaenc: Do not unecessarily consume memory for cuepoints
On Tue, Jul 07, 2015 at 07:41:11PM +0200, Carl Eugen Hoyos wrote: On Tuesday 07 July 2015 06:45:04 pm Michael Niedermayer wrote: On Tue, Jul 07, 2015 at 03:13:06PM +0200, Carl Eugen Hoyos wrote: Hi! Matroska streaming currently consumes memory for cuepoints that are never used if the output stream is no seekable. This can lead to oom. Attached patch fixes ticket #4690. Please comment, Carl Eugen matroskaenc.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) 3bf45b1a064962b7e988c3ee5739cc8f2faf023d patchmkvseekable.diff breaks fate New patch attached. Thank you, Carl Eugen matroskaenc.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 02d8783a90db91330e08667d1fc927cbc24e4dd9 patchmkvseekable2.diff diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 3b525ad..713cb33 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c should be ok [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Breaking DRM is a little like attempting to break through a door even though the window is wide open and the only thing in the house is a bunch of things you dont want and which you would get tomorrow for free anyway signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] fix mime-types in movenc.c
On Wed, Jul 08, 2015 at 02:24:46PM -0400, compn wrote: https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/CreatingContentforSafarioniPhone/CreatingContentforSafarioniPhone.html says video/mp4 suggested by BBB on irc. -compn diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 42529ec..a95fbde 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Those who are too smart to engage in politics are punished by being governed by those who are dumber. -- Plato signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodev/libdcadec: implement request_channel_layout
On Wed, Jul 08, 2015 at 09:17:16PM -0300, James Almer wrote: Signed-off-by: James Almer jamr...@gmail.com --- libavcodec/libdcadec.c | 33 + 1 file changed, 33 insertions(+) LGTM thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB No human being will ever know the Truth, for even if they happen to say it by chance, they would not even known they had done so. -- Xenophanes signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavcodec/qsvenc.c: incorrect loop condition has been fixed.
On Tue, Jul 07, 2015 at 08:42:09PM +0300, Ivan Uskov wrote: Hello All, For example, the encoder may return MFX_WRN_INCOMPATIBLE_VIDEO_PARAM warning i.e. ret==5 old loop implementation will repeat several times until output buffer overflow. New implementation explicitly uses loop only for device busy case. -- Best regards, Ivan mailto:ivan.us...@nablet.com qsvenc.c |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) da3f27e659bc908886c2361bb8f2ad57a39f5c53 0001-libavcodec-qsvenc.c-incorrect-loop-condition-has-bee.patch From 85bd72379184f71ae87c0975a95c635da8faa5eb Mon Sep 17 00:00:00 2001 From: Ivan Uskov ivan.us...@nablet.com Date: Tue, 7 Jul 2015 20:33:36 +0300 Subject: [PATCH] libavcodec/qsvenc.c: incorrect loop condition has been fixed. For example, the encoder may return MFX_WRN_INCOMPATIBLE_VIDEO_PARAM warning i.e. ret==5 old loop implementation will repeat several timesuntil output buffer overflow. New implementation explicitly uses loop only for device busy case. applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In fact, the RIAA has been known to suggest that students drop out of college or go to community college in order to be able to afford settlements. -- The RIAA signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodev/libdcadec: implement request_channel_layout
On 08/07/15 9:53 PM, Michael Niedermayer wrote: On Wed, Jul 08, 2015 at 09:17:16PM -0300, James Almer wrote: Signed-off-by: James Almer jamr...@gmail.com --- libavcodec/libdcadec.c | 33 + 1 file changed, 33 insertions(+) LGTM thanks Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg needs a new host
Dear Sir/Madam, I wanted to get in touch with the right person to address the need of FFmpeg project. Thank you in advance! Ilya Ustinov CDNvideo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel