Re: [FFmpeg-devel] [PATCH 6/6] dnn-layer-math-unary-test: add unit test for atan
> -Original Message- > From: ffmpeg-devel On Behalf Of Ting Fu > Sent: 2020年6月18日 17:16 > To: ffmpeg-devel@ffmpeg.org > Subject: [FFmpeg-devel] [PATCH 6/6] dnn-layer-math-unary-test: add unit test > for atan > > Signed-off-by: Ting Fu > --- > tests/dnn/dnn-layer-mathunary-test.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/tests/dnn/dnn-layer-mathunary-test.c > b/tests/dnn/dnn-layer-mathunary-test.c > index 540ea4cef5..bf77c44bbe 100644 > --- a/tests/dnn/dnn-layer-mathunary-test.c > +++ b/tests/dnn/dnn-layer-mathunary-test.c > @@ -42,6 +42,8 @@ static float get_expected(float f, > DNNMathUnaryOperation op) > return asin(f); > case DMUO_ACOS: > return acos(f); > +case DMUO_ATAN: > +return atan(f); > default: > av_assert0(!"not supported yet"); > return 0.f; > @@ -97,5 +99,7 @@ int main(int agrc, char **argv) > return 1; > if (test(DMUO_ACOS)) > return 1; > +if (test(DMUO_ATAN)) > +return 1; > return 0; > } > -- > 2.17.1 > LGTM, will push soon, thanks. > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org > with > subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avdevice/gdigrab: client_only option to discard decorations such as titlebar or borders
On Fri, Jun 19, 2020 at 10:33:00 +0200, Sergio Acereda wrote: > +static int > +calc_titlebar_height(HWND hwnd) { Nit: the opening bracket of a function belongs in the next line. > GetClientRect(hwnd, &virtual_rect); > +if (gdigrab->client_only) { > +int cxborder = GetSystemMetrics(SM_CXBORDER); > +int cyborder = GetSystemMetrics(SM_CYBORDER); > +int titlebar_height = calc_titlebar_height(hwnd); > +virtual_rect.left += cxborder; > +virtual_rect.right += -cxborder; > +virtual_rect.top+= cxborder + titlebar_height; > +virtual_rect.bottom += -cyborder; > +} Does this actually work correctly? Just wondering, as I read this: https://stackoverflow.com/a/11707312/3974309 I can't test, sorry. > +{ "client_only", "client only", OFFSET(client_only), AV_OPT_TYPE_BOOL, > {.i64 = 0}, 0, 1, DEC }, Please also update the documentation (doc/indevs.texi). Thanks, Moritz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/7] avfilter: add ff_inlink_peek_samples and ff_inlink_skip samples
On 6/19/20, Paul B Mahol wrote: > On 6/16/20, Nicolas George wrote: >> Paul B Mahol (12020-06-12): >>> How so? Its purely random. >> >> +ret = ff_inlink_peek_samples(inlink, s->win_size, &fin); >> >> +ret = ff_inlink_peek_samples(inlink, s->window_size, &in); >> >> They seem constant in both cases. Can you elaborate about this >> randomness? >> > > For showspectrumpic window size is random in sense it depends > on input, it is not random for every call. Also memory and CPU overhead is very small if it exists at all. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH]lavc: Lower MediaFoundation encoder priority
On Tue, Jun 23, 2020 at 20:43:34 +0200, Carl Eugen Hoyos wrote: > Pushed with that change, Carl Eugen I suggest backporting this to 4.3, where MediaFoundation support was added (and this issue is present). Thanks, Moritz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/7] avfilter: add ff_inlink_peek_samples and ff_inlink_skip samples
Paul B Mahol (12020-06-24): > Also memory and CPU overhead is very small if it exists at all. They're not the problem, code complexity is. Just use a fixed buffer in your code and be done with it. -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/7] avfilter: add ff_inlink_peek_samples and ff_inlink_skip samples
On 6/24/20, Nicolas George wrote: > Paul B Mahol (12020-06-24): >> Also memory and CPU overhead is very small if it exists at all. > > They're not the problem, code complexity is. > > Just use a fixed buffer in your code and be done with it. > As already explained I can not use fixed buffer at all. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/7] avfilter: add ff_inlink_peek_samples and ff_inlink_skip samples
Paul B Mahol (12020-06-24): > As already explained I can not use fixed buffer at all. Not true. Bring new, accurate arguments, or stop. -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/2] add socks5 support for tcp clients
Now that I have tested this: On Sat, Jun 13, 2020 at 23:17:41 +0800, leviz...@live.cn wrote: > #endif /* !HAVE_WINSOCK2_H */ > +char *socks_proxy; > } TCPContext; [...] > { "listen", "Listen for incoming connections", OFFSET(listen), > AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, .flags = D|E }, > +{ "socks_proxy", "set socks proxy for connection", > OFFSET(socks_proxy), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, > .flags = D }, > { "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 }, You're not using this variable anywhere. So the introduced command line option is dead. > +proxy_path = getenv("socks_proxy"); > +use_proxy = proxy_path && av_strstart(proxy_path, "socks5://", NULL); > +if(use_proxy) { And here's the reason: You use the environment variable only. Furthermore, I'm not sure this is the proper convention for specifying a SOCKS proxy in the environment. I found various other suggestions around the net, but not this one. Please don't invent one, instead make the command line option functional. > .url_open= tcp_open, > +.url_open2= tcp_open2, If the url_open2 function pointer exists, url_open will never be used. So you should be writing a *replacement* function for tcp_open(), not an amendment. Actually, since your tcp_open2() doesn't even use the "options" argument, it would be a url_open callback. url_open2: "This callback is to be used by protocols which open further nested protocols." I think this does not apply to the "tcp" protocol. Therefore, you should merge the socks functionality into the existing tcp_open(). I would also appreciate a log message (at level verbose or debug), indicating that a SOCKS "redirection" is taking place. Otherwise, there's a seemingly random mismatch between the URI's hostname and the logged IP/port. All this said, when using the environment variable, I managed to get ffmpeg to connect to an http:// and an https:// input URL (HLS) through a SOCKS5 proxy. So at least it works. Thanks for your effort so far. Regards, Moritz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/2] avformat/subtitles: Check for NOPTS in ff_subtitles_queue_finalize()
Michael Niedermayer (12020-06-24): > On Tue, Jun 23, 2020 at 02:08:44PM +0200, Nicolas George wrote: > > Michael Niedermayer (12020-06-23): > > > Fixes; signed integer overflow: 1 - -9223372036854775808 cannot be > > > represented in type 'long' > > > Fixes: > > > 23490/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5133490093031424 > > > > > > Found-by: continuous fuzzing process > > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > > Signed-off-by: Michael Niedermayer > > > --- > > > libavformat/subtitles.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c > > > index ad7f68938e..ccab80391f 100644 > > > --- a/libavformat/subtitles.c > > > +++ b/libavformat/subtitles.c > > > @@ -202,7 +202,7 @@ void ff_subtitles_queue_finalize(void *log_ctx, > > > FFDemuxSubtitlesQueue *q) > > >q->sort == SUB_SORT_TS_POS ? cmp_pkt_sub_ts_pos > > > : cmp_pkt_sub_pos_ts); > > > for (i = 0; i < q->nb_subs; i++) > > > -if (q->subs[i].duration < 0 && i < q->nb_subs - 1) > > > +if (q->subs[i].duration < 0 && i < q->nb_subs - 1 && > > > q->subs[i].pts != AV_NOPTS_VALUE) > > > q->subs[i].duration = q->subs[i + 1].pts - q->subs[i].pts; > > > > > > if (!q->keep_duplicates) > > > > Having no PTS at this point makes no sense. We should examine why it > > arrived there. > > it comes from microdvddec in this case, it can be fixed for example > with the following: (i do not know if these are all cases which can > generate this) Thanks. It seems like a much more correct fix. We can see in $FATE/sub/MicroDVD_capability_tester.sub that all lines have a number in the first pair of braces except DEFAULT, which is parsed separately. > commit 06eff32c6e4100b70a3a215a0756580a6fa124b5 (HEAD -> master) > Author: Michael Niedermayer > Date: Tue Jun 23 01:43:14 2020 +0200 > > iavformat/microdvddec: Skip NOPTS values skip malformed lines without frame number. > > Fixes; signed integer overflow: 1 - -9223372036854775808 cannot be > represented in type 'long' Colon / semicolon. > Fixes: > 23490/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5133490093031424 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > > diff --git a/libavformat/microdvddec.c b/libavformat/microdvddec.c > index 8759200f88..1f871b2518 100644 > --- a/libavformat/microdvddec.c > +++ b/libavformat/microdvddec.c > @@ -94,6 +94,7 @@ static int microdvd_read_header(AVFormatContext *s) > int64_t pos = avio_tell(s->pb); > int len = ff_get_line(s->pb, line_buf, sizeof(line_buf)); > char *line = line_buf; > +int64_t pts; > > if (!strncmp(line, bom, 3)) > line += 3; > @@ -137,13 +138,16 @@ static int microdvd_read_header(AVFormatContext *s) > SKIP_FRAME_ID; > if (!*p) > continue; > +pts = get_pts(line); > +if (pts == AV_NOPTS_VALUE) > +continue; > sub = ff_subtitles_queue_insert(µdvd->q, p, strlen(p), 0); > if (!sub) { > ret = AVERROR(ENOMEM); > goto fail; > } > sub->pos = pos; > -sub->pts = get_pts(line); > +sub->pts = pts; > sub->duration = get_duration(line); > } > ff_subtitles_queue_finalize(s, µdvd->q); > > > > > > > Can you share the test case? > > Ill send you the file privatly I really do not see the point. I only understood what I was looking at after reading your public mail and the source code, which means anybody could get the same information. And it is not as if it was a real bug, even less a security issue, just a case of garbage in garbage out. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v3] avcodec/v4l2_m2m_dec: Remove redundant packet and fix double free
On Mon, 25. May 14:59, Andriy Gelman wrote: > On Sat, 16. May 11:53, Andriy Gelman wrote: > > On Sat, 09. May 13:35, Andriy Gelman wrote: > > > From: Andriy Gelman > > > > > > v4l2_receive_frame() uses two packets s->buf_pkt and avpkt. If avpkt > > > cannot be enqueued, the packet is buffered in s->buf_pkt and enqueued in > > > the next call. Currently the ownership transfer between the two packets > > > is not properly handled. A double free occurs if > > > ff_v4l2_context_enqueue_packet() returns EAGAIN and v4l2_try_start > > > returns EINVAL. > > > > > > In fact, having two AVPackets is not needed and everything can be > > > handled by s->buf_pkt. > > > > > > This commit removes the local avpkt from v4l2_receive_frame(), meaning > > > that the ownership transfer doesn't need to be handled and the double > > > free is fixed. > > > > > > Signed-off-by: Andriy Gelman > > > --- > > > > > > Sorry, forgot to squash the commit from v1 so v2 didn't apply. This is > > > correct version. > > > > > > Supersedes: > > > https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200505055454.28683-1-andriy.gel...@gmail.com/ > > > > > > > > > libavcodec/v4l2_m2m_dec.c | 37 +++-- > > > 1 file changed, 15 insertions(+), 22 deletions(-) > > > > > > diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c > > > index 3e17e0fcac..b038efed9c 100644 > > > --- a/libavcodec/v4l2_m2m_dec.c > > > +++ b/libavcodec/v4l2_m2m_dec.c > > > @@ -138,14 +138,10 @@ static int v4l2_receive_frame(AVCodecContext > > > *avctx, AVFrame *frame) > > > V4L2m2mContext *s = ((V4L2m2mPriv*)avctx->priv_data)->context; > > > V4L2Context *const capture = &s->capture; > > > V4L2Context *const output = &s->output; > > > -AVPacket avpkt = {0}; > > > int ret; > > > > > > -if (s->buf_pkt.size) { > > > -avpkt = s->buf_pkt; > > > -memset(&s->buf_pkt, 0, sizeof(AVPacket)); > > > -} else { > > > -ret = ff_decode_get_packet(avctx, &avpkt); > > > +if (!s->buf_pkt.size) { > > > +ret = ff_decode_get_packet(avctx, &s->buf_pkt); > > > if (ret < 0 && ret != AVERROR_EOF) > > > return ret; > > > } > > > @@ -153,32 +149,29 @@ static int v4l2_receive_frame(AVCodecContext > > > *avctx, AVFrame *frame) > > > if (s->draining) > > > goto dequeue; > > > > > > -ret = ff_v4l2_context_enqueue_packet(output, &avpkt); > > > -if (ret < 0) { > > > -if (ret != AVERROR(EAGAIN)) > > > - return ret; > > > +ret = ff_v4l2_context_enqueue_packet(output, &s->buf_pkt); > > > +if (ret < 0 && ret != AVERROR(EAGAIN)) > > > +goto fail; > > > > > > -s->buf_pkt = avpkt; > > > -/* no input buffers available, continue dequeing */ > > > -} > > > +/* if EAGAIN don't unref packet and try to enqueue in the next > > > iteration */ > > > +if (ret != AVERROR(EAGAIN)) > > > +av_packet_unref(&s->buf_pkt); > > > > > > -if (avpkt.size) { > > > +if (!s->draining) { > > > ret = v4l2_try_start(avctx); > > > if (ret) { > > > -av_packet_unref(&avpkt); > > > - > > > /* cant recover */ > > > -if (ret == AVERROR(ENOMEM)) > > > -return ret; > > > - > > > -return 0; > > > +if (ret != AVERROR(ENOMEM)) > > > +ret = 0; > > > +goto fail; > > > } > > > } > > > > > > dequeue: > > > -if (!s->buf_pkt.size) > > > -av_packet_unref(&avpkt); > > > return ff_v4l2_context_dequeue_frame(capture, frame, -1); > > > +fail: > > > +av_packet_unref(&s->buf_pkt); > > > +return ret; > > > } > > > > > > static av_cold int v4l2_decode_init(AVCodecContext *avctx) > > > -- > > > 2.25.1 > > > > > > > ping > > > > ping > ping -- Andriy ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/3] avcodec/mlpenc: free filter state buffers on allocation failure
Signed-off-by: James Almer --- libavcodec/mlpenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c index 4d50f0ea33..52ea06ed91 100644 --- a/libavcodec/mlpenc.c +++ b/libavcodec/mlpenc.c @@ -1820,7 +1820,8 @@ static int apply_filter(MLPEncodeContext *ctx, unsigned int channel) if (!filter_state_buffer[i]) { av_log(ctx->avctx, AV_LOG_ERROR, "Not enough memory for applying filters.\n"); -return AVERROR(ENOMEM); +ret = AVERROR(ENOMEM); +goto free_and_return; } } -- 2.27.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/3] avcodec/mlpenc: remove delay codec capability
The encoder has no delayed packets at the end of the encoding process, so signaling this capability is unnecessary. This also fix an assertion failure introduced in 827d6fe73d, as return values higher than 0 are not expected. Signed-off-by: James Almer --- libavcodec/mlpenc.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c index c6a7963c22..f99d2f5d6f 100644 --- a/libavcodec/mlpenc.c +++ b/libavcodec/mlpenc.c @@ -2226,9 +2226,6 @@ static int mlp_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, if ((ret = ff_alloc_packet2(avctx, avpkt, 87500 * avctx->channels, 0)) < 0) return ret; -if (!frame) -return 1; - /* add current frame to queue */ if ((ret = ff_af_queue_add(&ctx->afq, frame)) < 0) return ret; @@ -2389,7 +2386,7 @@ AVCodec ff_mlp_encoder = { .init = mlp_encode_init, .encode2= mlp_encode_frame, .close = mlp_encode_close, -.capabilities = AV_CODEC_CAP_SMALL_LAST_FRAME | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_EXPERIMENTAL, +.capabilities = AV_CODEC_CAP_SMALL_LAST_FRAME | AV_CODEC_CAP_EXPERIMENTAL, .sample_fmts= (const enum AVSampleFormat[]) {AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE}, .supported_samplerates = (const int[]) {44100, 48000, 88200, 96000, 176400, 192000, 0}, .channel_layouts= ff_mlp_channel_layouts, @@ -2405,7 +2402,7 @@ AVCodec ff_truehd_encoder = { .init = mlp_encode_init, .encode2= mlp_encode_frame, .close = mlp_encode_close, -.capabilities = AV_CODEC_CAP_SMALL_LAST_FRAME | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_EXPERIMENTAL, +.capabilities = AV_CODEC_CAP_SMALL_LAST_FRAME | AV_CODEC_CAP_EXPERIMENTAL, .sample_fmts= (const enum AVSampleFormat[]) {AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE}, .supported_samplerates = (const int[]) {44100, 48000, 88200, 96000, 176400, 192000, 0}, .channel_layouts= (const uint64_t[]) {AV_CH_LAYOUT_STEREO, AV_CH_LAYOUT_5POINT0_BACK, AV_CH_LAYOUT_5POINT1_BACK, 0}, -- 2.27.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 3/7] avcodec/h264_slice: use av_timecode_get_smpte()
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/h264_slice.c | 33 ++--- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 47f3917..2a41de2 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1304,7 +1304,6 @@ static int h264_export_frame_props(H264Context *h) h->sei.unregistered.nb_buf_ref = 0; if (h->sei.picture_timing.timecode_cnt > 0) { -uint32_t tc = 0; uint32_t *tc_sd; AVFrameSideData *tcside = av_frame_new_side_data(cur->f, @@ -1317,33 +1316,13 @@ static int h264_export_frame_props(H264Context *h) tc_sd[0] = h->sei.picture_timing.timecode_cnt; for (int i = 0; i < tc_sd[0]; i++) { -uint32_t frames; - -/* For SMPTE 12-M timecodes, frame count is a special case if > 30 FPS. - See SMPTE ST 12-1:2014 Sec 12.1 for more info. */ -if (av_cmp_q(h->avctx->framerate, (AVRational) {30, 1}) == 1) { -frames = h->sei.picture_timing.timecode[i].frame / 2; -if (h->sei.picture_timing.timecode[i].frame % 2 == 1) { -if (av_cmp_q(h->avctx->framerate, (AVRational) {50, 1}) == 0) -tc |= (1 << 7); -else -tc |= (1 << 23); -} -} else { -frames = h->sei.picture_timing.timecode[i].frame; -} +int drop = h->sei.picture_timing.timecode[i].dropframe; +int hh = h->sei.picture_timing.timecode[i].hours; +int mm = h->sei.picture_timing.timecode[i].minutes; +int ss = h->sei.picture_timing.timecode[i].seconds; +int ff = h->sei.picture_timing.timecode[i].frame; -tc |= h->sei.picture_timing.timecode[i].dropframe << 30; -tc |= (frames / 10) << 28; -tc |= (frames % 10) << 24; -tc |= (h->sei.picture_timing.timecode[i].seconds / 10) << 20; -tc |= (h->sei.picture_timing.timecode[i].seconds % 10) << 16; -tc |= (h->sei.picture_timing.timecode[i].minutes / 10) << 12; -tc |= (h->sei.picture_timing.timecode[i].minutes % 10) << 8; -tc |= (h->sei.picture_timing.timecode[i].hours / 10) << 4; -tc |= (h->sei.picture_timing.timecode[i].hours % 10); - -tc_sd[i + 1] = tc; +tc_sd[i + 1] = av_timecode_get_smpte(h->avctx->framerate, drop, hh, mm, ss, ff); } h->sei.picture_timing.timecode_cnt = 0; } -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 2/7] avutil/timecode: add function av_timecode_get_smpte()
From: Limin Wang Signed-off-by: Limin Wang --- libavutil/timecode.c | 32 libavutil/timecode.h | 13 + 2 files changed, 45 insertions(+) diff --git a/libavutil/timecode.c b/libavutil/timecode.c index 60077ba..cca53d7 100644 --- a/libavutil/timecode.c +++ b/libavutil/timecode.c @@ -81,6 +81,38 @@ uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum) (hh % 10);// units of hours } +uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss, int ff) +{ +uint32_t tc = 0; +uint32_t frames; + +/* For SMPTE 12-M timecodes, frame count is a special case if > 30 FPS. + See SMPTE ST 12-1:2014 Sec 12.1 for more info. */ +if (av_cmp_q(rate, (AVRational) {30, 1}) == 1) { +frames = ff / 2; +if (ff % 2 == 1) { +if (av_cmp_q(rate, (AVRational) {50, 1}) == 0) +tc |= (1 << 7); +else +tc |= (1 << 23); +} +} else { +frames = ff; +} + +tc |= drop << 30; +tc |= (frames / 10) << 28; +tc |= (frames % 10) << 24; +tc |= (ss / 10) << 20; +tc |= (ss % 10) << 16; +tc |= (mm / 10) << 12; +tc |= (mm % 10) << 8; +tc |= (hh / 10) << 4; +tc |= (hh % 10); + +return tc; +} + char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum) { int fps = tc->fps; diff --git a/libavutil/timecode.h b/libavutil/timecode.h index 37c1361..ab38e66 100644 --- a/libavutil/timecode.h +++ b/libavutil/timecode.h @@ -71,6 +71,19 @@ int av_timecode_adjust_ntsc_framenum2(int framenum, int fps); uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum); /** + * Convert sei info to SMPTE 12M binary representation. + * + * @param rate frame rate in rational form + * @param drop drop flag + * @param hh hour + * @param mm minute + * @param ss second + * @param ff frame number + * @return the SMPTE binary representation + */ +uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss, int ff); + +/** * Load timecode string in buf. * * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 4/7] avcodec/hevc_sei: support HEVC timecode decode
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/hevc_sei.c | 49 + libavcodec/hevc_sei.h | 21 + 2 files changed, 70 insertions(+) diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c index 1736891..bf92de6 100644 --- a/libavcodec/hevc_sei.c +++ b/libavcodec/hevc_sei.c @@ -306,6 +306,53 @@ static int decode_nal_sei_alternative_transfer(HEVCSEIAlternativeTransfer *s, Ge return 0; } +static int decode_nal_sei_timecode(HEVCSEITimeCode *s, GetBitContext *gb) +{ +s->num_clock_ts = get_bits(gb, 2); + +for (int i = 0; i < s->num_clock_ts; i++) { +s->clock_timestamp_flag[i] = get_bits(gb, 1); + +if (s->clock_timestamp_flag[i]) { +s->units_field_based_flag[i] = get_bits(gb, 1); +s->counting_type[i] = get_bits(gb, 5); +s->full_timestamp_flag[i]= get_bits(gb, 1); +s->discontinuity_flag[i] = get_bits(gb, 1); +s->cnt_dropped_flag[i] = get_bits(gb, 1); + +s->n_frames[i] = get_bits(gb, 9); + +if (s->full_timestamp_flag[i]) { +s->seconds_value[i] = av_clip(get_bits(gb, 6), 0, 59); +s->minutes_value[i] = av_clip(get_bits(gb, 6), 0, 59); +s->hours_value[i]= av_clip(get_bits(gb, 5), 0, 23); +} else { +s->seconds_flag[i] = get_bits(gb, 1); +if (s->seconds_flag[i]) { +s->seconds_value[i] = av_clip(get_bits(gb, 6), 0, 59); +s->minutes_flag[i] = get_bits(gb, 1); +if (s->minutes_flag[i]) { +s->minutes_value[i] = av_clip(get_bits(gb, 6), 0, 59); +s->hours_flag[i] = get_bits(gb, 1); +if (s->hours_flag[i]) { +s->hours_value[i] = av_clip(get_bits(gb, 5), 0, 23); +} +} +} +} + +s->time_offset_length[i] = get_bits(gb, 5); +if (s->time_offset_length[i] > 0) { +s->time_offset_value[i] = get_bits(gb, s->time_offset_length[i]); +} +} +} + +s->present = 1; +return 0; +} + + static int decode_nal_sei_prefix(GetBitContext *gb, void *logctx, HEVCSEI *s, const HEVCParamSets *ps, int type, int size) { @@ -330,6 +377,8 @@ static int decode_nal_sei_prefix(GetBitContext *gb, void *logctx, HEVCSEI *s, return decode_nal_sei_user_data_unregistered(&s->unregistered, gb, size); case HEVC_SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS: return decode_nal_sei_alternative_transfer(&s->alternative_transfer, gb); +case HEVC_SEI_TYPE_TIME_CODE: +return decode_nal_sei_timecode(&s->timecode, gb); default: av_log(logctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type); skip_bits_long(gb, 8 * size); diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h index 3618d16..5ee7a47 100644 --- a/libavcodec/hevc_sei.h +++ b/libavcodec/hevc_sei.h @@ -115,6 +115,26 @@ typedef struct HEVCSEIAlternativeTransfer { int preferred_transfer_characteristics; } HEVCSEIAlternativeTransfer; +typedef struct HEVCSEITimeCode { +int present; +uint8_t num_clock_ts; +uint8_t clock_timestamp_flag[3]; +uint8_t units_field_based_flag[3]; +uint8_t counting_type[3]; +uint8_t full_timestamp_flag[3]; +uint8_t discontinuity_flag[3]; +uint8_t cnt_dropped_flag[3]; +uint16_t n_frames[3]; +uint8_t seconds_value[3]; +uint8_t minutes_value[3]; +uint8_t hours_value[3]; +uint8_t seconds_flag[3]; +uint8_t minutes_flag[3]; +uint8_t hours_flag[3]; +uint8_t time_offset_length[3]; +int32_t time_offset_value[3]; +} HEVCSEITimeCode; + typedef struct HEVCSEI { HEVCSEIPictureHash picture_hash; HEVCSEIFramePacking frame_packing; @@ -126,6 +146,7 @@ typedef struct HEVCSEI { HEVCSEIContentLight content_light; int active_seq_parameter_set_id; HEVCSEIAlternativeTransfer alternative_transfer; +HEVCSEITimeCode timecode; } HEVCSEI; struct HEVCParamSets; -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 5/7] avcodec/hevcdec: create AVFrame side data from HEVC timecodes like H.264
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/hevcdec.c | 24 1 file changed, 24 insertions(+) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index c9e28f5..3bdec12 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -32,6 +32,7 @@ #include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "libavutil/stereo3d.h" +#include "libavutil/timecode.h" #include "bswapdsp.h" #include "bytestream.h" @@ -2808,6 +2809,29 @@ static int set_side_data(HEVCContext *s) } s->sei.unregistered.nb_buf_ref = 0; +if (s->sei.timecode.present) { +uint32_t *tc_sd; +AVFrameSideData *tcside = av_frame_new_side_data(out, AV_FRAME_DATA_S12M_TIMECODE, + sizeof(uint32_t) * 4); +if (!tcside) +return AVERROR(ENOMEM); + +tc_sd = (uint32_t*)tcside->data; +tc_sd[0] = s->sei.timecode.num_clock_ts; + +for (int i = 0; i < tc_sd[0]; i++) { +int drop = s->sei.timecode.cnt_dropped_flag[i]; +int hh = s->sei.timecode.hours_value[i]; +int mm = s->sei.timecode.minutes_value[i]; +int ss = s->sei.timecode.seconds_value[i]; +int ff = s->sei.timecode.n_frames[i]; + +tc_sd[i + 1] = av_timecode_get_smpte(s->avctx->framerate, drop, hh, mm, ss, ff); +} + +s->sei.timecode.num_clock_ts = 0; +} + return 0; } -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 6/7] avcodec/utils: add ff_alloc_timecode_sei() for hevc timecode sei
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/internal.h | 15 libavcodec/utils.c| 63 +++ 2 files changed, 78 insertions(+) diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 21708df..8771078 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -380,6 +380,21 @@ int ff_alloc_a53_sei(const AVFrame *frame, size_t prefix_len, void **data, size_t *sei_size); /** + * Check AVFrame for S12M timecode side data and allocate and fill TC SEI message with timecode info + * + * @param frame Raw frame to get S12M timecode side data from + * @param prefix_len Number of bytes to allocate before SEI message + * @param data Pointer to a variable to store allocated memory + * Upon return the variable will hold NULL on error or if frame has no S12M timecode info. + * Otherwise it will point to prefix_len uninitialized bytes followed by + * *sei_size SEI message + * @param sei_size Pointer to a variable to store generated SEI message length + * @return Zero on success, negative error code on failure + */ +int ff_alloc_timecode_sei(const AVFrame *frame, size_t prefix_len, + void **data, size_t *sei_size); + +/** * Get an estimated video bitrate based on frame size, frame rate and coded * bits per pixel. */ diff --git a/libavcodec/utils.c b/libavcodec/utils.c index b61f274..2ece34f 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -50,6 +50,7 @@ #include "thread.h" #include "frame_thread_encoder.h" #include "internal.h" +#include "put_bits.h" #include "raw.h" #include "bytestream.h" #include "version.h" @@ -2244,6 +2245,68 @@ int ff_alloc_a53_sei(const AVFrame *frame, size_t prefix_len, return 0; } +static unsigned bcd2uint(uint8_t bcd) +{ +unsigned low = bcd & 0xf; +unsigned high = bcd >> 4; +if (low > 9 || high > 9) +return 0; +return low + 10*high; +} + +int ff_alloc_timecode_sei(const AVFrame *frame, size_t prefix_len, + void **data, size_t *sei_size) +{ +AVFrameSideData *sd = NULL; +uint8_t *sei_data; +PutBitContext pb; +uint32_t *tc; +int m; + +if (frame) +sd = av_frame_get_side_data(frame, AV_FRAME_DATA_S12M_TIMECODE); + +if (!sd) { +*data = NULL; +return 0; +} +tc = (uint32_t*)sd->data; +m = tc[0] & 3; + +*sei_size = sizeof(uint32_t) * 4; +*data = av_mallocz(*sei_size + prefix_len); +if (!*data) +return AVERROR(ENOMEM); +sei_data = (uint8_t*)*data + prefix_len; + +init_put_bits(&pb, sei_data, *sei_size); +put_bits(&pb, 2, m); // num_clock_ts + +for (int j = 1; j <= m; j++) { +uint32_t tcsmpte = tc[j]; +unsigned hh = bcd2uint(tcsmpte & 0x3f);// 6-bit hours +unsigned mm = bcd2uint(tcsmpte>>8 & 0x7f);// 7-bit minutes +unsigned ss = bcd2uint(tcsmpte>>16 & 0x7f);// 7-bit seconds +unsigned ff = bcd2uint(tcsmpte>>24 & 0x3f);// 6-bit frames +unsigned drop = tcsmpte & 1<<30 && !0; // 1-bit drop if not arbitrary bit + +put_bits(&pb, 1, 1); // clock_timestamp_flag +put_bits(&pb, 1, 1); // units_field_based_flag +put_bits(&pb, 5, 0); // counting_type +put_bits(&pb, 1, 1); // full_timestamp_flag +put_bits(&pb, 1, 0); // discontinuity_flag +put_bits(&pb, 1, drop); +put_bits(&pb, 9, ff); +put_bits(&pb, 6, ss); +put_bits(&pb, 6, mm); +put_bits(&pb, 5, hh); +put_bits(&pb, 5, 0); +} +flush_put_bits(&pb); + +return 0; +} + int64_t ff_guess_coded_bitrate(AVCodecContext *avctx) { AVRational framerate = avctx->framerate; -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 7/7] avcodec/nvenc: support for HEVC timecode passthrough
From: Limin Wang Reviewed-by: Timo Rothenpieler Signed-off-by: Limin Wang --- libavcodec/nvenc.c | 17 + libavcodec/nvenc.h | 1 + libavcodec/nvenc_hevc.c | 1 + 3 files changed, 19 insertions(+) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 22c19f3..4efd532 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -22,6 +22,7 @@ #include "config.h" #include "nvenc.h" +#include "hevc_sei.h" #include "libavutil/hwcontext_cuda.h" #include "libavutil/hwcontext.h" @@ -2147,6 +2148,22 @@ static int nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame) } } +if (ctx->tc && av_frame_get_side_data(frame, AV_FRAME_DATA_S12M_TIMECODE)) { +void *tc_data = NULL; +size_t tc_size = 0; + +if (ff_alloc_timecode_sei(frame, 0, (void**)&tc_data, &tc_size) < 0) { +av_log(ctx, AV_LOG_ERROR, "Not enough memory for timecode sei, skipping\n"); +} + +if (tc_data) { +sei_data[sei_count].payloadSize = (uint32_t)tc_size; +sei_data[sei_count].payloadType = HEVC_SEI_TYPE_TIME_CODE; +sei_data[sei_count].payload = (uint8_t*)tc_data; +sei_count ++; +} +} + nvenc_codec_specific_pic_params(avctx, &pic_params, sei_data); } else { pic_params.encodePicFlags = NV_ENC_PIC_FLAG_EOS; diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h index 007721a..b67abca 100644 --- a/libavcodec/nvenc.h +++ b/libavcodec/nvenc.h @@ -196,6 +196,7 @@ typedef struct NvencContext int coder; int b_ref_mode; int a53_cc; +int tc; int dpb_size; } NvencContext; diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c index 434dc66..45dda3d 100644 --- a/libavcodec/nvenc_hevc.c +++ b/libavcodec/nvenc_hevc.c @@ -129,6 +129,7 @@ static const AVOption options[] = { { "each", "", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, VE, "b_ref_mode" }, { "middle", "", 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, VE, "b_ref_mode" }, #endif +{ "tc", "Use timecode (if available)",OFFSET(tc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE }, { "dpb_size", "Specifies the DPB size used for encoding (0 means automatic)", OFFSET(dpb_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, { NULL } -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/cbs_h265: set default VUI parameters when vui_parameters_present_flag is false
On 6/22/2020 9:53 PM, James Almer wrote: > Based on cbs_h264 code. > > Should fix ticket #8752. > > Signed-off-by: James Almer > --- > libavcodec/cbs_h265_syntax_template.c | 28 +++ > 1 file changed, 28 insertions(+) Will apply soon. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2 2/4] avcodec/hevcdec: create AVFrame side data from HEVC timecodes like H.264
On Tue, Jun 23, 2020 at 10:18:55PM +0100, Josh de Kock wrote: > On 17/06/2020 17:07, lance.lmw...@gmail.com wrote: > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > libavcodec/hevcdec.c | 44 > > 1 file changed, 44 insertions(+) > > > > diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c > > index c9e28f5..39abbb9 100644 > > --- a/libavcodec/hevcdec.c > > +++ b/libavcodec/hevcdec.c > > @@ -2808,6 +2808,50 @@ static int set_side_data(HEVCContext *s) > > } > > s->sei.unregistered.nb_buf_ref = 0; > > +if (s->sei.timecode.present) { > > +uint32_t tc = 0; > > +uint32_t *tc_sd; > > +AVFrameSideData *tcside = av_frame_new_side_data(out, > > AV_FRAME_DATA_S12M_TIMECODE, > > + sizeof(uint32_t) > > * 4); > > +if (!tcside) > > +return AVERROR(ENOMEM); > > + > > +tc_sd = (uint32_t*)tcside->data; > > +tc_sd[0] = s->sei.timecode.num_clock_ts; > > + > > +for (int i = 0; i < tc_sd[0]; i++) { > > +uint32_t frames; > > + > > +/* For SMPTE 12-M timecodes, frame count is a special case if > > > 30 FPS. > > + See SMPTE ST 12-1:2014 Sec 12.1 for more info. */ > > +if (av_cmp_q(s->avctx->framerate, (AVRational) {30, 1}) == 1) { > > +frames = s->sei.timecode.n_frames[i] / 2; > > +if (s->sei.timecode.n_frames[i] % 2 == 1) { > > +if (av_cmp_q(s->avctx->framerate, (AVRational) {50, > > 1}) == 0) > > +tc |= (1 << 7); > > +else > > +tc |= (1 << 23); > > +} > > +} else { > > +frames = s->sei.timecode.n_frames[i]; > > +} > > + > > +tc |= s->sei.timecode.cnt_dropped_flag[i] << 30; > > +tc |= (frames / 10) << 28; > > +tc |= (frames % 10) << 24; > > +tc |= (s->sei.timecode.seconds_value[i] / 10) << 20; > > +tc |= (s->sei.timecode.seconds_value[i] % 10) << 16; > > +tc |= (s->sei.timecode.minutes_value[i] / 10) << 12; > > +tc |= (s->sei.timecode.minutes_value[i] % 10) << 8; > > +tc |= (s->sei.timecode.hours_value[i] / 10) << 4; > > +tc |= (s->sei.timecode.hours_value[i] % 10); > > + > > +tc_sd[i + 1] = tc; > > +} > > + > > +s->sei.timecode.num_clock_ts = 0; > > +} > > + > > return 0; > > } > > > > As you said in the commit message, h264 already does this so it would be > nice if you didn't duplicate the code. Split both parts of s12m decoding > you've copied into a common h2645 or just an s12m file maybe? I have updated the patchset to remove the code duplication, please help to review whether it's OK for you, thx. > > -- > Josh > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". -- Thanks, Limin Wang ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/9] avformat/smacker: Check audio frame size
The first four bytes of smacker audio are supposed to contain the number of samples, so treat audio frames smaller than that as invalid. Signed-off-by: Andreas Rheinhardt --- libavformat/smacker.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 787c5d8972..c803ecbec9 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -307,14 +307,14 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) if(flags & 1) { uint32_t size; -size = avio_rl32(s->pb) - 4; -if (!size || size + 4LL > frame_size) { +size = avio_rl32(s->pb); +if ((int)size < 8 || size > frame_size) { av_log(s, AV_LOG_ERROR, "Invalid audio part size\n"); ret = AVERROR_INVALIDDATA; goto next_frame; } frame_size -= size; -frame_size -= 4; +size -= 4; if ((ret = av_reallocp(&smk->bufs[smk->curstream], size)) < 0) { smk->buf_sizes[smk->curstream] = 0; goto next_frame; -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/9] avformat/smacker: Avoid potential inifinite loop on error
When reading a new frame, the Smacker demuxer seeks to the next frame position where it excepts the next frame; then it (potentially) reads the palette, the audio packets associated with the frame and finally the actual video frame. It is only at the end that the frame counter as well as the position where the next frame is expected get updated. This has a downside: If e.g. invalid data is encountered when reading the palette, the demuxer returns immediately (with an error) and if the caller calls av_read_frame again, the demuxer seeks to the position where it already was, reads the very same palette data again and therefore will return an error again. If the caller calls av_read_frame repeatedly (say, until a packet is received or until EOF), this meight become an infinite loop. This could also happen if e.g. the size of one of the audio frames was invalid or if the frame size was gigantic. This commit changes this by skipping a frame if it turns out to be invalid or an error happens otherwise. This ensures that EOF will be returned eventually in the above scenario. Signed-off-by: Andreas Rheinhardt --- libavformat/smacker.c | 48 --- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 14dc4ef406..787c5d8972 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -57,7 +57,6 @@ typedef struct SmackerContext { int buf_sizes[7]; int stream_id[7]; int curstream; -int64_t nextpos; int64_t aud_pts[7]; } SmackerContext; @@ -229,8 +228,6 @@ static int smacker_read_header(AVFormatContext *s) return AVERROR(EIO); } -smk->nextpos = avio_tell(pb); - return 0; } @@ -238,6 +235,7 @@ static int smacker_read_header(AVFormatContext *s) static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) { SmackerContext *smk = s->priv_data; +int64_t next_frame_pos; int flags; int ret; int i; @@ -249,8 +247,8 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) /* if we demuxed all streams, pass another frame */ if (smk->curstream <= 0) { -avio_seek(s->pb, smk->nextpos, 0); frame_size = smk->frm_size[smk->cur_frame] & (~3); +next_frame_pos = avio_tell(s->pb) + (unsigned)frame_size; flags = smk->frm_flags[smk->cur_frame]; /* handle palette change event */ if(flags & SMACKER_PAL){ @@ -261,8 +259,10 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) memcpy(oldpal, pal, 768); size = avio_r8(s->pb); size = size * 4 - 1; -if(size + 1 > frame_size) -return AVERROR_INVALIDDATA; +if (size + 1 > frame_size) { +ret = AVERROR_INVALIDDATA; +goto next_frame; +} frame_size -= size; frame_size--; sz = 0; @@ -279,7 +279,8 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) av_log(s, AV_LOG_ERROR, "Invalid palette update, offset=%d length=%d extends beyond palette size\n", off, j); -return AVERROR_INVALIDDATA; +ret = AVERROR_INVALIDDATA; +goto next_frame; } off *= 3; while(j-- && sz < 256) { @@ -305,44 +306,45 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) for(i = 0; i < 7; i++) { if(flags & 1) { uint32_t size; -int err; size = avio_rl32(s->pb) - 4; if (!size || size + 4LL > frame_size) { av_log(s, AV_LOG_ERROR, "Invalid audio part size\n"); -return AVERROR_INVALIDDATA; +ret = AVERROR_INVALIDDATA; +goto next_frame; } frame_size -= size; frame_size -= 4; -if ((err = av_reallocp(&smk->bufs[smk->curstream], size)) < 0) { +if ((ret = av_reallocp(&smk->bufs[smk->curstream], size)) < 0) { smk->buf_sizes[smk->curstream] = 0; -return err; +goto next_frame; } smk->buf_sizes[smk->curstream] = size; -ret = avio_read(s->pb, smk->bufs[smk->curstream], size); -if(ret != size) -return AVERROR(EIO); +ret = ffio_read_size(s->pb, smk->bufs[smk->curstream], size); +if (ret < 0) +goto next_frame; smk->stream_id[smk->curstream] = smk->indexes[i]; smk->curstream++; } flags >>= 1; } -if (frame_size < 0 || frame_size >= INT_MAX/
[FFmpeg-devel] [PATCH 7/9] avformat/smacker: Don't read only one byte at a time
Instead use ffio_read_size to read data into a buffer. Also check that the desired size was actually successfully read and combine the check with the check for reading the extradata. Signed-off-by: Andreas Rheinhardt --- libavformat/smacker.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 2043563fdb..201372aee6 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -215,15 +215,12 @@ static int smacker_read_header(AVFormatContext *s) for (i = 0; i < smk->frames; i++) { smk->frm_size[i] = avio_rl32(pb); } -for (i = 0; i < smk->frames; i++) { -smk->frm_flags[i] = avio_r8(pb); -} - -/* load trees to extradata, they will be unpacked by decoder */ -ret = avio_read(pb, par->extradata + 16, par->extradata_size - 16); -if (ret != par->extradata_size - 16) { +if ((ret = ffio_read_size(pb, smk->frm_flags, smk->frames)) < 0 || +/* load trees to extradata, they will be unpacked by decoder */ +(ret = ffio_read_size(pb, par->extradata + 16, + par->extradata_size - 16)) < 0) { av_freep(&smk->frm_size); -return AVERROR(EIO); +return ret; } return 0; -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 6/9] avformat/smacker: Don't allocate arrays separately
Allocating two arrays with the same number of elements together simplifies freeing them. Signed-off-by: Andreas Rheinhardt --- libavformat/smacker.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 0138af3d14..2043563fdb 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -205,13 +205,11 @@ static int smacker_read_header(AVFormatContext *s) avio_rl32(pb); /* padding */ /* setup data */ -smk->frm_size = av_malloc_array(smk->frames, sizeof(*smk->frm_size)); -smk->frm_flags = av_malloc(smk->frames); -if (!smk->frm_size || !smk->frm_flags) { -av_freep(&smk->frm_size); -av_freep(&smk->frm_flags); +smk->frm_size = av_malloc_array(smk->frames, sizeof(*smk->frm_size) + + sizeof(*smk->frm_flags)); +if (!smk->frm_size) return AVERROR(ENOMEM); -} +smk->frm_flags = (void*)(smk->frm_size + smk->frames); /* read frame info */ for (i = 0; i < smk->frames; i++) { @@ -225,7 +223,6 @@ static int smacker_read_header(AVFormatContext *s) ret = avio_read(pb, par->extradata + 16, par->extradata_size - 16); if (ret != par->extradata_size - 16) { av_freep(&smk->frm_size); -av_freep(&smk->frm_flags); return AVERROR(EIO); } @@ -362,7 +359,6 @@ static int smacker_read_close(AVFormatContext *s) SmackerContext *smk = s->priv_data; av_freep(&smk->frm_size); -av_freep(&smk->frm_flags); return 0; } -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 4/9] avformat/smacker: Stop caching and copying audio frames
The layout of a Smacker frame is as follows: For some frames, the beginning of the frame contained a palette for the video stream; then there are potentially several audio frames, followed by the data for the video stream. The Smacker demuxer used to read the palette, then cache every audio frame into a buffer (that gets reallocated to the desired size every time a frame is read into this buffer), then read and return the video frame (together with the palette). The cached audio frames are then returned by copying the data into freshly allocated buffers; if there are none left, the next frame is read. This commit changes this: At the beginning of a frame, the palette is read and cached as now. But audio frames are no longer cached at all; they are returned immediately. This gets rid of copying and also allows to remove the code for the buffer-to-AVStream correspondence. Signed-off-by: Andreas Rheinhardt --- libavformat/smacker.c | 94 --- 1 file changed, 43 insertions(+), 51 deletions(-) diff --git a/libavformat/smacker.c b/libavformat/smacker.c index c803ecbec9..4990b7d920 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -48,14 +48,16 @@ typedef struct SmackerContext { uint32_t *frm_size; uint8_t *frm_flags; /* internal variables */ +int64_t next_frame_pos; int cur_frame; /* current frame for demuxing */ +uint32_t frame_size; +int flags; +int next_audio_index; +int new_palette; uint8_t pal[768]; int indexes[7]; int videoindex; -uint8_t *bufs[7]; -int buf_sizes[7]; -int stream_id[7]; int curstream; int64_t aud_pts[7]; } SmackerContext; @@ -235,21 +237,19 @@ static int smacker_read_header(AVFormatContext *s) static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) { SmackerContext *smk = s->priv_data; -int64_t next_frame_pos; int flags; int ret; -int i; -int frame_size = 0; -int palchange = 0; if (avio_feof(s->pb) || smk->cur_frame >= smk->frames) return AVERROR_EOF; /* if we demuxed all streams, pass another frame */ -if (smk->curstream <= 0) { -frame_size = smk->frm_size[smk->cur_frame] & (~3); -next_frame_pos = avio_tell(s->pb) + (unsigned)frame_size; +if (!smk->next_audio_index) { +smk->frame_size = smk->frm_size[smk->cur_frame] & (~3); +smk->next_frame_pos = avio_tell(s->pb) + smk->frame_size; +smk->curstream = 0; flags = smk->frm_flags[smk->cur_frame]; +smk->flags = flags >> 1; /* handle palette change event */ if(flags & SMACKER_PAL){ int size, sz, t, off, j, pos; @@ -258,13 +258,12 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) memcpy(oldpal, pal, 768); size = avio_r8(s->pb); -size = size * 4 - 1; -if (size + 1 > frame_size) { +size = size * 4; +if (size > smk->frame_size) { ret = AVERROR_INVALIDDATA; goto next_frame; } -frame_size -= size; -frame_size--; +smk->frame_size -= size--; sz = 0; pos = avio_tell(s->pb) + size; while(sz < 256){ @@ -298,69 +297,65 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) } } avio_seek(s->pb, pos, 0); -palchange |= 1; +smk->new_palette = 1; } -flags >>= 1; -smk->curstream = 0; -/* if audio chunks are present, put them to stack and retrieve later */ -for(i = 0; i < 7; i++) { -if(flags & 1) { +} + +for (int i = smk->next_audio_index; i < 7; i++) { +if (smk->flags & (1 << i)) { uint32_t size; size = avio_rl32(s->pb); -if ((int)size < 8 || size > frame_size) { +if ((int)size < 8 || size > smk->frame_size) { av_log(s, AV_LOG_ERROR, "Invalid audio part size\n"); ret = AVERROR_INVALIDDATA; goto next_frame; } -frame_size -= size; +smk->frame_size -= size; size -= 4; -if ((ret = av_reallocp(&smk->bufs[smk->curstream], size)) < 0) { -smk->buf_sizes[smk->curstream] = 0; + +if (smk->indexes[i] < 0) { +avio_skip(s->pb, size); +continue; +} +if ((ret = av_get_packet(s->pb, pkt, size)) != size) { +ret = ret < 0 ? ret : AVERROR_INVALIDDATA; goto next_frame; } -smk->buf_sizes[smk->curstream] = size; -ret = ffio_read_size(s->pb, smk->bufs[smk->curstream], size); -if (ret < 0) -goto next_frame; -
[FFmpeg-devel] [PATCH 8/9] avformat/smacker: Use st->priv_data to store array
It simplifies freeing and allows to completely remove smacker_read_close. Signed-off-by: Andreas Rheinhardt --- libavformat/smacker.c | 16 +++- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 201372aee6..2e4a499a13 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -205,10 +205,11 @@ static int smacker_read_header(AVFormatContext *s) avio_rl32(pb); /* padding */ /* setup data */ -smk->frm_size = av_malloc_array(smk->frames, sizeof(*smk->frm_size) + +st->priv_data = av_malloc_array(smk->frames, sizeof(*smk->frm_size) + sizeof(*smk->frm_flags)); -if (!smk->frm_size) +if (!st->priv_data) return AVERROR(ENOMEM); +smk->frm_size = st->priv_data; smk->frm_flags = (void*)(smk->frm_size + smk->frames); /* read frame info */ @@ -219,7 +220,6 @@ static int smacker_read_header(AVFormatContext *s) /* load trees to extradata, they will be unpacked by decoder */ (ret = ffio_read_size(pb, par->extradata + 16, par->extradata_size - 16)) < 0) { -av_freep(&smk->frm_size); return ret; } @@ -351,15 +351,6 @@ next_frame: return ret; } -static int smacker_read_close(AVFormatContext *s) -{ -SmackerContext *smk = s->priv_data; - -av_freep(&smk->frm_size); - -return 0; -} - AVInputFormat ff_smacker_demuxer = { .name = "smk", .long_name = NULL_IF_CONFIG_SMALL("Smacker"), @@ -367,5 +358,4 @@ AVInputFormat ff_smacker_demuxer = { .read_probe = smacker_probe, .read_header= smacker_read_header, .read_packet= smacker_read_packet, -.read_close = smacker_read_close, }; -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 9/9] avformat/smacker: Cosmetics
Mainly reindentation. Signed-off-by: Andreas Rheinhardt --- libavformat/smacker.c | 60 +-- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 2e4a499a13..0ca5a87b8f 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -50,14 +50,14 @@ typedef struct SmackerContext { /* internal variables */ int64_t next_frame_pos; int cur_frame; +int videoindex; +int indexes[7]; /* current frame for demuxing */ uint32_t frame_size; int flags; int next_audio_index; int new_palette; uint8_t pal[768]; -int indexes[7]; -int videoindex; int64_t aud_pts[7]; } SmackerContext; @@ -226,7 +226,6 @@ static int smacker_read_header(AVFormatContext *s) return 0; } - static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) { SmackerContext *smk = s->priv_data; @@ -243,7 +242,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) flags = smk->frm_flags[smk->cur_frame]; smk->flags = flags >> 1; /* handle palette change event */ -if(flags & SMACKER_PAL){ +if (flags & SMACKER_PAL) { int size, sz, t, off, j, pos; uint8_t *pal = smk->pal; uint8_t oldpal[768]; @@ -258,12 +257,12 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) smk->frame_size -= size--; sz = 0; pos = avio_tell(s->pb) + size; -while(sz < 256){ +while (sz < 256) { t = avio_r8(s->pb); -if(t & 0x80){ /* skip palette entries */ -sz += (t & 0x7F) + 1; +if (t & 0x80) { /* skip palette entries */ +sz += (t & 0x7F) + 1; pal += ((t & 0x7F) + 1) * 3; -} else if(t & 0x40){ /* copy with offset */ +} else if (t & 0x40) { /* copy with offset */ off = avio_r8(s->pb); j = (t & 0x3F) + 1; if (off + j > 0x100) { @@ -274,7 +273,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) goto next_frame; } off *= 3; -while(j-- && sz < 256) { +while (j-- && sz < 256) { *pal++ = oldpal[off + 0]; *pal++ = oldpal[off + 1]; *pal++ = oldpal[off + 2]; @@ -295,16 +294,16 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) for (int i = smk->next_audio_index; i < 7; i++) { if (smk->flags & (1 << i)) { -uint32_t size; +uint32_t size; -size = avio_rl32(s->pb); +size = avio_rl32(s->pb); if ((int)size < 8 || size > smk->frame_size) { -av_log(s, AV_LOG_ERROR, "Invalid audio part size\n"); -ret = AVERROR_INVALIDDATA; -goto next_frame; -} +av_log(s, AV_LOG_ERROR, "Invalid audio part size\n"); +ret = AVERROR_INVALIDDATA; +goto next_frame; +} smk->frame_size -= size; -size -= 4; +size-= 4; if (smk->indexes[i] < 0) { avio_skip(s->pb, size); @@ -312,36 +311,35 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) } if ((ret = av_get_packet(s->pb, pkt, size)) != size) { ret = ret < 0 ? ret : AVERROR_INVALIDDATA; -goto next_frame; -} +goto next_frame; +} pkt->stream_index = smk->indexes[i]; pkt->pts = smk->aud_pts[i]; smk->aud_pts[i] += AV_RL32(pkt->data); smk->next_audio_index = i + 1; return 0; -} } +} if (smk->frame_size >= INT_MAX/2) { -ret = AVERROR_INVALIDDATA; -goto next_frame; -} +ret = AVERROR_INVALIDDATA; +goto next_frame; +} if ((ret = av_new_packet(pkt, smk->frame_size + 769)) < 0) -goto next_frame; +goto next_frame; flags = smk->new_palette; -if(smk->frm_size[smk->cur_frame] & 1) +if (smk->frm_size[smk->cur_frame] & 1) flags |= 2; pkt->data[0] = flags; -memcpy(pkt->data + 1, smk->pal, 768); +memcpy(pkt->data + 1, smk->pal, 768); ret = ffio_read_size(s->pb, pkt->data + 769, smk->frame_size); -if (ret < 0) -goto next_frame; -pkt->stream_index = smk->videoindex; -pkt->pts = smk->cur_frame; -pkt->size = ret + 769; +if (ret < 0) +goto next_frame; +pkt->stream_index = smk->videoindex; +
[FFmpeg-devel] [PATCH 5/9] avformat/smacker: Improve timestamps
A Smacker file can contain up to seven audio tracks. Up until now, the pts for the i. audio packet contained in a Smacker frame was simply the end timestamp of the last i. audio packet contained in an earlier Smacker frame. The problem with this is that a Smacker stream need not contain data in every Smacker frame and so the current i. audio packet present may come from a different underlying stream than the last i. audio packet contained in an earlier frame. The sample hypnotix.smk* exhibits this. It has three audio tracks and the first of the three has a longer first packet, so that the audio for the first track is contained in only 235 packets contained in the first 235 Smacker frames; the end timestamp of this track is 166696 (about 7.56s at a timebase of 1/22050); the other two audio tracks both have 253 packets contained in the first 253 Smacker frames. Up until now, the 236th packet of the second track being the first audio packet in the 236th Smacker frame would get the end timestamp of the last first audio packet from the last Smacker frame containing a first audio packet and said last audio packet is the first audio packet from the 235th Smacker frame from the first audio track, so that the timestamp is 166696. In contrast, the 236th packet from the third track (whose packets contain the same number of samples as the packets from the second track) has a timestamp of 156116 (because its timestamp is derived from the end timestamp of the 235th packet of the second audio track). In the end, the second track ended up being 177360/22050 s = 8.044s long; in contrast, the third track was 166780/22050 s = 7.56s long which also coincided with the video. This commit fixes this by not using timestamps from other tracks for a packet's pts. *: https://samples.ffmpeg.org/game-formats/smacker/wetlands/hypnotix.smk Signed-off-by: Andreas Rheinhardt --- libavformat/smacker.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 4990b7d920..0138af3d14 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -58,7 +58,6 @@ typedef struct SmackerContext { uint8_t pal[768]; int indexes[7]; int videoindex; -int curstream; int64_t aud_pts[7]; } SmackerContext; @@ -247,7 +246,6 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) if (!smk->next_audio_index) { smk->frame_size = smk->frm_size[smk->cur_frame] & (~3); smk->next_frame_pos = avio_tell(s->pb) + smk->frame_size; -smk->curstream = 0; flags = smk->frm_flags[smk->cur_frame]; smk->flags = flags >> 1; /* handle palette change event */ @@ -323,10 +321,9 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) goto next_frame; } pkt->stream_index = smk->indexes[i]; -pkt->pts = smk->aud_pts[smk->curstream]; -smk->aud_pts[smk->curstream] += AV_RL32(pkt->data); +pkt->pts = smk->aud_pts[i]; +smk->aud_pts[i] += AV_RL32(pkt->data); smk->next_audio_index = i + 1; -smk->curstream++; return 0; } } -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/9] avformat/smacker: Don't increase packet counter prematurely
The Smacker demuxer buffers audio packets before it outputs them, but it increments the counter of buffered packets prematurely: If allocating the audio buffer fails, an error (most likely AVERROR(ENOMEM)) is returned. If the caller decides to call av_read_frame() again, the next call will take the codepath for returning already buffered audio packets and it will fail (because the buffer that ought to be allocated isn't) without decrementing the number of supposedly buffered audio packets (it doesn't matter whether there would be enough memory available in subsequent calls). Depending on the caller's behaviour this is potentially an infinite loop. This commit fixes this by only incrementing the number of buffered audio packets after having successfully read them and unconditionally reducing said number when outputting one of them. It also changes the semantics of the curstream variable: It is now the number of currently buffered audio packets whereas it used to be the index of the last audio stream to be read. (Index refers to the index in the array of buffers, not to the stream index.) Signed-off-by: Andreas Rheinhardt --- libavformat/smacker.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 8b1e185817..14dc4ef406 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -229,7 +229,6 @@ static int smacker_read_header(AVFormatContext *s) return AVERROR(EIO); } -smk->curstream = -1; smk->nextpos = avio_tell(pb); return 0; @@ -249,7 +248,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR_EOF; /* if we demuxed all streams, pass another frame */ -if(smk->curstream < 0) { +if (smk->curstream <= 0) { avio_seek(s->pb, smk->nextpos, 0); frame_size = smk->frm_size[smk->cur_frame] & (~3); flags = smk->frm_flags[smk->cur_frame]; @@ -301,7 +300,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) palchange |= 1; } flags >>= 1; -smk->curstream = -1; +smk->curstream = 0; /* if audio chunks are present, put them to stack and retrieve later */ for(i = 0; i < 7; i++) { if(flags & 1) { @@ -315,7 +314,6 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) } frame_size -= size; frame_size -= 4; -smk->curstream++; if ((err = av_reallocp(&smk->bufs[smk->curstream], size)) < 0) { smk->buf_sizes[smk->curstream] = 0; return err; @@ -325,6 +323,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) if(ret != size) return AVERROR(EIO); smk->stream_id[smk->curstream] = smk->indexes[i]; +smk->curstream++; } flags >>= 1; } @@ -345,6 +344,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) smk->cur_frame++; smk->nextpos = avio_tell(s->pb); } else { +smk->curstream--; if (smk->stream_id[smk->curstream] < 0 || !smk->bufs[smk->curstream]) return AVERROR_INVALIDDATA; if ((ret = av_new_packet(pkt, smk->buf_sizes[smk->curstream])) < 0) @@ -354,7 +354,6 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->stream_index = smk->stream_id[smk->curstream]; pkt->pts = smk->aud_pts[smk->curstream]; smk->aud_pts[smk->curstream] += AV_RL32(pkt->data); -smk->curstream--; } return 0; -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/3] avcodec/mlpenc: propagate proper error values
Signed-off-by: James Almer --- libavcodec/mlpenc.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c index f99d2f5d6f..4d50f0ea33 100644 --- a/libavcodec/mlpenc.c +++ b/libavcodec/mlpenc.c @@ -531,7 +531,7 @@ static av_cold int mlp_encode_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d. Supported " "sample rates are 44100, 88200, 176400, 48000, " "96000, and 192000.\n", avctx->sample_rate); -return -1; +return AVERROR(EINVAL); } ctx->coded_sample_rate[1] = -1 & 0xf; @@ -564,7 +564,7 @@ static av_cold int mlp_encode_init(AVCodecContext *avctx) default: av_log(avctx, AV_LOG_ERROR, "Sample format not supported. " "Only 16- and 24-bit samples are supported.\n"); -return -1; +return AVERROR(EINVAL); } ctx->coded_sample_fmt[1] = -1 & 0xf; @@ -638,7 +638,7 @@ static av_cold int mlp_encode_init(AVCodecContext *avctx) ctx->channel_arrangement = 12; break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported channel arrangement\n"); -return -1; +return AVERROR(EINVAL); } ctx->flags = FLAGS_DVDA; ctx->channel_occupancy = ff_mlp_ch_info[ctx->channel_arrangement].channel_occupancy; @@ -666,7 +666,7 @@ static av_cold int mlp_encode_init(AVCodecContext *avctx) break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported channel arrangement\n"); -return -1; +return AVERROR(EINVAL); } ctx->flags = 0; ctx->channel_occupancy = 0; @@ -1190,7 +1190,7 @@ static unsigned int write_access_unit(MLPEncodeContext *ctx, uint8_t *buf, int total_length; if (buf_size < 4) -return -1; +return AVERROR(EINVAL); /* Frame header will be written at the end. */ buf += 4; @@ -1198,7 +1198,7 @@ static unsigned int write_access_unit(MLPEncodeContext *ctx, uint8_t *buf, if (restart_frame) { if (buf_size < 28) -return -1; +return AVERROR(EINVAL); write_major_sync(ctx, buf, buf_size); buf += 28; buf_size -= 28; @@ -1820,7 +1820,7 @@ static int apply_filter(MLPEncodeContext *ctx, unsigned int channel) if (!filter_state_buffer[i]) { av_log(ctx->avctx, AV_LOG_ERROR, "Not enough memory for applying filters.\n"); -return -1; +return AVERROR(ENOMEM); } } @@ -1848,7 +1848,7 @@ static int apply_filter(MLPEncodeContext *ctx, unsigned int channel) residual = sample - (accum & mask); if (residual < SAMPLE_MIN(24) || residual > SAMPLE_MAX(24)) { -ret = -1; +ret = AVERROR_INVALIDDATA; goto free_and_return; } @@ -2264,7 +2264,7 @@ static int mlp_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, if (ctx->frame_size[ctx->frame_index] > MAX_BLOCKSIZE) { av_log(avctx, AV_LOG_ERROR, "Invalid frame size (%d > %d)\n", ctx->frame_size[ctx->frame_index], MAX_BLOCKSIZE); -return -1; +return AVERROR_INVALIDDATA; } restart_frame = !ctx->frame_index; -- 2.27.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/6] avutil/opt: check return value of av_bprint_finalize()
unsubscribe On Mon, Jun 22, 2020 at 4:32 PM wrote: > From: Limin Wang > > Signed-off-by: Limin Wang > --- > libavutil/opt.c | 5 - > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/libavutil/opt.c b/libavutil/opt.c > index 2c3f998..552985e 100644 > --- a/libavutil/opt.c > +++ b/libavutil/opt.c > @@ -2120,6 +2120,9 @@ int av_opt_serialize(void *obj, int opt_flags, int > flags, char **buffer, > av_freep(&buf); > } > } > -av_bprint_finalize(&bprint, buffer); > +ret = av_bprint_finalize(&bprint, buffer); > +if (ret < 0) > +return ret; > + > return 0; > } > -- > 1.8.3.1 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 1/7] FATE: add h264 timecode side data test
From: Limin Wang The old fate test is for framecrc and haven't testing timecode info. so it's better to change to ffprobe and dump them. Signed-off-by: Limin Wang --- tests/fate/h264.mak |4 +- tests/ref/fate/h264-timecode | 3608 ++ 2 files changed, 3305 insertions(+), 307 deletions(-) diff --git a/tests/fate/h264.mak b/tests/fate/h264.mak index 13a596e..0bf6800 100644 --- a/tests/fate/h264.mak +++ b/tests/fate/h264.mak @@ -196,7 +196,6 @@ FATE_H264 := $(FATE_H264:%=fate-h264-conformance-%) \ fate-h264-3386\ fate-h264-missing-frame \ fate-h264-ref-pic-mod-overflow\ - fate-h264-timecode\ fate-h264-encparams FATE_H264-$(call DEMDEC, H264, H264) += $(FATE_H264) @@ -228,6 +227,7 @@ FATE_H264-$(call DEMDEC, MXF, H264) += fate-h264-xavc-4389 FATE_H264-$(call DEMDEC, MOV, H264) += fate-h264-attachment-631 FATE_H264-$(call DEMDEC, MPEGTS, H264) += fate-h264-skip-nokey fate-h264-skip-nointra FATE_H264_FFPROBE-$(call DEMDEC, MATROSKA, H264) += fate-h264-dts_5frames +FATE_H264_FFPROBE-$(call DEMDEC, H264, H264) += fate-h264-timecode FATE_SAMPLES_AVCONV += $(FATE_H264-yes) FATE_SAMPLES_FFPROBE += $(FATE_H264_FFPROBE-yes) @@ -442,7 +442,7 @@ fate-h264-twofields-packet: CMD = framecrc -i $(TARGET_SAM fate-h264-unescaped-extradata:CMD = framecrc -i $(TARGET_SAMPLES)/h264/unescaped_extradata.mp4 -an -frames 10 fate-h264-3386: CMD = framecrc -i $(TARGET_SAMPLES)/h264/bbc2.sample.h264 fate-h264-missing-frame: CMD = framecrc -i $(TARGET_SAMPLES)/h264/nondeterministic_cut.h264 -fate-h264-timecode: CMD = framecrc -i $(TARGET_SAMPLES)/h264/crew_cif_timecode-2.h264 +fate-h264-timecode: CMD = probeframes -show_entries frame=side_data -select_streams v -i $(TARGET_SAMPLES)/h264/crew_cif_timecode-2.h264 fate-h264-reinit-%: CMD = framecrc -i $(TARGET_SAMPLES)/h264/$(@:fate-h264-%=%).h264 -vf format=yuv444p10le,scale=w=352:h=288 diff --git a/tests/ref/fate/h264-timecode b/tests/ref/fate/h264-timecode index b78f700..de97ed5 100644 --- a/tests/ref/fate/h264-timecode +++ b/tests/ref/fate/h264-timecode @@ -1,305 +1,3303 @@ -#tb 0: 1/30 -#media_type 0: video -#codec_id 0: rawvideo -#dimensions 0: 352x288 -#sar 0: 128/117 -0, 0, 0,1, 152064, 0x70684c80 -0, 1, 1,1, 152064, 0xb5c8b300 -0, 2, 2,1, 152064, 0x5777ac60 -0, 3, 3,1, 152064, 0xb27646a5 -0, 4, 4,1, 152064, 0x20bd98ec -0, 5, 5,1, 152064, 0xcf5ac1b0 -0, 6, 6,1, 152064, 0x85a42952 -0, 7, 7,1, 152064, 0xc25aa530 -0, 8, 8,1, 152064, 0x97b14be9 -0, 9, 9,1, 152064, 0xf67ec91a -0, 10, 10,1, 152064, 0x3890d6a3 -0, 11, 11,1, 152064, 0xc52c8467 -0, 12, 12,1, 152064, 0x30a7af36 -0, 13, 13,1, 152064, 0x27528a98 -0, 14, 14,1, 152064, 0x245c08c5 -0, 15, 15,1, 152064, 0x7e0220f3 -0, 16, 16,1, 152064, 0x4b254c89 -0, 17, 17,1, 152064, 0x1586e3e5 -0, 18, 18,1, 152064, 0x594dfc58 -0, 19, 19,1, 152064, 0x85ba9c8e -0, 20, 20,1, 152064, 0x1e235100 -0, 21, 21,1, 152064, 0xa02c6a72 -0, 22, 22,1, 152064, 0xd1166fb6 -0, 23, 23,1, 152064, 0xcc9b1546 -0, 24, 24,1, 152064, 0x55e35a35 -0, 25, 25,1, 152064, 0xea63e2ae -0, 26, 26,1, 152064, 0x936a1802 -0, 27, 27,1, 152064, 0x354a749c -0, 28, 28,1, 152064, 0x5cd0f246 -0, 29, 29,1, 152064, 0x0376e69b -0, 30, 30,1, 152064, 0x5af5fb61 -0, 31, 31,1, 152064, 0x9a053ab8 -0, 32, 32,1, 152064, 0x57cbbfcc -0, 33, 33,1, 152064, 0x81f19e93 -0, 34, 34,1, 152064, 0x0812953d -0, 35, 35,1, 152064, 0x0ae2a166 -0, 36, 36,1, 152064, 0x193125b8 -0, 37, 37,1, 152064, 0xab7eca7b -0, 38, 38,1, 152064, 0x91ff1870 -0, 39, 39,1, 152064, 0x8f5
Re: [FFmpeg-devel] [PATCH] avformat/av1: Avoid using dynamic buffer when assembling av1c
Andreas Rheinhardt: > Given that AV1 only has exactly one sequence header, it is unnecessary > to copy the content of said sequence header into an intermediate dynamic > buffer; instead the sequence header can be copied from where it is in > the input buffer. > > Signed-off-by: Andreas Rheinhardt > --- > libavformat/av1.c | 18 +++--- > 1 file changed, 7 insertions(+), 11 deletions(-) > > diff --git a/libavformat/av1.c b/libavformat/av1.c > index 1e7a67d2f2..0cbffb1fd8 100644 > --- a/libavformat/av1.c > +++ b/libavformat/av1.c > @@ -363,11 +363,11 @@ int ff_av1_parse_seq_header(AV1SequenceParameters *seq, > const uint8_t *buf, int > > int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size) > { > -AVIOContext *seq_pb = NULL, *meta_pb = NULL; > +AVIOContext *meta_pb; > AV1SequenceParameters seq_params; > PutBitContext pbc; > -uint8_t header[4]; > -uint8_t *seq, *meta; > +uint8_t header[4], *meta; > +const uint8_t *seq; > int64_t obu_size; > int start_pos, type, temporal_id, spatial_id; > int ret, nb_seq = 0, seq_size, meta_size; > @@ -375,12 +375,9 @@ int ff_isom_write_av1c(AVIOContext *pb, const uint8_t > *buf, int size) > if (size <= 0) > return AVERROR_INVALIDDATA; > > -ret = avio_open_dyn_buf(&seq_pb); > -if (ret < 0) > -return ret; > ret = avio_open_dyn_buf(&meta_pb); > if (ret < 0) > -goto fail; > +return ret; > > while (size > 0) { > int len = parse_obu_header(buf, size, &obu_size, &start_pos, > @@ -401,7 +398,8 @@ int ff_isom_write_av1c(AVIOContext *pb, const uint8_t > *buf, int size) > if (ret < 0) > goto fail; > > -avio_write(seq_pb, buf, len); > +seq = buf; > +seq_size = len; > break; > case AV1_OBU_METADATA: > if (!obu_size) { > @@ -417,8 +415,7 @@ int ff_isom_write_av1c(AVIOContext *pb, const uint8_t > *buf, int size) > buf += len; > } > > -seq_size = avio_get_dyn_buf(seq_pb, &seq); > -if (!seq_size) { > +if (!nb_seq) { > ret = AVERROR_INVALIDDATA; > goto fail; > } > @@ -447,7 +444,6 @@ int ff_isom_write_av1c(AVIOContext *pb, const uint8_t > *buf, int size) > avio_write(pb, meta, meta_size); > > fail: > -ffio_free_dyn_buf(&seq_pb); > ffio_free_dyn_buf(&meta_pb); > > return ret; > Will apply tomorrow unless there are objections. - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 06/17] avformat/smoothstreaming: Add deinit function
Andreas Rheinhardt: > Signed-off-by: Andreas Rheinhardt > --- > libavformat/smoothstreamingenc.c | 43 > 1 file changed, 16 insertions(+), 27 deletions(-) > > diff --git a/libavformat/smoothstreamingenc.c > b/libavformat/smoothstreamingenc.c > index 07745d5cb5..ff38edbe05 100644 > --- a/libavformat/smoothstreamingenc.c > +++ b/libavformat/smoothstreamingenc.c > @@ -292,21 +292,18 @@ static int ism_write_header(AVFormatContext *s) > ff_const59 AVOutputFormat *oformat; > > if (mkdir(s->url, 0777) == -1 && errno != EEXIST) { > -ret = AVERROR(errno); > av_log(s, AV_LOG_ERROR, "mkdir failed\n"); > -goto fail; > +return AVERROR(errno); > } > > oformat = av_guess_format("ismv", NULL, NULL); > if (!oformat) { > -ret = AVERROR_MUXER_NOT_FOUND; > -goto fail; > +return AVERROR_MUXER_NOT_FOUND; > } > > c->streams = av_mallocz_array(s->nb_streams, sizeof(*c->streams)); > if (!c->streams) { > -ret = AVERROR(ENOMEM); > -goto fail; > +return AVERROR(ENOMEM); > } > > for (i = 0; i < s->nb_streams; i++) { > @@ -324,24 +321,21 @@ static int ism_write_header(AVFormatContext *s) > } > > if (mkdir(os->dirname, 0777) == -1 && errno != EEXIST) { > -ret = AVERROR(errno); > av_log(s, AV_LOG_ERROR, "mkdir failed\n"); > -goto fail; > +return AVERROR(errno); > } > > os->ctx = ctx = avformat_alloc_context(); > if (!ctx) { > -ret = AVERROR(ENOMEM); > -goto fail; > +return AVERROR(ENOMEM); > } > if ((ret = ff_copy_whiteblacklists(ctx, s)) < 0) > -goto fail; > +return ret; > ctx->oformat = oformat; > ctx->interrupt_callback = s->interrupt_callback; > > if (!(st = avformat_new_stream(ctx, NULL))) { > -ret = AVERROR(ENOMEM); > -goto fail; > +return AVERROR(ENOMEM); > } > avcodec_parameters_copy(st->codecpar, s->streams[i]->codecpar); > st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio; > @@ -349,8 +343,7 @@ static int ism_write_header(AVFormatContext *s) > > ctx->pb = avio_alloc_context(os->iobuf, sizeof(os->iobuf), > AVIO_FLAG_WRITE, os, NULL, ism_write, ism_seek); > if (!ctx->pb) { > -ret = AVERROR(ENOMEM); > -goto fail; > +return AVERROR(ENOMEM); > } > > av_dict_set_int(&opts, "ism_lookahead", c->lookahead_count, 0); > @@ -358,7 +351,7 @@ static int ism_write_header(AVFormatContext *s) > ret = avformat_write_header(ctx, &opts); > av_dict_free(&opts); > if (ret < 0) { > - goto fail; > + return ret; > } > avio_flush(ctx->pb); > s->streams[i]->time_base = st->time_base; > @@ -371,8 +364,7 @@ static int ism_write_header(AVFormatContext *s) > os->fourcc = "WVC1"; > } else { > av_log(s, AV_LOG_ERROR, "Unsupported video codec\n"); > -ret = AVERROR(EINVAL); > -goto fail; > +return AVERROR(EINVAL); > } > } else { > c->has_audio = 1; > @@ -385,8 +377,7 @@ static int ism_write_header(AVFormatContext *s) > os->audio_tag = 0x0162; > } else { > av_log(s, AV_LOG_ERROR, "Unsupported audio codec\n"); > -ret = AVERROR(EINVAL); > -goto fail; > +return AVERROR(EINVAL); > } > os->packet_size = st->codecpar->block_align ? > st->codecpar->block_align : 4; > } > @@ -395,15 +386,13 @@ static int ism_write_header(AVFormatContext *s) > > if (!c->has_video && c->min_frag_duration <= 0) { > av_log(s, AV_LOG_WARNING, "no video stream and no min frag duration > set\n"); > -ret = AVERROR(EINVAL); > -goto fail; > +return AVERROR(EINVAL); > } > ret = write_manifest(s, 0); > +if (ret < 0) > +return ret; > > -fail: > -if (ret) > -ism_free(s); > -return ret; > +return 0; > } > > static int parse_fragment(AVFormatContext *s, const char *filename, int64_t > *start_ts, int64_t *duration, int64_t *moof_size, int64_t size) > @@ -633,7 +622,6 @@ static int ism_write_trailer(AVFormatContext *s) > rmdir(s->url); > } > > -ism_free(s); > return 0; > } > > @@ -666,5 +654,6 @@ AVOutputFormat ff_smoothstreaming_muxer = { > .write_header = ism_write_header, > .write_packet = ism_write_packet, > .write_trailer = ism_write_trailer, > +.deinit = ism_free, > .priv_class = &ism_class, > }; > Ping. - Andreas ___ ffmpeg-devel mailing list
Re: [FFmpeg-devel] [PATCH] avfilter: add nonlinearstretch filter.
Mathias Rasmussen (12020-06-22): > Yes, you are correct, is it supposed to be an empty file? > I'm not sure my test case really works though, is there a way to see the > results of the test? Just run "make fate-filter-nonlinearstretch" and it should try the test. It is advised to run "make fate" completely before sending patches, preferably with samples. http://ffmpeg.org/fate.html#Using-FATE-from-your-FFmpeg-source-directory Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/6] avutil/opt: check return value of av_bprint_finalize()
lance.lmw...@gmail.com (12020-06-22): > From: Limin Wang > > Signed-off-by: Limin Wang > --- > libavutil/opt.c | 5 - > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/libavutil/opt.c b/libavutil/opt.c > index 2c3f998..552985e 100644 > --- a/libavutil/opt.c > +++ b/libavutil/opt.c > @@ -2120,6 +2120,9 @@ int av_opt_serialize(void *obj, int opt_flags, int > flags, char **buffer, > av_freep(&buf); > } > } > -av_bprint_finalize(&bprint, buffer); > +ret = av_bprint_finalize(&bprint, buffer); > +if (ret < 0) > +return ret; > + > return 0; > } The extra empty line seems unnecessary. LGTM otherwise. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 6/6] avformat/hlsenc: fix av_bprint_finalize() usage
lance.lmw...@gmail.com (12020-06-22): > From: Limin Wang > > Don't need to do double check by the description of the API. Looks ok. Could be simplified even further bu passing s directly. I do not maintain that file. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/6] avformat/au: check return value of av_bprint_finalize()
lance.lmw...@gmail.com (12020-06-22): > From: Limin Wang > > Signed-off-by: Limin Wang > --- > libavformat/au.c | 6 -- > 1 file changed, 4 insertions(+), 2 deletions(-) Probably ok, buy I do not maintain this. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/6] avutil/opt: check return value of av_bprint_finalize()
On Wed, Jun 24, 2020 at 05:36:08PM +0200, Nicolas George wrote: > lance.lmw...@gmail.com (12020-06-22): > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > libavutil/opt.c | 5 - > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/libavutil/opt.c b/libavutil/opt.c > > index 2c3f998..552985e 100644 > > --- a/libavutil/opt.c > > +++ b/libavutil/opt.c > > @@ -2120,6 +2120,9 @@ int av_opt_serialize(void *obj, int opt_flags, int > > flags, char **buffer, > > av_freep(&buf); > > } > > } > > -av_bprint_finalize(&bprint, buffer); > > +ret = av_bprint_finalize(&bprint, buffer); > > +if (ret < 0) > > +return ret; > > + > > return 0; > > } > > The extra empty line seems unnecessary. LGTM otherwise. Thanks, fix locally. will apply tomorrow if no comments from other developer. > > Regards, > > -- > Nicolas George -- Thanks, Limin Wang ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 6/6] avformat/hlsenc: fix av_bprint_finalize() usage
On Wed, Jun 24, 2020 at 05:37:59PM +0200, Nicolas George wrote: > lance.lmw...@gmail.com (12020-06-22): > > From: Limin Wang > > > > Don't need to do double check by the description of the API. > > Looks ok. Could be simplified even further bu passing s directly. Yes, I prefer to change it in another patch, if you think it's OK to change in one patch, I'll update the patch. > > I do not maintain that file. > > Regards, > > -- > Nicolas George -- Thanks, Limin Wang ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v4 1/7] FATE: add h264 timecode side data test
On Wed, Jun 24, 2020 at 09:43:14PM +0800, lance.lmw...@gmail.com wrote: > From: Limin Wang > > The old fate test is for framecrc and haven't testing timecode info. > so it's better to change to ffprobe and dump them. > > Signed-off-by: Limin Wang > --- > tests/fate/h264.mak |4 +- > tests/ref/fate/h264-timecode | 3608 > ++ > 2 files changed, 3305 insertions(+), 307 deletions(-) > > diff --git a/tests/fate/h264.mak b/tests/fate/h264.mak > index 13a596e..0bf6800 100644 > --- a/tests/fate/h264.mak > +++ b/tests/fate/h264.mak > @@ -196,7 +196,6 @@ FATE_H264 := $(FATE_H264:%=fate-h264-conformance-%) > \ >fate-h264-3386\ >fate-h264-missing-frame \ >fate-h264-ref-pic-mod-overflow\ > - fate-h264-timecode\ >fate-h264-encparams > > FATE_H264-$(call DEMDEC, H264, H264) += $(FATE_H264) > @@ -228,6 +227,7 @@ FATE_H264-$(call DEMDEC, MXF, H264) += fate-h264-xavc-4389 > FATE_H264-$(call DEMDEC, MOV, H264) += fate-h264-attachment-631 > FATE_H264-$(call DEMDEC, MPEGTS, H264) += fate-h264-skip-nokey > fate-h264-skip-nointra > FATE_H264_FFPROBE-$(call DEMDEC, MATROSKA, H264) += fate-h264-dts_5frames > +FATE_H264_FFPROBE-$(call DEMDEC, H264, H264) += fate-h264-timecode > > FATE_SAMPLES_AVCONV += $(FATE_H264-yes) > FATE_SAMPLES_FFPROBE += $(FATE_H264_FFPROBE-yes) > @@ -442,7 +442,7 @@ fate-h264-twofields-packet: CMD = > framecrc -i $(TARGET_SAM > fate-h264-unescaped-extradata:CMD = framecrc -i > $(TARGET_SAMPLES)/h264/unescaped_extradata.mp4 -an -frames 10 > fate-h264-3386: CMD = framecrc -i > $(TARGET_SAMPLES)/h264/bbc2.sample.h264 > fate-h264-missing-frame: CMD = framecrc -i > $(TARGET_SAMPLES)/h264/nondeterministic_cut.h264 > -fate-h264-timecode: CMD = framecrc -i > $(TARGET_SAMPLES)/h264/crew_cif_timecode-2.h264 > +fate-h264-timecode: CMD = probeframes > -show_entries frame=side_data -select_streams v -i > $(TARGET_SAMPLES)/h264/crew_cif_timecode-2.h264 Note for the fate testing: I'm trying to use less frames(2-4s) data for fate testing, but the read_intervals option isn't working for the raw h264 file by the actual testing. ./ffprobe -show_entries frame=side_data -read_intervals "%2s" -select_streams v ../fate-suite/h264/crew_cif_timecode-2.h264 |wc -l 2402 ./ffprobe -show_entries frame=side_data -read_intervals "%4s" -select_streams v ../fate-suite/h264/crew_cif_timecode-2.h264 |wc -l 2402 So the patch fate testing is only show no broken for the side data after change. > > fate-h264-reinit-%: CMD = framecrc -i > $(TARGET_SAMPLES)/h264/$(@:fate-h264-%=%).h264 -vf > format=yuv444p10le,scale=w=352:h=288 > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avfilter: add nonlinearstretch filter.
> On 24 Jun 2020, at 17.32, Nicolas George wrote: > > Just run "make fate-filter-nonlinearstretch" and it should try the test. > > It is advised to run "make fate" completely before sending patches, > preferably with samples. > > http://ffmpeg.org/fate.html#Using-FATE-from-your-FFmpeg-source-directory Okay thanks, I did run all the tests with samples, but I still don’t know what my testcase accomplishes? But anyway I will send a patch that doesn’t fail later, just noting that even though it builds I’m not sure that it properly tests my filter. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/2] avformat/avc, mxfenc: Avoid allocation of H264 SPS structure, fix memleak
Up until now, ff_avc_decode_sps would parse a SPS and return some properties from it in a freshly allocated structure. Yet said structure is very small and completely internal to libavformat, so there is no reason to use the heap for it. This commit therefore changes the function to return an int and to modify a caller-provided structure. This will also allow ff_avc_decode_sps to return better error codes in the future. It also fixes a memleak in mxfenc: If a packet contained multiple SPS, only the SPS structure belonging to the last SPS would be freed, the other ones would leak when the pointer is overwritten to point to the new SPS structure. Of course, without allocations there are no leaks. This is Coverity issue #1445194. Furthermore, the SPS structure has been renamed from H264SequenceParameterSet to H264SPS in order to avoid overlong lines. Signed-off-by: Andreas Rheinhardt --- This commit only intends to fix the memleak in mxfenc; I leave any modifications that might need to be made for the case of several SPS to other people. Apropos better error codes: Error checking will necessitate modifications to the helper functions; i.e. get_ue_golomb does not allow to check for invalid data (e.g. 32 zero bits in a row). I am surprised that the fuzzer hasn't complained about this yet. libavformat/avc.c| 27 --- libavformat/avc.h| 4 ++-- libavformat/mxfenc.c | 15 +++ 3 files changed, 21 insertions(+), 25 deletions(-) diff --git a/libavformat/avc.c b/libavformat/avc.c index 975d37ae82..b5e2921388 100644 --- a/libavformat/avc.c +++ b/libavformat/avc.c @@ -196,18 +196,17 @@ int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len) avio_write(pb, pps, pps_size); if (sps[3] != 66 && sps[3] != 77 && sps[3] != 88) { -H264SequenceParameterSet *seq = ff_avc_decode_sps(sps + 3, sps_size - 3); -if (!seq) { -ret = AVERROR(ENOMEM); +H264SPS seq; +ret = ff_avc_decode_sps(&seq, sps + 3, sps_size - 3); +if (ret < 0) goto fail; -} -avio_w8(pb, 0xfc | seq->chroma_format_idc); /* 6 bits reserved (11) + chroma_format_idc */ -avio_w8(pb, 0xf8 | (seq->bit_depth_luma - 8)); /* 5 bits reserved (1) + bit_depth_luma_minus8 */ -avio_w8(pb, 0xf8 | (seq->bit_depth_chroma - 8)); /* 5 bits reserved (1) + bit_depth_chroma_minus8 */ + +avio_w8(pb, 0xfc | seq.chroma_format_idc); /* 6 bits reserved (11) + chroma_format_idc */ +avio_w8(pb, 0xf8 | (seq.bit_depth_luma - 8)); /* 5 bits reserved (1) + bit_depth_luma_minus8 */ +avio_w8(pb, 0xf8 | (seq.bit_depth_chroma - 8)); /* 5 bits reserved (1) + bit_depth_chroma_minus8 */ avio_w8(pb, nb_sps_ext); /* number of sps ext */ if (nb_sps_ext) avio_write(pb, sps_ext, sps_ext_size); -av_free(seq); } fail: @@ -332,27 +331,24 @@ static inline int get_se_golomb(GetBitContext *gb) { return ((v >> 1) ^ sign) - sign; } -H264SequenceParameterSet *ff_avc_decode_sps(const uint8_t *buf, int buf_size) +int ff_avc_decode_sps(H264SPS *sps, const uint8_t *buf, int buf_size) { int i, j, ret, rbsp_size, aspect_ratio_idc, pic_order_cnt_type; int num_ref_frames_in_pic_order_cnt_cycle; int delta_scale, lastScale = 8, nextScale = 8; int sizeOfScalingList; -H264SequenceParameterSet *sps = NULL; GetBitContext gb; uint8_t *rbsp_buf; rbsp_buf = ff_nal_unit_extract_rbsp(buf, buf_size, &rbsp_size, 0); if (!rbsp_buf) -return NULL; +return AVERROR(ENOMEM); ret = init_get_bits8(&gb, rbsp_buf, rbsp_size); if (ret < 0) goto end; -sps = av_mallocz(sizeof(*sps)); -if (!sps) -goto end; +memset(sps, 0, sizeof(*sps)); sps->profile_idc = get_bits(&gb, 8); sps->constraint_set_flags |= get_bits1(&gb) << 0; // constraint_set0_flag @@ -448,7 +444,8 @@ H264SequenceParameterSet *ff_avc_decode_sps(const uint8_t *buf, int buf_size) sps->sar.den = 1; } +ret = 0; end: av_free(rbsp_buf); -return sps; +return ret; } diff --git a/libavformat/avc.h b/libavformat/avc.h index 5286d19d89..9792b77913 100644 --- a/libavformat/avc.h +++ b/libavformat/avc.h @@ -46,8 +46,8 @@ typedef struct { uint8_t bit_depth_chroma; uint8_t frame_mbs_only_flag; AVRational sar; -} H264SequenceParameterSet; +} H264SPS; -H264SequenceParameterSet *ff_avc_decode_sps(const uint8_t *src, int src_len); +int ff_avc_decode_sps(H264SPS *sps, const uint8_t *buf, int buf_size); #endif /* AVFORMAT_AVC_H */ diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index c3b6809e98..5a3a609bf6 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -2171,14 +2171,14 @@ static int mxf_parse_h264_frame(AVFormatContext *s, AVStream *st, { MXFContext *mxf = s->priv_data; MXFStreamContext *sc = st->priv_data; -H264Seque
[FFmpeg-devel] [PATCH 1/2] avformat/avc: Don't use ff_ prefix for static function
Signed-off-by: Andreas Rheinhardt --- libavformat/avc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/avc.c b/libavformat/avc.c index cd15ac3cdb..975d37ae82 100644 --- a/libavformat/avc.c +++ b/libavformat/avc.c @@ -27,7 +27,7 @@ #include "avc.h" #include "avio_internal.h" -static const uint8_t *ff_avc_find_startcode_internal(const uint8_t *p, const uint8_t *end) +static const uint8_t *avc_find_startcode_internal(const uint8_t *p, const uint8_t *end) { const uint8_t *a = p + 4 - ((intptr_t)p & 3); @@ -65,7 +65,7 @@ static const uint8_t *ff_avc_find_startcode_internal(const uint8_t *p, const uin } const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end){ -const uint8_t *out= ff_avc_find_startcode_internal(p, end); +const uint8_t *out = avc_find_startcode_internal(p, end); if(phttps://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] libavcodec/pgx: Added pgx decoder
From: Gautam Ramakrishnan This patch support to read and decode pgx files. --- libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/codec_id.h| 1 + libavcodec/pgx.h | 38 + libavcodec/pgxdec.c | 177 +++ libavformat/allformats.c | 1 + libavformat/img2dec.c| 11 +++ 7 files changed, 230 insertions(+) create mode 100644 libavcodec/pgx.h create mode 100644 libavcodec/pgxdec.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 5a6ea59715..0198c244e0 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -533,6 +533,7 @@ OBJS-$(CONFIG_PCX_ENCODER) += pcxenc.o OBJS-$(CONFIG_PFM_DECODER) += pnmdec.o pnm.o OBJS-$(CONFIG_PGM_DECODER) += pnmdec.o pnm.o OBJS-$(CONFIG_PGM_ENCODER) += pnmenc.o +OBJS-$(CONFIG_PGX_DECODER) += pgxdec.o OBJS-$(CONFIG_PGMYUV_DECODER) += pnmdec.o pnm.o OBJS-$(CONFIG_PGMYUV_ENCODER) += pnmenc.o OBJS-$(CONFIG_PGSSUB_DECODER) += pgssubdec.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index fa0c08d42e..b0217e6d6a 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -236,6 +236,7 @@ extern AVCodec ff_pcx_decoder; extern AVCodec ff_pfm_decoder; extern AVCodec ff_pgm_encoder; extern AVCodec ff_pgm_decoder; +extern AVCodec ff_pgx_decoder; extern AVCodec ff_pgmyuv_encoder; extern AVCodec ff_pgmyuv_decoder; extern AVCodec ff_pictor_decoder; diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h index d885962c9c..027ef21c62 100644 --- a/libavcodec/codec_id.h +++ b/libavcodec/codec_id.h @@ -111,6 +111,7 @@ enum AVCodecID { AV_CODEC_ID_PPM, AV_CODEC_ID_PBM, AV_CODEC_ID_PGM, +AV_CODEC_ID_PGX, AV_CODEC_ID_PGMYUV, AV_CODEC_ID_PAM, AV_CODEC_ID_FFVHUFF, diff --git a/libavcodec/pgx.h b/libavcodec/pgx.h new file mode 100644 index 00..bbe93fafe7 --- /dev/null +++ b/libavcodec/pgx.h @@ -0,0 +1,38 @@ +/* + * PGX image format + * Copyright (c) 2020 Gautam Ramakrishnan + * + * 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 + */ + +#ifndef AVCODEC_PGX_H +#define AVCODEC_PGX_H + +#include "avcodec.h" +#include "bytestream.h" + +typedef struct PGXContext { +GetByteContext g; +int depth; +int sgnd; +int width; +int height; +} PGXContext; + +int ff_pgx_decode_header(AVCodecContext *avctx, PGXContext * const s); + +#endif /* AVCODEC_PNM_H */ \ No newline at end of file diff --git a/libavcodec/pgxdec.c b/libavcodec/pgxdec.c new file mode 100644 index 00..f972853bf9 --- /dev/null +++ b/libavcodec/pgxdec.c @@ -0,0 +1,177 @@ +/* + * PGX image format + * Copyright (c) 2020 Gautam Ramakrishnan + * + * 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 "avcodec.h" +#include "internal.h" +#include "pgx.h" + +static int pgx_get_number(AVCodecContext *avctx, PGXContext * const s) { +char number[10]; +int i; +int ret; +number[9] = '\0'; +for (i = 0; i < 9; i++) { +if (!bytestream2_get_bytes_left(&s->g)) +return AVERROR_INVALIDDATA; +number[i] = (char)bytestream2_get_byteu(&s->g); +if (number[i] == ' ' || number[i] == 0xA || number[i] == 0xD) { +number[i] = '\0'; +break; +} else if (number[i] < '0' || number[i] > '9') { +return AVERROR_INVALIDDATA; +} +} +if (i > 9) +return AVERROR_INVALIDDATA; +ret = (int)strtol(number, NULL, 10); +if (ret >= 0) +re
Re: [FFmpeg-devel] [PATCH] libavcodec/pgx: Added pgx decoder
On Wed, Jun 24, 2020 at 11:54 PM wrote: > > From: Gautam Ramakrishnan > > This patch support to read and decode > pgx files. > --- > libavcodec/Makefile | 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/codec_id.h| 1 + > libavcodec/pgx.h | 38 + > libavcodec/pgxdec.c | 177 +++ > libavformat/allformats.c | 1 + > libavformat/img2dec.c| 11 +++ > 7 files changed, 230 insertions(+) > create mode 100644 libavcodec/pgx.h > create mode 100644 libavcodec/pgxdec.c > > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index 5a6ea59715..0198c244e0 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -533,6 +533,7 @@ OBJS-$(CONFIG_PCX_ENCODER) += pcxenc.o > OBJS-$(CONFIG_PFM_DECODER) += pnmdec.o pnm.o > OBJS-$(CONFIG_PGM_DECODER) += pnmdec.o pnm.o > OBJS-$(CONFIG_PGM_ENCODER) += pnmenc.o > +OBJS-$(CONFIG_PGX_DECODER) += pgxdec.o > OBJS-$(CONFIG_PGMYUV_DECODER) += pnmdec.o pnm.o > OBJS-$(CONFIG_PGMYUV_ENCODER) += pnmenc.o > OBJS-$(CONFIG_PGSSUB_DECODER) += pgssubdec.o > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c > index fa0c08d42e..b0217e6d6a 100644 > --- a/libavcodec/allcodecs.c > +++ b/libavcodec/allcodecs.c > @@ -236,6 +236,7 @@ extern AVCodec ff_pcx_decoder; > extern AVCodec ff_pfm_decoder; > extern AVCodec ff_pgm_encoder; > extern AVCodec ff_pgm_decoder; > +extern AVCodec ff_pgx_decoder; > extern AVCodec ff_pgmyuv_encoder; > extern AVCodec ff_pgmyuv_decoder; > extern AVCodec ff_pictor_decoder; > diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h > index d885962c9c..027ef21c62 100644 > --- a/libavcodec/codec_id.h > +++ b/libavcodec/codec_id.h > @@ -111,6 +111,7 @@ enum AVCodecID { > AV_CODEC_ID_PPM, > AV_CODEC_ID_PBM, > AV_CODEC_ID_PGM, > +AV_CODEC_ID_PGX, > AV_CODEC_ID_PGMYUV, > AV_CODEC_ID_PAM, > AV_CODEC_ID_FFVHUFF, > diff --git a/libavcodec/pgx.h b/libavcodec/pgx.h > new file mode 100644 > index 00..bbe93fafe7 > --- /dev/null > +++ b/libavcodec/pgx.h > @@ -0,0 +1,38 @@ > +/* > + * PGX image format > + * Copyright (c) 2020 Gautam Ramakrishnan > + * > + * 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 > + */ > + > +#ifndef AVCODEC_PGX_H > +#define AVCODEC_PGX_H > + > +#include "avcodec.h" > +#include "bytestream.h" > + > +typedef struct PGXContext { > +GetByteContext g; > +int depth; > +int sgnd; > +int width; > +int height; > +} PGXContext; > + > +int ff_pgx_decode_header(AVCodecContext *avctx, PGXContext * const s); > + > +#endif /* AVCODEC_PNM_H */ > \ No newline at end of file > diff --git a/libavcodec/pgxdec.c b/libavcodec/pgxdec.c > new file mode 100644 > index 00..f972853bf9 > --- /dev/null > +++ b/libavcodec/pgxdec.c > @@ -0,0 +1,177 @@ > +/* > + * PGX image format > + * Copyright (c) 2020 Gautam Ramakrishnan > + * > + * 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 "avcodec.h" > +#include "internal.h" > +#include "pgx.h" > + > +static int pgx_get_number(AVCodecContext *avctx, PGXContext * const s) { > +char number[10]; > +int i; > +int ret; > +number[9] = '\0'; > +for (i = 0; i < 9; i++) { > +if (!bytestream2_get_bytes_left(&s->g)) > +return AVERROR_INVALIDDATA; > +number[i] = (char)bytestream2_get_byteu(&s->g); > +if (number[i] == ' ' || number[i]
[FFmpeg-devel] [PATCH] libavcodec/pgx: Added pgx decoder
From: Gautam Ramakrishnan This patch support to read and decode pgx files. --- libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/codec_id.h| 1 + libavcodec/pgx.h | 38 + libavcodec/pgxdec.c | 176 +++ libavformat/allformats.c | 1 + libavformat/img2dec.c| 11 +++ 7 files changed, 229 insertions(+) create mode 100644 libavcodec/pgx.h create mode 100644 libavcodec/pgxdec.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 5a6ea59715..0198c244e0 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -533,6 +533,7 @@ OBJS-$(CONFIG_PCX_ENCODER) += pcxenc.o OBJS-$(CONFIG_PFM_DECODER) += pnmdec.o pnm.o OBJS-$(CONFIG_PGM_DECODER) += pnmdec.o pnm.o OBJS-$(CONFIG_PGM_ENCODER) += pnmenc.o +OBJS-$(CONFIG_PGX_DECODER) += pgxdec.o OBJS-$(CONFIG_PGMYUV_DECODER) += pnmdec.o pnm.o OBJS-$(CONFIG_PGMYUV_ENCODER) += pnmenc.o OBJS-$(CONFIG_PGSSUB_DECODER) += pgssubdec.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index fa0c08d42e..b0217e6d6a 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -236,6 +236,7 @@ extern AVCodec ff_pcx_decoder; extern AVCodec ff_pfm_decoder; extern AVCodec ff_pgm_encoder; extern AVCodec ff_pgm_decoder; +extern AVCodec ff_pgx_decoder; extern AVCodec ff_pgmyuv_encoder; extern AVCodec ff_pgmyuv_decoder; extern AVCodec ff_pictor_decoder; diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h index d885962c9c..027ef21c62 100644 --- a/libavcodec/codec_id.h +++ b/libavcodec/codec_id.h @@ -111,6 +111,7 @@ enum AVCodecID { AV_CODEC_ID_PPM, AV_CODEC_ID_PBM, AV_CODEC_ID_PGM, +AV_CODEC_ID_PGX, AV_CODEC_ID_PGMYUV, AV_CODEC_ID_PAM, AV_CODEC_ID_FFVHUFF, diff --git a/libavcodec/pgx.h b/libavcodec/pgx.h new file mode 100644 index 00..bbe93fafe7 --- /dev/null +++ b/libavcodec/pgx.h @@ -0,0 +1,38 @@ +/* + * PGX image format + * Copyright (c) 2020 Gautam Ramakrishnan + * + * 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 + */ + +#ifndef AVCODEC_PGX_H +#define AVCODEC_PGX_H + +#include "avcodec.h" +#include "bytestream.h" + +typedef struct PGXContext { +GetByteContext g; +int depth; +int sgnd; +int width; +int height; +} PGXContext; + +int ff_pgx_decode_header(AVCodecContext *avctx, PGXContext * const s); + +#endif /* AVCODEC_PNM_H */ \ No newline at end of file diff --git a/libavcodec/pgxdec.c b/libavcodec/pgxdec.c new file mode 100644 index 00..233bf34717 --- /dev/null +++ b/libavcodec/pgxdec.c @@ -0,0 +1,176 @@ +/* + * PGX image format + * Copyright (c) 2020 Gautam Ramakrishnan + * + * 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 "avcodec.h" +#include "internal.h" +#include "pgx.h" + +static int pgx_get_number(AVCodecContext *avctx, PGXContext * const s) { +char number[10]; +int i; +int ret; +number[9] = '\0'; +for (i = 0; i < 9; i++) { +if (!bytestream2_get_bytes_left(&s->g)) +return AVERROR_INVALIDDATA; +number[i] = (char)bytestream2_get_byteu(&s->g); +if (number[i] == ' ' || number[i] == 0xA || number[i] == 0xD) { +number[i] = '\0'; +break; +} else if (number[i] < '0' || number[i] > '9') { +return AVERROR_INVALIDDATA; +} +} +if (i > 9) +return AVERROR_INVALIDDATA; +ret = (int)strtol(number, NULL, 10); +if (ret >= 0) +re
Re: [FFmpeg-devel] [PATCH] libavcodec/pgx: Added pgx decoder
Thanks for the patch. Here are a few preliminary remarks. gautamr...@gmail.com (12020-06-24): > From: Gautam Ramakrishnan > > This patch support to read and decode > pgx files. > --- > libavcodec/Makefile | 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/codec_id.h| 1 + > libavcodec/pgx.h | 38 + > libavcodec/pgxdec.c | 176 +++ > libavformat/allformats.c | 1 + > libavformat/img2dec.c| 11 +++ > 7 files changed, 229 insertions(+) > create mode 100644 libavcodec/pgx.h > create mode 100644 libavcodec/pgxdec.c Documentation? > > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index 5a6ea59715..0198c244e0 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -533,6 +533,7 @@ OBJS-$(CONFIG_PCX_ENCODER) += pcxenc.o > OBJS-$(CONFIG_PFM_DECODER) += pnmdec.o pnm.o > OBJS-$(CONFIG_PGM_DECODER) += pnmdec.o pnm.o > OBJS-$(CONFIG_PGM_ENCODER) += pnmenc.o > +OBJS-$(CONFIG_PGX_DECODER) += pgxdec.o > OBJS-$(CONFIG_PGMYUV_DECODER) += pnmdec.o pnm.o > OBJS-$(CONFIG_PGMYUV_ENCODER) += pnmenc.o > OBJS-$(CONFIG_PGSSUB_DECODER) += pgssubdec.o > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c > index fa0c08d42e..b0217e6d6a 100644 > --- a/libavcodec/allcodecs.c > +++ b/libavcodec/allcodecs.c > @@ -236,6 +236,7 @@ extern AVCodec ff_pcx_decoder; > extern AVCodec ff_pfm_decoder; > extern AVCodec ff_pgm_encoder; > extern AVCodec ff_pgm_decoder; > +extern AVCodec ff_pgx_decoder; > extern AVCodec ff_pgmyuv_encoder; > extern AVCodec ff_pgmyuv_decoder; > extern AVCodec ff_pictor_decoder; > diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h > index d885962c9c..027ef21c62 100644 > --- a/libavcodec/codec_id.h > +++ b/libavcodec/codec_id.h > @@ -111,6 +111,7 @@ enum AVCodecID { > AV_CODEC_ID_PPM, > AV_CODEC_ID_PBM, > AV_CODEC_ID_PGM, > +AV_CODEC_ID_PGX, > AV_CODEC_ID_PGMYUV, > AV_CODEC_ID_PAM, > AV_CODEC_ID_FFVHUFF, > diff --git a/libavcodec/pgx.h b/libavcodec/pgx.h > new file mode 100644 > index 00..bbe93fafe7 > --- /dev/null > +++ b/libavcodec/pgx.h > @@ -0,0 +1,38 @@ > +/* > + * PGX image format > + * Copyright (c) 2020 Gautam Ramakrishnan > + * > + * 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 > + */ > + > +#ifndef AVCODEC_PGX_H > +#define AVCODEC_PGX_H > + > +#include "avcodec.h" > +#include "bytestream.h" > + > +typedef struct PGXContext { > +GetByteContext g; > +int depth; > +int sgnd; Is the micro-economy of letters rly ncssry? > +int width; > +int height; > +} PGXContext; > + > +int ff_pgx_decode_header(AVCodecContext *avctx, PGXContext * const s); This is not compatible with the function definition, how did you not get a warning from the compiler? Nit: no space after pointer mark. Will this be used elsewhere? Probably not. Then put it directly in the source file. > + > +#endif /* AVCODEC_PNM_H */ > \ No newline at end of file You need to fix the config of your text editor. > diff --git a/libavcodec/pgxdec.c b/libavcodec/pgxdec.c > new file mode 100644 > index 00..233bf34717 > --- /dev/null > +++ b/libavcodec/pgxdec.c > @@ -0,0 +1,176 @@ > +/* > + * PGX image format > + * Copyright (c) 2020 Gautam Ramakrishnan > + * > + * 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 "avcodec.h" > +#include "internal.h" > +#include "pgx
Re: [FFmpeg-devel] [PATCH] libavcodec/pgx: Added pgx decoder
Am Mi., 24. Juni 2020 um 20:55 Uhr schrieb : > > From: Gautam Ramakrishnan > > This patch support to read and decode > pgx files. > --- > libavcodec/Makefile | 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/codec_id.h| 1 + > libavcodec/pgx.h | 38 + > libavcodec/pgxdec.c | 176 +++ > libavformat/allformats.c | 1 + > libavformat/img2dec.c| 11 +++ > 7 files changed, 229 insertions(+) > create mode 100644 libavcodec/pgx.h > create mode 100644 libavcodec/pgxdec.c > > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index 5a6ea59715..0198c244e0 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -533,6 +533,7 @@ OBJS-$(CONFIG_PCX_ENCODER) += pcxenc.o > OBJS-$(CONFIG_PFM_DECODER) += pnmdec.o pnm.o > OBJS-$(CONFIG_PGM_DECODER) += pnmdec.o pnm.o > OBJS-$(CONFIG_PGM_ENCODER) += pnmenc.o > +OBJS-$(CONFIG_PGX_DECODER) += pgxdec.o > OBJS-$(CONFIG_PGMYUV_DECODER) += pnmdec.o pnm.o > OBJS-$(CONFIG_PGMYUV_ENCODER) += pnmenc.o > OBJS-$(CONFIG_PGSSUB_DECODER) += pgssubdec.o > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c > index fa0c08d42e..b0217e6d6a 100644 > --- a/libavcodec/allcodecs.c > +++ b/libavcodec/allcodecs.c > @@ -236,6 +236,7 @@ extern AVCodec ff_pcx_decoder; > extern AVCodec ff_pfm_decoder; > extern AVCodec ff_pgm_encoder; > extern AVCodec ff_pgm_decoder; > +extern AVCodec ff_pgx_decoder; > extern AVCodec ff_pgmyuv_encoder; > extern AVCodec ff_pgmyuv_decoder; > extern AVCodec ff_pictor_decoder; > diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h > index d885962c9c..027ef21c62 100644 > --- a/libavcodec/codec_id.h > +++ b/libavcodec/codec_id.h > @@ -111,6 +111,7 @@ enum AVCodecID { > AV_CODEC_ID_PPM, > AV_CODEC_ID_PBM, > AV_CODEC_ID_PGM, > +AV_CODEC_ID_PGX, You cannot put this in the middle of an enum, it breaks abi. > AV_CODEC_ID_PGMYUV, > AV_CODEC_ID_PAM, > AV_CODEC_ID_FFVHUFF, > diff --git a/libavcodec/pgx.h b/libavcodec/pgx.h > new file mode 100644 > index 00..bbe93fafe7 > --- /dev/null > +++ b/libavcodec/pgx.h > @@ -0,0 +1,38 @@ > +/* > + * PGX image format > + * Copyright (c) 2020 Gautam Ramakrishnan > + * > + * 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 > + */ > + > +#ifndef AVCODEC_PGX_H > +#define AVCODEC_PGX_H > + > +#include "avcodec.h" > +#include "bytestream.h" > + > +typedef struct PGXContext { > +GetByteContext g; > +int depth; > +int sgnd; > +int width; > +int height; > +} PGXContext; > + > +int ff_pgx_decode_header(AVCodecContext *avctx, PGXContext * const s); > + > +#endif /* AVCODEC_PNM_H */ > \ No newline at end of file Apart from this: Why is the header file needed at all? > diff --git a/libavcodec/pgxdec.c b/libavcodec/pgxdec.c > new file mode 100644 > index 00..233bf34717 > --- /dev/null > +++ b/libavcodec/pgxdec.c > @@ -0,0 +1,176 @@ > +/* > + * PGX image format > + * Copyright (c) 2020 Gautam Ramakrishnan > + * > + * 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 "avcodec.h" > +#include "internal.h" > +#include "pgx.h" > + > +static int pgx_get_number(AVCodecContext *avctx, PGXContext * const s) { > +char number[10]; > +int i; > +int ret; > +number[9] = '\0'; > +for (i = 0; i < 9; i++) { > +if (!bytestream2_get_bytes_left(&s->g)) > +return
Re: [FFmpeg-devel] [PATCH] lavu: make AV_TIME_BASE_Q work in C++ code
Am Mi., 24. Juni 2020 um 21:10 Uhr schrieb rcombs : > > --- > libavutil/avutil.h | 4 > 1 file changed, 4 insertions(+) > > diff --git a/libavutil/avutil.h b/libavutil/avutil.h > index 4d633156d1..c11b33f466 100644 > --- a/libavutil/avutil.h > +++ b/libavutil/avutil.h > @@ -257,7 +257,11 @@ const char *av_get_media_type_string(enum AVMediaType > media_type); > * Internal time base represented as fractional value > */ > > +#ifdef __cplusplus > +#define AV_TIME_BASE_Q AVRational{1, AV_TIME_BASE} > +#else > #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} > +#endif The problem with this patch is that it gives C++ users of the libraries the feeling that we would care about them and that we would indeed fix issues. Given that the contrary is true (at least in the past) and that we do not do any specific C++ testing, I believe it is better to let users work around this issue (from their point of you). Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/7] avfilter: add ff_inlink_peek_samples and ff_inlink_skip samples
On 6/24/20, Nicolas George wrote: > Paul B Mahol (12020-06-24): >> As already explained I can not use fixed buffer at all. > > Not true. > > Bring new, accurate arguments, or stop. You never provided argument to show how to accomplish anything with fixed buffer. You are being rude. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avfilter: add v360_vulkan filter
Signed-off-by: Paul B Mahol --- Please test it and reports benchmark results on non toyish GPUs. --- configure| 1 + libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/vf_v360_vulkan.c | 668 +++ 4 files changed, 671 insertions(+) create mode 100644 libavfilter/vf_v360_vulkan.c diff --git a/configure b/configure index 7495f35faa..2a3ac563db 100755 --- a/configure +++ b/configure @@ -3622,6 +3622,7 @@ transpose_opencl_filter_deps="opencl" transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags" unsharp_opencl_filter_deps="opencl" uspp_filter_deps="gpl avcodec" +v360_vulkan_filter_deps="vulkan libglslang" vaguedenoiser_filter_deps="gpl" vidstabdetect_filter_deps="libvidstab" vidstabtransform_filter_deps="libvidstab" diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 191826a622..6440794bcf 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -441,6 +441,7 @@ OBJS-$(CONFIG_UNSHARP_OPENCL_FILTER) += vf_unsharp_opencl.o opencl.o \ OBJS-$(CONFIG_UNTILE_FILTER) += vf_untile.o OBJS-$(CONFIG_USPP_FILTER) += vf_uspp.o OBJS-$(CONFIG_V360_FILTER) += vf_v360.o +OBJS-$(CONFIG_V360_VULKAN_FILTER)+= vf_v360_vulkan.o vulkan.o OBJS-$(CONFIG_VAGUEDENOISER_FILTER) += vf_vaguedenoiser.o OBJS-$(CONFIG_VECTORSCOPE_FILTER)+= vf_vectorscope.o OBJS-$(CONFIG_VFLIP_FILTER) += vf_vflip.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index de5884529c..65669c4422 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -420,6 +420,7 @@ extern AVFilter ff_vf_unsharp_opencl; extern AVFilter ff_vf_untile; extern AVFilter ff_vf_uspp; extern AVFilter ff_vf_v360; +extern AVFilter ff_vf_v360_vulkan; extern AVFilter ff_vf_vaguedenoiser; extern AVFilter ff_vf_vectorscope; extern AVFilter ff_vf_vflip; diff --git a/libavfilter/vf_v360_vulkan.c b/libavfilter/vf_v360_vulkan.c new file mode 100644 index 00..7db200f1c6 --- /dev/null +++ b/libavfilter/vf_v360_vulkan.c @@ -0,0 +1,668 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/random_seed.h" +#include "libavutil/opt.h" +#include "vulkan.h" +#include "internal.h" + +enum RotationOrder { +YAW, +PITCH, +ROLL, +NB_RORDERS, +}; + +enum Projections { +EQUIRECTANGULAR, +CUBEMAP_3_2, +CUBEMAP_6_1, +EQUIANGULAR, +FLAT, +DUAL_FISHEYE, +BARREL, +CUBEMAP_1_6, +STEREOGRAPHIC, +MERCATOR, +BALL, +HAMMER, +SINUSOIDAL, +FISHEYE, +PANNINI, +CYLINDRICAL, +PERSPECTIVE, +TETRAHEDRON, +BARREL_SPLIT, +TSPYRAMID, +HEQUIRECTANGULAR, +NB_PROJECTIONS, +}; + +#define CGROUPS (int [3]){ 32, 32, 1 } + +typedef struct V360VulkanContext { +VulkanFilterContext vkctx; + +int initialized; +FFVkExecContext *exec; +VulkanPipeline *pl; + +/* Shader updators, must be in the main filter struct */ +VkDescriptorImageInfo input_images[3]; +VkDescriptorImageInfo output_images[3]; + +int planewidth[4], planeheight[4]; +int inplanewidth[4], inplaneheight[4]; +int in, out; +int width, height; +float h_fov, v_fov; +float ih_fov, iv_fov; +float yaw, pitch, roll; +char *rorder; +int rotation_order[3]; + +/* Push constants / options */ +struct { +float flat_range[2]; +float iflat_range[2]; +float rot_mat[4][4]; +} opts; +} V360VulkanContext; + +static const char flat_to_xyz[] = { +C(0, void out_transform(out vec3 v, in ivec2 out_size, in ivec2 pos) ) +C(0, { ) +C(1, vec2 fpos = vec2(pos) + vec2(0.5f, 0.5f); ) +C(1, vec2 p = ((fpos / vec2(out_size)) - 0.5f)*2.0f; ) +C(1, v = vec3(p[0], p[1], 1.f) * vec3(flat_range, 1.f); ) +C(1, v = normalize(v); ) +C(0, } ) +}; + +static const char xyz_to_flat[] = { +C(0, v
[FFmpeg-devel] [PATCH]doc/examples: Always open files as "binary", not "text"
Hi! Attached patch fixes ticket #8638 and the only other occurrence of fopen() without b in doc/examples. Please comment, Carl Eugen From c0ae8356baaf40dbf5d3312264b42b8f02c1561b Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 25 Jun 2020 00:01:36 +0200 Subject: [PATCH] doc/examples: Always open files as "binary", not "text". Fixes ticket #8638. --- doc/examples/decode_video.c | 2 +- doc/examples/hw_decode.c| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/examples/decode_video.c b/doc/examples/decode_video.c index 169188a4b9..18ee90a6c0 100644 --- a/doc/examples/decode_video.c +++ b/doc/examples/decode_video.c @@ -41,7 +41,7 @@ static void pgm_save(unsigned char *buf, int wrap, int xsize, int ysize, FILE *f; int i; -f = fopen(filename,"w"); +f = fopen(filename,"wb"); fprintf(f, "P5\n%d %d\n%d\n", xsize, ysize, 255); for (i = 0; i < ysize; i++) fwrite(buf + i * wrap, 1, xsize, f); diff --git a/doc/examples/hw_decode.c b/doc/examples/hw_decode.c index f3286f472d..71be6e6709 100644 --- a/doc/examples/hw_decode.c +++ b/doc/examples/hw_decode.c @@ -223,7 +223,7 @@ int main(int argc, char *argv[]) } /* open the file to dump raw data */ -output_file = fopen(argv[3], "w+"); +output_file = fopen(argv[3], "w+b"); /* actual decoding and dump the raw data */ while (ret >= 0) { -- 2.24.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] libavcodec/pgx: Added pgx decoder
On Wed, Jun 24, 2020 at 23:57:10 +0530, gautamr...@gmail.com wrote: > +const char *header_start = "PG ML "; What about LM? Or do little-endian samples not exist? > +if (bytestream2_peek_byte(&s->g) == ' ') > +bytestream2_skip(&s->g, 1); I understand the separators can also be tabs, but that might also not be realistic. (I'm looking at the reference parser.) Same in pgx_get_number(). > +static inline int write_frame_8(AVPacket *avpkt, AVFrame *frame, PGXContext > * const s) This is a bit similar to write_frame_16(). If a write_frame_16le() also needs to be added, the three could perhaps be formed with macros. Moritz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] libavcodec/pgx: Added pgx decoder
Am Do., 25. Juni 2020 um 00:12 Uhr schrieb Moritz Barsnick : > > On Wed, Jun 24, 2020 at 23:57:10 +0530, gautamr...@gmail.com wrote: > > +const char *header_start = "PG ML "; > > What about LM? Or do little-endian samples not exist? There are only 78 known samples, all from the jpeg2000 test suite. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] lavu: make AV_TIME_BASE_Q work in C++ code
--- libavutil/avutil.h | 4 1 file changed, 4 insertions(+) diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 4d633156d1..c11b33f466 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -257,7 +257,11 @@ const char *av_get_media_type_string(enum AVMediaType media_type); * Internal time base represented as fractional value */ +#ifdef __cplusplus +#define AV_TIME_BASE_Q AVRational{1, AV_TIME_BASE} +#else #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} +#endif /** * @} -- 2.27.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v3 6/6] avformat/hlsenc: simplify code to pass s directly
From: Limin Wang Suggested-by: Nicolas George Signed-off-by: Limin Wang --- libavformat/hlsenc.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index a34da2f..0a318d2 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -365,7 +365,6 @@ fail: static int replace_str_data_in_filename(char **s, const char *filename, char placeholder, const char *datastring) { const char *p; -char *new_filename; char c; int addchar_count; int found_count = 0; @@ -398,16 +397,14 @@ static int replace_str_data_in_filename(char **s, const char *filename, char pla av_bprint_finalize(&buf, NULL); return AVERROR(ENOMEM); } -if ((ret = av_bprint_finalize(&buf, &new_filename)) < 0) +if ((ret = av_bprint_finalize(&buf, s)) < 0) return ret; -*s = new_filename; return found_count; } static int replace_int_data_in_filename(char **s, const char *filename, char placeholder, int64_t number) { const char *p; -char *new_filename; char c; int nd, addchar_count; int found_count = 0; @@ -448,9 +445,8 @@ static int replace_int_data_in_filename(char **s, const char *filename, char pla av_bprint_finalize(&buf, NULL); return AVERROR(ENOMEM); } -if ((ret = av_bprint_finalize(&buf, &new_filename)) < 0) +if ((ret = av_bprint_finalize(&buf, s)) < 0) return ret; -*s = new_filename; return found_count; } -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v3 1/6] avutil/opt: check return value of av_bprint_finalize()
From: Limin Wang Reviewed-by: Nicolas George Signed-off-by: Limin Wang --- libavutil/opt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index 2c3f998..c8413fa 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -2120,6 +2120,8 @@ int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer, av_freep(&buf); } } -av_bprint_finalize(&bprint, buffer); +ret = av_bprint_finalize(&bprint, buffer); +if (ret < 0) +return ret; return 0; } -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v3 2/6] avformat/au: check return value of av_bprint_finalize()
From: Limin Wang Reviewed-by: Nicolas George Signed-off-by: Limin Wang --- libavformat/au.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/au.c b/libavformat/au.c index 4afee85..ff9176a 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -81,7 +81,7 @@ static int au_read_annotation(AVFormatContext *s, int size) AVBPrint bprint; char * key = NULL; char * value = NULL; -int i; +int ret, i; av_bprint_init(&bprint, 64, AV_BPRINT_SIZE_UNLIMITED); @@ -92,7 +92,9 @@ static int au_read_annotation(AVFormatContext *s, int size) if (c == '\0') { state = PARSE_FINISHED; } else if (c == '=') { -av_bprint_finalize(&bprint, &key); +ret = av_bprint_finalize(&bprint, &key); +if (ret < 0) +return ret; av_bprint_init(&bprint, 64, AV_BPRINT_SIZE_UNLIMITED); state = PARSE_VALUE; } else { -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/2] avformat/subtitles: Check for NOPTS in ff_subtitles_queue_finalize()
On Wed, Jun 24, 2020 at 02:10:09PM +0200, Nicolas George wrote: > Michael Niedermayer (12020-06-24): > > On Tue, Jun 23, 2020 at 02:08:44PM +0200, Nicolas George wrote: > > > Michael Niedermayer (12020-06-23): > > > > Fixes; signed integer overflow: 1 - -9223372036854775808 cannot be > > > > represented in type 'long' > > > > Fixes: > > > > 23490/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5133490093031424 > > > > > > > > Found-by: continuous fuzzing process > > > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > > > Signed-off-by: Michael Niedermayer > > > > --- > > > > libavformat/subtitles.c | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c > > > > index ad7f68938e..ccab80391f 100644 > > > > --- a/libavformat/subtitles.c > > > > +++ b/libavformat/subtitles.c > > > > @@ -202,7 +202,7 @@ void ff_subtitles_queue_finalize(void *log_ctx, > > > > FFDemuxSubtitlesQueue *q) > > > >q->sort == SUB_SORT_TS_POS ? cmp_pkt_sub_ts_pos > > > > : cmp_pkt_sub_pos_ts); > > > > for (i = 0; i < q->nb_subs; i++) > > > > -if (q->subs[i].duration < 0 && i < q->nb_subs - 1) > > > > +if (q->subs[i].duration < 0 && i < q->nb_subs - 1 && > > > > q->subs[i].pts != AV_NOPTS_VALUE) > > > > q->subs[i].duration = q->subs[i + 1].pts - q->subs[i].pts; > > > > > > > > if (!q->keep_duplicates) > > > > > > Having no PTS at this point makes no sense. We should examine why it > > > arrived there. > > > > it comes from microdvddec in this case, it can be fixed for example > > with the following: (i do not know if these are all cases which can > > generate this) > > Thanks. It seems like a much more correct fix. We can see in > $FATE/sub/MicroDVD_capability_tester.sub that all lines have a number in > the first pair of braces except DEFAULT, which is parsed separately. > > > commit 06eff32c6e4100b70a3a215a0756580a6fa124b5 (HEAD -> master) > > Author: Michael Niedermayer > > Date: Tue Jun 23 01:43:14 2020 +0200 > > > > > iavformat/microdvddec: Skip NOPTS values > > skip malformed lines without frame number. > > > > > Fixes; signed integer overflow: 1 - -9223372036854775808 cannot be > > represented in type 'long' > > Colon / semicolon. will apply with these changes thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you think the mosad wants you dead since a long time then you are either wrong or dead since a long time. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v3 3/6] avformat/au: check return value of au_read_annotation()
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/au.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/au.c b/libavformat/au.c index ff9176a..f92863e 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -145,6 +145,7 @@ static int au_read_header(AVFormatContext *s) int bps, ba = 0; enum AVCodecID codec; AVStream *st; +int ret; tag = avio_rl32(pb); if (tag != MKTAG('.', 's', 'n', 'd')) @@ -163,7 +164,9 @@ static int au_read_header(AVFormatContext *s) if (size > 24) { /* parse annotation field to get metadata */ -au_read_annotation(s, size - 24); +ret = au_read_annotation(s, size - 24); +if (ret < 0) +return ret; } codec = ff_codec_get_id(codec_au_tags, id); -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v3 5/6] avformat/hlsenc: fix av_bprint_finalize() usage
From: Limin Wang Don't need to do double check by the description of the API. Reviewed-by: Nicolas George Signed-off-by: Limin Wang --- libavformat/hlsenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index f7a4f30..a34da2f 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -398,7 +398,7 @@ static int replace_str_data_in_filename(char **s, const char *filename, char pla av_bprint_finalize(&buf, NULL); return AVERROR(ENOMEM); } -if ((ret = av_bprint_finalize(&buf, &new_filename)) < 0 || !new_filename) +if ((ret = av_bprint_finalize(&buf, &new_filename)) < 0) return ret; *s = new_filename; return found_count; @@ -448,7 +448,7 @@ static int replace_int_data_in_filename(char **s, const char *filename, char pla av_bprint_finalize(&buf, NULL); return AVERROR(ENOMEM); } -if ((ret = av_bprint_finalize(&buf, &new_filename)) < 0 || !new_filename) +if ((ret = av_bprint_finalize(&buf, &new_filename)) < 0) return ret; *s = new_filename; return found_count; -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v3 4/6] avformat/hlsenc: use proper error codes
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/hlsenc.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 71fa3db..f7a4f30 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -370,6 +370,7 @@ static int replace_str_data_in_filename(char **s, const char *filename, char pla int addchar_count; int found_count = 0; AVBPrint buf; +int ret; av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED); @@ -395,10 +396,10 @@ static int replace_str_data_in_filename(char **s, const char *filename, char pla } if (!av_bprint_is_complete(&buf)) { av_bprint_finalize(&buf, NULL); -return -1; +return AVERROR(ENOMEM); } -if (av_bprint_finalize(&buf, &new_filename) < 0 || !new_filename) -return -1; +if ((ret = av_bprint_finalize(&buf, &new_filename)) < 0 || !new_filename) +return ret; *s = new_filename; return found_count; } @@ -411,6 +412,7 @@ static int replace_int_data_in_filename(char **s, const char *filename, char pla int nd, addchar_count; int found_count = 0; AVBPrint buf; +int ret; av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED); @@ -444,10 +446,10 @@ static int replace_int_data_in_filename(char **s, const char *filename, char pla } if (!av_bprint_is_complete(&buf)) { av_bprint_finalize(&buf, NULL); -return -1; +return AVERROR(ENOMEM); } -if (av_bprint_finalize(&buf, &new_filename) < 0 || !new_filename) -return -1; +if ((ret = av_bprint_finalize(&buf, &new_filename)) < 0 || !new_filename) +return ret; *s = new_filename; return found_count; } -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/2] hwcontext_vaapi: try VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 firstly when importing a DMABuf
Jun 19, 2020, 07:47 by haihao.xi...@intel.com: > User should provide the modifier when importing a DMABuf if this DMABuf > has modifier. > > Signed-off-by: Haihao Xiang > --- > libavutil/hwcontext_vaapi.c | 137 +--- > 1 file changed, 126 insertions(+), 11 deletions(-) > > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c > index a378bcd12a..514bb07a20 100644 > --- a/libavutil/hwcontext_vaapi.c > +++ b/libavutil/hwcontext_vaapi.c > @@ -999,8 +999,9 @@ static void vaapi_unmap_from_drm(AVHWFramesContext > *dst_fc, > vaDestroySurfaces(dst_dev->display, &surface_id, 1); > } > > -static int vaapi_map_from_drm(AVHWFramesContext *dst_fc, AVFrame *dst, > - const AVFrame *src, int flags) > +static VASurfaceID vaapi_get_surface_from_drm_prime(AVHWFramesContext > *dst_fc, > +AVFrame *dst, > +const AVFrame *src) > { > AVHWFramesContext *src_fc = > (AVHWFramesContext*)src->hw_frames_ctx->data; > @@ -1010,7 +1011,7 @@ static int vaapi_map_from_drm(AVHWFramesContext > *dst_fc, AVFrame *dst, > VASurfaceID surface_id; > VAStatus vas; > uint32_t va_fourcc; > -int err, i, j, k; > +int i, j, k; > > unsigned long buffer_handle; > VASurfaceAttribExternalBuffers buffer_desc; > @@ -1030,13 +1031,6 @@ static int vaapi_map_from_drm(AVHWFramesContext > *dst_fc, AVFrame *dst, > }; > > desc = (AVDRMFrameDescriptor*)src->data[0]; > - > -if (desc->nb_objects != 1) { > -av_log(dst_fc, AV_LOG_ERROR, "VAAPI can only map frames " > - "made from a single DRM object.\n"); > -return AVERROR(EINVAL); > -} > - > va_fourcc = 0; > for (i = 0; i < FF_ARRAY_ELEMS(vaapi_drm_format_map); i++) { > if (desc->nb_layers != vaapi_drm_format_map[i].nb_layer_formats) > @@ -1092,9 +1086,130 @@ static int vaapi_map_from_drm(AVHWFramesContext > *dst_fc, AVFrame *dst, > src->width, src->height, > &surface_id, 1, > attrs, FF_ARRAY_ELEMS(attrs)); > + > +if (vas != VA_STATUS_SUCCESS) { > +av_log(dst_fc, AV_LOG_DEBUG, "Failed to create surface from > DRM_PRIME " > + "object: %d (%s).\n", vas, vaErrorStr(vas)); > +return VA_INVALID_ID; > +} > + > +return surface_id; > +} > + > +static VASurfaceID vaapi_get_surface_from_drm_prime2(AVHWFramesContext > *dst_fc, > + AVFrame *dst, > + const AVFrame *src) > +{ > +AVHWFramesContext *src_fc = > +(AVHWFramesContext*)src->hw_frames_ctx->data; > +AVVAAPIDeviceContext *dst_dev = dst_fc->device_ctx->hwctx; > +const AVDRMFrameDescriptor *desc; > +const VAAPIFormatDescriptor *format_desc; > +VASurfaceID surface_id; > +VAStatus vas; > +uint32_t va_fourcc; > +int i, j; > + > +VADRMPRIMESurfaceDescriptor surface_desc; > +VASurfaceAttrib attrs[2] = { > +{ > +.type = VASurfaceAttribMemoryType, > +.flags = VA_SURFACE_ATTRIB_SETTABLE, > +.value.type= VAGenericValueTypeInteger, > +.value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2, > +}, > +{ > +.type = VASurfaceAttribExternalBufferDescriptor, > +.flags = VA_SURFACE_ATTRIB_SETTABLE, > +.value.type= VAGenericValueTypePointer, > +.value.value.p = &surface_desc, > +} > +}; > + > +desc = (AVDRMFrameDescriptor*)src->data[0]; > +va_fourcc = 0; > +for (i = 0; i < FF_ARRAY_ELEMS(vaapi_drm_format_map); i++) { > +if (desc->nb_layers != vaapi_drm_format_map[i].nb_layer_formats) > +continue; > +for (j = 0; j < desc->nb_layers; j++) { > +if (desc->layers[j].format != > +vaapi_drm_format_map[i].layer_formats[j]) > +break; > +} > +if (j != desc->nb_layers) > +continue; > +va_fourcc = vaapi_drm_format_map[i].va_fourcc; > +break; > +} > +if (!va_fourcc) { > +av_log(dst_fc, AV_LOG_ERROR, "DRM format not supported " > + "by VAAPI.\n"); > +return AVERROR(EINVAL); > +} > + > +av_log(dst_fc, AV_LOG_DEBUG, "Map DRM object %d to VAAPI as " > + "%08x.\n", desc->objects[0].fd, va_fourcc); > + > +format_desc = vaapi_format_from_fourcc(va_fourcc); > +av_assert0(format_desc && !format_desc->chroma_planes_swapped); > + > +surface_desc.fourcc = va_fourcc; > +surface_desc.width = src_fc->width; > +surface_desc.height = src_fc->height; > +surface_desc.num_objects = 1; > +surface_desc.objects[0].fd = desc->objects[0].fd; > +surface_desc.objects[0].size = desc->objects[0].size; > +surface_desc.objects[0].drm_format_modifier = > desc->objects[0].format_modifier; > +surface_desc.num_layers = desc->n
Re: [FFmpeg-devel] [PATCH] avformat/webvttdec: Accept \r as newline
Andreas Rheinhardt: > After parsing the end timestamp of a WebVTT cue block, the current code > skips everything after the start of the timestamp that is not a \t, ' ' > or \n and treats what is next as the start of a WebVTT cue settings list. > Yet if there is no such list, but a single \r, this will skip a part of > the cue payload (namely everything until the first occurence of \t, ' ' > or \n) and treat what has not been skipped as the beginning of the > WebVTT cue settings list that extends until the next \r or \n (or the > end). > > Signed-off-by: Andreas Rheinhardt > --- > libavformat/webvttdec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavformat/webvttdec.c b/libavformat/webvttdec.c > index bd3d45b382..8d2fdfed37 100644 > --- a/libavformat/webvttdec.c > +++ b/libavformat/webvttdec.c > @@ -125,7 +125,7 @@ static int webvtt_read_header(AVFormatContext *s) > break; > > /* optional cue settings */ > -p += strcspn(p, "\n\t "); > +p += strcspn(p, "\n\r\t "); > while (*p == '\t' || *p == ' ') > p++; > settings = p; > Will apply tomorrow unless there are objections. - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat: AMQP: add option delivery_mode
On Sat, 20. Jun 22:46, Florian Levis wrote: > > Le sam. 20 juin 2020 à 20:56, Andriy Gelman a > écrit : > > > On Sat, 20. Jun 19:16, Levis Florian wrote: > > > Signed-off-by: Levis Florian > > > --- > > > doc/protocols.texi| 15 +++ > > > libavformat/libamqp.c | 6 +- > > > 2 files changed, 20 insertions(+), 1 deletion(-) > > > > > > diff --git a/doc/protocols.texi b/doc/protocols.texi > > > index 7aa758541c..2e15925eeb 100644 > > > --- a/doc/protocols.texi > > > +++ b/doc/protocols.texi > > > @@ -109,6 +109,21 @@ the received message may be truncated causing > > decoding errors. > > > The timeout in seconds during the initial connection to the broker. The > > > default value is rw_timeout, or 5 seconds if rw_timeout is not set. > > > > > > +@item delivery_mode @var{mode} > > > +Sets the delivery mode of each messages sent. > > > + > > > +The following values are recognized: > > > +@table @samp > > > +@item persistent > > > +Delivery mode set to "persistent" (2). This is the default value. > > > +Messages may be written to the broker's disk depending on its setup. > > > + > > > > > +@item non-persistent > > > +Delivery mode set to "non-persistent" (1) > > > +Messages may be stay in the broker's memory depending on its setup. > > > + > > > > I feel the following is clearer: > > > > Messages will stay in broker's memory unless the broker is under memory > > pressure. > > > > Let me know if you agree and I'll push in a few days if there are no more > > comments. > > > That's OK for me > Applied. Thanks, -- Andriy ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] libavcodec/pgx: Added pgx decoder
On Thu, Jun 25, 2020 at 00:52:57 +0200, Carl Eugen Hoyos wrote: > Am Do., 25. Juni 2020 um 00:12 Uhr schrieb Moritz Barsnick : > > What about LM? Or do little-endian samples not exist? > There are only 78 known samples, all from the jpeg2000 test suite. Okay, that makes this a fringe feature. I found 138 samples, 115 of them unique, and none of them uses little endianness, so case closed. Funnily, the reference decoder supports LE. For the record, all samples have either 4, 8 or 12 bit depth. Moritz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] libavcodec/pgx: Added pgx decoder
On Thu, Jun 25, 2020 at 12:43 AM Nicolas George wrote: > > Thanks for the patch. Here are a few preliminary remarks. > > gautamr...@gmail.com (12020-06-24): > > From: Gautam Ramakrishnan > > > > This patch support to read and decode > > pgx files. > > --- > > libavcodec/Makefile | 1 + > > libavcodec/allcodecs.c | 1 + > > libavcodec/codec_id.h| 1 + > > libavcodec/pgx.h | 38 + > > libavcodec/pgxdec.c | 176 +++ > > libavformat/allformats.c | 1 + > > libavformat/img2dec.c| 11 +++ > > 7 files changed, 229 insertions(+) > > create mode 100644 libavcodec/pgx.h > > create mode 100644 libavcodec/pgxdec.c > > Documentation? > > > > > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > > index 5a6ea59715..0198c244e0 100644 > > --- a/libavcodec/Makefile > > +++ b/libavcodec/Makefile > > @@ -533,6 +533,7 @@ OBJS-$(CONFIG_PCX_ENCODER) += pcxenc.o > > OBJS-$(CONFIG_PFM_DECODER) += pnmdec.o pnm.o > > OBJS-$(CONFIG_PGM_DECODER) += pnmdec.o pnm.o > > OBJS-$(CONFIG_PGM_ENCODER) += pnmenc.o > > +OBJS-$(CONFIG_PGX_DECODER) += pgxdec.o > > OBJS-$(CONFIG_PGMYUV_DECODER) += pnmdec.o pnm.o > > OBJS-$(CONFIG_PGMYUV_ENCODER) += pnmenc.o > > OBJS-$(CONFIG_PGSSUB_DECODER) += pgssubdec.o > > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c > > index fa0c08d42e..b0217e6d6a 100644 > > --- a/libavcodec/allcodecs.c > > +++ b/libavcodec/allcodecs.c > > @@ -236,6 +236,7 @@ extern AVCodec ff_pcx_decoder; > > extern AVCodec ff_pfm_decoder; > > extern AVCodec ff_pgm_encoder; > > extern AVCodec ff_pgm_decoder; > > +extern AVCodec ff_pgx_decoder; > > extern AVCodec ff_pgmyuv_encoder; > > extern AVCodec ff_pgmyuv_decoder; > > extern AVCodec ff_pictor_decoder; > > diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h > > index d885962c9c..027ef21c62 100644 > > --- a/libavcodec/codec_id.h > > +++ b/libavcodec/codec_id.h > > @@ -111,6 +111,7 @@ enum AVCodecID { > > AV_CODEC_ID_PPM, > > AV_CODEC_ID_PBM, > > AV_CODEC_ID_PGM, > > +AV_CODEC_ID_PGX, > > AV_CODEC_ID_PGMYUV, > > AV_CODEC_ID_PAM, > > AV_CODEC_ID_FFVHUFF, > > diff --git a/libavcodec/pgx.h b/libavcodec/pgx.h > > new file mode 100644 > > index 00..bbe93fafe7 > > --- /dev/null > > +++ b/libavcodec/pgx.h > > @@ -0,0 +1,38 @@ > > +/* > > + * PGX image format > > + * Copyright (c) 2020 Gautam Ramakrishnan > > + * > > + * 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 > > + */ > > + > > +#ifndef AVCODEC_PGX_H > > +#define AVCODEC_PGX_H > > + > > +#include "avcodec.h" > > +#include "bytestream.h" > > + > > > +typedef struct PGXContext { > > +GetByteContext g; > > +int depth; > > > +int sgnd; > > Is the micro-economy of letters rly ncssry? > > > +int width; > > +int height; > > +} PGXContext; > > + > > +int ff_pgx_decode_header(AVCodecContext *avctx, PGXContext * const s); > > This is not compatible with the function definition, how did you not get > a warning from the compiler? > > Nit: no space after pointer mark. > > Will this be used elsewhere? Probably not. Then put it directly in the > source file. > > > + > > +#endif /* AVCODEC_PNM_H */ > > > \ No newline at end of file > > You need to fix the config of your text editor. > > > diff --git a/libavcodec/pgxdec.c b/libavcodec/pgxdec.c > > new file mode 100644 > > index 00..233bf34717 > > --- /dev/null > > +++ b/libavcodec/pgxdec.c > > @@ -0,0 +1,176 @@ > > +/* > > + * PGX image format > > + * Copyright (c) 2020 Gautam Ramakrishnan > > + * > > + * 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 Licen