#endif
#include <gst/rtp/gstrtpbuffer.h>
+#include <gst/video/video.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "gstrtpjpegdepay.h"
+#include "gstrtputils.h"
GST_DEBUG_CATEGORY_STATIC (rtpjpegdepay_debug);
#define GST_CAT_DEFAULT (rtpjpegdepay_debug)
gobject_class->finalize = gst_rtp_jpeg_depay_finalize;
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&gst_rtp_jpeg_depay_src_template));
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&gst_rtp_jpeg_depay_sink_template));
+ gst_element_class_add_static_pad_template (gstelement_class,
+ &gst_rtp_jpeg_depay_src_template);
+ gst_element_class_add_static_pad_template (gstelement_class,
+ &gst_rtp_jpeg_depay_sink_template);
gst_element_class_set_static_metadata (gstelement_class,
"RTP JPEG depayloader", "Codec/Depayloader/Network/RTP",
*p++ = 0x11; /* huffman table 1 */
*p++ = 0; /* first DCT coeff */
*p++ = 63; /* last DCT coeff */
- *p++ = 0; /* sucessive approx. */
+ *p++ = 0; /* successive approx. */
return (p - start);
};
width = payload[6] * 8;
height = payload[7] * 8;
+ /* saw a packet with fragment offset > 0 and we don't already have data queued
+ * up (most importantly, we don't have a header for this data) -- drop it
+ * XXX: maybe we can check if the jpeg is progressive and salvage the data?
+ * XXX: not implemented yet because jpegenc can't create progressive jpegs */
+ if (frag_offset > 0 && gst_adapter_available (rtpjpegdepay->adapter) == 0)
+ goto no_header_packet;
+
/* allow frame dimensions > 2040, passed in SDP session or media attributes
* from gstrtspsrc.c (gst_rtspsrc_sdp_attributes_to_caps), or in caps */
if (!width)
GstCaps *outcaps;
outcaps =
- gst_caps_new_simple ("image/jpeg", "framerate", GST_TYPE_FRACTION,
- rtpjpegdepay->frate_num, rtpjpegdepay->frate_denom, "width",
- G_TYPE_INT, width, "height", G_TYPE_INT, height, NULL);
+ gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, TRUE,
+ "framerate", GST_TYPE_FRACTION, rtpjpegdepay->frate_num,
+ rtpjpegdepay->frate_denom, "width", G_TYPE_INT, width,
+ "height", G_TYPE_INT, height, NULL);
gst_pad_set_caps (depayload->srcpad, outcaps);
gst_caps_unref (outcaps);
rtpjpegdepay->discont = FALSE;
}
+ gst_rtp_drop_non_video_meta (rtpjpegdepay, outbuf);
+
GST_DEBUG_OBJECT (rtpjpegdepay, "returning %u bytes", avail);
}
gst_adapter_available (rtpjpegdepay->adapter));
return NULL;
}
+no_header_packet:
+ {
+ GST_WARNING_OBJECT (rtpjpegdepay,
+ "discarding data packets received when we have no header");
+ return NULL;
+ }
}