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

Function decode_frame

libavcodec/wmaprodec.c:1444–1549  ·  view source on GitHub ↗

*@brief Decode one WMA frame. *@param s codec context *@return 0 if the trailer bit indicates that this is the last frame, * 1 if there are additional frames */

Source from the content-addressed store, hash-verified

1442 * 1 if there are additional frames
1443 */
1444static int decode_frame(WMAProDecodeCtx *s, AVFrame *frame, int *got_frame_ptr)
1445{
1446 GetBitContext* gb = &s->gb;
1447 int more_frames = 0;
1448 int len = 0;
1449 int i;
1450
1451 /** get frame length */
1452 if (s->len_prefix)
1453 len = get_bits(gb, s->log2_frame_size);
1454
1455 ff_dlog(s->avctx, "decoding frame with length %x\n", len);
1456
1457 /** decode tile information */
1458 if (decode_tilehdr(s)) {
1459 s->packet_loss = 1;
1460 return 0;
1461 }
1462
1463 /** read postproc transform */
1464 if (s->nb_channels > 1 && get_bits1(gb)) {
1465 if (get_bits1(gb)) {
1466 for (i = 0; i < s->nb_channels * s->nb_channels; i++)
1467 skip_bits(gb, 4);
1468 }
1469 }
1470
1471 /** read drc info */
1472 if (s->dynamic_range_compression) {
1473 s->drc_gain = get_bits(gb, 8);
1474 ff_dlog(s->avctx, "drc_gain %i\n", s->drc_gain);
1475 }
1476
1477 if (get_bits1(gb)) {
1478 if (get_bits1(gb))
1479 s->trim_start = get_bits(gb, av_log2(s->samples_per_frame * 2));
1480
1481 if (get_bits1(gb))
1482 s->trim_end = get_bits(gb, av_log2(s->samples_per_frame * 2));
1483 } else {
1484 s->trim_start = s->trim_end = 0;
1485 }
1486
1487 ff_dlog(s->avctx, "BITSTREAM: frame header length was %i\n",
1488 get_bits_count(gb) - s->frame_offset);
1489
1490 /** reset subframe states */
1491 s->parsed_all_subframes = 0;
1492 for (i = 0; i < s->nb_channels; i++) {
1493 s->channel[i].decoded_samples = 0;
1494 s->channel[i].cur_subframe = 0;
1495 s->channel[i].reuse_sf = 0;
1496 }
1497
1498 /** decode all subframes */
1499 while (!s->parsed_all_subframes) {
1500 if (decode_subframe(s) < 0) {
1501 s->packet_loss = 1;

Callers 1

decode_packetFunction · 0.70

Calls 10

get_bits1Function · 0.85
skip_bitsFunction · 0.85
av_log2Function · 0.85
get_bits_countFunction · 0.85
av_frame_unrefFunction · 0.85
av_logFunction · 0.85
skip_bits_longFunction · 0.85
get_bitsFunction · 0.70
decode_tilehdrFunction · 0.70
decode_subframeFunction · 0.70

Tested by

no test coverage detected