comparison movenc.c @ 2920:5f15ed0f5fdc libavformat

Add one more parameter to avc_parse_nal_units so that it allows not to free the input buffer. This is required by upcoming extraction of isom_write_avcc to a function.
author aurel
date Fri, 11 Jan 2008 01:00:04 +0000
parents e70dc14a3f9f
children dab2aecebb97
comparison
equal deleted inserted replaced
2919:e70dc14a3f9f 2920:5f15ed0f5fdc
450 } 450 }
451 451
452 return end + 3; 452 return end + 3;
453 } 453 }
454 454
455 static int avc_parse_nal_units(uint8_t **buf, int *size) 455 static int avc_parse_nal_units(uint8_t *buf_in, uint8_t **buf, int *size)
456 { 456 {
457 ByteIOContext *pb; 457 ByteIOContext *pb;
458 uint8_t *p = *buf; 458 uint8_t *p = buf_in;
459 uint8_t *end = p + *size; 459 uint8_t *end = p + *size;
460 uint8_t *nal_start, *nal_end; 460 uint8_t *nal_start, *nal_end;
461 int ret = url_open_dyn_buf(&pb); 461 int ret = url_open_dyn_buf(&pb);
462 if(ret < 0) 462 if(ret < 0)
463 return ret; 463 return ret;
486 if (AV_RB32(track->vosData) == 0x00000001) { 486 if (AV_RB32(track->vosData) == 0x00000001) {
487 uint8_t *buf, *end; 487 uint8_t *buf, *end;
488 uint32_t sps_size=0, pps_size=0; 488 uint32_t sps_size=0, pps_size=0;
489 uint8_t *sps=0, *pps=0; 489 uint8_t *sps=0, *pps=0;
490 490
491 int ret = avc_parse_nal_units(&track->vosData, &track->vosLen); 491 int ret = avc_parse_nal_units(track->vosData, &track->vosData, &track->vosLen);
492 if (ret < 0) 492 if (ret < 0)
493 return ret; 493 return ret;
494 buf = track->vosData; 494 buf = track->vosData;
495 end = track->vosData + track->vosLen; 495 end = track->vosData + track->vosLen;
496 496
1635 } 1635 }
1636 1636
1637 if (enc->codec_id == CODEC_ID_H264 && trk->vosLen > 0 && *(uint8_t *)trk->vosData != 1) { 1637 if (enc->codec_id == CODEC_ID_H264 && trk->vosLen > 0 && *(uint8_t *)trk->vosData != 1) {
1638 /* from x264 or from bytestream h264 */ 1638 /* from x264 or from bytestream h264 */
1639 /* nal reformating needed */ 1639 /* nal reformating needed */
1640 int ret = avc_parse_nal_units(&pkt->data, &pkt->size); 1640 int ret = avc_parse_nal_units(pkt->data, &pkt->data, &pkt->size);
1641 if (ret < 0) 1641 if (ret < 0)
1642 return ret; 1642 return ret;
1643 assert(pkt->size); 1643 assert(pkt->size);
1644 size = pkt->size; 1644 size = pkt->size;
1645 } else if (enc->codec_id == CODEC_ID_DNXHD && !trk->vosLen) { 1645 } else if (enc->codec_id == CODEC_ID_DNXHD && !trk->vosLen) {