[FFmpeg-devel] [FFServer]Stylesheet patch - part1
Stefano Sabatini
stefano.sabatini-lala
Sun Mar 28 19:13:28 CEST 2010
On date Sunday 2010-03-28 16:38:46 +0200, Michal Wisniewski encoded:
> Hello,
> I am sending patch that allow user set stylesheets for FFServer status page.
> It is first step to small template subsystem, that might be useful for some
> broadcast systems.
> --- ffserver.c.bak 2010-03-28 15:13:49.703213827 +0200
> +++ ffserver.c 2010-03-28 15:48:07.223213507 +0200
> @@ -242,6 +242,8 @@
> int64_t feed_write_index; /* current write position in feed (it wraps around) */
> int64_t feed_size; /* current size of feed */
> struct FFStream *next_feed;
> + /* status stylesheet */
> + char stylesheet[1024];
Put docs inline (i.e. at right).
> } FFStream;
>
> typedef struct FeedData {
> @@ -1670,12 +1672,14 @@
> url_fprintf(pb, "<HTML><HEAD><TITLE>%s Status</TITLE>\n", program_name);
> if (c->stream->feed_filename[0])
> url_fprintf(pb, "<link rel=\"shortcut icon\" href=\"%s\">\n", c->stream->feed_filename);
> + if (c->stream->stylesheet[0])
> + url_fprintf(pb, "<link rel=\"stylesheet\" href=\"%s\">\n", c->stream->template_file);
Weird indent here and below, use k&r style, tab is forbidden, also run
tools/patcheck for discovering all these trivial warts.
> url_fprintf(pb, "</HEAD>\n<BODY>");
> url_fprintf(pb, "<H1>%s Status</H1>\n", program_name);
> /* format status */
> url_fprintf(pb, "<H2>Available Streams</H2>\n");
> url_fprintf(pb, "<TABLE cellspacing=0 cellpadding=4>\n");
> - url_fprintf(pb, "<TR><Th valign=top>Path<th align=left>Served<br>Conns<Th><br>bytes<Th valign=top>Format<Th>Bit rate<br>kbits/s<Th align=left>Video<br>kbits/s<th><br>Codec<Th align=left>Audio<br>kbits/s<th><br>Codec<Th align=left valign=top>Feed\n");
> + url_fprintf(pb, "<TR id=\"streams\"><Th valign=top>Path<th align=left>Served<br>Conns<Th><br>bytes<Th valign=top>Format<Th>Bit rate<br>kbits/s<Th align=left>Video<br>kbits/s<th><br>Codec<Th align=left>Audio<br>kbits/s<th><br>Codec<Th align=left valign=top>Feed\n");
> stream = first_stream;
> while (stream != NULL) {
> char sfilename[1024];
> @@ -1768,6 +1772,7 @@
> stream = first_stream;
> while (stream != NULL) {
> if (stream->feed == stream) {
> + url_fprintf(pb, "<div class=\"stream\">");
> url_fprintf(pb, "<h2>Feed %s</h2>", stream->filename);
> if (stream->pid) {
> url_fprintf(pb, "Running as pid %d.\n", stream->pid);
> @@ -1825,7 +1830,7 @@
> url_fprintf(pb, "<tr><td align=right>%d<td>%s<td align=right>%d<td>%s<td>%s\n",
> i, type, st->codec->bit_rate/1000, codec ? codec->name : "", parameters);
> }
> - url_fprintf(pb, "</table>\n");
> + url_fprintf(pb, "</table>\n</div>\n");
>
> }
> stream = stream->next;
> @@ -1862,7 +1867,7 @@
> #endif
>
> /* connection status */
> - url_fprintf(pb, "<H2>Connection Status</H2>\n");
> + url_fprintf(pb, "<div class=\"conn_status\"><H2>Connection Status</H2>\n");
>
> url_fprintf(pb, "Number of connections: %d / %d<BR>\n",
> nb_connections, nb_max_connections);
> @@ -1905,7 +1910,7 @@
> url_fprintf(pb, "\n");
> c1 = c1->next;
> }
> - url_fprintf(pb, "</TABLE>\n");
> + url_fprintf(pb, "</TABLE>\n</div>\n");
>
> /* date */
> ti = time(NULL);
> @@ -4037,6 +4042,14 @@
> filename, line_num);
> errors++;
> }
> + } else if (!strcasecmp(cmd, "Stylesheet")) {
> + if (stream && stream->stream_type == STREAM_TYPE_STATUS) {
> + get_arg(stream->stylesheet, sizeof(stream->stylesheet), &p);
> + } else {
> + fprintf(stderr, "%s:%d: Stylesheet only permitted for status streams\n",
> + filename, line_num);
> + errors++;
> + }
> } else if (!strcasecmp(cmd, "Author")) {
> if (stream)
> get_arg(stream->author, sizeof(stream->author), &p);
Missing docs, the rest looks OK to me.
Regards.
--
FFmpeg = Formidable and Fantastic Multimedia Pure Elitist Guru
More information about the ffmpeg-devel
mailing list