summaryrefslogtreecommitdiff
path: root/libavdevice/dshow.c
diff options
context:
space:
mode:
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-04-10 20:58:15 +0100
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-04-10 20:59:55 +0100
commit6f69f7a8bf6a0d013985578df2ef42ee6b1c7994 (patch)
tree0c2ec8349ff1763d5f48454b8b9f26374dbd80b0 /libavdevice/dshow.c
parent60b75186b2c878b6257b43c8fcc0b1356ada218e (diff)
parent9200514ad8717c63f82101dc394f4378854325bf (diff)
Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
* commit '9200514ad8717c63f82101dc394f4378854325bf': lavf: replace AVStream.codec with AVStream.codecpar This has been a HUGE effort from: - Derek Buitenhuis <derek.buitenhuis@gmail.com> - Hendrik Leppkes <h.leppkes@gmail.com> - wm4 <nfxjfg@googlemail.com> - Clément Bœsch <clement@stupeflix.com> - James Almer <jamrial@gmail.com> - Michael Niedermayer <michael@niedermayer.cc> - Rostislav Pehlivanov <atomnuker@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavdevice/dshow.c')
-rw-r--r--libavdevice/dshow.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index f56c165539..678861da4b 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -918,7 +918,7 @@ dshow_add_device(AVFormatContext *avctx,
{
struct dshow_ctx *ctx = avctx->priv_data;
AM_MEDIA_TYPE type;
- AVCodecContext *codec;
+ AVCodecParameters *par;
AVStream *st;
int ret = AVERROR(EIO);
@@ -933,7 +933,7 @@ dshow_add_device(AVFormatContext *avctx,
libAVPin_ConnectionMediaType(ctx->capture_pin[devtype], &type);
- codec = st->codec;
+ par = st->codecpar;
if (devtype == VideoDevice) {
BITMAPINFOHEADER *bih = NULL;
AVRational time_base;
@@ -952,33 +952,34 @@ dshow_add_device(AVFormatContext *avctx,
goto error;
}
- codec->time_base = time_base;
- codec->codec_type = AVMEDIA_TYPE_VIDEO;
- codec->width = bih->biWidth;
- codec->height = bih->biHeight;
- codec->codec_tag = bih->biCompression;
- codec->pix_fmt = dshow_pixfmt(bih->biCompression, bih->biBitCount);
+ st->avg_frame_rate = av_inv_q(time_base);
+
+ par->codec_type = AVMEDIA_TYPE_VIDEO;
+ par->width = bih->biWidth;
+ par->height = bih->biHeight;
+ par->codec_tag = bih->biCompression;
+ par->format = dshow_pixfmt(bih->biCompression, bih->biBitCount);
if (bih->biCompression == MKTAG('H', 'D', 'Y', 'C')) {
av_log(avctx, AV_LOG_DEBUG, "attempt to use full range for HDYC...\n");
- codec->color_range = AVCOL_RANGE_MPEG; // just in case it needs this...
+ par->color_range = AVCOL_RANGE_MPEG; // just in case it needs this...
}
- if (codec->pix_fmt == AV_PIX_FMT_NONE) {
+ if (par->format == AV_PIX_FMT_NONE) {
const AVCodecTag *const tags[] = { avformat_get_riff_video_tags(), NULL };
- codec->codec_id = av_codec_get_id(tags, bih->biCompression);
- if (codec->codec_id == AV_CODEC_ID_NONE) {
+ par->codec_id = av_codec_get_id(tags, bih->biCompression);
+ if (par->codec_id == AV_CODEC_ID_NONE) {
av_log(avctx, AV_LOG_ERROR, "Unknown compression type. "
"Please report type 0x%X.\n", (int) bih->biCompression);
return AVERROR_PATCHWELCOME;
}
- codec->bits_per_coded_sample = bih->biBitCount;
+ par->bits_per_coded_sample = bih->biBitCount;
} else {
- codec->codec_id = AV_CODEC_ID_RAWVIDEO;
+ par->codec_id = AV_CODEC_ID_RAWVIDEO;
if (bih->biCompression == BI_RGB || bih->biCompression == BI_BITFIELDS) {
- codec->bits_per_coded_sample = bih->biBitCount;
- codec->extradata = av_malloc(9 + AV_INPUT_BUFFER_PADDING_SIZE);
- if (codec->extradata) {
- codec->extradata_size = 9;
- memcpy(codec->extradata, "BottomUp", 9);
+ par->bits_per_coded_sample = bih->biBitCount;
+ par->extradata = av_malloc(9 + AV_INPUT_BUFFER_PADDING_SIZE);
+ if (par->extradata) {
+ par->extradata_size = 9;
+ memcpy(par->extradata, "BottomUp", 9);
}
}
}
@@ -993,11 +994,11 @@ dshow_add_device(AVFormatContext *avctx,
goto error;
}
- codec->codec_type = AVMEDIA_TYPE_AUDIO;
- codec->sample_fmt = sample_fmt_bits_per_sample(fx->wBitsPerSample);
- codec->codec_id = waveform_codec_id(codec->sample_fmt);
- codec->sample_rate = fx->nSamplesPerSec;
- codec->channels = fx->nChannels;
+ par->codec_type = AVMEDIA_TYPE_AUDIO;
+ par->format = sample_fmt_bits_per_sample(fx->wBitsPerSample);
+ par->codec_id = waveform_codec_id(par->format);
+ par->sample_rate = fx->nSamplesPerSec;
+ par->channels = fx->nChannels;
}
avpriv_set_pts_info(st, 64, 1, 10000000);