Lines Matching defs:vp8
27 * @see http://tools.ietf.org/html/draft-ietf-payload-vp8-05
55 static void vp8_free_buffer(PayloadContext *vp8)
58 if (!vp8->data)
60 avio_close_dyn_buf(vp8->data, &tmp);
62 vp8->data = NULL;
65 static int vp8_broken_sequence(AVFormatContext *ctx, PayloadContext *vp8,
68 vp8->sequence_ok = 0;
70 vp8_free_buffer(vp8);
74 static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
88 if (vp8->data) {
89 int ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);
92 *timestamp = vp8->timestamp;
93 if (vp8->sequence_dirty)
153 vp8_free_buffer(vp8);
155 vp8->sequence_ok = 1;
156 vp8->sequence_dirty = 0;
157 vp8->got_keyframe = 1;
159 int can_continue = vp8->data && !vp8->is_keyframe &&
160 avio_tell(vp8->data) >= vp8->first_part_size;
161 if (!vp8->sequence_ok)
163 if (!vp8->got_keyframe)
164 return vp8_broken_sequence(ctx, vp8, "Keyframe missing\n");
166 if (pictureid != ((vp8->prev_pictureid + 1) & pictureid_mask)) {
167 return vp8_broken_sequence(ctx, vp8,
170 if (vp8->data && !can_continue)
171 return vp8_broken_sequence(ctx, vp8,
175 uint16_t expected_seq = vp8->prev_seq + 1;
177 if (vp8->data) {
188 return vp8_broken_sequence(ctx, vp8,
193 return vp8_broken_sequence(ctx, vp8,
197 if (vp8->data) {
198 vp8->sequence_dirty = 1;
199 if (avio_tell(vp8->data) >= vp8->first_part_size) {
200 int ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);
205 old_timestamp = vp8->timestamp;
208 vp8_free_buffer(vp8);
212 vp8->first_part_size = (AV_RL16(&buf[1]) << 3 | buf[0] >> 5) + 3;
213 if ((res = avio_open_dyn_buf(&vp8->data)) < 0)
215 vp8->timestamp = *timestamp;
216 vp8->broken_frame = 0;
217 vp8->prev_pictureid = pictureid;
218 vp8->is_keyframe = !non_key;
220 uint16_t expected_seq = vp8->prev_seq + 1;
222 if (!vp8->sequence_ok)
225 if (vp8->timestamp != *timestamp) {
227 return vp8_broken_sequence(ctx, vp8,
232 if (vp8->is_keyframe) {
233 return vp8_broken_sequence(ctx, vp8,
235 } else if (vp8->data && avio_tell(vp8->data) >= vp8->first_part_size) {
236 vp8->broken_frame = 1;
237 vp8->sequence_dirty = 1;
239 return vp8_broken_sequence(ctx, vp8,
245 if (!vp8->data)
246 return vp8_broken_sequence(ctx, vp8, "Received no start marker\n");
248 vp8->prev_seq = seq;
249 if (!vp8->broken_frame)
250 avio_write(vp8->data, buf, len);
259 ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);
262 if (vp8->sequence_dirty)
272 PayloadContext *vp8 = av_mallocz(sizeof(PayloadContext));
273 if (!vp8)
275 vp8->sequence_ok = 1;
276 return vp8;
279 static void vp8_free_context(PayloadContext *vp8)
281 vp8_free_buffer(vp8);
282 av_free(vp8);
285 static int vp8_need_keyframe(PayloadContext *vp8)
287 return vp8->sequence_dirty || !vp8->sequence_ok;