On Wed, 30 Apr 2014, Luca Barbato wrote:
On 29/04/14 13:43, Martin Storsjö wrote:
On Sat, 26 Apr 2014, Luca Barbato wrote:
Makes the two protocols nearly seamless.
---
Removed unmapped options, mapped swfverify, always try to map the
options.
libavformat/librtmp.c | 141
++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 125 insertions(+), 16 deletions(-)
+ if (ctx->swfurl || ctx->swfverify)
+ av_strlcat(filename, " swfUrl=", len);
+
+ if (ctx->swfverify) {
+ av_strlcat(filename, ctx->swfverify, len);
+ av_strlcat(filename, " swfVfy=1", len);
+ }
+ if (!ctx->swfverify && ctx->swfurl)
+ av_strlcat(filename, ctx->swfurl, len);
This part feels a bit hard to read. What about this instead?
if (ctx->swfurl || ctx->swfverify) {
av_strlcat(filename, " swfUrl=", len);
av_strlcat(filename, ctx->swfverify ? ctx->swfverify : ctx->swfurl,
len);
if (ctx->swfverify)
av_strlcat(filename, " swfVfy=1");
}
That at least to me is much more straightforward about what really
happens. If people dislike the ternary operator that line could be a
separate if though, but it makes it clearer to me what actually happens.
Something similar probably can be done for the string length calculation
further up.
In the end I wrote it as
if (ctx->swfurl || ctx->swfverify) {
av_strlcat(filename, " swfUrl=", len);
if (ctx->swfverify) {
av_strlcat(filename, ctx->swfverify, len);
av_strlcat(filename, " swfVfy=1", len);
} else {
av_strlcat(filename, ctx->swfurl, len);
}
}
Not sure if is as clear but is quite compact in both directions.
That looks ok to me.
// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel