* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define HAVE_AV_CONFIG_H
+#include <signal.h>
#include <limits.h>
#include "avformat.h"
#include "swscale.h"
#include "opt.h"
#include "fifo.h"
-#ifndef __MINGW32__
+#ifdef __MINGW32__
+#include <conio.h>
+#else
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <termios.h>
#include <sys/resource.h>
-#include <signal.h>
#endif
#ifdef CONFIG_OS2
#include <sys/types.h>
/* init terminal so that we can grab keys */
static struct termios oldtty;
+#endif
static void term_exit(void)
{
+#ifndef __MINGW32__
tcsetattr (0, TCSANOW, &oldtty);
+#endif
}
static volatile sig_atomic_t received_sigterm = 0;
static void term_init(void)
{
+#ifndef __MINGW32__
struct termios tty;
tcgetattr (0, &tty);
tty.c_cc[VTIME] = 0;
tcsetattr (0, TCSANOW, &tty);
+ signal(SIGQUIT, sigterm_handler); /* Quit (POSIX). */
+#endif
signal(SIGINT , sigterm_handler); /* Interrupt (ANSI). */
- signal(SIGQUIT, sigterm_handler); /* Quit (POSIX). */
signal(SIGTERM, sigterm_handler); /* Termination (ANSI). */
/*
register a function to be called at normal program termination
/* read a key without blocking */
static int read_key(void)
{
+#ifdef __MINGW32__
+ if(kbhit())
+ return(getch());
+#else
int n = 1;
unsigned char ch;
#ifndef CONFIG_BEOS_NETSERVER
return n;
}
+#endif
return -1;
}
return q_pressed || (q_pressed = read_key() == 'q');
}
-#else
-
-static volatile int received_sigterm = 0;
-
-/* no interactive support */
-static void term_exit(void)
-{
-}
-
-static void term_init(void)
-{
-}
-
-static int read_key(void)
-{
- return 0;
-}
-
-#endif
-
static int read_ffserver_streams(AVFormatContext *s, const char *filename)
{
int i, err;
}
}
- ti = MAXINT64;
+ ti = INT64_MAX;
enc = ost->st->codec;
if (enc->codec_type == CODEC_TYPE_VIDEO) {
frame_number = ost->frame_number;
}
}
-#ifndef __MINGW32__
if ( !using_stdin && verbose >= 0) {
fprintf(stderr, "Press [q] to stop encoding\n");
url_set_interrupt_cb(decode_interrupt_cb);
}
-#endif
term_init();
stream_no_data = 0;
if (enc->time_base.den != rfps || enc->time_base.num != rfps_base) {
if (verbose >= 0)
- fprintf(stderr,"\nSeems that stream %d comes from film source: %2.2f (%d/%d) -> %2.2f (%d/%d)\n",
+ fprintf(stderr,"\nSeems stream %d codec frame rate differs from container frame rate: %2.2f (%d/%d) -> %2.2f (%d/%d)\n",
i, (float)enc->time_base.den / enc->time_base.num, enc->time_base.den, enc->time_base.num,
(float)rfps / rfps_base, rfps, rfps_base);
audio_enc = st->codec;
audio_enc->codec_type = CODEC_TYPE_AUDIO;
+ audio_enc->strict_std_compliance = strict;
if(audio_codec_tag)
audio_enc->codec_tag= audio_codec_tag;
audio_enc->flags |= CODEC_FLAG_QSCALE;
audio_enc->global_quality = st->quality = FF_QP2LAMBDA * audio_qscale;
}
- audio_enc->strict_std_compliance = strict;
audio_enc->thread_count = thread_count;
/* For audio codecs other than AC3 or DTS we limit */
/* the number of coded channels to stereo */
if (has_video) {
AVInputFormat *fmt1;
+#warning FIXME: find a better interface
+ if(video_device&&!strncmp(video_device,"x11:",4)) {
+ video_grab_format="x11grab";
+ }
fmt1 = av_find_input_format(video_grab_format);
vp->device = video_device;
vp->channel = video_channel;
int j;
if (!(s->oformat->flags & AVFMT_NOFILE))
url_fclose(&s->pb);
- for(j=0;j<s->nb_streams;j++)
+ for(j=0;j<s->nb_streams;j++) {
+ av_free(s->streams[j]->codec);
av_free(s->streams[j]);
+ }
av_free(s);
}
for(i=0;i<nb_input_files;i++)
powerpc_display_perf_report();
#endif /* POWERPC_PERFORMANCE_REPORT */
-#ifndef __MINGW32__
if (received_sigterm) {
fprintf(stderr,
"Received signal %d: terminating.\n",
(int) received_sigterm);
exit (255);
}
-#endif
+
exit(0); /* not all OS-es handle main() return value */
return 0;
}