mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
gdppay: refactor a little
Get rid of now-useless packetizer struct and just call internal functions directly. Also remove version property which is now defunct, not least because we create the packetizer with the version in the init function before a version can be set.
This commit is contained in:
parent
3e74746d72
commit
c184a4bb04
5 changed files with 57 additions and 238 deletions
|
@ -56,10 +56,8 @@
|
|||
* the event as the payload. In addition, GDP streams can now start with
|
||||
* events as well, as required by the new data stream model in GStreamer 0.10.
|
||||
*
|
||||
* Converting buffers, caps and events to GDP buffers is done using a
|
||||
* #GstDPPacketizer object and invoking its packetizer functions.
|
||||
* For backwards-compatibility reasons, the old 0.2 methods are still
|
||||
* available but deprecated.
|
||||
* Converting buffers, caps and events to GDP buffers is done using the
|
||||
* appropriate functions.
|
||||
*
|
||||
* For reference, this image shows the byte layout of the GDP header:
|
||||
*
|
||||
|
@ -82,6 +80,13 @@ GST_DEBUG_CATEGORY_STATIC (data_protocol_debug);
|
|||
#define GST_CAT_DEFAULT data_protocol_debug
|
||||
#endif
|
||||
|
||||
/* The version of the GDP protocol being used */
|
||||
typedef enum
|
||||
{
|
||||
GST_DP_VERSION_0_2 = 1,
|
||||
GST_DP_VERSION_1_0,
|
||||
} GstDPVersion;
|
||||
|
||||
/* helper macros */
|
||||
|
||||
/* write first 6 bytes of header */
|
||||
|
@ -347,24 +352,6 @@ gst_dp_crc_from_memory_maps (const GstMapInfo * maps, guint n_maps)
|
|||
return (0xffff ^ crc_register);
|
||||
}
|
||||
|
||||
GType
|
||||
gst_dp_version_get_type (void)
|
||||
{
|
||||
static gsize gst_dp_version_type = 0;
|
||||
static const GEnumValue gst_dp_version[] = {
|
||||
{GST_DP_VERSION_0_2, "GST_DP_VERSION_0_2", "0.2"},
|
||||
{GST_DP_VERSION_1_0, "GST_DP_VERSION_1_0", "1.0"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (g_once_init_enter (&gst_dp_version_type)) {
|
||||
GType tmp = g_enum_register_static ("GstDPVersion", gst_dp_version);
|
||||
g_once_init_leave (&gst_dp_version_type, tmp);
|
||||
}
|
||||
|
||||
return (GType) gst_dp_version_type;
|
||||
};
|
||||
|
||||
/**
|
||||
* gst_dp_init:
|
||||
*
|
||||
|
@ -376,15 +363,6 @@ gst_dp_version_get_type (void)
|
|||
void
|
||||
gst_dp_init (void)
|
||||
{
|
||||
static gboolean _gst_dp_initialized = FALSE;
|
||||
|
||||
if (_gst_dp_initialized)
|
||||
return;
|
||||
|
||||
_gst_dp_initialized = TRUE;
|
||||
|
||||
g_type_class_ref (gst_dp_version_get_type ());
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (data_protocol_debug, "gdp", 0,
|
||||
"GStreamer Data Protocol");
|
||||
}
|
||||
|
@ -421,26 +399,26 @@ gst_dp_header_payload_type (const guint8 * header)
|
|||
return GST_DP_HEADER_PAYLOAD_TYPE (header);
|
||||
}
|
||||
|
||||
/*** PACKETIZER FUNCTIONS ***/
|
||||
/* payloading functions */
|
||||
|
||||
static gboolean
|
||||
gst_dp_header_from_buffer_1_0 (GstBuffer * buffer, GstDPHeaderFlag flags,
|
||||
gboolean
|
||||
gst_dp_buffer_to_header (GstBuffer * buffer, GstDPHeaderFlag flags,
|
||||
guint * length, guint8 ** header)
|
||||
{
|
||||
return gst_dp_header_from_buffer_any (buffer, flags, length, header,
|
||||
GST_DP_VERSION_1_0);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_dp_packet_from_caps_1_0 (const GstCaps * caps, GstDPHeaderFlag flags,
|
||||
gboolean
|
||||
gst_dp_caps_to_header (const GstCaps * caps, GstDPHeaderFlag flags,
|
||||
guint * length, guint8 ** header, guint8 ** payload)
|
||||
{
|
||||
return gst_dp_packet_from_caps_any (caps, flags, length, header, payload,
|
||||
GST_DP_VERSION_1_0);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_dp_packet_from_event_1_0 (const GstEvent * event, GstDPHeaderFlag flags,
|
||||
gboolean
|
||||
gst_dp_event_to_header (const GstEvent * event, GstDPHeaderFlag flags,
|
||||
guint * length, guint8 ** header, guint8 ** payload)
|
||||
{
|
||||
guint8 *h;
|
||||
|
@ -783,46 +761,3 @@ gst_dp_validate_packet (guint header_length, const guint8 * header,
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_dp_packetizer_new:
|
||||
* @version: the #GstDPVersion of the protocol to packetize for.
|
||||
*
|
||||
* Creates a new packetizer.
|
||||
*
|
||||
* Returns: a newly allocated #GstDPPacketizer
|
||||
*/
|
||||
GstDPPacketizer *
|
||||
gst_dp_packetizer_new (GstDPVersion version)
|
||||
{
|
||||
GstDPPacketizer *ret;
|
||||
|
||||
ret = g_malloc0 (sizeof (GstDPPacketizer));
|
||||
ret->version = version;
|
||||
|
||||
switch (version) {
|
||||
case GST_DP_VERSION_1_0:
|
||||
ret->header_from_buffer = gst_dp_header_from_buffer_1_0;
|
||||
ret->packet_from_caps = gst_dp_packet_from_caps_1_0;
|
||||
ret->packet_from_event = gst_dp_packet_from_event_1_0;
|
||||
break;
|
||||
default:
|
||||
g_free (ret);
|
||||
ret = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_dp_packetizer_free:
|
||||
* @packetizer: the #GstDPPacketizer to free.
|
||||
*
|
||||
* Free the given packetizer.
|
||||
*/
|
||||
void
|
||||
gst_dp_packetizer_free (GstDPPacketizer * packetizer)
|
||||
{
|
||||
g_free (packetizer);
|
||||
}
|
||||
|
|
|
@ -29,34 +29,6 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* GstDPVersion:
|
||||
* @GST_DP_VERSION_0_2: protocol version 0.2
|
||||
* @GST_DP_VERSION_1_0: protocol version 1.0
|
||||
*
|
||||
* The version of the GDP protocol being used.
|
||||
*/
|
||||
typedef enum {
|
||||
GST_DP_VERSION_0_2 = 1,
|
||||
GST_DP_VERSION_1_0,
|
||||
} GstDPVersion;
|
||||
|
||||
GType gst_dp_version_get_type (void);
|
||||
#define GST_TYPE_DP_VERSION (gst_dp_version_get_type ())
|
||||
|
||||
/**
|
||||
* GST_DP_VERSION_MAJOR:
|
||||
*
|
||||
* The major version number of the GStreamer Data Protocol.
|
||||
*/
|
||||
#define GST_DP_VERSION_MAJOR 0
|
||||
/**
|
||||
* GST_DP_VERSION_MINOR:
|
||||
*
|
||||
* The minor version number of the GStreamer Data Protocol.
|
||||
*/
|
||||
#define GST_DP_VERSION_MINOR 2
|
||||
|
||||
/**
|
||||
* GST_DP_HEADER_LENGTH:
|
||||
*
|
||||
|
@ -97,49 +69,8 @@ typedef enum {
|
|||
GST_DP_PAYLOAD_EVENT_NONE = 64,
|
||||
} GstDPPayloadType;
|
||||
|
||||
typedef gboolean (*GstDPHeaderFromBufferFunction) (GstBuffer * buffer,
|
||||
GstDPHeaderFlag flags,
|
||||
guint * length,
|
||||
guint8 ** header);
|
||||
typedef gboolean (*GstDPPacketFromCapsFunction) (const GstCaps * caps,
|
||||
GstDPHeaderFlag flags,
|
||||
guint * length,
|
||||
guint8 ** header,
|
||||
guint8 ** payload);
|
||||
typedef gboolean (*GstDPPacketFromEventFunction) (const GstEvent * event,
|
||||
GstDPHeaderFlag flags,
|
||||
guint * length,
|
||||
guint8 ** header,
|
||||
guint8 ** payload);
|
||||
|
||||
/**
|
||||
* GstDPPacketizer:
|
||||
* @version: the #GstDPVersion of the protocol to be used
|
||||
* @header_from_buffer: buffer serializer function
|
||||
* @packet_from_caps: caps serializer function
|
||||
* @packet_from_event: event serializer function
|
||||
*
|
||||
* Data protocol packetizer handle.
|
||||
*/
|
||||
typedef struct {
|
||||
GstDPVersion version;
|
||||
|
||||
GstDPHeaderFromBufferFunction header_from_buffer;
|
||||
GstDPPacketFromCapsFunction packet_from_caps;
|
||||
GstDPPacketFromEventFunction packet_from_event;
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
} GstDPPacketizer;
|
||||
|
||||
|
||||
void gst_dp_init (void);
|
||||
|
||||
/* packetizer */
|
||||
GstDPPacketizer *
|
||||
gst_dp_packetizer_new (GstDPVersion version);
|
||||
void gst_dp_packetizer_free (GstDPPacketizer *packetizer);
|
||||
|
||||
/* payload information from header */
|
||||
guint32 gst_dp_header_payload_length (const guint8 * header);
|
||||
GstDPPayloadType
|
||||
|
@ -155,6 +86,24 @@ GstEvent * gst_dp_event_from_packet (guint header_length,
|
|||
const guint8 * header,
|
||||
const guint8 * payload);
|
||||
|
||||
/* payloading GstBuffer/GstEvent/GstCaps */
|
||||
gboolean gst_dp_buffer_to_header (GstBuffer * buffer,
|
||||
GstDPHeaderFlag flags,
|
||||
guint * length,
|
||||
guint8 ** header);
|
||||
|
||||
gboolean gst_dp_caps_to_header (const GstCaps * caps,
|
||||
GstDPHeaderFlag flags,
|
||||
guint * length,
|
||||
guint8 ** header,
|
||||
guint8 ** payload);
|
||||
|
||||
gboolean gst_dp_event_to_header (const GstEvent * event,
|
||||
GstDPHeaderFlag flags,
|
||||
guint * length,
|
||||
guint8 ** header,
|
||||
guint8 ** payload);
|
||||
|
||||
/* validation */
|
||||
gboolean gst_dp_validate_header (guint header_length,
|
||||
const guint8 * header);
|
||||
|
|
|
@ -57,14 +57,12 @@ GST_DEBUG_CATEGORY_STATIC (gst_gdp_pay_debug);
|
|||
|
||||
#define DEFAULT_CRC_HEADER TRUE
|
||||
#define DEFAULT_CRC_PAYLOAD FALSE
|
||||
#define DEFAULT_VERSION GST_DP_VERSION_1_0
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_CRC_HEADER,
|
||||
PROP_CRC_PAYLOAD,
|
||||
PROP_VERSION,
|
||||
PROP_CRC_PAYLOAD
|
||||
};
|
||||
|
||||
#define _do_init \
|
||||
|
@ -113,12 +111,6 @@ gst_gdp_pay_class_init (GstGDPPayClass * klass)
|
|||
g_param_spec_boolean ("crc-payload", "CRC Payload",
|
||||
"Calculate and store a CRC checksum on the payload",
|
||||
DEFAULT_CRC_PAYLOAD, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_class, PROP_VERSION,
|
||||
g_param_spec_enum ("version", "Version",
|
||||
"Version of the GStreamer Data Protocol",
|
||||
GST_TYPE_DP_VERSION, DEFAULT_VERSION,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
gst_element_class_set_static_metadata (gstelement_class,
|
||||
"GDP Payloader", "GDP/Payloader",
|
||||
"Payloads GStreamer Data Protocol buffers",
|
||||
|
@ -152,10 +144,7 @@ gst_gdp_pay_init (GstGDPPay * gdppay)
|
|||
gdppay->crc_header = DEFAULT_CRC_HEADER;
|
||||
gdppay->crc_payload = DEFAULT_CRC_PAYLOAD;
|
||||
gdppay->header_flag = gdppay->crc_header | gdppay->crc_payload;
|
||||
gdppay->version = DEFAULT_VERSION;
|
||||
gdppay->offset = 0;
|
||||
|
||||
gdppay->packetizer = gst_dp_packetizer_new (gdppay->version);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -164,7 +153,6 @@ gst_gdp_pay_finalize (GObject * gobject)
|
|||
GstGDPPay *this = GST_GDP_PAY (gobject);
|
||||
|
||||
gst_gdp_pay_reset (this);
|
||||
gst_dp_packetizer_free (this->packetizer);
|
||||
|
||||
GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (gobject));
|
||||
}
|
||||
|
@ -212,8 +200,7 @@ gst_gdp_buffer_from_caps (GstGDPPay * this, GstCaps * caps)
|
|||
guint8 *header, *payload;
|
||||
guint len, plen;
|
||||
|
||||
if (!this->packetizer->packet_from_caps (caps, this->header_flag, &len,
|
||||
&header, &payload))
|
||||
if (!gst_dp_caps_to_header (caps, this->header_flag, &len, &header, &payload))
|
||||
goto packet_failed;
|
||||
|
||||
GST_LOG_OBJECT (this, "creating GDP header and payload buffer from caps");
|
||||
|
@ -241,8 +228,7 @@ gst_gdp_pay_buffer_from_buffer (GstGDPPay * this, GstBuffer * buffer)
|
|||
guint8 *header;
|
||||
guint len;
|
||||
|
||||
if (!this->packetizer->header_from_buffer (buffer, this->header_flag, &len,
|
||||
&header))
|
||||
if (!gst_dp_buffer_to_header (buffer, this->header_flag, &len, &header))
|
||||
goto no_buffer;
|
||||
|
||||
GST_LOG_OBJECT (this, "creating GDP header and payload buffer from buffer");
|
||||
|
@ -271,8 +257,8 @@ gst_gdp_buffer_from_event (GstGDPPay * this, GstEvent * event)
|
|||
gboolean ret;
|
||||
|
||||
ret =
|
||||
this->packetizer->packet_from_event (event, this->header_flag, &len,
|
||||
&header, &payload);
|
||||
gst_dp_event_to_header (event, this->header_flag, &len, &header,
|
||||
&payload);
|
||||
if (!ret)
|
||||
goto no_event;
|
||||
|
||||
|
@ -347,7 +333,6 @@ gst_gdp_pay_reset_streamheader (GstGDPPay * this)
|
|||
GstCaps *caps;
|
||||
GstStructure *structure;
|
||||
GstFlowReturn r = GST_FLOW_OK;
|
||||
gboolean version_one_zero = TRUE;
|
||||
GstGDPPayAndArray gdp_and_array;
|
||||
|
||||
GValue array = { 0 };
|
||||
|
@ -356,46 +341,19 @@ gst_gdp_pay_reset_streamheader (GstGDPPay * this)
|
|||
gdp_and_array.array = &array;
|
||||
|
||||
GST_DEBUG_OBJECT (this, "start");
|
||||
/* In version 0.2, we didn't need or send new segment or tags */
|
||||
if (this->version == GST_DP_VERSION_0_2)
|
||||
version_one_zero = FALSE;
|
||||
|
||||
if (version_one_zero) {
|
||||
if (!this->have_segment || !this->have_caps || !this->have_streamstartid) {
|
||||
GST_DEBUG_OBJECT (this, "1.0, missing new_segment or caps or stream "
|
||||
"start id, returning");
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
} else {
|
||||
if (!this->have_caps) {
|
||||
GST_DEBUG_OBJECT (this, "0.2, missing caps, returning");
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
if (!this->have_segment || !this->have_caps || !this->have_streamstartid) {
|
||||
GST_DEBUG_OBJECT (this, "1.0, missing new_segment or caps or stream "
|
||||
"start id, returning");
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
/* put copies of the buffers in a fixed list
|
||||
* Stamp the buffers with offset and offset_end as well.
|
||||
* We do this here so the offsets match the order the buffers go out in */
|
||||
g_value_init (&array, GST_TYPE_ARRAY);
|
||||
if (version_one_zero) {
|
||||
gst_pad_sticky_events_foreach (this->sinkpad,
|
||||
gdp_streamheader_array_store_events, &gdp_and_array);
|
||||
} else {
|
||||
GstEvent *capsevent =
|
||||
gst_pad_get_sticky_event (this->sinkpad, GST_EVENT_CAPS, 0);
|
||||
if (capsevent) {
|
||||
GstCaps *caps;
|
||||
GstBuffer *capsbuffer = NULL;
|
||||
|
||||
gst_event_parse_caps (capsevent, &caps);
|
||||
capsbuffer = gst_gdp_buffer_from_caps (this, caps);
|
||||
|
||||
gst_gdp_stamp_buffer (this, capsbuffer);
|
||||
gdp_streamheader_array_append_take_buffer (&array, capsbuffer);
|
||||
|
||||
gst_event_unref (capsevent);
|
||||
}
|
||||
}
|
||||
gst_pad_sticky_events_foreach (this->sinkpad,
|
||||
gdp_streamheader_array_store_events, &gdp_and_array);
|
||||
|
||||
/* we also need to add GDP serializations of the streamheaders of the
|
||||
* incoming caps */
|
||||
|
@ -761,9 +719,6 @@ gst_gdp_pay_set_property (GObject * object, guint prop_id,
|
|||
g_value_get_boolean (value) ? GST_DP_HEADER_FLAG_CRC_PAYLOAD : 0;
|
||||
this->header_flag = this->crc_header | this->crc_payload;
|
||||
break;
|
||||
case PROP_VERSION:
|
||||
this->version = g_value_get_enum (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -786,9 +741,6 @@ gst_gdp_pay_get_property (GObject * object, guint prop_id,
|
|||
case PROP_CRC_PAYLOAD:
|
||||
g_value_set_boolean (value, this->crc_payload);
|
||||
break;
|
||||
case PROP_VERSION:
|
||||
g_value_set_enum (value, this->version);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
|
|
@ -65,8 +65,6 @@ struct _GstGDPPay
|
|||
gboolean crc_header;
|
||||
gboolean crc_payload;
|
||||
GstDPHeaderFlag header_flag;
|
||||
GstDPVersion version;
|
||||
GstDPPacketizer *packetizer;
|
||||
};
|
||||
|
||||
struct _GstGDPPayClass
|
||||
|
|
|
@ -112,12 +112,9 @@ GST_START_TEST (test_audio_per_byte)
|
|||
GstBuffer *buffer, *outbuffer;
|
||||
guint8 *header, *payload;
|
||||
guint len;
|
||||
GstDPPacketizer *pk;
|
||||
GstEvent *event;
|
||||
GstSegment segment;
|
||||
|
||||
pk = gst_dp_packetizer_new (GST_DP_VERSION_1_0);
|
||||
|
||||
gdpdepay = setup_gdpdepay ();
|
||||
srcpad = gst_element_get_static_pad (gdpdepay, "src");
|
||||
|
||||
|
@ -136,7 +133,7 @@ GST_START_TEST (test_audio_per_byte)
|
|||
|
||||
/* send stream-start event */
|
||||
event = gst_event_new_stream_start ("s-s-id-1234");
|
||||
fail_unless (pk->packet_from_event (event, 0, &len, &header, &payload));
|
||||
fail_unless (gst_dp_event_to_header (event, 0, &len, &header, &payload));
|
||||
gst_event_unref (event);
|
||||
gdpdepay_push_per_byte ("caps header", header, len);
|
||||
fail_unless_equals_int (g_list_length (buffers), 0);
|
||||
|
@ -149,7 +146,7 @@ GST_START_TEST (test_audio_per_byte)
|
|||
|
||||
/* create caps and buffer packets and push them */
|
||||
caps = gst_caps_from_string (AUDIO_CAPS_STRING);
|
||||
fail_unless (pk->packet_from_caps (caps, 0, &len, &header, &payload));
|
||||
fail_unless (gst_dp_caps_to_header (caps, 0, &len, &header, &payload));
|
||||
gst_caps_unref (caps);
|
||||
gdpdepay_push_per_byte ("caps header", header, len);
|
||||
fail_unless_equals_int (g_list_length (buffers), 0);
|
||||
|
@ -166,7 +163,7 @@ GST_START_TEST (test_audio_per_byte)
|
|||
/* send segment */
|
||||
gst_segment_init (&segment, GST_FORMAT_TIME);
|
||||
event = gst_event_new_segment (&segment);
|
||||
fail_unless (pk->packet_from_event (event, 0, &len, &header, &payload));
|
||||
fail_unless (gst_dp_event_to_header (event, 0, &len, &header, &payload));
|
||||
gst_event_unref (event);
|
||||
gdpdepay_push_per_byte ("caps header", header, len);
|
||||
fail_unless_equals_int (g_list_length (buffers), 0);
|
||||
|
@ -181,7 +178,7 @@ GST_START_TEST (test_audio_per_byte)
|
|||
gst_buffer_fill (buffer, 0, "f00d", 4);
|
||||
GST_BUFFER_TIMESTAMP (buffer) = GST_SECOND;
|
||||
GST_BUFFER_DURATION (buffer) = GST_SECOND / 10;
|
||||
fail_unless (pk->header_from_buffer (buffer, 0, &len, &header));
|
||||
fail_unless (gst_dp_buffer_to_header (buffer, 0, &len, &header));
|
||||
gdpdepay_push_per_byte ("buffer header", header, len);
|
||||
fail_unless_equals_int (g_list_length (buffers), 0);
|
||||
gdpdepay_push_per_byte ("buffer payload", (const guint8 *) "f00d",
|
||||
|
@ -206,8 +203,6 @@ GST_START_TEST (test_audio_per_byte)
|
|||
buffers = NULL;
|
||||
gst_object_unref (srcpad);
|
||||
cleanup_gdpdepay (gdpdepay);
|
||||
|
||||
gst_dp_packetizer_free (pk);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
@ -223,12 +218,9 @@ GST_START_TEST (test_audio_in_one_buffer)
|
|||
guint8 *segment_header, *segment_payload;
|
||||
guint header_len, payload_len, streamstart_len, segment_len;
|
||||
guint i;
|
||||
GstDPPacketizer *pk;
|
||||
GstEvent *event;
|
||||
GstSegment segment;
|
||||
|
||||
pk = gst_dp_packetizer_new (GST_DP_VERSION_1_0);
|
||||
|
||||
gdpdepay = setup_gdpdepay ();
|
||||
srcpad = gst_element_get_static_pad (gdpdepay, "src");
|
||||
|
||||
|
@ -248,25 +240,25 @@ GST_START_TEST (test_audio_in_one_buffer)
|
|||
|
||||
/* create stream-start event */
|
||||
event = gst_event_new_stream_start ("s-s-id-1234");
|
||||
fail_unless (pk->packet_from_event (event, 0, &streamstart_len,
|
||||
fail_unless (gst_dp_event_to_header (event, 0, &streamstart_len,
|
||||
&streamstart_header, &streamstart_payload));
|
||||
gst_event_unref (event);
|
||||
|
||||
/* create caps and buffer packets and push them as one buffer */
|
||||
caps = gst_caps_from_string (AUDIO_CAPS_STRING);
|
||||
fail_unless (pk->packet_from_caps (caps, 0, &header_len, &caps_header,
|
||||
fail_unless (gst_dp_caps_to_header (caps, 0, &header_len, &caps_header,
|
||||
&caps_payload));
|
||||
|
||||
/* create segment */
|
||||
gst_segment_init (&segment, GST_FORMAT_TIME);
|
||||
event = gst_event_new_segment (&segment);
|
||||
fail_unless (pk->packet_from_event (event, 0, &segment_len, &segment_header,
|
||||
fail_unless (gst_dp_event_to_header (event, 0, &segment_len, &segment_header,
|
||||
&segment_payload));
|
||||
gst_event_unref (event);
|
||||
|
||||
buffer = gst_buffer_new_and_alloc (4);
|
||||
gst_buffer_fill (buffer, 0, "f00d", 4);
|
||||
fail_unless (pk->header_from_buffer (buffer, 0, &header_len, &buf_header));
|
||||
fail_unless (gst_dp_buffer_to_header (buffer, 0, &header_len, &buf_header));
|
||||
|
||||
payload_len =
|
||||
gst_dp_header_payload_length (caps_header) +
|
||||
|
@ -325,8 +317,6 @@ GST_START_TEST (test_audio_in_one_buffer)
|
|||
buffers = NULL;
|
||||
ASSERT_OBJECT_REFCOUNT (gdpdepay, "gdpdepay", 1);
|
||||
cleanup_gdpdepay (gdpdepay);
|
||||
|
||||
gst_dp_packetizer_free (pk);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
@ -372,9 +362,6 @@ GST_START_TEST (test_streamheader)
|
|||
GstStructure *structure;
|
||||
GValue array = { 0 };
|
||||
GValue value = { 0 };
|
||||
GstDPPacketizer *pk;
|
||||
|
||||
pk = gst_dp_packetizer_new (GST_DP_VERSION_1_0);
|
||||
|
||||
gdpdepay = setup_gdpdepay_streamheader ();
|
||||
srcpad = gst_element_get_static_pad (gdpdepay, "src");
|
||||
|
@ -414,23 +401,23 @@ GST_START_TEST (test_streamheader)
|
|||
/* basic events */
|
||||
/* create stream-start event */
|
||||
event = gst_event_new_stream_start ("s-s-id-1234");
|
||||
fail_unless (pk->packet_from_event (event, 0, &streamstart_len,
|
||||
fail_unless (gst_dp_event_to_header (event, 0, &streamstart_len,
|
||||
&streamstart_header, &streamstart_payload));
|
||||
gst_event_unref (event);
|
||||
|
||||
/* create segment */
|
||||
gst_segment_init (&segment, GST_FORMAT_TIME);
|
||||
event = gst_event_new_segment (&segment);
|
||||
fail_unless (pk->packet_from_event (event, 0, &segment_len, &segment_header,
|
||||
fail_unless (gst_dp_event_to_header (event, 0, &segment_len, &segment_header,
|
||||
&segment_payload));
|
||||
gst_event_unref (event);
|
||||
|
||||
/* create GDP packets for the caps and the buffer, and put them in one
|
||||
* GDP buffer */
|
||||
fail_unless (pk->packet_from_caps (caps, 0, &header_len, &caps_header,
|
||||
fail_unless (gst_dp_caps_to_header (caps, 0, &header_len, &caps_header,
|
||||
&caps_payload));
|
||||
|
||||
fail_unless (pk->header_from_buffer (buffer, 0, &header_len, &buf_header));
|
||||
fail_unless (gst_dp_buffer_to_header (buffer, 0, &header_len, &buf_header));
|
||||
|
||||
payload_len =
|
||||
gst_dp_header_payload_length (caps_header) +
|
||||
|
@ -501,8 +488,6 @@ GST_START_TEST (test_streamheader)
|
|||
buffers = NULL;
|
||||
ASSERT_OBJECT_REFCOUNT (gdpdepay, "gdpdepay", 1);
|
||||
cleanup_gdpdepay (gdpdepay);
|
||||
|
||||
gst_dp_packetizer_free (pk);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
|
Loading…
Reference in a new issue