comparison raw.c @ 1003:2d57ce58f576 libavformat

simplify AVFormatParameters NULL checks
author michael
date Sat, 11 Mar 2006 00:22:21 +0000
parents 7f8b1a1ac020
children 26d75e74c7b7
comparison
equal deleted inserted replaced
1002:56db80b1131e 1003:2d57ce58f576
46 int id; 46 int id;
47 47
48 st = av_new_stream(s, 0); 48 st = av_new_stream(s, 0);
49 if (!st) 49 if (!st)
50 return AVERROR_NOMEM; 50 return AVERROR_NOMEM;
51 if (ap) { 51
52 id = s->iformat->value; 52 id = s->iformat->value;
53 if (id == CODEC_ID_RAWVIDEO) { 53 if (id == CODEC_ID_RAWVIDEO) {
54 st->codec->codec_type = CODEC_TYPE_VIDEO; 54 st->codec->codec_type = CODEC_TYPE_VIDEO;
55 } else { 55 } else {
56 st->codec->codec_type = CODEC_TYPE_AUDIO; 56 st->codec->codec_type = CODEC_TYPE_AUDIO;
72 st->codec->pix_fmt= PIX_FMT_YUV420P; 72 st->codec->pix_fmt= PIX_FMT_YUV420P;
73 break; 73 break;
74 default: 74 default:
75 return -1; 75 return -1;
76 } 76 }
77 } else {
78 return -1;
79 }
80 return 0; 77 return 0;
81 } 78 }
82 79
83 #define RAW_PACKET_SIZE 1024 80 #define RAW_PACKET_SIZE 1024
84 81
287 st->codec->codec_id = s->iformat->value; 284 st->codec->codec_id = s->iformat->value;
288 st->need_parsing = 1; 285 st->need_parsing = 1;
289 286
290 /* for mjpeg, specify frame rate */ 287 /* for mjpeg, specify frame rate */
291 /* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/ 288 /* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/
292 if (ap && ap->time_base.num) { 289 if (ap->time_base.num) {
293 av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den); 290 av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den);
294 } else if ( st->codec->codec_id == CODEC_ID_MJPEG || 291 } else if ( st->codec->codec_id == CODEC_ID_MJPEG ||
295 st->codec->codec_id == CODEC_ID_MPEG4 || 292 st->codec->codec_id == CODEC_ID_MPEG4 ||
296 st->codec->codec_id == CODEC_ID_H264) { 293 st->codec->codec_id == CODEC_ID_H264) {
297 av_set_pts_info(st, 64, 1, 25); 294 av_set_pts_info(st, 64, 1, 25);