[FFmpeg-devel] [PATCH] NIST SPHERE demuxer
James Almer
jamrial at gmail.com
Wed Dec 19 08:32:32 CET 2012
On 18/12/12 10:38 PM, Paul B Mahol wrote:
> + while (!url_feof(s->pb)) {
> + ff_get_line(s->pb, (char *)&buffer, sizeof(buffer));
buffer alone (without the cast and &) seems to work the same.
> + if (!memcmp(buffer, "end_head", 8)) {
> + if (!strcasecmp(coding, "pcm"))
av_strcasecmp()? Every other file uses it, and I'm getting an "implicit declaration" error for strcasecmp()
when i try to compile on Gentoo.
> + st->codec->codec_id = ff_get_pcm_codec_id(bps, 0, be, 0xFFFF);
> +
> + avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
> +
> + st->codec->block_align = bps * st->codec->channels / 8;
> +
> + avio_skip(s->pb, 1024 - avio_tell(s->pb));
> + return 0;
> + } else if (!memcmp(buffer, "channel_count", 13)) {
> + sscanf(buffer, "%*s %*s %u", &st->codec->channels);
> + } else if (!memcmp(buffer, "sample_byte_format", 18)) {
> + sscanf(buffer, "%*s %*s %3s", format);
> +
> + if (!strcasecmp(format, "01")) {
> + be = 0;
> + } else if (!strcasecmp(format, "10")) {
> + be = 1;
> + } else if (strcasecmp(format, "1")) {
> + av_log_ask_for_sample(s, "unsupported sample byte format\n");
> + return AVERROR_INVALIDDATA;
> + }
> + } else if (!memcmp(buffer, "sample_n_bytes", 14)) {
> + sscanf(buffer, "%*s %*s %u", &bps);
> + bps <<= 3;
> + st->codec->bits_per_coded_sample = bps;
> + } else if (!memcmp(buffer, "sample_coding", 13)) {
> + sscanf(buffer, "%*s %*s %31s", coding);
> + } else if (!memcmp(buffer, "sample_count", 12)) {
> + sscanf(buffer, "%*s %*s %llu", &st->duration);
nit: SCNd64 (Or SCNu64 if you still want it unsigned, even though duration is declared as int64_t).
It's more portable, since it for example fixes a warning about unknown conversion type on Mingw, which
doesn't like %l.
Also consider using SCNd32 (or SCNu32) for bps, st->codec->channels and st->codec->sample_rate.
Regards.
More information about the ffmpeg-devel
mailing list