summaryrefslogtreecommitdiff
path: root/libavdevice/xv.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/xv.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/xv.c')
-rw-r--r--libavdevice/xv.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/libavdevice/xv.c b/libavdevice/xv.c
index 64cddeb068..185de7569e 100644
--- a/libavdevice/xv.c
+++ b/libavdevice/xv.c
@@ -109,22 +109,22 @@ static int xv_write_header(AVFormatContext *s)
XColor fgcolor;
XWindowAttributes window_attrs;
int num_formats = 0, j, tag, ret;
- AVCodecContext *encctx = s->streams[0]->codec;
+ AVCodecParameters *par = s->streams[0]->codecpar;
if ( s->nb_streams > 1
- || encctx->codec_type != AVMEDIA_TYPE_VIDEO
- || encctx->codec_id != AV_CODEC_ID_RAWVIDEO) {
+ || par->codec_type != AVMEDIA_TYPE_VIDEO
+ || par->codec_id != AV_CODEC_ID_RAWVIDEO) {
av_log(s, AV_LOG_ERROR, "Only supports one rawvideo stream\n");
return AVERROR(EINVAL);
}
- if (!(tag = xv_get_tag_from_format(encctx->pix_fmt))) {
+ if (!(tag = xv_get_tag_from_format(par->format))) {
av_log(s, AV_LOG_ERROR,
"Unsupported pixel format '%s', only yuv420p, uyvy422, yuyv422 are currently supported\n",
- av_get_pix_fmt_name(encctx->pix_fmt));
+ av_get_pix_fmt_name(par->format));
return AVERROR_PATCHWELCOME;
}
- xv->image_format = encctx->pix_fmt;
+ xv->image_format = par->format;
xv->display = XOpenDisplay(xv->display_name);
if (!xv->display) {
@@ -132,12 +132,12 @@ static int xv_write_header(AVFormatContext *s)
return AVERROR(EINVAL);
}
- xv->image_width = encctx->width;
- xv->image_height = encctx->height;
+ xv->image_width = par->width;
+ xv->image_height = par->height;
if (!xv->window_width && !xv->window_height) {
- AVRational sar = encctx->sample_aspect_ratio;
- xv->window_width = encctx->width;
- xv->window_height = encctx->height;
+ AVRational sar = par->sample_aspect_ratio;
+ xv->window_width = par->width;
+ xv->window_height = par->height;
if (sar.num) {
if (sar.num > sar.den)
xv->window_width = av_rescale(xv->window_width, sar.num, sar.den);
@@ -189,14 +189,14 @@ static int xv_write_header(AVFormatContext *s)
if (j >= num_formats) {
av_log(s, AV_LOG_ERROR,
"Device does not support pixel format %s, aborting\n",
- av_get_pix_fmt_name(encctx->pix_fmt));
+ av_get_pix_fmt_name(par->format));
ret = AVERROR(EINVAL);
goto fail;
}
xv->gc = XCreateGC(xv->display, xv->window, 0, 0);
- xv->image_width = encctx->width;
- xv->image_height = encctx->height;
+ xv->image_width = par->width;
+ xv->image_height = par->height;
xv->yuv_image = XvShmCreateImage(xv->display, xv->xv_port, tag, 0,
xv->image_width, xv->image_height, &xv->yuv_shminfo);
xv->yuv_shminfo.shmid = shmget(IPC_PRIVATE, xv->yuv_image->data_size,
@@ -228,11 +228,11 @@ static void compute_display_area(AVFormatContext *s)
XVContext *xv = s->priv_data;
AVRational sar, dar; /* sample and display aspect ratios */
AVStream *st = s->streams[0];
- AVCodecContext *encctx = st->codec;
+ AVCodecParameters *par = st->codecpar;
/* compute overlay width and height from the codec context information */
sar = st->sample_aspect_ratio.num ? st->sample_aspect_ratio : (AVRational){ 1, 1 };
- dar = av_mul_q(sar, (AVRational){ encctx->width, encctx->height });
+ dar = av_mul_q(sar, (AVRational){ par->width, par->height });
/* we suppose the screen has a 1/1 sample aspect ratio */
/* fit in the window */
@@ -321,12 +321,12 @@ static int write_picture(AVFormatContext *s, uint8_t *input_data[4],
static int xv_write_packet(AVFormatContext *s, AVPacket *pkt)
{
- AVCodecContext *ctx = s->streams[0]->codec;
+ AVCodecParameters *par = s->streams[0]->codecpar;
uint8_t *data[4];
int linesize[4];
- av_image_fill_arrays(data, linesize, pkt->data, ctx->pix_fmt,
- ctx->width, ctx->height, 1);
+ av_image_fill_arrays(data, linesize, pkt->data, par->format,
+ par->width, par->height, 1);
return write_picture(s, data, linesize);
}