On Thu, Dec 17, 2015 at 10:28:58AM -0500, Vittorio Giovara wrote:
> On Thu, Dec 17, 2015 at 7:28 AM, Diego Biurrun <[email protected]> wrote:
> > --- a/libavcodec/alac.c
> > +++ b/libavcodec/alac.c
> > @@ -266,7 +266,7 @@ static int decode_element(AVCodecContext *avctx,
> > AVFrame *frame, int ch_index,
> > alac->extra_bits = get_bits(&alac->gb, 2) << 3;
> > bps = alac->sample_size - alac->extra_bits + channels - 1;
> > if (bps > 32) {
> > - av_log(avctx, AV_LOG_ERROR, "bps is unsupported: %d\n", bps);
> > + avpriv_report_missing_feature(avctx, "bps %d", bps);
> > return AVERROR_PATCHWELCOME;
> > }
> >
> > @@ -424,7 +424,7 @@ static int alac_decode_frame(AVCodecContext *avctx,
> > void *data,
> > break;
> > }
> > if (element > TYPE_CPE && element != TYPE_LFE) {
> > - av_log(avctx, AV_LOG_ERROR, "syntax element unsupported: %d",
> > element);
> > + avpriv_report_missing_feature(avctx, "Syntax element %d",
> > element);
> > return AVERROR_PATCHWELCOME;
> > }
> >
> > @@ -564,8 +564,8 @@ static av_cold int alac_decode_init(AVCodecContext *
> > avctx)
> > avctx->channels = alac->channels;
> > }
> > if (avctx->channels > ALAC_MAX_CHANNELS) {
> > - av_log(avctx, AV_LOG_ERROR, "Unsupported channel count: %d\n",
> > - avctx->channels);
> > + avpriv_report_missing_feature(avctx, "Channel count %d",
> > + avctx->channels);
> > return AVERROR_PATCHWELCOME;
> > }
> > avctx->channel_layout = ff_alac_channel_layouts[alac->channels - 1];
>
> > --- a/libavcodec/fraps.c
> > +++ b/libavcodec/fraps.c
> > @@ -163,9 +163,7 @@ static int decode_frame(AVCodecContext *avctx,
> > prev_pic_bit = header & (1U << 31); /* bit 31 means same as previous
> > pic */
> >
> > if (version > 5) {
> > - av_log(avctx, AV_LOG_ERROR,
> > - "This file is encoded with Fraps version %u. "
> > - "This codec can only decode versions <= 5.\n", version);
> > + avpriv_report_missing_feature(avctx, "Fraps version %u", version);
> > return AVERROR_PATCHWELCOME;
> > }
>
> > --- a/libavcodec/g2meet.c
> > +++ b/libavcodec/g2meet.c
> > @@ -1424,9 +1424,8 @@ static int g2m_decode_frame(AVCodecContext *avctx,
> > void *data,
> > }
> > c->compression = bytestream2_get_be32(&bc);
> > if (c->compression != 2 && c->compression != 3) {
> > - av_log(avctx, AV_LOG_ERROR,
> > - "Unknown compression method %d\n",
> > - c->compression);
> > + avpriv_report_missing_feature(avctx, "Compression method
> > %d",
> > + c->compression);
> > return AVERROR_PATCHWELCOME;
> > }
> > c->tile_width = bytestream2_get_be32(&bc);
> > @@ -1453,9 +1452,9 @@ static int g2m_decode_frame(AVCodecContext *avctx,
> > void *data,
> > g_mask = bytestream2_get_be32(&bc);
> > b_mask = bytestream2_get_be32(&bc);
> > if (r_mask != 0xFF0000 || g_mask != 0xFF00 || b_mask !=
> > 0xFF) {
> > - av_log(avctx, AV_LOG_ERROR,
> > - "Invalid or unsupported bitmasks: R=%"PRIX32",
> > G=%"PRIX32", B=%"PRIX32"\n",
> > - r_mask, g_mask, b_mask);
> > + avpriv_report_missing_feature(avctx,
> > + "Bitmasks: R=%"PRIX32",
> > G=%"PRIX32", B=%"PRIX32,
> > + r_mask, g_mask, b_mask);
> > return AVERROR_PATCHWELCOME;
> > }
> > } else {
>
> > --- a/libavcodec/libopusenc.c
> > +++ b/libavcodec/libopusenc.c
> > @@ -164,8 +164,9 @@ static int av_cold libopus_encode_init(AVCodecContext
> > *avctx)
> > /* FIXME: Opus can handle up to 255 channels. However, the mapping for
> > * anything greater than 8 is undefined. */
> > if (avctx->channels > 8) {
> > - av_log(avctx, AV_LOG_ERROR,
> > - "Channel layout undefined for %d channels.\n",
> > avctx->channels);
> > + avpriv_report_missing_feature(avctx,
> > + "Undefined channel layout for %d
> > channels",
> > + avctx->channels);
> > return AVERROR_PATCHWELCOME;
> > }
> > if (!avctx->bit_rate) {
>
> > --- a/libavcodec/txd.c
> > +++ b/libavcodec/txd.c
> > @@ -56,8 +56,7 @@ static int txd_decode_frame(AVCodecContext *avctx, void
> > *data, int *got_frame,
> > flags = bytestream2_get_byte(&gb);
> >
> > if (version < 8 || version > 9) {
> > - av_log(avctx, AV_LOG_ERROR, "texture data version %u is
> > unsupported\n",
> > -
> > version);
> > + avpriv_report_missing_feature(avctx, "Texture data version %u",
> > version);
> > return AVERROR_PATCHWELCOME;
> > }
> >
> > @@ -66,7 +65,7 @@ static int txd_decode_frame(AVCodecContext *avctx, void
> > *data, int *got_frame,
> > } else if (depth == 16 || depth == 32) {
> > avctx->pix_fmt = AV_PIX_FMT_RGBA;
> > } else {
> > - av_log(avctx, AV_LOG_ERROR, "depth of %u is unsupported\n", depth);
> > + avpriv_report_missing_feature(avctx, "Color depth of %u", depth);
> > return AVERROR_PATCHWELCOME;
> > }
> >
> > @@ -143,7 +142,7 @@ static int txd_decode_frame(AVCodecContext *avctx, void
> > *data, int *got_frame,
> > return avpkt->size;
> >
> > unsupported:
> > - av_log(avctx, AV_LOG_ERROR, "unsupported d3d format (%08x)\n",
> > d3d_format);
> > + avpriv_report_missing_feature(avctx, "d3d format (%08x)", d3d_format);
> > return AVERROR_PATCHWELCOME;
> > }
>
> > --- a/libavdevice/vfwcap.c
> > +++ b/libavdevice/vfwcap.c
> > @@ -382,8 +382,7 @@ static int vfw_read_header(AVFormatContext *s)
> > if(codec->pix_fmt == AV_PIX_FMT_NONE) {
> > codec->codec_id = vfw_codecid(biCompression);
> > if(codec->codec_id == AV_CODEC_ID_NONE) {
> > - av_log(s, AV_LOG_ERROR, "Unknown compression type. "
> > - "Please report verbose (-v 9) debug
> > information.\n");
> > + avpriv_report_missing_feature(s, "This compression type");
>
> this?
Do you have a better suggestion?
> > --- a/libavformat/avienc.c
> > +++ b/libavformat/avienc.c
> > @@ -225,8 +225,7 @@ static int avi_write_header(AVFormatContext *s)
> > // XSUB subtitles behave like video tracks, other subtitles
> > // are not (yet) supported.
> > if (enc->codec_id != AV_CODEC_ID_XSUB) {
> > - av_log(s, AV_LOG_ERROR,
> > - "Subtitle streams other than DivX XSUB are not
> > supported by the AVI muxer.\n");
> > + avpriv_report_missing_feature(s, "Subtitle streams other
> > than DivX XSUB");
> > return AVERROR_PATCHWELCOME;
> > }
> > case AVMEDIA_TYPE_VIDEO:
>
> > --- a/libavformat/lxfdec.c
> > +++ b/libavformat/lxfdec.c
> > @@ -190,8 +190,7 @@ static int get_packet_header(AVFormatContext *s)
> > case 24: st->codec->codec_id = AV_CODEC_ID_PCM_S24LE_PLANAR; break;
> > case 32: st->codec->codec_id = AV_CODEC_ID_PCM_S32LE_PLANAR; break;
> > default:
> > - av_log(s, AV_LOG_WARNING,
> > - "only 16-, 20-, 24- and 32-bit PCM currently
> > supported\n");
> > + avpriv_report_missing_feature(s, "PCM not 16-, 20-, 24- or
> > 32-bits");
> > return AVERROR_PATCHWELCOME;
> > }
>
> > --- a/libavformat/mpc8.c
> > +++ b/libavformat/mpc8.c
> > @@ -228,7 +228,7 @@ static int mpc8_read_header(AVFormatContext *s)
> > avio_skip(pb, 4); //CRC
> > c->ver = avio_r8(pb);
> > if(c->ver != 8){
> > - av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver);
> > + avpriv_report_missing_feature(s, "Stream version %d", c->ver);
> > return AVERROR_PATCHWELCOME;
> > }
> > c->samples = ffio_read_varlen(pb);
>
> > --- a/libavformat/rtpdec_xiph.c
> > +++ b/libavformat/rtpdec_xiph.c
> > @@ -245,9 +244,8 @@ parse_packed_headers(const uint8_t * packed_headers,
> > length2 = get_base128(&packed_headers, packed_headers_end);
> >
> > if (num_packed != 1 || num_headers > 3) {
> > - av_log(codec, AV_LOG_ERROR,
> > - "Unimplemented number of headers: %u packed headers, %u
> > headers\n",
> > - num_packed, num_headers);
> > + avpriv_report_missing_feature(codec, "%u packed headers, %u
> > headers",
> > + num_packed, num_headers);
> > return AVERROR_PATCHWELCOME;
> > }
>
> > --- a/libavformat/spdifenc.c
> > +++ b/libavformat/spdifenc.c
> > @@ -469,7 +469,8 @@ static int spdif_write_header(AVFormatContext *s)
> > return AVERROR(ENOMEM);
> > break;
> > default:
> > - av_log(s, AV_LOG_ERROR, "codec not supported\n");
> > + avpriv_report_missing_feature(s, "Codec %d",
> > + s->streams[0]->codec->codec_id);
> > return AVERROR_PATCHWELCOME;
> > }
> > return 0;
>
> --- a/libavformat/wvdec.c
> +++ b/libavformat/wvdec.c
> @@ -95,7 +95,8 @@ static int wv_read_block_header(AVFormatContext
> *ctx, AVIOContext *pb)
> }
>
> if (wc->header.version < 0x402 || wc->header.version > 0x410) {
> - av_log(ctx, AV_LOG_ERROR, "Unsupported version %03X\n",
> wc->header.version);
> + avpriv_report_missing_feature(ctx, "WV version 0x%03X",
> + wc->header.version);
> return AVERROR_PATCHWELCOME;
> }
>
> Are you absolutely sure that the bounds of the codecs/formats I
> highlighted above aren't actually features that the standard or the
> format explicitly disallows? For example in txd there might be only
> the currently supported formats, and all the others should be
> considered as an error.
No, as I don't know all the formats in detail. I just located places
that returned AVERROR_PATCHWELCOME w/o reporting a missing feature or
requesting a sample and did more or less the same manually instead.
> Likewise, many of this error messages could
> probably be replaced with request_sample rather than missing_feature,
> especially the ones related to version checking.
Probably.
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel