openbsd-ports/graphics/mplex/patches/patch-multplex_c
wcobb 63476d43e9 - pull in missing prototypes.
- fix format strings.
- remove unnecessary statics from headers, reduce executable size.
- disable insane verbosity that just slows down encoding.
2002-08-12 19:33:31 +00:00

127 lines
4.0 KiB
Plaintext

$OpenBSD: patch-multplex_c,v 1.2 2002/08/12 19:33:31 wcobb Exp $
--- multplex.c.orig Tue Jun 6 09:16:52 1995
+++ multplex.c Thu Jul 18 15:57:13 2002
@@ -1,4 +1,5 @@
#include "main.h"
+extern int Interactive;
#ifdef TIMER
extern long total_sec;
extern long total_usec;
@@ -45,11 +46,11 @@ unsigned int which_streams;
{
- FILE *istream_v; /* Inputstream Video */
- FILE *istream_a; /* Inputstream Audio */
+ FILE *istream_v = NULL; /* Inputstream Video */
+ FILE *istream_a = NULL; /* Inputstream Audio */
FILE *ostream; /* Outputstream MPEG */
- FILE *vunits_info; /* Input Video Units */
- FILE *aunits_info; /* Input Audio Units */
+ FILE *vunits_info = NULL; /* Input Video Units */
+ FILE *aunits_info = NULL; /* Input Audio Units */
Vaunit_struc video_au; /* Video Access Unit */
Aaunit_struc audio_au; /* Audio Access Unit */
@@ -67,7 +68,6 @@ unsigned int which_streams;
unsigned int mux_rate;
unsigned char picture_start;
unsigned char audio_frame_start;
- unsigned int bytes_left;
unsigned int audio_bytes;
unsigned int video_bytes;
@@ -76,7 +76,9 @@ unsigned int which_streams;
unsigned int nsec_p=0;
unsigned char* index;
-
+
+ extern unsigned int bitrate_index[3][16];
+
Timecode_struc SCR_audio_delay;
Timecode_struc SCR_video_delay;
Timecode_struc current_SCR;
@@ -89,7 +91,6 @@ unsigned int which_streams;
Pack_struc pack;
Sys_header_struc sys_header;
Sector_struc sector;
- Timecode_struc timestamp;
unsigned long sector_size;
unsigned long min_packet_data;
@@ -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,21 +205,31 @@ 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);
printf ("\nstartup sectors_delay : ");
- scanf ("%u", &sectors_delay);
+ scanf ("%lu", &sectors_delay);
printf ("video stream startup offset (ms) : ");
- scanf ("%u", &video_delay_ms);
+ scanf ("%lu", &video_delay_ms);
printf ("audio stream startup offset (ms) : ");
- scanf ("%u", &audio_delay_ms);
+ scanf ("%lu", &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);
@@ -501,8 +519,6 @@ printf("\n+------------------ MPEG/SYSTE
if (which_streams & STREAMS_VIDEO) unlink (video_units);
if (which_streams & STREAMS_AUDIO) unlink (audio_units);
- printf ("\nDone, tmp files removed.\n\n");
-
#ifdef TIMER
gettimeofday (&tp_global_end, NULL);
global_sec = 10*(tp_global_end.tv_sec - tp_global_start.tv_sec);
@@ -1051,8 +1067,6 @@ unsigned char marker_pack;
unsigned int which_streams;
{
- unsigned int bytes_left;
- unsigned int temp;
Pack_struc *pack_ptr;
Sys_header_struc *sys_header_ptr;