static GstFlowReturn daala_dec_decode_buffer (GstDaalaDec * dec, GstBuffer * buf, GstVideoCodecFrame * frame) { ogg_packet packet; GstFlowReturn result = GST_FLOW_OK; GstMapInfo minfo; /* make ogg_packet out of the buffer */ gst_buffer_map (buf, &minfo, GST_MAP_READ); packet.packet = minfo.data; packet.bytes = minfo.size; packet.granulepos = -1; packet.packetno = 0; /* we don't really care */ packet.b_o_s = dec->have_header ? 0 : 1; /* EOS does not matter for the decoder */ packet.e_o_s = 0; GST_LOG_OBJECT (dec, "decode buffer of size %ld", packet.bytes); GST_DEBUG_OBJECT (dec, "header=%02x", packet.bytes ? packet.packet[0] : -1); /* switch depending on packet type. A zero byte packet is always a data * packet; we don't dereference it in that case. */ if (packet.bytes && packet.packet[0] & 0x80) { if (dec->have_header) { GST_WARNING_OBJECT (GST_OBJECT (dec), "Ignoring header"); GST_VIDEO_CODEC_FRAME_FLAG_SET (frame, GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY); result = GST_CUSTOM_FLOW_DROP; goto done; } result = daala_handle_header_packet (dec, &packet); /* header packets are not meant to be displayed */ /* FIXME : This is a temporary hack. The proper fix would be to * not call _finish_frame() for these types of packets */ GST_VIDEO_CODEC_FRAME_FLAG_SET (frame, GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY); } else { result = daala_handle_data_packet (dec, &packet, frame); } done: gst_buffer_unmap (buf, &minfo); return result; }
static void drop_frame (GstVaapiDecoder * decoder, GstVideoCodecFrame * frame) { GST_DEBUG ("drop frame %d", frame->system_frame_number); /* no surface proxy */ gst_video_codec_frame_set_user_data (frame, NULL, NULL); frame->pts = GST_CLOCK_TIME_NONE; GST_VIDEO_CODEC_FRAME_FLAG_SET (frame, GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY); g_async_queue_push (decoder->frames, gst_video_codec_frame_ref (frame)); }