Initial import of mplex, based on FreeBSD port.

Multiplex MPEG video/audio streams.
This commit is contained in:
angelos 2001-06-19 03:23:26 +00:00
parent f10d97e0ef
commit fae68ec075
9 changed files with 243 additions and 0 deletions

24
graphics/mplex/Makefile Normal file
View File

@ -0,0 +1,24 @@
# $OpenBSD: Makefile,v 1.1.1.1 2001/06/19 03:23:26 angelos Exp $
# $FreeBSD: ports/graphics/mplex/Makefile,v 1.8 2000/05/29 23:54:39 steve Exp $
#
COMMENT= "Multiplexes MPEG component streams into system layers"
DISTNAME= mplex-1.1
CATEGORIES= graphics
NEED_VERSION= 1.402
MAINTAINER= ports@openbsd.org
# GNU
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
MASTER_SITES= ftp://ftp.leo.org/pub/comp/general/graphics/mpeg/mplex/
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/mplex ${PREFIX}/bin
.include <bsd.port.mk>

3
graphics/mplex/files/md5 Normal file
View File

@ -0,0 +1,3 @@
MD5 (mplex-1.1.tar.gz) = 3da8bd9ba199aa439a0bdd2ab2d93230
RMD160 (mplex-1.1.tar.gz) = 4f14e0c967b356e63ab2ea7d1ea740167ae359e1
SHA1 (mplex-1.1.tar.gz) = 7ec708cc6b00d6e8e8f897bce964588132ec14ad

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2001/06/19 03:23:26 angelos Exp $
--- Makefile.orig Tue Apr 11 03:46:13 1995
+++ Makefile Sun Jun 10 00:43:14 2001
@@ -19,10 +19,12 @@
#CFLAGS = -g
-CFLAGS = -O
+CFLAGS?= -O
LDFLAGS= -lm
-CC = cc
+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

View File

@ -0,0 +1,25 @@
$OpenBSD: patch-inptstrm_c,v 1.1.1.1 2001/06/19 03:23:26 angelos Exp $
--- inptstrm.c.orig Wed May 31 09:04:11 1995
+++ inptstrm.c Sun Jun 10 00:43:14 2001
@@ -1,4 +1,5 @@
#include "main.h"
+extern int Interactive;
/*************************************************************************
MPEG Streams Kontrolle
@@ -310,6 +311,7 @@ unsigned int length;
fclose (info_file);
output_info_video (video_info);
+ if( Interactive )
ask_continue ();
}
@@ -565,6 +567,7 @@ unsigned int length;
close_bit_stream_r (&audio_bs);
fclose (info_file);
output_info_audio (audio_info);
+ if( Interactive )
ask_continue ();
}

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-interact_c,v 1.1.1.1 2001/06/19 03:23:26 angelos Exp $
--- interact.c.orig Wed May 31 07:18:33 1995
+++ interact.c Sun Jun 10 00:43:14 2001
@@ -67,7 +67,7 @@ void ask_continue ()
char input[20];
printf ("\nContinue processing (y/n) : ");
- do gets (input);
+ do fgets (input, sizeof(input), stdin);
while (input[0]!='N'&&input[0]!='n'&&input[0]!='y'&&input[0]!='Y');
if (input[0]=='N' || input[0]=='n')
@@ -92,7 +92,7 @@ unsigned char ask_verbose ()
char input[20];
printf ("\nVery verbose mode (y/n) : ");
- do gets (input);
+ do fgets (input, sizeof(input), stdin);
while (input[0]!='N'&&input[0]!='n'&&input[0]!='y'&&input[0]!='Y');
if (input[0]=='N' || input[0]=='n') return (FALSE); else return (TRUE);

View File

@ -0,0 +1,73 @@
$OpenBSD: patch-main_c,v 1.1.1.1 2001/06/19 03:23:26 angelos Exp $
--- main.c.orig Wed Apr 5 04:51:53 1995
+++ main.c Sun Jun 10 00:56:44 2001
@@ -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 @@ char* argv[];
unsigned int which_streams=0;
double startup_delay=0;
+ int tmp, fd;
+
+ 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,
@@ -102,13 +113,35 @@ char* argv[];
empty_audio_struc (&audio_info);
if (which_streams & STREAMS_VIDEO) {
- video_units=tempnam ("./","tmp_v");
+ video_units=strdup ("./XXXXXXXX.tmp_v");
+ if (video_units == NULL) {
+ perror ("strdup (\"./XXXXXXXX.tmp_v\") failed");
+ return (1);
+ }
+
+ fd=mkstemps(video_units, strlen (".tmp_v"));
+ if (fd == -1) {
+ perror ("mkstemps() failed");
+ return (1);
+ }
+ close(fd);
get_info_video (video_file, video_units, &video_info, &startup_delay,
video_bytes);
}
if (which_streams & STREAMS_AUDIO) {
- audio_units=tempnam ("./","tmp_a");
+ audio_units=strdup ("./XXXXXXXX.tmp_a");
+ if (audio_units == NULL) {
+ perror ("strdup (\"./XXXXXXXX.tmp_a\") failed");
+ return (1);
+ }
+
+ fd=mkstemps(audio_units, strlen (".tmp_a"));
+ if (fd == -1) {
+ perror ("mkstemps() failed");
+ return (1);
+ }
+ close(fd);
get_info_audio (audio_file, audio_units, &audio_info, &startup_delay,
audio_bytes);
}

View File

@ -0,0 +1,60 @@
$OpenBSD: patch-multplex_c,v 1.1.1.1 2001/06/19 03:23:26 angelos Exp $
--- multplex.c.orig Tue Jun 6 08:16:52 1995
+++ multplex.c Sun Jun 10 00:43:14 2001
@@ -1,4 +1,5 @@
#include "main.h"
+extern int Interactive;
#ifdef TIMER
extern long total_sec;
extern long total_usec;
@@ -129,6 +130,7 @@ unsigned int which_streams;
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 @@ printf("\n+------------------ MPEG/SYSTE
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 @@ printf("\n+------------------ MPEG/SYSTE
(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 @@ printf("\n+------------------ MPEG/SYSTE
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);

17
graphics/mplex/pkg/DESCR Normal file
View File

@ -0,0 +1,17 @@
The mplex multiplexes MPEG audio and video streams into system layers.
From INSTRUCT (in the mplex source):
>
> Please note that I do not have a comprehensive instruction manual for this
> release. I suggest you try the program out with some default values and
> learn something more about ISO/IEC 11172-1 (aka MPEG1/Systems).
>
>
> Christoph.
> moar@heaven.zfe.siemens.de
> +---------------------------------------+--------------------------------+
> | http://www.informatik.tu-muenchen.de/ | Christoph Moar |
> | cgi-bin/nph-gateway/hphalle6/~moar/ | Kaulbachstr.29a |
> | index.html | 80539 Munich |
> | email:moar@informatik.tu-muenchen.de | voice: ++49 - 89 - 23862874 |
> +---------------------------------------+--------------------------------+

2
graphics/mplex/pkg/PLIST Normal file
View File

@ -0,0 +1,2 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2001/06/19 03:23:27 angelos Exp $
bin/mplex