Browse code

Added VideoBitRateRange and VideoBitRAteTolerance settings Also made the Launch directive work again if you invoke ffserver with a relative path.

Originally committed as revision 1111 to svn://svn.ffmpeg.org/ffmpeg/trunk

Philip Gladstone authored on 2002/10/30 11:15:07
Showing 1 changed files
... ...
@@ -244,6 +244,7 @@ static int rtp_new_av_stream(HTTPContext *c,
244 244
                              int stream_index, struct sockaddr_in *dest_addr);
245 245
 
246 246
 static const char *my_program_name;
247
+static const char *my_program_dir;
247 248
 
248 249
 static int ffserver_debug;
249 250
 static int ffserver_daemon;
... ...
@@ -380,6 +381,9 @@ static void start_children(FFStream *feed)
380 380
                 }
381 381
                 strcpy(slash, "ffmpeg");
382 382
 
383
+                /* This is needed to make relative pathnames work */
384
+                chdir(my_program_dir);
385
+
383 386
                 execvp(pathname, feed->child_argv);
384 387
 
385 388
                 _exit(1);
... ...
@@ -3301,7 +3305,10 @@ void add_codec(FFStream *stream, AVCodecContext *av)
3301 3301
             av->b_quant_factor = 1.25;
3302 3302
         if (!av->b_quant_offset)
3303 3303
             av->b_quant_offset = 1.25;
3304
-            
3304
+        if (!av->rc_min_rate)
3305
+            av->rc_min_rate = av->bit_rate / 2;
3306
+        if (!av->rc_max_rate)
3307
+            av->rc_max_rate = av->bit_rate * 2;
3305 3308
 
3306 3309
         break;
3307 3310
     default:
... ...
@@ -3695,6 +3702,26 @@ int parse_ffconfig(const char *filename)
3695 3695
             if (stream) {
3696 3696
                 audio_enc.quality = atof(arg) * 1000;
3697 3697
             }
3698
+        } else if (!strcasecmp(cmd, "VideoBitRateRange")) {
3699
+            if (stream) {
3700
+                int minrate, maxrate;
3701
+
3702
+                get_arg(arg, sizeof(arg), &p);
3703
+
3704
+                if (sscanf(arg, "%d-%d", &minrate, &maxrate) == 2) {
3705
+                    video_enc.rc_min_rate = minrate * 1000;
3706
+                    video_enc.rc_max_rate = maxrate * 1000;
3707
+                } else {
3708
+                    fprintf(stderr, "%s:%d: Incorrect format for VideoBitRateRange -- should be <min>-<max>: %s\n", 
3709
+                            filename, line_num, arg);
3710
+                    errors++;
3711
+                }
3712
+            }
3713
+        } else if (!strcasecmp(cmd, "VideoBitRateTolerance")) {
3714
+            if (stream) {
3715
+                get_arg(arg, sizeof(arg), &p);
3716
+                video_enc.bit_rate_tolerance = atoi(arg) * 1000;
3717
+            }
3698 3718
         } else if (!strcasecmp(cmd, "VideoBitRate")) {
3699 3719
             get_arg(arg, sizeof(arg), &p);
3700 3720
             if (stream) {
... ...
@@ -4018,6 +4045,7 @@ int main(int argc, char **argv)
4018 4018
     config_filename = "/etc/ffserver.conf";
4019 4019
 
4020 4020
     my_program_name = argv[0];
4021
+    my_program_dir = getcwd(0, 0);
4021 4022
     ffserver_daemon = 1;
4022 4023
     
4023 4024
     for(;;) {