gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2008 Axis Communications <dev-gstreamer@axis.com>
|
|
|
|
* @author Bjorn Ostby <bjorn.ostby@axis.com>
|
|
|
|
* @author Peter Kjellerstedt <peter.kjellerstedt@axis.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:rtpjpegpay
|
|
|
|
*
|
|
|
|
* Payload encode JPEG pictures into RTP packets according to RFC 2435.
|
|
|
|
* For detailed information see: http://www.rfc-editor.org/rfc/rfc2435.txt
|
|
|
|
*
|
|
|
|
* The payloader takes a JPEG picture, scans the header for quantization
|
|
|
|
* tables (if needed) and constructs the RTP packet header followed by
|
|
|
|
* the actual JPEG entropy scan.
|
|
|
|
*
|
|
|
|
* The payloader assumes that correct width and height is found in the caps.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <gst/rtp/gstrtpbuffer.h>
|
|
|
|
|
|
|
|
#include "gstrtpjpegpay.h"
|
|
|
|
|
|
|
|
/* elementfactory information */
|
|
|
|
static const GstElementDetails gst_rtp_jpeg_pay_details =
|
gst/rtp/: Add a jpeg depayloader.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegdepay.c: (gst_rtp_jpeg_depay_base_init),
(gst_rtp_jpeg_depay_class_init), (gst_rtp_jpeg_depay_init),
(gst_rtp_jpeg_depay_finalize), (MakeTables), (MakeQuantHeader),
(MakeHuffmanHeader), (MakeDRIHeader), (MakeHeaders),
(gst_rtp_jpeg_depay_setcaps), (gst_rtp_jpeg_depay_process),
(gst_rtp_jpeg_depay_change_state),
(gst_rtp_jpeg_depay_plugin_init):
* gst/rtp/gstrtpjpegdepay.h:
Add a jpeg depayloader.
* gst/rtp/gstrtpjpegpay.c:
Set the default properties on the payloader to better defaults.
2008-11-14 18:41:29 +00:00
|
|
|
GST_ELEMENT_DETAILS ("RTP JPEG payloader",
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
"Codec/Payloader/Network",
|
gst/rtp/: Add a jpeg depayloader.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegdepay.c: (gst_rtp_jpeg_depay_base_init),
(gst_rtp_jpeg_depay_class_init), (gst_rtp_jpeg_depay_init),
(gst_rtp_jpeg_depay_finalize), (MakeTables), (MakeQuantHeader),
(MakeHuffmanHeader), (MakeDRIHeader), (MakeHeaders),
(gst_rtp_jpeg_depay_setcaps), (gst_rtp_jpeg_depay_process),
(gst_rtp_jpeg_depay_change_state),
(gst_rtp_jpeg_depay_plugin_init):
* gst/rtp/gstrtpjpegdepay.h:
Add a jpeg depayloader.
* gst/rtp/gstrtpjpegpay.c:
Set the default properties on the payloader to better defaults.
2008-11-14 18:41:29 +00:00
|
|
|
"Payload-encodes JPEG pictures into RTP packets (RFC 2435)",
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
"Axis Communications <dev-gstreamer@axis.com>");
|
|
|
|
|
|
|
|
static GstStaticPadTemplate gst_rtp_jpeg_pay_sink_template =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2009-05-05 14:32:17 +00:00
|
|
|
GST_STATIC_CAPS ("image/jpeg; " "video/x-jpeg")
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate gst_rtp_jpeg_pay_src_template =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("application/x-rtp, "
|
|
|
|
" media = (string) \"video\", "
|
|
|
|
" payload = (int) 26 , "
|
|
|
|
" clock-rate = (int) 90000, " " encoding-name = (string) \"JPEG\"")
|
|
|
|
);
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (rtpjpegpay_debug);
|
|
|
|
#define GST_CAT_DEFAULT (rtpjpegpay_debug)
|
|
|
|
|
2009-01-28 10:29:42 +00:00
|
|
|
/*
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
* QUANT_PREFIX_LEN:
|
|
|
|
*
|
|
|
|
* Prefix length in the header before the quantization tables:
|
|
|
|
* Two size bytes and one byte for precision
|
|
|
|
*/
|
|
|
|
#define QUANT_PREFIX_LEN 3
|
|
|
|
|
|
|
|
typedef enum _RtpJpegMarker RtpJpegMarker;
|
|
|
|
|
2009-01-28 10:29:42 +00:00
|
|
|
/*
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
* RtpJpegMarker:
|
|
|
|
* @JPEG_MARKER: Prefix for JPEG marker
|
|
|
|
* @JPEG_MARKER_SOI: Start of Image marker
|
|
|
|
* @JPEG_MARKER_JFIF: JFIF marker
|
|
|
|
* @JPEG_MARKER_CMT: Comment marker
|
|
|
|
* @JPEG_MARKER_DQT: Define Quantization Table marker
|
|
|
|
* @JPEG_MARKER_SOF: Start of Frame marker
|
|
|
|
* @JPEG_MARKER_DHT: Define Huffman Table marker
|
|
|
|
* @JPEG_MARKER_SOS: Start of Scan marker
|
|
|
|
* @JPEG_MARKER_EOI: End of Image marker
|
|
|
|
*
|
|
|
|
* Identifers for markers in JPEG header
|
|
|
|
*/
|
|
|
|
enum _RtpJpegMarker
|
|
|
|
{
|
|
|
|
JPEG_MARKER = 0xFF,
|
|
|
|
JPEG_MARKER_SOI = 0xD8,
|
|
|
|
JPEG_MARKER_JFIF = 0xE0,
|
|
|
|
JPEG_MARKER_CMT = 0xFE,
|
|
|
|
JPEG_MARKER_DQT = 0xDB,
|
|
|
|
JPEG_MARKER_SOF = 0xC0,
|
|
|
|
JPEG_MARKER_DHT = 0xC4,
|
|
|
|
JPEG_MARKER_SOS = 0xDA,
|
|
|
|
JPEG_MARKER_EOI = 0xD9,
|
|
|
|
};
|
|
|
|
|
2009-05-05 14:32:17 +00:00
|
|
|
#define DEFAULT_JPEG_QUANT 255
|
|
|
|
|
|
|
|
#define DEFAULT_JPEG_QUALITY 255
|
|
|
|
#define DEFAULT_JPEG_TYPE 1
|
|
|
|
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_JPEG_QUALITY,
|
|
|
|
PROP_JPEG_TYPE
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
Q_TABLE_0 = 0,
|
|
|
|
Q_TABLE_1,
|
|
|
|
Q_TABLE_MAX /* only support for two tables at the moment */
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _RtpJpegHeader RtpJpegHeader;
|
|
|
|
|
2009-01-28 10:29:42 +00:00
|
|
|
/*
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
* RtpJpegHeader:
|
|
|
|
* @type_spec: type specific
|
|
|
|
* @offset: fragment offset
|
|
|
|
* @type: type field
|
|
|
|
* @q: quantization table for this frame
|
|
|
|
* @width: width of image in 8-pixel multiples
|
|
|
|
* @height: height of image in 8-pixel multiples
|
|
|
|
*
|
|
|
|
* 0 1 2 3
|
|
|
|
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Type-specific | Fragment Offset |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Type | Q | Width | Height |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
*/
|
|
|
|
struct _RtpJpegHeader
|
|
|
|
{
|
|
|
|
guint type_spec:8;
|
|
|
|
guint offset:24;
|
|
|
|
guint8 type;
|
|
|
|
guint8 q;
|
|
|
|
guint8 width;
|
|
|
|
guint8 height;
|
|
|
|
};
|
|
|
|
|
2009-01-28 10:29:42 +00:00
|
|
|
/*
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
* RtpQuantHeader
|
|
|
|
* @mbz: must be zero
|
|
|
|
* @precision: specify size of quantization tables
|
|
|
|
* @length: length of quantization data
|
|
|
|
*
|
|
|
|
* 0 1 2 3
|
|
|
|
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | MBZ | Precision | Length |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Quantization Table Data |
|
|
|
|
* | ... |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
*/
|
2009-05-06 14:09:13 +00:00
|
|
|
typedef struct
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
{
|
|
|
|
guint8 mbz;
|
|
|
|
guint8 precision;
|
|
|
|
guint16 length;
|
2009-05-06 14:09:13 +00:00
|
|
|
} RtpQuantHeader;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
guint8 size;
|
|
|
|
const guint8 *data;
|
|
|
|
} RtpQuantTable;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
guint8 id;
|
|
|
|
guint8 samp;
|
|
|
|
guint8 qt;
|
|
|
|
} CompInfo;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
|
|
|
/* FIXME: restart marker header currently unsupported */
|
|
|
|
|
|
|
|
static void gst_rtp_jpeg_pay_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
|
|
|
|
static void gst_rtp_jpeg_pay_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
|
|
|
|
static gboolean gst_rtp_jpeg_pay_setcaps (GstBaseRTPPayload * basepayload,
|
|
|
|
GstCaps * caps);
|
|
|
|
|
|
|
|
static GstFlowReturn gst_rtp_jpeg_pay_handle_buffer (GstBaseRTPPayload * pad,
|
|
|
|
GstBuffer * buffer);
|
|
|
|
|
|
|
|
GST_BOILERPLATE (GstRtpJPEGPay, gst_rtp_jpeg_pay, GstBaseRTPPayload,
|
|
|
|
GST_TYPE_BASE_RTP_PAYLOAD);
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_rtp_jpeg_pay_base_init (gpointer klass)
|
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&gst_rtp_jpeg_pay_src_template));
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&gst_rtp_jpeg_pay_sink_template));
|
|
|
|
|
|
|
|
gst_element_class_set_details (element_class, &gst_rtp_jpeg_pay_details);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_rtp_jpeg_pay_class_init (GstRtpJPEGPayClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstBaseRTPPayloadClass *gstbasertppayload_class;
|
|
|
|
|
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
|
|
|
|
|
|
|
|
gobject_class->set_property = gst_rtp_jpeg_pay_set_property;
|
|
|
|
gobject_class->get_property = gst_rtp_jpeg_pay_get_property;
|
|
|
|
|
|
|
|
gstbasertppayload_class->set_caps = gst_rtp_jpeg_pay_setcaps;
|
|
|
|
gstbasertppayload_class->handle_buffer = gst_rtp_jpeg_pay_handle_buffer;
|
|
|
|
|
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_JPEG_QUALITY,
|
2009-05-05 14:32:17 +00:00
|
|
|
g_param_spec_int ("quality", "Quality",
|
|
|
|
"Quality factor on JPEG data (unused)", 0, 255, 255,
|
|
|
|
G_PARAM_READWRITE));
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_JPEG_TYPE,
|
2009-05-05 14:32:17 +00:00
|
|
|
g_param_spec_int ("type", "Type",
|
|
|
|
"Default JPEG Type, overwritten by SOF when present", 0, 255,
|
|
|
|
DEFAULT_JPEG_TYPE, G_PARAM_READWRITE));
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (rtpjpegpay_debug, "rtpjpegpay", 0,
|
|
|
|
"Motion JPEG RTP Payloader");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-05-05 14:32:17 +00:00
|
|
|
gst_rtp_jpeg_pay_init (GstRtpJPEGPay * pay, GstRtpJPEGPayClass * klass)
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
{
|
2009-05-05 14:32:17 +00:00
|
|
|
pay->quality = DEFAULT_JPEG_QUALITY;
|
|
|
|
pay->quant = DEFAULT_JPEG_QUANT;
|
|
|
|
pay->type = DEFAULT_JPEG_TYPE;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_rtp_jpeg_pay_setcaps (GstBaseRTPPayload * basepayload, GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstStructure *caps_structure = gst_caps_get_structure (caps, 0);
|
2009-05-05 14:32:17 +00:00
|
|
|
GstRtpJPEGPay *pay;
|
|
|
|
gint width = 0, height = 0;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
2009-05-05 14:32:17 +00:00
|
|
|
pay = GST_RTP_JPEG_PAY (basepayload);
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
2009-05-05 14:32:17 +00:00
|
|
|
/* these properties are not mandatory, we can get them from the SOF, if there
|
|
|
|
* is one. */
|
|
|
|
if (gst_structure_get_int (caps_structure, "height", &height)) {
|
|
|
|
if (height <= 0 || height > 2040)
|
|
|
|
goto invalid_dimension;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
}
|
2009-05-05 14:32:17 +00:00
|
|
|
pay->height = height / 8;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
2009-05-05 14:32:17 +00:00
|
|
|
if (gst_structure_get_int (caps_structure, "width", &width)) {
|
|
|
|
if (width <= 0 || width > 2040)
|
|
|
|
goto invalid_dimension;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
}
|
2009-05-05 14:32:17 +00:00
|
|
|
pay->width = width / 8;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
|
|
|
gst_basertppayload_set_options (basepayload, "video", TRUE, "JPEG", 90000);
|
|
|
|
gst_basertppayload_set_outcaps (basepayload, NULL);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
2009-05-05 14:32:17 +00:00
|
|
|
/* ERRORS */
|
|
|
|
invalid_dimension:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (pay, "Invalid width/height from caps");
|
|
|
|
return FALSE;
|
|
|
|
}
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static guint
|
|
|
|
gst_rtp_jpeg_pay_header_size (const guint8 * data, guint offset)
|
|
|
|
{
|
|
|
|
return data[offset] << 8 | data[offset + 1];
|
|
|
|
}
|
|
|
|
|
|
|
|
static guint
|
|
|
|
gst_rtp_jpeg_pay_read_quant_table (const guint8 * data, guint offset,
|
2009-05-06 14:09:13 +00:00
|
|
|
RtpQuantTable tables[])
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
{
|
2009-05-06 14:09:13 +00:00
|
|
|
gint quant_size, size, result;
|
|
|
|
guint8 prec;
|
|
|
|
guint8 id;
|
2009-05-05 14:32:17 +00:00
|
|
|
|
2009-05-06 14:09:13 +00:00
|
|
|
result = quant_size = gst_rtp_jpeg_pay_header_size (data, offset);
|
|
|
|
offset += 2;
|
|
|
|
quant_size -= 2;
|
2009-05-05 14:32:17 +00:00
|
|
|
|
2009-05-06 14:09:13 +00:00
|
|
|
while (quant_size > 0) {
|
|
|
|
prec = (data[offset] & 0xf0) >> 4;
|
|
|
|
id = data[offset] & 0xf;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
2009-05-06 14:09:13 +00:00
|
|
|
if (prec)
|
|
|
|
size = 128;
|
|
|
|
else
|
|
|
|
size = 64;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
2009-05-06 14:09:13 +00:00
|
|
|
GST_LOG ("read quant table %d, size %d, prec %02x", id, size, prec);
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
2009-05-06 14:09:13 +00:00
|
|
|
tables[id].size = size;
|
|
|
|
tables[id].data = &data[offset + 1];
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
2009-05-06 14:09:13 +00:00
|
|
|
size += 1;
|
|
|
|
quant_size -= size;
|
|
|
|
offset += size;
|
|
|
|
}
|
|
|
|
return result;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
}
|
|
|
|
|
2009-05-05 14:32:17 +00:00
|
|
|
static gboolean
|
|
|
|
gst_rtp_jpeg_pay_read_sof (GstRtpJPEGPay * pay, const guint8 * data,
|
2009-05-06 14:09:13 +00:00
|
|
|
guint * offset, CompInfo info[])
|
2009-05-05 14:32:17 +00:00
|
|
|
{
|
|
|
|
guint sof_size;
|
|
|
|
guint width, height, infolen;
|
2009-05-06 14:09:13 +00:00
|
|
|
CompInfo elem;
|
2009-05-05 14:32:17 +00:00
|
|
|
gint i, j;
|
|
|
|
|
|
|
|
sof_size = gst_rtp_jpeg_pay_header_size (data, *offset);
|
|
|
|
if (sof_size < 17)
|
|
|
|
goto wrong_length;
|
|
|
|
|
|
|
|
/* skip size */
|
|
|
|
*offset += 2;
|
|
|
|
|
|
|
|
/* precision should be 8 */
|
|
|
|
if (data[(*offset)++] != 8)
|
|
|
|
goto bad_precision;
|
|
|
|
|
|
|
|
/* read dimensions */
|
|
|
|
height = data[*offset] << 8 | data[*offset + 1];
|
|
|
|
width = data[*offset + 2] << 8 | data[*offset + 3];
|
|
|
|
*offset += 4;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (pay, "got dimensions %ux%u", height, width);
|
|
|
|
|
|
|
|
if (height == 0 || height > 2040)
|
|
|
|
goto invalid_dimension;
|
|
|
|
if (width == 0 || width > 2040)
|
|
|
|
goto invalid_dimension;
|
|
|
|
|
|
|
|
pay->height = height / 8;
|
|
|
|
pay->width = width / 8;
|
|
|
|
|
|
|
|
/* we only support 3 components */
|
|
|
|
if (data[(*offset)++] != 3)
|
|
|
|
goto bad_components;
|
|
|
|
|
|
|
|
infolen = 0;
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
elem.id = data[(*offset)++];
|
|
|
|
elem.samp = data[(*offset)++];
|
|
|
|
elem.qt = data[(*offset)++];
|
|
|
|
GST_LOG_OBJECT (pay, "got comp %d, samp %02x, qt %d", elem.id, elem.samp,
|
|
|
|
elem.qt);
|
|
|
|
/* insertion sort from the last element to the first */
|
|
|
|
for (j = infolen; j > 1; j--) {
|
|
|
|
if (G_LIKELY (info[j - 1].id < elem.id))
|
|
|
|
break;
|
|
|
|
info[j] = info[j - 1];
|
|
|
|
}
|
|
|
|
info[j] = elem;
|
|
|
|
infolen++;
|
|
|
|
}
|
|
|
|
|
2009-05-06 14:09:13 +00:00
|
|
|
/* see that the components are supported */
|
|
|
|
if (info[0].samp == 0x21)
|
2009-05-05 14:32:17 +00:00
|
|
|
pay->type = 0;
|
2009-05-06 14:09:13 +00:00
|
|
|
else if (info[0].samp == 0x22)
|
2009-05-05 14:32:17 +00:00
|
|
|
pay->type = 1;
|
|
|
|
else
|
|
|
|
goto invalid_comp;
|
|
|
|
|
2009-05-06 14:09:13 +00:00
|
|
|
/* the other components are free to use any quant table but they have to
|
|
|
|
* have the same table id */
|
|
|
|
if (!(info[1].samp == 0x11))
|
|
|
|
goto invalid_comp;
|
2009-05-05 14:32:17 +00:00
|
|
|
|
2009-05-06 14:09:13 +00:00
|
|
|
if (!(info[2].samp == 0x11))
|
2009-05-05 14:32:17 +00:00
|
|
|
goto invalid_comp;
|
|
|
|
|
2009-05-06 14:09:13 +00:00
|
|
|
if (info[1].qt != info[2].qt)
|
2009-05-05 14:32:17 +00:00
|
|
|
goto invalid_comp;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
wrong_length:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (pay, STREAM, FORMAT,
|
|
|
|
("Wrong SOF length %u.", sof_size), (NULL));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
bad_precision:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (pay, STREAM, FORMAT,
|
|
|
|
("Wrong precision, expecting 8."), (NULL));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
invalid_dimension:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (pay, STREAM, FORMAT,
|
|
|
|
("Wrong dimension, size %ux%u", width, height), (NULL));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
bad_components:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (pay, STREAM, FORMAT,
|
|
|
|
("Wrong number of components"), (NULL));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
invalid_comp:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (pay, STREAM, FORMAT, ("Invalid component"), (NULL));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
static RtpJpegMarker
|
|
|
|
gst_rtp_jpeg_pay_scan_marker (const guint8 * data, guint size, guint * offset)
|
|
|
|
{
|
|
|
|
while ((data[(*offset)++] != JPEG_MARKER) && ((*offset) < size));
|
|
|
|
|
|
|
|
if (G_UNLIKELY ((*offset) >= size)) {
|
2009-05-05 14:32:17 +00:00
|
|
|
GST_LOG ("found EOI marker");
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
return JPEG_MARKER_EOI;
|
|
|
|
} else {
|
2009-05-05 14:32:17 +00:00
|
|
|
guint8 marker;
|
|
|
|
|
|
|
|
marker = data[(*offset)++];
|
|
|
|
GST_LOG ("found %02x marker", marker);
|
|
|
|
return marker;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_rtp_jpeg_pay_handle_buffer (GstBaseRTPPayload * basepayload,
|
|
|
|
GstBuffer * buffer)
|
|
|
|
{
|
2009-05-05 14:32:17 +00:00
|
|
|
GstRtpJPEGPay *pay;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
GstClockTime timestamp;
|
|
|
|
GstFlowReturn ret = GST_FLOW_ERROR;
|
|
|
|
RtpJpegHeader jpeg_header;
|
|
|
|
RtpQuantHeader quant_header;
|
2009-05-06 14:09:13 +00:00
|
|
|
RtpQuantTable tables[15] = { {0, NULL}, };
|
|
|
|
CompInfo info[3] = { {0,}, };
|
|
|
|
guint quant_data_size;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
guint8 *data;
|
|
|
|
guint size;
|
|
|
|
guint mtu;
|
|
|
|
guint bytes_left;
|
|
|
|
guint jpeg_header_size = 0;
|
2009-05-06 14:09:13 +00:00
|
|
|
guint offset;
|
|
|
|
gboolean frame_done;
|
2009-05-06 21:56:44 +00:00
|
|
|
gboolean sos_found, sof_found, dqt_found;
|
2009-05-06 14:09:13 +00:00
|
|
|
gint i;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
2009-05-05 14:32:17 +00:00
|
|
|
pay = GST_RTP_JPEG_PAY (basepayload);
|
|
|
|
mtu = GST_BASE_RTP_PAYLOAD_MTU (pay);
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
|
|
|
size = GST_BUFFER_SIZE (buffer);
|
|
|
|
data = GST_BUFFER_DATA (buffer);
|
|
|
|
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
2009-05-06 14:09:13 +00:00
|
|
|
offset = 0;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
2009-05-06 10:54:22 +00:00
|
|
|
GST_LOG_OBJECT (pay, "got buffer size %u, timestamp %" GST_TIME_FORMAT, size,
|
|
|
|
GST_TIME_ARGS (timestamp));
|
|
|
|
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
/* parse the jpeg header for 'start of scan' and read quant tables if needed */
|
2009-05-06 14:09:13 +00:00
|
|
|
sos_found = FALSE;
|
2009-05-06 21:56:44 +00:00
|
|
|
dqt_found = FALSE;
|
|
|
|
sof_found = FALSE;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
while (!sos_found && (offset < size)) {
|
2009-05-06 10:54:22 +00:00
|
|
|
GST_LOG_OBJECT (pay, "checking from offset %u", offset);
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
switch (gst_rtp_jpeg_pay_scan_marker (data, size, &offset)) {
|
|
|
|
case JPEG_MARKER_JFIF:
|
|
|
|
case JPEG_MARKER_CMT:
|
2009-05-06 10:54:22 +00:00
|
|
|
case JPEG_MARKER_DHT:
|
2009-05-05 14:32:17 +00:00
|
|
|
offset += gst_rtp_jpeg_pay_header_size (data, offset);
|
|
|
|
break;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
case JPEG_MARKER_SOF:
|
2009-05-06 14:09:13 +00:00
|
|
|
if (!gst_rtp_jpeg_pay_read_sof (pay, data, &offset, info))
|
2009-05-06 10:54:22 +00:00
|
|
|
goto invalid_format;
|
2009-05-06 21:56:44 +00:00
|
|
|
sof_found = TRUE;
|
2009-05-05 14:32:17 +00:00
|
|
|
break;
|
|
|
|
case JPEG_MARKER_DQT:
|
|
|
|
GST_LOG ("DQT found");
|
2009-05-06 14:09:13 +00:00
|
|
|
offset += gst_rtp_jpeg_pay_read_quant_table (data, offset, tables);
|
2009-05-06 21:56:44 +00:00
|
|
|
dqt_found = TRUE;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
break;
|
|
|
|
case JPEG_MARKER_SOS:
|
|
|
|
sos_found = TRUE;
|
2009-05-05 14:32:17 +00:00
|
|
|
GST_LOG_OBJECT (pay, "SOS found");
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
jpeg_header_size = offset + gst_rtp_jpeg_pay_header_size (data, offset);
|
|
|
|
break;
|
|
|
|
case JPEG_MARKER_EOI:
|
2009-05-05 14:32:17 +00:00
|
|
|
GST_WARNING_OBJECT (pay, "EOI reached before SOS!");
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
break;
|
|
|
|
case JPEG_MARKER_SOI:
|
2009-05-05 14:32:17 +00:00
|
|
|
GST_LOG_OBJECT (pay, "SOI found");
|
|
|
|
break;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-05-06 21:56:44 +00:00
|
|
|
if (!dqt_found || !sof_found)
|
|
|
|
goto unsupported_jpeg;
|
|
|
|
|
2009-05-06 14:09:13 +00:00
|
|
|
/* by now we should either have negotiated the width/height or the SOF header
|
|
|
|
* should have filled us in */
|
|
|
|
if (pay->width == 0 || pay->height == 0)
|
2009-05-05 14:32:17 +00:00
|
|
|
goto no_dimension;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (pay, "header size %u", jpeg_header_size);
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
|
|
|
size -= jpeg_header_size;
|
|
|
|
data += jpeg_header_size;
|
|
|
|
offset = 0;
|
|
|
|
|
2009-05-06 14:09:13 +00:00
|
|
|
/* prepare stuff for the jpeg header */
|
|
|
|
jpeg_header.type_spec = 0;
|
|
|
|
jpeg_header.type = pay->type;
|
|
|
|
jpeg_header.q = pay->quant;
|
|
|
|
jpeg_header.width = pay->width;
|
|
|
|
jpeg_header.height = pay->height;
|
|
|
|
|
|
|
|
/* collect the quant headers sizes */
|
|
|
|
quant_header.mbz = 0;
|
|
|
|
quant_header.precision = 0;
|
|
|
|
quant_header.length = 0;
|
|
|
|
quant_data_size = 0;
|
|
|
|
|
|
|
|
if (pay->quant > 127) {
|
|
|
|
/* for the Y and U component, look up the quant table and its size. quant
|
|
|
|
* tables for U and V should be the same */
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
guint qsize;
|
|
|
|
guint qt;
|
|
|
|
|
|
|
|
qt = info[i].qt;
|
|
|
|
if (qt > 15)
|
|
|
|
goto invalid_quant;
|
|
|
|
|
|
|
|
qsize = tables[qt].size;
|
|
|
|
if (qsize == 0)
|
|
|
|
goto invalid_quant;
|
|
|
|
|
|
|
|
quant_header.precision |= (qsize == 64 ? 0 : (1 << i));
|
|
|
|
quant_data_size += qsize;
|
|
|
|
}
|
|
|
|
quant_header.length = g_htons (quant_data_size);
|
|
|
|
quant_data_size += sizeof (quant_header);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (pay, "quant_data size %u", quant_data_size);
|
|
|
|
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
bytes_left = sizeof (jpeg_header) + quant_data_size + size;
|
|
|
|
|
2009-05-06 14:09:13 +00:00
|
|
|
frame_done = FALSE;
|
|
|
|
do {
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
GstBuffer *outbuf;
|
|
|
|
guint8 *payload;
|
|
|
|
guint payload_size = (bytes_left < mtu ? bytes_left : mtu);
|
|
|
|
|
|
|
|
outbuf = gst_rtp_buffer_new_allocate (payload_size, 0, 0);
|
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
|
|
|
|
|
|
|
|
if (payload_size == bytes_left) {
|
2009-05-05 14:32:17 +00:00
|
|
|
GST_LOG_OBJECT (pay, "last packet of frame");
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
frame_done = TRUE;
|
|
|
|
gst_rtp_buffer_set_marker (outbuf, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
payload = gst_rtp_buffer_get_payload (outbuf);
|
|
|
|
|
2009-05-06 14:09:13 +00:00
|
|
|
/* update offset */
|
|
|
|
#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
|
|
|
|
jpeg_header.offset = ((offset & 0x0000FF) << 16) |
|
|
|
|
((offset & 0xFF0000) >> 16) | (offset & 0x00FF00);
|
|
|
|
#else
|
|
|
|
jpeg_header.offset = offset;
|
|
|
|
#endif
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
memcpy (payload, &jpeg_header, sizeof (jpeg_header));
|
|
|
|
payload += sizeof (jpeg_header);
|
|
|
|
payload_size -= sizeof (jpeg_header);
|
|
|
|
|
|
|
|
/* only send quant table with first packet */
|
|
|
|
if (G_UNLIKELY (quant_data_size > 0)) {
|
|
|
|
memcpy (payload, &quant_header, sizeof (quant_header));
|
|
|
|
payload += sizeof (quant_header);
|
|
|
|
|
2009-05-06 14:09:13 +00:00
|
|
|
/* copy the quant tables for luma and chrominance */
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
guint qsize;
|
|
|
|
guint qt;
|
|
|
|
|
|
|
|
qt = info[i].qt;
|
|
|
|
qsize = tables[qt].size;
|
|
|
|
memcpy (payload, tables[qt].data, qsize);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (pay, "component %d using quant %d, size %d", i, qt,
|
|
|
|
qsize);
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
2009-05-06 14:09:13 +00:00
|
|
|
payload += qsize;
|
|
|
|
}
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
payload_size -= quant_data_size;
|
|
|
|
bytes_left -= quant_data_size;
|
|
|
|
quant_data_size = 0;
|
|
|
|
}
|
2009-05-05 14:32:17 +00:00
|
|
|
GST_LOG_OBJECT (pay, "sending payload size %d", payload_size);
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
2009-05-06 14:09:13 +00:00
|
|
|
memcpy (payload, data, payload_size);
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
|
|
|
ret = gst_basertppayload_push (basepayload, outbuf);
|
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
break;
|
|
|
|
|
|
|
|
bytes_left -= payload_size;
|
|
|
|
offset += payload_size;
|
2009-05-06 14:09:13 +00:00
|
|
|
data += payload_size;
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
}
|
2009-05-06 14:09:13 +00:00
|
|
|
while (!frame_done);
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
|
|
|
|
return ret;
|
2009-05-05 14:32:17 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
2009-05-06 21:56:44 +00:00
|
|
|
unsupported_jpeg:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (pay, STREAM, FORMAT, ("Unsupported JPEG"), (NULL));
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
return GST_FLOW_NOT_SUPPORTED;
|
|
|
|
}
|
2009-05-05 14:32:17 +00:00
|
|
|
no_dimension:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (pay, STREAM, FORMAT, ("No size given"), (NULL));
|
2009-05-06 14:09:13 +00:00
|
|
|
gst_buffer_unref (buffer);
|
2009-05-05 14:32:17 +00:00
|
|
|
return GST_FLOW_NOT_NEGOTIATED;
|
|
|
|
}
|
2009-05-06 10:54:22 +00:00
|
|
|
invalid_format:
|
|
|
|
{
|
|
|
|
/* error was posted */
|
2009-05-06 14:09:13 +00:00
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
invalid_quant:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (pay, STREAM, FORMAT, ("Invalid quant tables"), (NULL));
|
|
|
|
gst_buffer_unref (buffer);
|
2009-05-06 10:54:22 +00:00
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
gst/rtp/: Add JPEG payloader. Fixes #560756.
Original commit message from CVS:
Patch by: Bjorn Ostby <bjornos at axis dot com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpjpegpay.c: (gst_rtp_jpeg_pay_base_init),
(gst_rtp_jpeg_pay_class_init), (gst_rtp_jpeg_pay_init),
(gst_rtp_jpeg_pay_setcaps), (gst_rtp_jpeg_pay_header_size),
(gst_rtp_jpeg_pay_read_quant_table),
(gst_rtp_jpeg_pay_scan_marker), (gst_rtp_jpeg_pay_handle_buffer),
(gst_rtp_jpeg_pay_set_property), (gst_rtp_jpeg_pay_get_property),
(gst_rtp_jpeg_pay_plugin_init):
* gst/rtp/gstrtpjpegpay.h:
Add JPEG payloader. Fixes #560756.
2008-11-14 11:41:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_rtp_jpeg_pay_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstRtpJPEGPay *rtpjpegpay;
|
|
|
|
|
|
|
|
rtpjpegpay = GST_RTP_JPEG_PAY (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_JPEG_QUALITY:
|
|
|
|
rtpjpegpay->quality = g_value_get_int (value);
|
|
|
|
GST_DEBUG_OBJECT (object, "quality = %d", rtpjpegpay->quality);
|
|
|
|
break;
|
|
|
|
case PROP_JPEG_TYPE:
|
|
|
|
rtpjpegpay->type = g_value_get_int (value);
|
|
|
|
GST_DEBUG_OBJECT (object, "type = %d", rtpjpegpay->type);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_rtp_jpeg_pay_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstRtpJPEGPay *rtpjpegpay;
|
|
|
|
|
|
|
|
rtpjpegpay = GST_RTP_JPEG_PAY (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_JPEG_QUALITY:
|
|
|
|
g_value_set_int (value, rtpjpegpay->quality);
|
|
|
|
break;
|
|
|
|
case PROP_JPEG_TYPE:
|
|
|
|
g_value_set_int (value, rtpjpegpay->type);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gst_rtp_jpeg_pay_plugin_init (GstPlugin * plugin)
|
|
|
|
{
|
|
|
|
return gst_element_register (plugin, "rtpjpegpay", GST_RANK_NONE,
|
|
|
|
GST_TYPE_RTP_JPEG_PAY);
|
|
|
|
}
|