#include <unistd.h>
#include <stdlib.h>
-#include <avformat.h>
-//#include <avdevice.h>
+#include <libavformat/avformat.h>
+#include <libavdevice/avdevice.h>
+#include <libswscale/swscale.h>
#include "input.h"
#include "output.h"
static const char *sdp_file = "sdp.txt";
static const char *vdev = "/dev/video0";
-static const char *dst = "224.10.20.30";
+static const char *dst = "127.0.0.1";
static int dport = 20000;
static int width = 352;
static int height = 288;
int fps = 25;
+static const char *impform = "video4linux2";
static void sdp_print(AVFormatContext *s, const char *fname)
{
{
int v;
- while ((v = getopt(argc, argv, "w:h:r:d:")) >= 0) {
+ while ((v = getopt(argc, argv, "w:h:r:d:m:i:")) >= 0) {
switch (v) {
case 'w':
width = atoi(optarg);
case 'm':
dst = optarg;
break;
+ case 'i':
+ impform = optarg;
+ if(!strcmp(impform, "v4l"))
+ impform = "video4linux";
+ else if(!strcmp(impform, "v4l2"))
+ impform = "video4linux2";
+ break;
default: /* ’?’ */
fprintf(stderr, "%s: illegal option %c\n", argv[0], v);
exit(-1);
args_parse(argc, argv);
- s = open_input_stream(vdev, width, height, fps);
+ s = open_input_stream(vdev, width, height, fps, impform);
if (s == NULL) {
fprintf(stderr, "Cannot open input file %s\n", vdev);
AVPacket *opkt;
pkt->pts += s->streams[pkt->stream_index]->start_time;
- rt_job_start(pkt->pts);
+ //rt_job_start(pkt->pts);
f = pkt_decode(s, pkt);
if (f) {
opkt = pkt_encode(os, f);
pkt_send(os, opkt);
}
}
- rt_job_end();
+ //rt_job_end();
av_free_packet(pkt);
}
}