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

Function ftr_decode_frame

libavcodec/ftr.c:74–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74static int ftr_decode_frame(AVCodecContext *avctx, AVFrame *frame,
75 int *got_frame, AVPacket *avpkt)
76{
77 FTRContext *s = avctx->priv_data;
78 GetBitContext gb;
79 int ret, ch_offset = 0;
80
81 ret = init_get_bits8(&gb, avpkt->data, avpkt->size);
82 if (ret < 0)
83 return ret;
84
85 frame->nb_samples = 0;
86
87 for (int i = 0; i < s->nb_context; i++) {
88 AVCodecContext *codec_avctx = s->aac_avctx[i];
89 GetBitContext gb2 = gb;
90 AACADTSHeaderInfo hdr_info;
91 int size;
92
93 if (get_bits_left(&gb) < 64)
94 return AVERROR_INVALIDDATA;
95
96 memset(&hdr_info, 0, sizeof(hdr_info));
97
98 size = ff_adts_header_parse(&gb2, &hdr_info);
99 if (size <= 0 || size * 8 > get_bits_left(&gb))
100 return AVERROR_INVALIDDATA;
101
102 if (size > s->packet->size) {
103 ret = av_grow_packet(s->packet, size - s->packet->size);
104 if (ret < 0)
105 return ret;
106 }
107
108 ret = av_packet_make_writable(s->packet);
109 if (ret < 0)
110 return ret;
111
112 memcpy(s->packet->data, avpkt->data + (get_bits_count(&gb) >> 3), size);
113 s->packet->size = size;
114
115 if (size > 12) {
116 uint8_t *buf = s->packet->data;
117
118 if (buf[3] & 0x20) {
119 int tmp = buf[8];
120 buf[ 9] = ~buf[9];
121 buf[11] = ~buf[11];
122 buf[12] = ~buf[12];
123 buf[ 8] = ~buf[10];
124 buf[10] = ~tmp;
125 }
126 }
127
128 ret = avcodec_send_packet(codec_avctx, s->packet);
129 if (ret < 0) {
130 av_log(avctx, AV_LOG_ERROR, "Error submitting a packet for decoding\n");
131 return ret;

Callers

nothing calls this directly

Calls 12

init_get_bits8Function · 0.85
get_bits_leftFunction · 0.85
ff_adts_header_parseFunction · 0.85
av_grow_packetFunction · 0.85
av_packet_make_writableFunction · 0.85
get_bits_countFunction · 0.85
avcodec_send_packetFunction · 0.85
av_logFunction · 0.85
avcodec_receive_frameFunction · 0.85
ff_get_bufferFunction · 0.85
skip_bits_longFunction · 0.85
av_get_bytes_per_sampleFunction · 0.85

Tested by

no test coverage detected