[FFmpeg-devel] [PATCH] ffserver: add initial log showing available streams

Michael Niedermayer michaelni at gmx.at
Sat Nov 30 13:40:39 CET 2013


On Fri, Nov 29, 2013 at 11:29:10AM +0100, Stefano Sabatini wrote:
> ---
>  ffserver.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/ffserver.c b/ffserver.c
> index 1e465ea..d549e8b 100644
> --- a/ffserver.c
> +++ b/ffserver.c
> @@ -196,6 +196,12 @@ enum StreamType {
>      STREAM_TYPE_REDIRECT,
>  };
>  
> +static const char *stream_type[] = {
> +   "live",
> +   "status",
> +   "redirect",
> +};
> +
>  enum IPAddressAction {
>      IP_ALLOW = 1,
>      IP_DENY,
> @@ -4780,6 +4786,24 @@ int main(int argc, char **argv)

the code might be easier to understand if the stream_type array is
close to where its used, so a reader can see its contents when looking
at the code that uses it.


>          av_log_set_callback(http_av_log);
>      }
>  
> +    {
> +        FFStream *stream;
> +        char type[32];
> +        http_log("Available streams\n");
> +        http_log("\t%-10s %s [feed_file:FEED_FILE]\n", "TYPE", "NAME");
> +
> +        for (stream = first_stream; stream; stream = stream->next) {
> +            if (stream->is_feed)
> +                snprintf(type, sizeof(type), "%s[FEED]", stream_type[stream->stream_type]);
> +            else
> +                snprintf(type, sizeof(type), "%s", stream_type[stream->stream_type]);

could be simplified to:
snprintf(type, sizeof(type), "%s%s",
         stream_type[stream->stream_type],
         stream->is_feed ? "[FEED]" : "");


otherwise LGTM

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Observe your enemies, for they first find out your faults. -- Antisthenes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131130/ef976fe5/attachment.asc>


More information about the ffmpeg-devel mailing list