summaryrefslogtreecommitdiff
path: root/libavdevice
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2014-06-18 20:42:52 +0200
committerAnton Khirnov <anton@khirnov.net>2016-02-23 17:01:58 +0100
commit9200514ad8717c63f82101dc394f4378854325bf (patch)
tree566b8d48565a88303363198acc81de06363daa7a /libavdevice
parenta8068346e48e123f8d3bdf4d64464d81e53e5fc7 (diff)
downloadffmpeg-9200514ad8717c63f82101dc394f4378854325bf.tar.gz
lavf: replace AVStream.codec with AVStream.codecpar
Currently, AVStream contains an embedded AVCodecContext instance, which is used by demuxers to export stream parameters to the caller and by muxers to receive stream parameters from the caller. It is also used internally as the codec context that is passed to parsers. In addition, it is also widely used by the callers as the decoding (when demuxer) or encoding (when muxing) context, though this has been officially discouraged since Libav 11. There are multiple important problems with this approach: - the fields in AVCodecContext are in general one of * stream parameters * codec options * codec state However, it's not clear which ones are which. It is consequently unclear which fields are a demuxer allowed to set or a muxer allowed to read. This leads to erratic behaviour depending on whether decoding or encoding is being performed or not (and whether it uses the AVStream embedded codec context). - various synchronization issues arising from the fact that the same context is used by several different APIs (muxers/demuxers, parsers, bitstream filters and encoders/decoders) simultaneously, with there being no clear rules for who can modify what and the different processes being typically delayed with respect to each other. - avformat_find_stream_info() making it necessary to support opening and closing a single codec context multiple times, thus complicating the semantics of freeing various allocated objects in the codec context. Those problems are resolved by replacing the AVStream embedded codec context with a newly added AVCodecParameters instance, which stores only the stream parameters exported by the demuxers or read by the muxers.
Diffstat (limited to 'libavdevice')
-rw-r--r--libavdevice/alsa.c2
-rw-r--r--libavdevice/alsa_dec.c14
-rw-r--r--libavdevice/alsa_enc.c10
-rw-r--r--libavdevice/bktr.c13
-rw-r--r--libavdevice/fbdev.c16
-rw-r--r--libavdevice/jack.c10
-rw-r--r--libavdevice/libcdio.c12
-rw-r--r--libavdevice/libdc1394.c15
-rw-r--r--libavdevice/oss_dec.c8
-rw-r--r--libavdevice/oss_enc.c4
-rw-r--r--libavdevice/pulse.c8
-rw-r--r--libavdevice/sndio_dec.c8
-rw-r--r--libavdevice/sndio_enc.c4
-rw-r--r--libavdevice/v4l2.c18
-rw-r--r--libavdevice/vfwcap.c35
-rw-r--r--libavdevice/x11grab.c15
-rw-r--r--libavdevice/xcbgrab.c11
17 files changed, 101 insertions, 102 deletions
diff --git a/libavdevice/alsa.c b/libavdevice/alsa.c
index 6d68267602..d394e4377d 100644
--- a/libavdevice/alsa.c
+++ b/libavdevice/alsa.c
@@ -194,7 +194,7 @@ av_cold int ff_alsa_open(AVFormatContext *ctx, snd_pcm_stream_t mode,
snd_pcm_t *h;
snd_pcm_hw_params_t *hw_params;
snd_pcm_uframes_t buffer_size, period_size;
- uint64_t layout = ctx->streams[0]->codec->channel_layout;
+ uint64_t layout = ctx->streams[0]->codecpar->channel_layout;
if (ctx->filename[0] == 0) audio_device = "default";
else audio_device = ctx->filename;
diff --git a/libavdevice/alsa_dec.c b/libavdevice/alsa_dec.c
index e7819ec18a..58bf1dd6a1 100644
--- a/libavdevice/alsa_dec.c
+++ b/libavdevice/alsa_dec.c
@@ -101,10 +101,10 @@ static av_cold int audio_read_header(AVFormatContext *s1)
}
/* take real parameters */
- st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = codec_id;
- st->codec->sample_rate = s->sample_rate;
- st->codec->channels = s->channels;
+ st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codecpar->codec_id = codec_id;
+ st->codecpar->sample_rate = s->sample_rate;
+ st->codecpar->channels = s->channels;
avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
return 0;
@@ -144,9 +144,9 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
snd_pcm_htimestamp(s->h, &ts_delay, &timestamp);
ts_delay += res;
pkt->pts = timestamp.tv_sec * 1000000LL
- + (timestamp.tv_nsec * st->codec->sample_rate
- - (int64_t)ts_delay * 1000000000LL + st->codec->sample_rate * 500LL)
- / (st->codec->sample_rate * 1000LL);
+ + (timestamp.tv_nsec * st->codecpar->sample_rate
+ - (int64_t)ts_delay * 1000000000LL + st->codecpar->sample_rate * 500LL)
+ / (st->codecpar->sample_rate * 1000LL);
pkt->size = res * s->frame_size;
diff --git a/libavdevice/alsa_enc.c b/libavdevice/alsa_enc.c
index 30c1719203..3094b5043e 100644
--- a/libavdevice/alsa_enc.c
+++ b/libavdevice/alsa_enc.c
@@ -54,14 +54,14 @@ static av_cold int audio_write_header(AVFormatContext *s1)
int res;
st = s1->streams[0];
- sample_rate = st->codec->sample_rate;
- codec_id = st->codec->codec_id;
+ sample_rate = st->codecpar->sample_rate;
+ codec_id = st->codecpar->codec_id;
res = ff_alsa_open(s1, SND_PCM_STREAM_PLAYBACK, &sample_rate,
- st->codec->channels, &codec_id);
- if (sample_rate != st->codec->sample_rate) {
+ st->codecpar->channels, &codec_id);
+ if (sample_rate != st->codecpar->sample_rate) {
av_log(s1, AV_LOG_ERROR,
"sample rate %d not available, nearest is %d\n",
- st->codec->sample_rate, sample_rate);
+ st->codecpar->sample_rate, sample_rate);
goto fail;
}
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
index 8042c38011..f76a1636c6 100644
--- a/libavdevice/bktr.c
+++ b/libavdevice/bktr.c
@@ -295,13 +295,12 @@ static int grab_read_header(AVFormatContext *s1)
s->height = height;
s->per_frame = ((uint64_t)1000000 * framerate.den) / framerate.num;
- st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->pix_fmt = AV_PIX_FMT_YUV420P;
- st->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
- st->codec->width = width;
- st->codec->height = height;
- st->codec->time_base.den = framerate.num;
- st->codec->time_base.num = framerate.den;
+ st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codecpar->format = AV_PIX_FMT_YUV420P;
+ st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
+ st->codecpar->width = width;
+ st->codecpar->height = height;
+ st->avg_frame_rate = framerate;
if (bktr_init(s1->filename, width, height, s->standard,
diff --git a/libavdevice/fbdev.c b/libavdevice/fbdev.c
index bdbc83f252..16469c56d3 100644
--- a/libavdevice/fbdev.c
+++ b/libavdevice/fbdev.c
@@ -164,21 +164,21 @@ static av_cold int fbdev_read_header(AVFormatContext *avctx)
goto fail;
}
- st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
- st->codec->width = fbdev->width;
- st->codec->height = fbdev->height;
- st->codec->pix_fmt = pix_fmt;
- st->codec->time_base = (AVRational){fbdev->framerate_q.den, fbdev->framerate_q.num};
- st->codec->bit_rate =
+ st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
+ st->codecpar->width = fbdev->width;
+ st->codecpar->height = fbdev->height;
+ st->codecpar->format = pix_fmt;
+ st->codecpar->bit_rate =
fbdev->width * fbdev->height * fbdev->bytes_per_pixel * av_q2d(fbdev->framerate_q) * 8;
+ st->avg_frame_rate = fbdev->framerate_q;
av_log(avctx, AV_LOG_INFO,
"w:%d h:%d bpp:%d pixfmt:%s fps:%d/%d bit_rate:%d\n",
fbdev->width, fbdev->height, fbdev->varinfo.bits_per_pixel,
av_get_pix_fmt_name(pix_fmt),
fbdev->framerate_q.num, fbdev->framerate_q.den,
- st->codec->bit_rate);
+ st->codecpar->bit_rate);
return 0;
fail:
diff --git a/libavdevice/jack.c b/libavdevice/jack.c
index 24c23e8c84..0b4deee01c 100644
--- a/libavdevice/jack.c
+++ b/libavdevice/jack.c
@@ -254,14 +254,14 @@ static int audio_read_header(AVFormatContext *context)
return AVERROR(ENOMEM);
}
- stream->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ stream->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
#if HAVE_BIGENDIAN
- stream->codec->codec_id = AV_CODEC_ID_PCM_F32BE;
+ stream->codecpar->codec_id = AV_CODEC_ID_PCM_F32BE;
#else
- stream->codec->codec_id = AV_CODEC_ID_PCM_F32LE;
+ stream->codecpar->codec_id = AV_CODEC_ID_PCM_F32LE;
#endif
- stream->codec->sample_rate = self->sample_rate;
- stream->codec->channels = self->nports;
+ stream->codecpar->sample_rate = self->sample_rate;
+ stream->codecpar->channels = self->nports;
avpriv_set_pts_info(stream, 64, 1, 1000000); /* 64 bits pts in us */
return 0;
diff --git a/libavdevice/libcdio.c b/libavdevice/libcdio.c
index 06ddb4a784..f19ca997b4 100644
--- a/libavdevice/libcdio.c
+++ b/libavdevice/libcdio.c
@@ -85,19 +85,19 @@ static av_cold int read_header(AVFormatContext *ctx)
}
cdio_paranoia_modeset(s->paranoia, s->paranoia_mode);
- st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
if (s->drive->bigendianp)
- st->codec->codec_id = AV_CODEC_ID_PCM_S16BE;
+ st->codecpar->codec_id = AV_CODEC_ID_PCM_S16BE;
else
- st->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
- st->codec->sample_rate = 44100;
- st->codec->channels = 2;
+ st->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE;
+ st->codecpar->sample_rate = 44100;
+ st->codecpar->channels = 2;
if (s->drive->audio_last_sector != CDIO_INVALID_LSN &&
s->drive->audio_first_sector != CDIO_INVALID_LSN)
st->duration = s->drive->audio_last_sector - s->drive->audio_first_sector;
else if (s->drive->tracks)
st->duration = s->drive->disc_toc[s->drive->tracks].dwStartSector;
- avpriv_set_pts_info(st, 64, CDIO_CD_FRAMESIZE_RAW, 2*st->codec->channels*st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, CDIO_CD_FRAMESIZE_RAW, 2 * st->codecpar->channels * st->codecpar->sample_rate);
for (i = 0; i < s->drive->tracks; i++) {
char title[16];
diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c
index 64c453bd9a..72e2e8bcc8 100644
--- a/libavdevice/libdc1394.c
+++ b/libavdevice/libdc1394.c
@@ -170,13 +170,12 @@ static inline int dc1394_read_common(AVFormatContext *c,
goto out;
}
avpriv_set_pts_info(vst, 64, 1, 1000);
- vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- vst->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
- vst->codec->time_base.den = framerate.num;
- vst->codec->time_base.num = framerate.den;
- vst->codec->width = fmt->width;
- vst->codec->height = fmt->height;
- vst->codec->pix_fmt = fmt->pix_fmt;
+ vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
+ vst->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
+ vst->codecpar->width = fmt->width;
+ vst->codecpar->height = fmt->height;
+ vst->codecpar->format = fmt->pix_fmt;
+ vst->avg_frame_rate = framerate;
/* packet init */
av_init_packet(&dc1394->packet);
@@ -187,7 +186,7 @@ static inline int dc1394_read_common(AVFormatContext *c,
dc1394->current_frame = 0;
- vst->codec->bit_rate = av_rescale(dc1394->packet.size * 8, fps->frame_rate, 1000);
+ vst->codecpar->bit_rate = av_rescale(dc1394->packet.size * 8, fps->frame_rate, 1000);
*select_fps = fps;
*select_fmt = fmt;
out:
diff --git a/libavdevice/oss_dec.c b/libavdevice/oss_dec.c
index 24d357110c..6f51a30662 100644
--- a/libavdevice/oss_dec.c
+++ b/libavdevice/oss_dec.c
@@ -61,10 +61,10 @@ static int audio_read_header(AVFormatContext *s1)
}
/* take real parameters */
- st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = s->codec_id;
- st->codec->sample_rate = s->sample_rate;
- st->codec->channels = s->channels;
+ st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codecpar->codec_id = s->codec_id;
+ st->codecpar->sample_rate = s->sample_rate;
+ st->codecpar->channels = s->channels;
avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
return 0;
diff --git a/libavdevice/oss_enc.c b/libavdevice/oss_enc.c
index 2f075589a9..eb6432ced0 100644
--- a/libavdevice/oss_enc.c
+++ b/libavdevice/oss_enc.c
@@ -47,8 +47,8 @@ static int audio_write_header(AVFormatContext *s1)
int ret;
st = s1->streams[0];
- s->sample_rate = st->codec->sample_rate;
- s->channels = st->codec->channels;
+ s->sample_rate = st->codecpar->sample_rate;
+ s->channels = st->codecpar->channels;
ret = ff_oss_audio_open(s1, 1, s1->filename);
if (ret < 0) {
return AVERROR(EIO);
diff --git a/libavdevice/pulse.c b/libavdevice/pulse.c
index 0e8bd09e15..c4d939a0d3 100644
--- a/libavdevice/pulse.c
+++ b/libavdevice/pulse.c
@@ -107,10 +107,10 @@ static av_cold int pulse_read_header(AVFormatContext *s)
return AVERROR(EIO);
}
/* take real parameters */
- st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = codec_id;
- st->codec->sample_rate = pd->sample_rate;
- st->codec->channels = pd->channels;
+ st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codecpar->codec_id = codec_id;
+ st->codecpar->sample_rate = pd->sample_rate;
+ st->codecpar->channels = pd->channels;
avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
pd->pts = AV_NOPTS_VALUE;
diff --git a/libavdevice/sndio_dec.c b/libavdevice/sndio_dec.c
index 5d40a7a5e2..a839a6fab2 100644
--- a/libavdevice/sndio_dec.c
+++ b/libavdevice/sndio_dec.c
@@ -46,10 +46,10 @@ static av_cold int audio_read_header(AVFormatContext *s1)
return ret;
/* take real parameters */
- st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = s->codec_id;
- st->codec->sample_rate = s->sample_rate;
- st->codec->channels = s->channels;
+ st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codecpar->codec_id = s->codec_id;
+ st->codecpar->sample_rate = s->sample_rate;
+ st->codecpar->channels = s->channels;
avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
diff --git a/libavdevice/sndio_enc.c b/libavdevice/sndio_enc.c
index fad361062b..97b1827f82 100644
--- a/libavdevice/sndio_enc.c
+++ b/libavdevice/sndio_enc.c
@@ -35,8 +35,8 @@ static av_cold int audio_write_header(AVFormatContext *s1)
int ret;
st = s1->streams[0];
- s->sample_rate = st->codec->sample_rate;
- s->channels = st->codec->channels;
+ s->sample_rate = st->codecpar->sample_rate;
+ s->channels = st->codecpar->channels;
ret = ff_sndio_open(s1, 1, s1->filename);
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 41dc0a12f8..46db25dbd3 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -827,8 +827,8 @@ static int v4l2_read_header(AVFormatContext *s1)
if ((res = v4l2_set_parameters(s1) < 0))
return res;
- st->codec->pix_fmt = fmt_v4l2ff(desired_format, codec_id);
- s->frame_size = av_image_get_buffer_size(st->codec->pix_fmt,
+ st->codecpar->format = fmt_v4l2ff(desired_format, codec_id);
+ s->frame_size = av_image_get_buffer_size(st->codecpar->format,
s->width, s->height, 1);
if ((res = mmap_init(s1)) ||
@@ -839,14 +839,14 @@ static int v4l2_read_header(AVFormatContext *s1)
s->top_field_first = first_field(s->fd);
- st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = codec_id;
+ st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codecpar->codec_id = codec_id;
if (codec_id == AV_CODEC_ID_RAWVIDEO)
- st->codec->codec_tag =
- avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt);
- st->codec->width = s->width;
- st->codec->height = s->height;
- st->codec->bit_rate = s->frame_size * av_q2d(st->avg_frame_rate) * 8;
+ st->codecpar->codec_tag =
+ avcodec_pix_fmt_to_codec_tag(st->codecpar->format);
+ st->codecpar->width = s->width;
+ st->codecpar->height = s->height;
+ st->codecpar->bit_rate = s->frame_size * av_q2d(st->avg_frame_rate) * 8;
return 0;
}
diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c
index cc73e82bd0..b0b2086883 100644
--- a/libavdevice/vfwcap.c
+++ b/libavdevice/vfwcap.c
@@ -244,7 +244,7 @@ static int vfw_read_close(AVFormatContext *s)
static int vfw_read_header(AVFormatContext *s)
{
struct vfw_ctx *ctx = s->priv_data;
- AVCodecContext *codec;
+ AVCodecParameters *par;
AVStream *st;
int devnum;
int bisize;
@@ -373,29 +373,30 @@ static int vfw_read_header(AVFormatContext *s)
if(!ret)
goto fail_io;
- codec = st->codec;
- codec->time_base = (AVRational){framerate_q.den, framerate_q.num};
- codec->codec_type = AVMEDIA_TYPE_VIDEO;
- codec->width = bi->bmiHeader.biWidth;
- codec->height = bi->bmiHeader.biHeight;
- codec->pix_fmt = vfw_pixfmt(biCompression, biBitCount);
- if(codec->pix_fmt == AV_PIX_FMT_NONE) {
- codec->codec_id = vfw_codecid(biCompression);
- if(codec->codec_id == AV_CODEC_ID_NONE) {
+ st->avg_frame_rate = framerate_q;
+
+ par = st->codecpar;
+ par->codec_type = AVMEDIA_TYPE_VIDEO;
+ par->width = bi->bmiHeader.biWidth;
+ par->height = bi->bmiHeader.biHeight;
+ par->format = vfw_pixfmt(biCompression, biBitCount);
+ if (par->format == AV_PIX_FMT_NONE) {
+ par->codec_id = vfw_codecid(biCompression);
+ if (par->codec_id == AV_CODEC_ID_NONE) {
av_log(s, AV_LOG_ERROR, "Unknown compression type. "
"Please report verbose (-v 9) debug information.\n");
vfw_read_close(s);
return AVERROR_PATCHWELCOME;
}
- codec->bits_per_coded_sample = biBitCount;
+ par->bits_per_coded_sample = biBitCount;
} else {
- codec->codec_id = AV_CODEC_ID_RAWVIDEO;
+ par->codec_id = AV_CODEC_ID_RAWVIDEO;
if(biCompression == BI_RGB) {
- codec->bits_per_coded_sample = 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 = biBitCount;
+ par->extradata = av_malloc(9 + AV_INPUT_BUFFER_PADDING_SIZE);
+ if (par->extradata) {
+ par->extradata_size = 9;
+ memcpy(par->extradata, "BottomUp", 9);
}
}
}
diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
index b2721ae8c6..20b299995e 100644
--- a/libavdevice/x11grab.c
+++ b/libavdevice/x11grab.c
@@ -347,16 +347,17 @@ static int x11grab_read_header(AVFormatContext *s1)
x11grab->image = image;
x11grab->use_shm = use_shm;
- ret = pixfmt_from_image(s1, image, &st->codec->pix_fmt);
+ ret = pixfmt_from_image(s1, image, &st->codecpar->format);
if (ret < 0)
goto out;
- st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
- st->codec->width = x11grab->width;
- st->codec->height = x11grab->height;
- st->codec->time_base = x11grab->time_base;
- st->codec->bit_rate = x11grab->frame_size * 1 / av_q2d(x11grab->time_base) * 8;
+ st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
+ st->codecpar->width = x11grab->width;
+ st->codecpar->height = x11grab->height;
+ st->codecpar->bit_rate = x11grab->frame_size * 1 / av_q2d(x11grab->time_base) * 8;
+
+ st->avg_frame_rate = av_inv_q(x11grab->time_base);
out:
av_free(param);
diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
index 356518ae5f..9b85c28e24 100644
--- a/libavdevice/xcbgrab.c
+++ b/libavdevice/xcbgrab.c
@@ -544,13 +544,12 @@ static int create_stream(AVFormatContext *s)
st->avg_frame_rate.num };
c->time_frame = av_gettime();
- st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
- st->codec->width = c->width;
- st->codec->height = c->height;
- st->codec->time_base = c->time_base;
+ st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
+ st->codecpar->width = c->width;
+ st->codecpar->height = c->height;
- ret = pixfmt_from_pixmap_format(s, geo->depth, &st->codec->pix_fmt);
+ ret = pixfmt_from_pixmap_format(s, geo->depth, &st->codecpar->format);
free(geo);