Commit 1f0fa80b authored by Ramiro Polla's avatar Ramiro Polla Committed by Michael Niedermayer

dshow: use DirectShow information to set time_base

Fixes build after removal of AVFormatParameters.
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent c9e5acad
...@@ -683,12 +683,15 @@ dshow_add_device(AVFormatContext *avctx, ...@@ -683,12 +683,15 @@ dshow_add_device(AVFormatContext *avctx,
codec = st->codec; codec = st->codec;
if (devtype == VideoDevice) { if (devtype == VideoDevice) {
BITMAPINFOHEADER *bih = NULL; BITMAPINFOHEADER *bih = NULL;
AVRational time_base;
if (IsEqualGUID(&type.formattype, &FORMAT_VideoInfo)) { if (IsEqualGUID(&type.formattype, &FORMAT_VideoInfo)) {
VIDEOINFOHEADER *v = (void *) type.pbFormat; VIDEOINFOHEADER *v = (void *) type.pbFormat;
time_base = (AVRational) { v->AvgTimePerFrame, 10000000 };
bih = &v->bmiHeader; bih = &v->bmiHeader;
} else if (IsEqualGUID(&type.formattype, &FORMAT_VideoInfo2)) { } else if (IsEqualGUID(&type.formattype, &FORMAT_VideoInfo2)) {
VIDEOINFOHEADER2 *v = (void *) type.pbFormat; VIDEOINFOHEADER2 *v = (void *) type.pbFormat;
time_base = (AVRational) { v->AvgTimePerFrame, 10000000 };
bih = &v->bmiHeader; bih = &v->bmiHeader;
} }
if (!bih) { if (!bih) {
...@@ -696,7 +699,7 @@ dshow_add_device(AVFormatContext *avctx, ...@@ -696,7 +699,7 @@ dshow_add_device(AVFormatContext *avctx,
goto error; goto error;
} }
codec->time_base = ap->time_base; codec->time_base = time_base;
codec->codec_type = AVMEDIA_TYPE_VIDEO; codec->codec_type = AVMEDIA_TYPE_VIDEO;
codec->width = bih->biWidth; codec->width = bih->biWidth;
codec->height = bih->biHeight; codec->height = bih->biHeight;
...@@ -851,7 +854,7 @@ static int dshow_read_header(AVFormatContext *avctx) ...@@ -851,7 +854,7 @@ static int dshow_read_header(AVFormatContext *avctx)
ret = dshow_open_device(avctx, devenum, VideoDevice); ret = dshow_open_device(avctx, devenum, VideoDevice);
if (ret < 0) if (ret < 0)
goto error; goto error;
ret = dshow_add_device(avctx, ap, VideoDevice); ret = dshow_add_device(avctx, VideoDevice);
if (ret < 0) if (ret < 0)
goto error; goto error;
} }
...@@ -859,7 +862,7 @@ static int dshow_read_header(AVFormatContext *avctx) ...@@ -859,7 +862,7 @@ static int dshow_read_header(AVFormatContext *avctx)
ret = dshow_open_device(avctx, devenum, AudioDevice); ret = dshow_open_device(avctx, devenum, AudioDevice);
if (ret < 0) if (ret < 0)
goto error; goto error;
ret = dshow_add_device(avctx, ap, AudioDevice); ret = dshow_add_device(avctx, AudioDevice);
if (ret < 0) if (ret < 0)
goto error; goto error;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment