MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / decode_vol_header

Function decode_vol_header

libavcodec/mpeg4videodec.c:1521–1826  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1519}
1520
1521static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
1522 int width, height, vo_ver_id;
1523
1524 /* vol header */
1525 skip_bits(gb, 1); /* random access */
1526 s->vo_type= get_bits(gb, 8);
1527 if (get_bits1(gb) != 0) { /* is_ol_id */
1528 vo_ver_id = get_bits(gb, 4); /* vo_ver_id */
1529 skip_bits(gb, 3); /* vo_priority */
1530 } else {
1531 vo_ver_id = 1;
1532 }
1533 s->aspect_ratio_info= get_bits(gb, 4);
1534 if(s->aspect_ratio_info == FF_ASPECT_EXTENDED){
1535 s->avctx->sample_aspect_ratio.num= get_bits(gb, 8); // par_width
1536 s->avctx->sample_aspect_ratio.den= get_bits(gb, 8); // par_height
1537 }else{
1538 s->avctx->sample_aspect_ratio= ff_h263_pixel_aspect[s->aspect_ratio_info];
1539 }
1540
1541 if ((s->vol_control_parameters=get_bits1(gb))) { /* vol control parameter */
1542 int chroma_format= get_bits(gb, 2);
1543 if(chroma_format!=CHROMA_420){
1544 av_log(s->avctx, AV_LOG_ERROR, "illegal chroma format\n");
1545 }
1546 s->low_delay= get_bits1(gb);
1547 if(get_bits1(gb)){ /* vbv parameters */
1548 get_bits(gb, 15); /* first_half_bitrate */
1549 skip_bits1(gb); /* marker */
1550 get_bits(gb, 15); /* latter_half_bitrate */
1551 skip_bits1(gb); /* marker */
1552 get_bits(gb, 15); /* first_half_vbv_buffer_size */
1553 skip_bits1(gb); /* marker */
1554 get_bits(gb, 3); /* latter_half_vbv_buffer_size */
1555 get_bits(gb, 11); /* first_half_vbv_occupancy */
1556 skip_bits1(gb); /* marker */
1557 get_bits(gb, 15); /* latter_half_vbv_occupancy */
1558 skip_bits1(gb); /* marker */
1559 }
1560 }else{
1561 // set low delay flag only once the smartest? low delay detection won't be overriden
1562 if(s->picture_number==0)
1563 s->low_delay=0;
1564 }
1565
1566 s->shape = get_bits(gb, 2); /* vol shape */
1567 if(s->shape != RECT_SHAPE) av_log(s->avctx, AV_LOG_ERROR, "only rectangular vol supported\n");
1568 if(s->shape == GRAY_SHAPE && vo_ver_id != 1){
1569 av_log(s->avctx, AV_LOG_ERROR, "Gray shape not supported\n");
1570 skip_bits(gb, 4); //video_object_layer_shape_extension
1571 }
1572
1573 check_marker(gb, "before time_increment_resolution");
1574
1575 s->avctx->time_base.den = get_bits(gb, 16);
1576 if(!s->avctx->time_base.den){
1577 av_log(s->avctx, AV_LOG_ERROR, "time_base.den==0\n");
1578 return -1;

Callers 1

Calls 9

skip_bitsFunction · 0.85
get_bitsFunction · 0.85
get_bits1Function · 0.85
av_logFunction · 0.85
skip_bits1Function · 0.85
check_markerFunction · 0.85
get_bits_countFunction · 0.85
skip_bits_longFunction · 0.85
AV_RL32Function · 0.50

Tested by

no test coverage detected