nb_streams;i++) {
+ AVStream *st = stream->streams[i];
+ AVCodec *codec = avcodec_find_encoder(st->codec->codec_id);
+
+ switch(st->codec->codec_type) {
+ case AVMEDIA_TYPE_AUDIO:
+ audio_bit_rate += st->codec->bit_rate;
+ if (codec) {
+ if (*audio_codec_name)
+ audio_codec_name_extra = "...";
+ audio_codec_name = codec->name;
}
- avio_printf(pb, " %s | %d | %d | %s %s | %d | %s %s",
- stream->fmt->name,
- stream->bandwidth,
- video_bit_rate / 1000, video_codec_name, video_codec_name_extra,
- audio_bit_rate / 1000, audio_codec_name, audio_codec_name_extra);
- if (stream->feed)
- avio_printf(pb, " | %s", stream->feed->filename);
- else
- avio_printf(pb, " | %s", stream->feed_filename);
- avio_printf(pb, "\n");
+ break;
+ case AVMEDIA_TYPE_VIDEO:
+ video_bit_rate += st->codec->bit_rate;
+ if (codec) {
+ if (*video_codec_name)
+ video_codec_name_extra = "...";
+ video_codec_name = codec->name;
+ }
+ break;
+ case AVMEDIA_TYPE_DATA:
+ video_bit_rate += st->codec->bit_rate;
+ break;
+ default:
+ abort();
}
- break;
- default:
- avio_printf(pb, " | - | - | - | | - | \n");
- break;
}
+
+ avio_printf(pb, " | %s | %d "
+ " | %d | %s %s | "
+ "%d | %s %s",
+ stream->fmt->name, stream->bandwidth,
+ video_bit_rate / 1000, video_codec_name,
+ video_codec_name_extra, audio_bit_rate / 1000,
+ audio_codec_name, audio_codec_name_extra);
+
+ if (stream->feed)
+ avio_printf(pb, " | %s", stream->feed->filename);
+ else
+ avio_printf(pb, " | %s", stream->feed_filename);
+ avio_printf(pb, "\n");
+ }
+ break;
+ default:
+ avio_printf(pb, " | - | - "
+ " | - | | - | \n");
+ break;
+ }
stream = stream->next;
}
avio_printf(pb, "\n");
stream = config.first_stream;
while (stream) {
+
if (stream->feed != stream) {
stream = stream->next;
continue;
}
- avio_printf(pb, "Feed %s", stream->filename);
- if (stream->pid) {
- avio_printf(pb, "Running as pid %d.\n", stream->pid);
+
+ avio_printf(pb, "Feed %s", stream->filename);
+ if (stream->pid) {
+ avio_printf(pb, "Running as pid %d.\n", stream->pid);
#if defined(linux)
- {
- FILE *pid_stat;
- char ps_cmd[64];
-
- /* This is somewhat linux specific I guess */
- snprintf(ps_cmd, sizeof(ps_cmd),
- "ps -o \"%%cpu,cputime\" --no-headers %d",
- stream->pid);
-
- pid_stat = popen(ps_cmd, "r");
- if (pid_stat) {
- char cpuperc[10];
- char cpuused[64];
-
- if (fscanf(pid_stat, "%9s %63s", cpuperc,
- cpuused) == 2) {
- avio_printf(pb, "Currently using %s%% of the cpu. Total time used %s.\n",
- cpuperc, cpuused);
- }
- fclose(pid_stat);
- }
- }
+ {
+ FILE *pid_stat;
+ char ps_cmd[64];
+
+ /* This is somewhat linux specific I guess */
+ snprintf(ps_cmd, sizeof(ps_cmd),
+ "ps -o \"%%cpu,cputime\" --no-headers %d",
+ stream->pid);
+
+ pid_stat = popen(ps_cmd, "r");
+ if (pid_stat) {
+ char cpuperc[10];
+ char cpuused[64];
+
+ if (fscanf(pid_stat, "%9s %63s", cpuperc, cpuused) == 2) {
+ avio_printf(pb, "Currently using %s%% of the cpu. "
+ "Total time used %s.\n",
+ cpuperc, cpuused);
+ }
+ fclose(pid_stat);
+ }
+ }
#endif
- avio_printf(pb, "");
- }
- avio_printf(pb, " Stream | type | kbits/s | codec | Parameters\n");
+ avio_printf(pb, " ");
+ }
- for (i = 0; i < stream->nb_streams; i++) {
- AVStream *st = stream->streams[i];
- AVCodec *codec = avcodec_find_encoder(st->codec->codec_id);
- const char *type = "unknown";
- char parameters[64];
+ avio_printf(pb, " Stream | "
+ "type | kbits/s | codec | "
+ "Parameters\n");
- parameters[0] = 0;
+ for (i = 0; i < stream->nb_streams; i++) {
+ AVStream *st = stream->streams[i];
+ AVCodec *codec = avcodec_find_encoder(st->codec->codec_id);
+ const char *type = "unknown";
+ char parameters[64];
- switch(st->codec->codec_type) {
- case AVMEDIA_TYPE_AUDIO:
- type = "audio";
- snprintf(parameters, sizeof(parameters), "%d channel(s), %d Hz", st->codec->channels, st->codec->sample_rate);
- break;
- case AVMEDIA_TYPE_VIDEO:
- type = "video";
- snprintf(parameters, sizeof(parameters), "%dx%d, q=%d-%d, fps=%d", st->codec->width, st->codec->height,
- st->codec->qmin, st->codec->qmax, st->codec->time_base.den / st->codec->time_base.num);
- break;
- default:
- abort();
- }
- avio_printf(pb, " |
---|
%d | %s | %d | %s | %s\n",
- i, type, st->codec->bit_rate/1000, codec ? codec->name : "", parameters);
+ parameters[0] = 0;
+
+ switch(st->codec->codec_type) {
+ case AVMEDIA_TYPE_AUDIO:
+ type = "audio";
+ snprintf(parameters, sizeof(parameters), "%d channel(s), %d Hz",
+ st->codec->channels, st->codec->sample_rate);
+ break;
+ case AVMEDIA_TYPE_VIDEO:
+ type = "video";
+ snprintf(parameters, sizeof(parameters),
+ "%dx%d, q=%d-%d, fps=%d", st->codec->width,
+ st->codec->height, st->codec->qmin, st->codec->qmax,
+ st->codec->time_base.den / st->codec->time_base.num);
+ break;
+ default:
+ abort();
}
- avio_printf(pb, " | \n");
+ avio_printf(pb, " |
---|
%d | %s | %d"
+ " | %s | %s\n",
+ i, type, st->codec->bit_rate/1000,
+ codec ? codec->name : "", parameters);
+ }
+
+ avio_printf(pb, " | \n");
stream = stream->next;
}
@@ -1928,13 +1947,14 @@ static void compute_status(HTTPContext *c)
avio_printf(pb, "Connection Status\n");
avio_printf(pb, "Number of connections: %d / %d \n",
- nb_connections, config.nb_max_connections);
+ nb_connections, config.nb_max_connections);
avio_printf(pb, "Bandwidth in use: %"PRIu64"k / %"PRIu64"k \n",
- current_bandwidth, config.max_bandwidth);
+ current_bandwidth, config.max_bandwidth);
avio_printf(pb, "\n");
- avio_printf(pb, "# | File | IP | Proto | State | Target bits/sec | Actual bits/sec | Bytes transferred\n");
+ avio_printf(pb, " |
---|
# | File | IP | Proto | State | Target "
+ "bits/sec | Actual bits/sec | Bytes transferred\n");
c1 = first_http_ctx;
i = 0;
while (c1) {
@@ -1953,13 +1973,11 @@ static void compute_status(HTTPContext *c)
i++;
p = inet_ntoa(c1->from_addr.sin_addr);
- avio_printf(pb, " |
---|
%d | %s%s | %s | %s | %s | ",
- i,
- c1->stream ? c1->stream->filename : "",
- c1->state == HTTPSTATE_RECEIVE_DATA ? "(input)" : "",
- p,
- c1->protocol,
- http_state[c1->state]);
+ avio_printf(pb, " | %d | %s%s | %s | %s | %s"
+ " | ",
+ i, c1->stream ? c1->stream->filename : "",
+ c1->state == HTTPSTATE_RECEIVE_DATA ? "(input)" : "", p,
+ c1->protocol, http_state[c1->state]);
fmt_bytecount(pb, bitrate);
avio_printf(pb, " | ");
fmt_bytecount(pb, compute_datarate(&c1->datarate, c1->data_count) * 8);
| |