Message ID | 20230902151921.1712373-12-stefasab@gmail.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,01/11] lavc/avcodec.h: fix typos in AVCodecContext.pkt_timebase description | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
Decoder formats may not relate to encoder formats, thus this one looks too hackish to me to accept.
On date Sunday 2023-09-03 09:41:49 +0200, Paul B Mahol wrote: > Decoder formats may not relate to encoder formats, thus this one looks too > hackish to me to accept. Agreed, but this is yet another change unrelated to the fix.
On date Sunday 2023-09-03 09:41:49 +0200, Paul B Mahol wrote: > Decoder formats may not relate to encoder formats, thus this one looks too > hackish to me to accept. Agreed but this is unrelated to the crash fix.
On Wed, Sep 6, 2023 at 1:49 AM Stefano Sabatini <stefasab@gmail.com> wrote: > On date Sunday 2023-09-03 09:41:49 +0200, Paul B Mahol wrote: > > Decoder formats may not relate to encoder formats, thus this one looks > too > > hackish to me to accept. > > Agreed but this is unrelated to the crash fix. > And what if decoder ones are empty too?
diff --git a/doc/examples/transcode.c b/doc/examples/transcode.c index 1d22a4b09e..3c72b9377e 100644 --- a/doc/examples/transcode.c +++ b/doc/examples/transcode.c @@ -189,8 +189,10 @@ static int open_output_file(const char *filename) ret = av_channel_layout_copy(&enc_ctx->ch_layout, &dec_ctx->ch_layout); if (ret < 0) return ret; - /* take first format from list of supported formats */ - enc_ctx->sample_fmt = encoder->sample_fmts[0]; + + /* take first format from list of supported formats or use decoder one */ + enc_ctx->sample_fmt = encoder->sample_fmts ? encoder->sample_fmts[0] : dec_ctx->sample_fmt; + enc_ctx->time_base = (AVRational){1, enc_ctx->sample_rate}; }