comparison flvenc.c @ 5910:536e5527c1e0 libavformat

Define AVMediaType enum, and use it instead of enum CodecType, which is deprecated and will be dropped at the next major bump.
author stefano
date Tue, 30 Mar 2010 23:30:55 +0000
parents a427102c12cd
children 11bb10c37225
comparison
equal deleted inserted replaced
5909:b8041f85c327 5910:536e5527c1e0
164 double framerate = 0.0; 164 double framerate = 0.0;
165 int metadata_size_pos, data_size; 165 int metadata_size_pos, data_size;
166 166
167 for(i=0; i<s->nb_streams; i++){ 167 for(i=0; i<s->nb_streams; i++){
168 AVCodecContext *enc = s->streams[i]->codec; 168 AVCodecContext *enc = s->streams[i]->codec;
169 if (enc->codec_type == CODEC_TYPE_VIDEO) { 169 if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
170 if (s->streams[i]->r_frame_rate.den && s->streams[i]->r_frame_rate.num) { 170 if (s->streams[i]->r_frame_rate.den && s->streams[i]->r_frame_rate.num) {
171 framerate = av_q2d(s->streams[i]->r_frame_rate); 171 framerate = av_q2d(s->streams[i]->r_frame_rate);
172 } else { 172 } else {
173 framerate = 1/av_q2d(s->streams[i]->codec->time_base); 173 framerate = 1/av_q2d(s->streams[i]->codec->time_base);
174 } 174 }
273 273
274 for (i = 0; i < s->nb_streams; i++) { 274 for (i = 0; i < s->nb_streams; i++) {
275 AVCodecContext *enc = s->streams[i]->codec; 275 AVCodecContext *enc = s->streams[i]->codec;
276 if (enc->codec_id == CODEC_ID_AAC || enc->codec_id == CODEC_ID_H264) { 276 if (enc->codec_id == CODEC_ID_AAC || enc->codec_id == CODEC_ID_H264) {
277 int64_t pos; 277 int64_t pos;
278 put_byte(pb, enc->codec_type == CODEC_TYPE_VIDEO ? 278 put_byte(pb, enc->codec_type == AVMEDIA_TYPE_VIDEO ?
279 FLV_TAG_TYPE_VIDEO : FLV_TAG_TYPE_AUDIO); 279 FLV_TAG_TYPE_VIDEO : FLV_TAG_TYPE_AUDIO);
280 put_be24(pb, 0); // size patched later 280 put_be24(pb, 0); // size patched later
281 put_be24(pb, 0); // ts 281 put_be24(pb, 0); // ts
282 put_byte(pb, 0); // ts ext 282 put_byte(pb, 0); // ts ext
283 put_be24(pb, 0); // streamid 283 put_be24(pb, 0); // streamid
340 else if(enc->codec_id == CODEC_ID_H264) 340 else if(enc->codec_id == CODEC_ID_H264)
341 flags_size= 5; 341 flags_size= 5;
342 else 342 else
343 flags_size= 1; 343 flags_size= 1;
344 344
345 if (enc->codec_type == CODEC_TYPE_VIDEO) { 345 if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
346 put_byte(pb, FLV_TAG_TYPE_VIDEO); 346 put_byte(pb, FLV_TAG_TYPE_VIDEO);
347 347
348 flags = enc->codec_tag; 348 flags = enc->codec_tag;
349 if(flags == 0) { 349 if(flags == 0) {
350 av_log(enc, AV_LOG_ERROR, "video codec %X not compatible with flv\n",enc->codec_id); 350 av_log(enc, AV_LOG_ERROR, "video codec %X not compatible with flv\n",enc->codec_id);
351 return -1; 351 return -1;
352 } 352 }
353 353
354 flags |= pkt->flags & PKT_FLAG_KEY ? FLV_FRAME_KEY : FLV_FRAME_INTER; 354 flags |= pkt->flags & PKT_FLAG_KEY ? FLV_FRAME_KEY : FLV_FRAME_INTER;
355 } else { 355 } else {
356 assert(enc->codec_type == CODEC_TYPE_AUDIO); 356 assert(enc->codec_type == AVMEDIA_TYPE_AUDIO);
357 flags = get_audio_flags(enc); 357 flags = get_audio_flags(enc);
358 358
359 assert(size); 359 assert(size);
360 360
361 put_byte(pb, FLV_TAG_TYPE_AUDIO); 361 put_byte(pb, FLV_TAG_TYPE_AUDIO);