- Timestamp:
- Mar 17, 2011 11:33:34 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-codec/ffmpeg_codecs.c
r3435 r3461 246 246 { 247 247 { 248 {PJMEDIA_FORMAT_H263P, {"H263-1998",9}, PJMEDIA_RTP_PT_H263 },248 {PJMEDIA_FORMAT_H263P, {"H263-1998",9}, PJMEDIA_RTP_PT_H263P}, 249 249 PJMEDIA_FORMAT_H263, 1000000, 2000000, 250 250 &h263_packetize, &h263_unpacketize, &h263_parse_fmtp, … … 258 258 }, 259 259 { 260 {PJMEDIA_FORMAT_H264, {"H264",4}, PJMEDIA_RTP_PT_H264}, 261 }, 262 { 260 263 {PJMEDIA_FORMAT_H261, {"H261",4}, PJMEDIA_RTP_PT_H261}, 261 264 }, … … 264 267 }, 265 268 { 266 {PJMEDIA_FORMAT_MPEG4, {"MP4V",4} , PJMEDIA_RTP_PT_MPV},269 {PJMEDIA_FORMAT_MPEG4, {"MP4V",4}}, 267 270 }, 268 271 { 269 {PJMEDIA_FORMAT_XVID, {"XVID",4} , PJMEDIA_RTP_PT_MPV},272 {PJMEDIA_FORMAT_XVID, {"XVID",4}}, 270 273 PJMEDIA_FORMAT_MPEG4, 271 274 }, … … 452 455 PJ_TODO(NOTIFY_APP_ABOUT_THIS_NEW_ENCODING_FORMAT); 453 456 } else { 454 return PJ _EUNKNOWN;457 return PJMEDIA_EBADFMT; 455 458 } 456 459 } … … 532 535 avcodec_init(); 533 536 avcodec_register_all(); 537 av_log_set_level(AV_LOG_ERROR); 534 538 535 539 /* Enum FFMPEG codecs */ … … 649 653 if (desc->info.clock_rate == 0) 650 654 desc->info.clock_rate = 90000; 655 656 /* Set RTP packetization support flag in the codec info */ 657 desc->info.has_rtp_pack = (desc->packetize != NULL) && 658 (desc->unpacketize != NULL); 651 659 } 652 660 … … 994 1002 if (vfd->avg_bps) { 995 1003 ctx->bit_rate = vfd->avg_bps; 996 if (vfd->max_bps )1004 if (vfd->max_bps > vfd->avg_bps) 997 1005 ctx->bit_rate_tolerance = vfd->max_bps - vfd->avg_bps; 1006 } 1007 1008 /* Libx264 experimental setting (it rejects ffmpeg defaults) */ 1009 if (ff->param.enc_fmt.id == PJMEDIA_FORMAT_H264) { 1010 ctx->me_range = 16; 1011 ctx->max_qdiff = 4; 1012 ctx->qmin = 10; 1013 ctx->qmax = 51; 1014 ctx->qcompress = 0.6f; 998 1015 } 999 1016 … … 1027 1044 if (err < 0) { 1028 1045 print_ffmpeg_err(err); 1029 return PJ _EUNKNOWN;1046 return PJMEDIA_CODEC_EFAILED; 1030 1047 } 1031 1048 … … 1219 1236 1220 1237 avcodec_get_frame_defaults(&avframe); 1238 avframe.pts = input->timestamp.u64; 1221 1239 1222 1240 for (i = 0; i < ff->enc_vfi->plane_cnt; ++i) { … … 1249 1267 if (err < 0) { 1250 1268 print_ffmpeg_err(err); 1251 return PJ _EUNKNOWN;1269 return PJMEDIA_CODEC_EFAILED; 1252 1270 } else { 1253 1271 output->size = err; … … 1301 1319 1302 1320 output->bit_info = 0; 1321 output->timestamp = input->timestamp; 1303 1322 1304 1323 #if LIBAVCODEC_VERSION_MAJOR >= 52 && LIBAVCODEC_VERSION_MINOR >= 72 … … 1316 1335 #endif 1317 1336 if (err < 0) { 1337 output->type = PJMEDIA_FRAME_TYPE_NONE; 1338 output->size = 0; 1318 1339 print_ffmpeg_err(err); 1319 return PJ _EUNKNOWN;1340 return PJMEDIA_CODEC_EFAILED; 1320 1341 } else if (got_picture) { 1321 1342 pjmedia_video_apply_fmt_param *vafp = &ff->dec_vafp; … … 1347 1368 ff->dec_vfi = pjmedia_get_video_format_info(NULL, ff->param.dec_fmt.id); 1348 1369 if (!ff->dec_vfi) 1349 return PJ_E UNKNOWN;1370 return PJ_ENOTSUP; 1350 1371 pj_bzero(&ff->dec_vafp, sizeof(ff->dec_vafp)); 1351 1372 ff->dec_vafp.size = ff->param.dec_fmt.det.vid.size; … … 1385 1406 } 1386 1407 1408 output->type = PJMEDIA_FRAME_TYPE_VIDEO; 1387 1409 output->size = vafp->framebytes; 1388 1410 } else { 1389 return PJ_EUNKNOWN; 1390 } 1391 1411 output->type = PJMEDIA_FRAME_TYPE_NONE; 1412 output->size = 0; 1413 } 1414 1392 1415 return PJ_SUCCESS; 1393 1416 }
Note: See TracChangeset
for help on using the changeset viewer.