const char *avformat_license(void)
{
#define LICENSE_PREFIX "libavformat license: "
- return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
+ return &LICENSE_PREFIX FFMPEG_LICENSE[sizeof(LICENSE_PREFIX) - 1];
}
int ff_lock_avformat(void)
* Return the number of bytes read or an error. */
static int append_packet_chunked(AVIOContext *s, AVPacket *pkt, int size)
{
- int64_t orig_pos = pkt->pos; // av_grow_packet might reset pos
int orig_size = pkt->size;
int ret;
if (size > 0)
pkt->flags |= AV_PKT_FLAG_CORRUPT;
- pkt->pos = orig_pos;
if (!pkt->size)
av_packet_unref(pkt);
return pkt->size > orig_size ? pkt->size - orig_size : ret;
return err;
}
- if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) &&
- (pkt->flags & AV_PKT_FLAG_CORRUPT)) {
+ if (pkt->flags & AV_PKT_FLAG_CORRUPT) {
av_log(s, AV_LOG_WARNING,
- "Dropped corrupted packet (stream = %d)\n",
- pkt->stream_index);
- av_packet_unref(pkt);
- continue;
+ "Packet corrupt (stream = %d, dts = %s)",
+ pkt->stream_index, av_ts2str(pkt->dts));
+ if (s->flags & AVFMT_FLAG_DISCARD_CORRUPT) {
+ av_log(s, AV_LOG_WARNING, ", dropping it.\n");
+ av_packet_unref(pkt);
+ continue;
+ }
+ av_log(s, AV_LOG_WARNING, ".\n");
}
av_assert0(pkt->stream_index < (unsigned)s->nb_streams &&
const AVCodecDescriptor *d = avcodec_descriptor_get(id);
if (!d)
return 0;
- if (d->type == AVMEDIA_TYPE_VIDEO && !(d->props & AV_CODEC_PROP_INTRA_ONLY))
+ if ((d->type == AVMEDIA_TYPE_VIDEO || d->type == AVMEDIA_TYPE_AUDIO) &&
+ !(d->props & AV_CODEC_PROP_INTRA_ONLY))
return 0;
return 1;
}
}
analyzed_all_streams = 0;
if (!missing_streams || !*missing_streams)
- if (i == ic->nb_streams) {
- analyzed_all_streams = 1;
- /* NOTE: If the format has no header, then we need to read some
- * packets to get most of the streams, so we cannot stop here. */
- if (!(ic->ctx_flags & AVFMTCTX_NOHEADER)) {
- /* If we found the info for all the codecs, we can stop. */
- ret = count;
- av_log(ic, AV_LOG_DEBUG, "All info found\n");
- flush_codecs = 0;
- break;
+ if (i == ic->nb_streams) {
+ analyzed_all_streams = 1;
+ /* NOTE: If the format has no header, then we need to read some
+ * packets to get most of the streams, so we cannot stop here. */
+ if (!(ic->ctx_flags & AVFMTCTX_NOHEADER)) {
+ /* If we found the info for all the codecs, we can stop. */
+ ret = count;
+ av_log(ic, AV_LOG_DEBUG, "All info found\n");
+ flush_codecs = 0;
+ break;
+ }
}
- }
/* We did not get all the codec info, but we read too much data. */
if (read_size >= probesize) {
ret = count;
};
const uint8_t *data = NULL;
- int size = 0;
+ int ret, size = 0;
if (st->codecpar->width == 1920) {
if (st->codecpar->field_order == AV_FIELD_PROGRESSIVE) {
if (!size)
return 0;
- av_freep(&st->codecpar->extradata);
- if (ff_alloc_extradata(st->codecpar, size))
- return AVERROR(ENOMEM);
+ if ((ret = ff_alloc_extradata(st->codecpar, size)) < 0)
+ return ret;
memcpy(st->codecpar->extradata, data, size);
return 0;