st->codec->codec_id = CODEC_ID_NONE;
st->codec->codec_tag = 0;
}
- st->need_parsing = 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
/* We have to init the frame size at some point .... */
pos2 = url_ftell(pb);
if (gsize >= (pos2 + 8 - pos1 + 24)) {
st->codec->codec_tag = tag1;
st->codec->codec_id = codec_get_id(codec_bmp_tags, tag1);
if(tag1 == MKTAG('D', 'V', 'R', ' '))
- st->need_parsing = 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
}
pos2 = url_ftell(pb);
url_fskip(pb, gsize - (pos2 - pos1 + 24));
struct AVInputFormat *next;
} AVInputFormat;
+enum AVStreamParseType {
+ AVSTREAM_PARSE_NONE,
+ AVSTREAM_PARSE_FULL, /**< full parsing and repack */
+ AVSTREAM_PARSE_HEADERS, /**< only parse headers, don't repack */
+ AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on packet boundary */
+};
+
typedef struct AVIndexEntry {
int64_t pos;
int64_t timestamp;
char language[4]; /** ISO 639 3-letter language code (empty string if undefined) */
/* av_read_frame() support */
-#define AVSTREAM_PARSE_TIMESTAMPS 3 /**< full parsing and interpolation of timestamps for frames not starting on packet boundary */
- int need_parsing; ///< 1->full parsing needed, 2->only parse headers dont repack, 3->full parsing and interpolate timestamps
+ enum AVStreamParseType need_parsing;
struct AVCodecParserContext *parser;
int64_t cur_dts;
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_tag = tag1;
st->codec->codec_id = codec_get_id(codec_bmp_tags, tag1);
- st->need_parsing = 2; //only parse headers dont do slower repacketization, this is needed to get the pict type which is needed for generating correct pts
+ st->need_parsing = AVSTREAM_PARSE_HEADERS; // this is needed to get the pict type which is needed for generating correct pts
// url_fskip(pb, size - 5 * 4);
break;
case CODEC_TYPE_AUDIO:
st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS;
/* ADTS header is in extradata, AAC without header must be stored as exact frames, parser not needed and it will fail */
if (st->codec->codec_id == CODEC_ID_AAC && st->codec->extradata_size)
- st->need_parsing = 0;
+ st->need_parsing = AVSTREAM_PARSE_NONE;
/* AVI files with Xan DPCM audio (wrongly) declare PCM
* audio in the header but have Axan as stream_code_tag. */
if (st->codec->stream_codec_tag == ff_get_fourcc("Axan")){
case FLV_CODECID_PCM_LE:
acodec->codec_id = acodec->bits_per_sample == 8 ? CODEC_ID_PCM_S8 : CODEC_ID_PCM_S16LE; break;
case FLV_CODECID_ADPCM: acodec->codec_id = CODEC_ID_ADPCM_SWF; break;
- case FLV_CODECID_MP3 : acodec->codec_id = CODEC_ID_MP3 ; astream->need_parsing = 1 ; break;
+ case FLV_CODECID_MP3 : acodec->codec_id = CODEC_ID_MP3 ; astream->need_parsing = AVSTREAM_PARSE_FULL; break;
case FLV_CODECID_NELLYMOSER_8HZ_MONO:
acodec->sample_rate = 8000; //in case metadata does not otherwise declare samplerate
case FLV_CODECID_NELLYMOSER:
case 20:
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_MPEG2VIDEO;
- st->need_parsing = 2; // get keyframe flag etc.
+ st->need_parsing = AVSTREAM_PARSE_HEADERS; //get keyframe flag etc.
break;
case 22:
case 23:
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_MPEG1VIDEO;
- st->need_parsing = 2; // get keyframe flag etc.
+ st->need_parsing = AVSTREAM_PARSE_HEADERS; //get keyframe flag etc.
break;
case 9:
st->codec->codec_type = CODEC_TYPE_AUDIO;
s->is_pipe = 0;
else{
s->is_pipe = 1;
- st->need_parsing= 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
}
if (!ap->time_base.num) {
st->codec->height * videotrack->display_width,
st->codec-> width * videotrack->display_height,
255);
- st->need_parsing = 2;
+ st->need_parsing = AVSTREAM_PARSE_HEADERS;
} else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) {
MatroskaAudioTrack *audiotrack = (MatroskaAudioTrack *)track;
case CODEC_ID_MP2:
case CODEC_ID_MP3:
st->codec->codec_type = CODEC_TYPE_AUDIO; /* force type after stsd for m1a hdlr */
- st->need_parsing = 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
break;
default:
break;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_MP3;
- st->need_parsing = 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
/* try to get the TAG */
if (!url_is_streamed(&s->pb)) {
st->codec->codec_type = type;
st->codec->codec_id = codec_id;
if (codec_id != CODEC_ID_PCM_S16BE)
- st->need_parsing = 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
found:
if(st->discard >= AVDISCARD_ALL)
goto skip;
st->priv_data = pes;
st->codec->codec_type = codec_type;
st->codec->codec_id = codec_id;
- st->need_parsing = 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
pes->st = st;
}
return st;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_MP3;
st->codec->bit_rate = mtv->audio_br;
- st->need_parsing=1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
/* Jump over header */
st->codec->width = descriptor->width;
st->codec->height = descriptor->height;
st->codec->bits_per_sample = descriptor->bits_per_sample; /* Uncompressed */
- st->need_parsing = 2; /* only parse headers */
+ st->need_parsing = AVSTREAM_PARSE_HEADERS;
} else if (st->codec->codec_type == CODEC_TYPE_AUDIO) {
container_ul = mxf_get_codec_ul(mxf_sound_essence_container_uls, essence_container_ul);
if (st->codec->codec_id == CODEC_ID_NONE)
if (descriptor->essence_container_ul[13] == 0x01) /* D-10 Mapping */
st->codec->channels = 8; /* force channels to 8 */
} else if (st->codec->codec_id == CODEC_ID_MP2) {
- st->need_parsing = 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
}
}
if (container_ul && container_ul->wrapping == Clip) {
dprintf(mxf->fc, "stream %d: clip wrapped essence\n", st->index);
- st->need_parsing = 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
}
}
return 0;
st->codec->codec_tag = atag;
st->codec->codec_id = codec_get_id(nsv_codec_audio_tags, atag);
- st->need_parsing = 1; /* for PCM we will read a chunk later and put correct info */
+ st->need_parsing = AVSTREAM_PARSE_FULL; /* for PCM we will read a chunk later and put correct info */
/* set timebase to common denominator of ms and framerate */
av_set_pts_info(st, 64, 1, framerate.num*1000);
asize-=4;
PRINT(("NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate));
if (fill_header) {
- st[NSV_ST_AUDIO]->need_parsing = 0; /* we know everything */
+ st[NSV_ST_AUDIO]->need_parsing = AVSTREAM_PARSE_NONE; /* we know everything */
if (bps != 16) {
PRINT(("NSV AUDIO bit/sample != 16 (%d)!!!\n", bps));
}
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_AC3;
- st->need_parsing = 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
/* the parameters will be extracted from the compressed bitstream */
return 0;
}
return AVERROR_NOMEM;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_SHORTEN;
- st->need_parsing = 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
/* the parameters will be extracted from the compressed bitstream */
return 0;
}
return AVERROR_NOMEM;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_FLAC;
- st->need_parsing = 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
/* the parameters will be extracted from the compressed bitstream */
return 0;
}
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_DTS;
- st->need_parsing = 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
/* the parameters will be extracted from the compressed bitstream */
return 0;
}
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_AAC;
- st->need_parsing = 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
/* the parameters will be extracted from the compressed bitstream */
return 0;
}
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = s->iformat->value;
- st->need_parsing = 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
/* for mjpeg, specify frame rate */
/* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/
case CODEC_ID_MP3:
case CODEC_ID_MPEG4:
case CODEC_ID_H264:
- st->need_parsing = 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
break;
default:
break;
ast->codec->channels = 1 + (v&1);
ast->codec->codec_type = CODEC_TYPE_AUDIO;
ast->codec->codec_id = codec_get_id(swf_audio_codec_tags, (v>>4) & 15);
- ast->need_parsing = 1;
+ ast->need_parsing = AVSTREAM_PARSE_FULL;
sample_rate_code= (v>>2) & 3;
if (!sample_rate_code)
return AVERROR_IO;
st->parser = av_parser_init(st->codec->codec_id);
if (!st->parser) {
/* no parser available : just output the raw packets */
- st->need_parsing = 0;
- }else if(st->need_parsing == 2){
+ st->need_parsing = AVSTREAM_PARSE_NONE;
+ }else if(st->need_parsing == AVSTREAM_PARSE_HEADERS){
st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
}
if(st->parser && (s->iformat->flags & AVFMT_GENERIC_INDEX)){
//only for the split stuff
if (!st->parser) {
st->parser = av_parser_init(st->codec->codec_id);
- if(st->need_parsing == 2 && st->parser){
+ if(st->need_parsing == AVSTREAM_PARSE_HEADERS && st->parser){
st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
}
}
if (st->codec->codec_id == CODEC_ID_NONE) {
codec_identified[st->index] = set_codec_from_probe_data(st, &(probe_data[st->index]), 0);
if (codec_identified[st->index]) {
- st->need_parsing = 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
}
}
if(!st->codec->bits_per_sample)
return AVERROR_NOMEM;
get_wav_header(pb, st->codec, size);
- st->need_parsing = 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
av_set_pts_info(st, 64, 1, st->codec->sample_rate);