From andre.albsmeier@mchp.siemens.de  Wed Aug 30 23:13:44 2000
Return-Path: <andre.albsmeier@mchp.siemens.de>
Received: from goliath.siemens.de (goliath.siemens.de [194.138.37.131])
	by hub.freebsd.org (Postfix) with ESMTP id 7654F37B43E
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 30 Aug 2000 23:13:43 -0700 (PDT)
Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.11])
	by goliath.siemens.de (8.10.1/8.10.1) with ESMTP id e7V55nc03383
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 31 Aug 2000 07:06:04 +0200 (MET DST)
Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.42.7])
	by mail2.siemens.de (8.10.1/8.10.1) with ESMTP id e7V55mQ03721
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 31 Aug 2000 07:05:48 +0200 (MET DST)
Received: (from localhost)
	by curry.mchp.siemens.de (8.11.0/8.11.0) id e7V55mt87881
	for FreeBSD-gnats-submit@freebsd.org; Thu, 31 Aug 2000 07:05:48 +0200 (CEST)
Message-Id: <200008310505.e7V55mq25824@curry.mchp.siemens.de>
Date: Thu, 31 Aug 2000 07:05:48 +0200 (CEST)
From: Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
To: FreeBSD-gnats-submit@freebsd.org
Subject: Two better patches for the mplex port
X-Send-Pr-Version: 3.2

>Number:         20956
>Category:       ports
>Synopsis:       Two better patches for the mplex port
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 30 23:20:00 PDT 2000
>Closed-Date:    Mon Sep 4 18:34:45 PDT 2000
>Last-Modified:  Mon Sep 04 18:36:38 PDT 2000
>Originator:     Andre Albsmeier
>Release:        FreeBSD 4.1-STABLE i386
>Organization:
>Environment:

Systems using the mplex port.

>Description:

By default, mplex needs parameter input from the user. This behaviour
has been changed by patch-ac and patch-ad to use defaults. Probably this
has been done to make it possible to use mplex in batch files without
the need for user intervention, e.g. fxtv.

However, in some cases it may be desired to change these parameters. The
two patches below replace patch-ac and patch-ad. They add an -i option
which will enable the user inputs again. If -i is not specified, the
behaviour remains the same so the change should be 100% compatible to 
existing software which rely on mplex as it is now.

>How-To-Repeat:

Use mplex and try to change parameters.

>Fix:

patch-ac only adds the -DTIMER compiletime options which enables
some timing measurements:

--------------------------- snip ----------------------------

--- Makefile.ORI	Wed Aug 30 21:03:47 2000
+++ Makefile	Wed Aug 30 21:05:55 2000
@@ -24,6 +24,8 @@
 CC     ?=  cc
 RM     =  /bin/rm -f
 
+CFLAGS+= -DTIMER
+
 OBJS = main.o bitstrm.o buffer.o inits.o inptstrm.o interact.o multplex.o systems.o timecode.o
 
 SRCS = main.c bitstrm.c buffer.c inits.c inptstrm.c interact.c multplex.c systems.c timecode.c


--------------------------- snap ----------------------------


patch-ad now implements the -i option mentioned above:

--------------------------- snip ----------------------------

--- main.c.ORI	Wed Aug 30 20:37:31 2000
+++ main.c	Wed Aug 30 20:36:38 2000
@@ -59,6 +59,7 @@
 *************************************************************************/
 
 #include "main.h"
+#include <unistd.h>
 
 /*************************************************************************
     Main
@@ -75,6 +76,8 @@
     struct timeval  tp_global_end;
 #endif
 
+int Interactive=0;
+
 int main (argc, argv)
 
 int argc;
@@ -93,6 +96,14 @@
     unsigned int which_streams=0;
     double	startup_delay=0;
 
+    int tmp;
+
+    if( getopt( argc, argv, "i" ) == 'i' )
+      Interactive=1;
+
+    optind -= 1;
+    argc -= optind;
+    argv += optind;
 
     intro (argc);
     check_files (argc, argv, &audio_file, &video_file, &multi_file,
--- inptstrm.c.ORI	Wed May 31 15:04:11 1995
+++ inptstrm.c	Wed Aug 30 20:39:29 2000
@@ -1,4 +1,5 @@
 #include "main.h"
+extern int Interactive;
 /*************************************************************************
     MPEG Streams Kontrolle
 
@@ -310,6 +311,7 @@
     fclose (info_file);
     output_info_video (video_info);
 
+  if( Interactive )
     ask_continue ();
 }
 
@@ -565,6 +567,7 @@
     close_bit_stream_r (&audio_bs);
     fclose (info_file);
     output_info_audio (audio_info);
+  if( Interactive )
     ask_continue ();
 
 }
--- multplex.c.ORI	Tue Jun  6 14:16:52 1995
+++ multplex.c	Wed Aug 30 20:47:35 2000
@@ -1,4 +1,5 @@
 #include "main.h"
+extern int Interactive;
 #ifdef TIMER
     extern long total_sec;
     extern long total_usec;
@@ -129,6 +130,7 @@
 	picture_start = TRUE;
     }
 
+if( Interactive ) {
 printf("\nMerging elementary streams to MPEG/SYSTEMS multiplexed stream.\n");
 printf("\n+------------------ MPEG/SYSTEMS INFORMATION -----------------+\n");
     
@@ -144,6 +146,12 @@
     scanf ("%ld", &video_buffer_size);
     printf   ("STD audio buffer in kB (CSPS: max  4 kB) : ");
     scanf ("%ld", &audio_buffer_size);
+} else {
+    sector_size=2324;
+    packets_per_pack=1;
+    video_buffer_size=46;
+    audio_buffer_size=4;
+}
 
     write_pack = packets_per_pack;
     video_buffer_size *= 1024;
@@ -197,6 +205,7 @@
 		 (double)(packets_per_pack-1.))) / (double)(packets_per_pack) );
     data_rate = ceil(dmux_rate/50.)*50;
 
+if( Interactive ) {
     printf ("\ncomputed multiplexed stream data rate    : %7.3f\n",dmux_rate);
     printf ("target data rate (e.g. %6u)           : ",data_rate);
     scanf  ("%lf", &dmux_rate);
@@ -206,12 +215,21 @@
     scanf  ("%u", &video_delay_ms);
     printf ("audio stream startup offset (ms)         : ");
     scanf  ("%u", &audio_delay_ms);
+} else {
+    dmux_rate=data_rate;
+    sectors_delay=8;
+    video_delay_ms=0;
+    audio_delay_ms=0;
+}
 
     video_delay = (double)video_delay_ms*(double)(CLOCKS/1000);
     audio_delay = (double)audio_delay_ms*(double)(CLOCKS/1000);
 
+if( Interactive ) {
     verbose=ask_verbose();
     printf ("\n");
+} else
+    verbose=1;
 
 #ifdef TIMER
     gettimeofday (&tp_global_start,NULL);

--------------------------- snap ----------------------------

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: steve 
State-Changed-When: Mon Sep 4 18:34:45 PDT 2000 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=20956 
>Unformatted:
