Implemented -i v4l and -i v4l2 options.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
}
}
-AVFormatContext *open_input_stream(const char *fname, int w, int h, int fps)
+AVFormatContext *open_input_stream(const char *fname, int w, int h, int fps, const char *impform)
{
AVFormatContext *s;
AVInputFormat *fmt;
param.pix_fmt = PIX_FMT_YUV420P;
param.time_base.den = fps;
param.time_base.num = 1;
- fmt = av_find_input_format("video4linux2");
+ if(impform == NULL)
+ impform = "video4linux2";
+ fmt = av_find_input_format(impform);
res = av_open_input_file(&s, fname, fmt, 0, ¶m);
if (res < 0) {
fprintf(stderr, "Error opening %s: %d\n", fname, res);
*
* This is free software; see GPL.txt
*/
-AVFormatContext *open_input_stream(const char *fname, int w, int h, int fps);
+AVFormatContext *open_input_stream(const char *fname, int w, int h, int fps, const char *impform);
void close_input_stream(AVFormatContext *s);
AVPacket *read_input_packet(AVFormatContext *s);
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:m:")) >= 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);