summaryrefslogtreecommitdiff
path: root/avconv.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2015-06-28 07:41:22 +0200
committerAnton Khirnov <anton@khirnov.net>2015-07-19 09:33:51 +0200
commit56c2f37727015212a404cae0f444d8bc8704d691 (patch)
tree8f296a67fb480c2541250d5a8b0b82641ca331d3 /avconv.c
parente61f39849c2e2b7f492c17b42058242ed2fa4d57 (diff)
avconv: drop update_sample_fmt()
There is only one decoder left that supports this (libopus, which is not used by default since we have a native one) and this code goes against the avconv design, since it propagates information back from the encoder to decoder.
Diffstat (limited to 'avconv.c')
-rw-r--r--avconv.c71
1 files changed, 1 insertions, 70 deletions
diff --git a/avconv.c b/avconv.c
index 5efa80d055..a44267c9c4 100644
--- a/avconv.c
+++ b/avconv.c
@@ -256,65 +256,6 @@ static void abort_codec_experimental(AVCodec *c, int encoder)
exit_program(1);
}
-/*
- * Update the requested input sample format based on the output sample format.
- * This is currently only used to request float output from decoders which
- * support multiple sample formats, one of which is AV_SAMPLE_FMT_FLT.
- * Ideally this will be removed in the future when decoders do not do format
- * conversion and only output in their native format.
- */
-static void update_sample_fmt(AVCodecContext *dec, AVCodec *dec_codec,
- AVCodecContext *enc)
-{
- /* if sample formats match or a decoder sample format has already been
- requested, just return */
- if (enc->sample_fmt == dec->sample_fmt ||
- dec->request_sample_fmt > AV_SAMPLE_FMT_NONE)
- return;
-
- /* if decoder supports more than one output format */
- if (dec_codec && dec_codec->sample_fmts &&
- dec_codec->sample_fmts[0] != AV_SAMPLE_FMT_NONE &&
- dec_codec->sample_fmts[1] != AV_SAMPLE_FMT_NONE) {
- const enum AVSampleFormat *p;
- int min_dec = INT_MAX, min_inc = INT_MAX;
- enum AVSampleFormat dec_fmt = AV_SAMPLE_FMT_NONE;
- enum AVSampleFormat inc_fmt = AV_SAMPLE_FMT_NONE;
-
- /* find a matching sample format in the encoder */
- for (p = dec_codec->sample_fmts; *p != AV_SAMPLE_FMT_NONE; p++) {
- if (*p == enc->sample_fmt) {
- dec->request_sample_fmt = *p;
- return;
- } else {
- enum AVSampleFormat dfmt = av_get_packed_sample_fmt(*p);
- enum AVSampleFormat efmt = av_get_packed_sample_fmt(enc->sample_fmt);
- int fmt_diff = 32 * abs(dfmt - efmt);
- if (av_sample_fmt_is_planar(*p) !=
- av_sample_fmt_is_planar(enc->sample_fmt))
- fmt_diff++;
- if (dfmt == efmt) {
- min_inc = fmt_diff;
- inc_fmt = *p;
- } else if (dfmt > efmt) {
- if (fmt_diff < min_inc) {
- min_inc = fmt_diff;
- inc_fmt = *p;
- }
- } else {
- if (fmt_diff < min_dec) {
- min_dec = fmt_diff;
- dec_fmt = *p;
- }
- }
- }
- }
-
- /* if none match, provide the one that matches quality closest */
- dec->request_sample_fmt = min_inc != INT_MAX ? inc_fmt : dec_fmt;
- }
-}
-
static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
{
AVBitStreamFilterContext *bsfc = ost->bitstream_filters;
@@ -1551,7 +1492,7 @@ static int get_buffer(AVCodecContext *s, AVFrame *frame, int flags)
static int init_input_stream(int ist_index, char *error, int error_len)
{
- int i, ret;
+ int ret;
InputStream *ist = input_streams[ist_index];
if (ist->decoding_needed) {
AVCodec *codec = ist->dec;
@@ -1561,16 +1502,6 @@ static int init_input_stream(int ist_index, char *error, int error_len)
return AVERROR(EINVAL);
}
- /* update requested sample format for the decoder based on the
- corresponding encoder sample format */
- for (i = 0; i < nb_output_streams; i++) {
- OutputStream *ost = output_streams[i];
- if (ost->source_index == ist_index) {
- update_sample_fmt(ist->dec_ctx, codec, ost->enc_ctx);
- break;
- }
- }
-
ist->dec_ctx->opaque = ist;
ist->dec_ctx->get_format = get_format;
ist->dec_ctx->get_buffer2 = get_buffer;