mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
Fix a memleak in gst_cmml_track_list_add_clip.
Original commit message from CVS: 2006-02-25 Alessandro Decina <alessandro@nnva.org> * ext/annodex/Makefile.am: * ext/annodex/gstannodex.c: * ext/annodex/gstcmmldec.c: * ext/annodex/gstcmmlenc.c: * ext/annodex/gstcmmlparser.c: * ext/annodex/gstcmmlparser.h: * ext/annodex/gstcmmlutils.c: * tests/check/elements/cmmldec.c: * tests/check/elements/cmmlenc.c: Fix a memleak in gst_cmml_track_list_add_clip. Handle overflows in clip's start and end times. Add the "encoded" parameter to cmmldec and cmmlenc caps. Do not parse junk at the end of a CMML preamble buffer. Register a libxml error handler to not print stuff on stderr. Check for bad clip start and end times in the testsuites.
This commit is contained in:
parent
36e55fc858
commit
675a5afed0
24 changed files with 195 additions and 128 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
2006-02-25 Alessandro Decina <alessandro@nnva.org>
|
||||
|
||||
* ext/annodex/Makefile.am:
|
||||
* ext/annodex/gstannodex.c:
|
||||
* ext/annodex/gstcmmldec.c:
|
||||
* ext/annodex/gstcmmlenc.c:
|
||||
* ext/annodex/gstcmmlparser.c:
|
||||
* ext/annodex/gstcmmlparser.h:
|
||||
* ext/annodex/gstcmmlutils.c:
|
||||
* tests/check/elements/cmmldec.c:
|
||||
* tests/check/elements/cmmlenc.c:
|
||||
Fix a memleak in gst_cmml_track_list_add_clip.
|
||||
Handle overflows in clip's start and end times.
|
||||
Add the "encoded" parameter to cmmldec and cmmlenc caps.
|
||||
Do not parse junk at the end of a CMML preamble buffer.
|
||||
Register a libxml error handler to not print stuff on stderr.
|
||||
Check for bad clip start and end times in the testsuites.
|
||||
|
||||
2006-02-25 Julien MOUTTE <julien@moutte.net>
|
||||
|
||||
* ext/annodex/gstcmmldec.c: (gst_cmml_dec_class_init),
|
||||
|
|
|
@ -12,8 +12,7 @@ libgstannodex_la_SOURCES = \
|
|||
gstcmmldec.c \
|
||||
gstcmmlenc.c \
|
||||
gstcmmltag.c \
|
||||
gstcmmlparser.c \
|
||||
gstskeltag.c
|
||||
gstcmmlparser.c
|
||||
|
||||
# flags used to compile this plugin
|
||||
# we use the GST_LIBS flags because we might be using plug-in libs
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <gst/tag/tag.h>
|
||||
#include "gstcmmlparser.h"
|
||||
#include "gstcmmlenc.h"
|
||||
#include "gstcmmldec.h"
|
||||
|
||||
|
@ -49,9 +51,9 @@ gst_annodex_granule_to_time (gint64 granulepos, gint64 granulerate_n,
|
|||
granulepos = keyindex + keyoffset;
|
||||
}
|
||||
|
||||
/* GST_SECOND / granulerate_n / granulerate_d */
|
||||
/* GST_SECOND / (granulerate_n / granulerate_d) */
|
||||
granulerate = gst_util_uint64_scale (GST_SECOND,
|
||||
granulerate_n, granulerate_d);
|
||||
granulerate_d, granulerate_n);
|
||||
|
||||
/* granulepos * granulerate */
|
||||
res = gst_util_uint64_scale (granulepos, granulerate, 1);
|
||||
|
@ -135,7 +137,6 @@ fail:
|
|||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
|
||||
gst_tag_register (GST_TAG_CMML_STREAM, GST_TAG_FLAG_META,
|
||||
GST_TYPE_CMML_TAG_STREAM, "cmml-stream", "annodex CMML stream tag", NULL);
|
||||
|
||||
|
@ -145,6 +146,8 @@ plugin_init (GstPlugin * plugin)
|
|||
gst_tag_register (GST_TAG_CMML_CLIP, GST_TAG_FLAG_META,
|
||||
GST_TYPE_CMML_TAG_CLIP, "cmml-clip", "annodex CMML clip tag", NULL);
|
||||
|
||||
gst_cmml_parser_init ();
|
||||
|
||||
if (!gst_cmml_enc_plugin_init (plugin))
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -79,14 +79,14 @@ static GstStaticPadTemplate gst_cmml_dec_src_factory =
|
|||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("text/xml")
|
||||
GST_STATIC_CAPS ("text/x-cmml, encoded = (boolean) false")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate gst_cmml_dec_sink_factory =
|
||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("text/x-cmml")
|
||||
GST_STATIC_CAPS ("text/x-cmml, encoded = (boolean) true")
|
||||
);
|
||||
|
||||
/* GstCmmlDec */
|
||||
|
@ -449,6 +449,9 @@ gst_cmml_dec_new_buffer (GstCmmlDec * dec,
|
|||
if (data)
|
||||
memcpy (GST_BUFFER_DATA (*buffer), data, size);
|
||||
GST_BUFFER_TIMESTAMP (*buffer) = dec->timestamp;
|
||||
} else {
|
||||
GST_WARNING_OBJECT (dec, "alloc function returned error %s",
|
||||
gst_flow_get_name (res));
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -505,8 +508,11 @@ gst_cmml_dec_parse_first_header (GstCmmlDec * dec, GstBuffer * buffer)
|
|||
* will be triggered. Otherwise we need to call it manually.
|
||||
*/
|
||||
if (!GST_FLOW_IS_FATAL (dec->flow_return) && !dec->sent_root) {
|
||||
gst_cmml_dec_parse_preamble (dec, GST_BUFFER_DATA (buffer),
|
||||
(guchar *) "<cmml>");
|
||||
guchar *preamble = (guchar *) g_strndup ((gchar *) GST_BUFFER_DATA (buffer),
|
||||
GST_BUFFER_SIZE (buffer));
|
||||
|
||||
gst_cmml_dec_parse_preamble (dec, preamble, (guchar *) "<cmml>");
|
||||
g_free (preamble);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -536,6 +542,7 @@ gst_cmml_dec_parse_preamble (GstCmmlDec * dec, guchar * preamble,
|
|||
|
||||
/* send the root element to the internal parser */
|
||||
gst_cmml_dec_parse_xml (dec, root_element, strlen ((gchar *) root_element));
|
||||
dec->sent_root = TRUE;
|
||||
|
||||
/* push the root element */
|
||||
dec->flow_return = gst_cmml_dec_new_buffer (dec,
|
||||
|
@ -546,7 +553,6 @@ gst_cmml_dec_parse_preamble (GstCmmlDec * dec, guchar * preamble,
|
|||
dec->flow_return = gst_pad_push (dec->srcpad, buffer);
|
||||
if (!GST_FLOW_IS_FATAL (dec->flow_return)) {
|
||||
GST_INFO_OBJECT (dec, "preamble parsed");
|
||||
dec->sent_root = TRUE;
|
||||
}
|
||||
|
||||
done:
|
||||
|
|
|
@ -75,14 +75,14 @@ static GstStaticPadTemplate gst_cmml_enc_src_factory =
|
|||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("text/x-cmml")
|
||||
GST_STATIC_CAPS ("text/x-cmml, encoded = (boolean) true")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate gst_cmml_enc_sink_factory =
|
||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("text/xml")
|
||||
GST_STATIC_CAPS ("text/x-cmml, encoded = (boolean) false")
|
||||
);
|
||||
|
||||
GST_BOILERPLATE (GstCmmlEnc, gst_cmml_enc, GstElement, GST_TYPE_ELEMENT);
|
||||
|
@ -103,9 +103,6 @@ static void gst_cmml_enc_parse_tag_clip (GstCmmlEnc * enc,
|
|||
GstCmmlTagClip * tag);
|
||||
static GstFlowReturn gst_cmml_enc_new_buffer (GstCmmlEnc * enc,
|
||||
guchar * data, gint size, GstBuffer ** buffer);
|
||||
#if 0
|
||||
static void gst_cmml_enc_flush_clips (GstCmmlEnc * enc);
|
||||
#endif
|
||||
static GstFlowReturn gst_cmml_enc_push_clip (GstCmmlEnc * enc,
|
||||
GstCmmlTagClip * clip, GstClockTime prev_clip_time);
|
||||
static GstFlowReturn gst_cmml_enc_push (GstCmmlEnc * enc, GstBuffer * buffer);
|
||||
|
@ -137,13 +134,13 @@ gst_cmml_enc_class_init (GstCmmlEncClass * enc_class)
|
|||
g_param_spec_int64 ("granule-rate-numerator",
|
||||
"Granulerate numerator",
|
||||
"Granulerate numerator",
|
||||
0, G_MAXINT64, 1, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
0, G_MAXINT64, 1000, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (klass, GST_CMML_ENC_GRANULERATE_D,
|
||||
g_param_spec_int64 ("granule-rate-denominator",
|
||||
"Granulerate denominator",
|
||||
"Granulerate denominator",
|
||||
0, G_MAXINT64, 1000, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
0, G_MAXINT64, 1, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (klass, GST_CMML_ENC_GRANULESHIFT,
|
||||
g_param_spec_uchar ("granule-shift",
|
||||
|
@ -304,15 +301,15 @@ gst_cmml_enc_new_buffer (GstCmmlEnc * enc,
|
|||
if (data)
|
||||
memcpy (GST_BUFFER_DATA (*buffer), data, size);
|
||||
} else {
|
||||
GST_ELEMENT_ERROR (enc, STREAM, ENCODE,
|
||||
(NULL), ("alloc function returned error %s", gst_flow_get_name (res)));
|
||||
GST_WARNING_OBJECT (enc, "alloc function returned error %s",
|
||||
gst_flow_get_name (res));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
gst_cmml_enc_set_header_on_caps (GstCaps * caps,
|
||||
gst_cmml_enc_set_header_on_caps (GstCmmlEnc * enc, GstCaps * caps,
|
||||
GstBuffer * ident, GstBuffer * preamble, GstBuffer * head)
|
||||
{
|
||||
GValue array = { 0 };
|
||||
|
@ -387,13 +384,6 @@ gst_cmml_enc_parse_end_tag (GstCmmlEnc * enc)
|
|||
GstBuffer *buffer;
|
||||
|
||||
GST_INFO_OBJECT (enc, "parsing end tag");
|
||||
#if 0
|
||||
if (!enc->streaming)
|
||||
gst_cmml_enc_flush_clips (enc);
|
||||
|
||||
if (GST_FLOW_IS_FATAL (enc->flow_return))
|
||||
goto done;
|
||||
#endif
|
||||
|
||||
/* push an empty buffer to signal EOS */
|
||||
enc->flow_return = gst_cmml_enc_new_buffer (enc, NULL, 0, &buffer);
|
||||
|
@ -444,24 +434,23 @@ gst_cmml_enc_parse_tag_head (GstCmmlEnc * enc, GstCmmlTagHead * head)
|
|||
headers = g_list_append (headers, head_buf);
|
||||
|
||||
caps = gst_pad_get_caps (enc->srcpad);
|
||||
/* this call unrefs caps and creates new caps */
|
||||
caps = gst_cmml_enc_set_header_on_caps (caps,
|
||||
caps = gst_cmml_enc_set_header_on_caps (enc, caps,
|
||||
ident_buf, preamble_buf, head_buf);
|
||||
|
||||
for (walk = headers; walk; walk = walk->next) {
|
||||
buffer = GST_BUFFER (walk->data);
|
||||
while (headers) {
|
||||
buffer = GST_BUFFER (headers->data);
|
||||
/* set granulepos 0 on headers */
|
||||
GST_BUFFER_OFFSET_END (buffer) = 0;
|
||||
gst_buffer_set_caps (buffer, caps);
|
||||
|
||||
enc->flow_return = gst_cmml_enc_push (enc, buffer);
|
||||
headers = g_list_delete_link (headers, headers);
|
||||
|
||||
if (GST_FLOW_IS_FATAL (enc->flow_return))
|
||||
goto push_error;
|
||||
|
||||
}
|
||||
|
||||
gst_caps_unref (caps);
|
||||
g_list_free (headers);
|
||||
|
||||
enc->sent_headers = TRUE;
|
||||
return;
|
||||
|
@ -481,22 +470,6 @@ alloc_error:
|
|||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
gst_cmml_enc_flush_clips (GstCmmlEnc * enc)
|
||||
{
|
||||
GList *clips, *walk;
|
||||
|
||||
clips = gst_cmml_track_list_get_clips (enc->tracks);
|
||||
for (walk = clips; walk; walk = g_list_next (walk)) {
|
||||
enc->flow_return = gst_cmml_enc_push_clip (enc,
|
||||
GST_CMML_TAG_CLIP (walk->data));
|
||||
if (!GST_FLOW_IS_FATAL (enc->flow_return))
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* encode a CMML clip tag
|
||||
* remove the start and end attributes (GstCmmlParser does this itself) and
|
||||
* push the tag with the timestamp of its start attribute. If the tag has the
|
||||
|
@ -510,7 +483,7 @@ gst_cmml_enc_parse_tag_clip (GstCmmlEnc * enc, GstCmmlTagClip * clip)
|
|||
|
||||
/* this can happen if there's a programming error (eg user forgets to set
|
||||
* the start-time property) or if one of the gst_cmml_clock_time_from_*
|
||||
* overflows in the GstCmmlParser code */
|
||||
* overflows in GstCmmlParser */
|
||||
if (clip->start_time == GST_CLOCK_TIME_NONE) {
|
||||
GST_ELEMENT_ERROR (enc, STREAM, ENCODE,
|
||||
(NULL), ("invalid start time for clip (%s)", clip->id));
|
||||
|
@ -519,10 +492,12 @@ gst_cmml_enc_parse_tag_clip (GstCmmlEnc * enc, GstCmmlTagClip * clip)
|
|||
return;
|
||||
}
|
||||
|
||||
/* get the previous clip's start time to encode the current granulepos */
|
||||
prev_clip = gst_cmml_track_list_get_track_last_clip (enc->tracks,
|
||||
(gchar *) clip->track);
|
||||
if (prev_clip) {
|
||||
prev_clip_time = prev_clip->start_time;
|
||||
/* we don't need the prev clip anymore */
|
||||
gst_cmml_track_list_del_clip (enc->tracks, prev_clip);
|
||||
}
|
||||
|
||||
|
@ -543,10 +518,8 @@ gst_cmml_enc_push_clip (GstCmmlEnc * enc, GstCmmlTagClip * clip,
|
|||
|
||||
if (prev_clip_time != GST_CLOCK_TIME_NONE &&
|
||||
prev_clip_time > clip->start_time) {
|
||||
GST_ELEMENT_ERROR (enc, STREAM, ENCODE,
|
||||
(NULL), ("previous clip start time > current clip (%s) start time",
|
||||
clip->id));
|
||||
return GST_FLOW_ERROR;
|
||||
GST_WARNING_OBJECT (enc,
|
||||
"previous clip start time > current clip (%s) start time", clip->id);
|
||||
}
|
||||
|
||||
/* encode the clip */
|
||||
|
@ -566,6 +539,9 @@ gst_cmml_enc_push_clip (GstCmmlEnc * enc, GstCmmlTagClip * clip,
|
|||
/* set the granulepos */
|
||||
granulepos = gst_cmml_clock_time_to_granule (prev_clip_time, clip->start_time,
|
||||
enc->granulerate_n, enc->granulerate_d, enc->granuleshift);
|
||||
if (granulepos == -1)
|
||||
goto granule_overflow;
|
||||
|
||||
GST_BUFFER_OFFSET_END (buffer) = granulepos;
|
||||
GST_BUFFER_TIMESTAMP (buffer) = clip->start_time;
|
||||
|
||||
|
@ -574,8 +550,7 @@ gst_cmml_enc_push_clip (GstCmmlEnc * enc, GstCmmlTagClip * clip,
|
|||
goto done;
|
||||
|
||||
if (clip->end_time != GST_CLOCK_TIME_NONE) {
|
||||
/* create a new empty clip for the same cmml "track" starting at
|
||||
* "end_time"
|
||||
/* create a new empty clip for the same cmml track starting at end_time
|
||||
*/
|
||||
GObject *end_clip = g_object_new (GST_TYPE_CMML_TAG_CLIP,
|
||||
"start-time", clip->end_time, "track", clip->track, NULL);
|
||||
|
@ -587,6 +562,10 @@ gst_cmml_enc_push_clip (GstCmmlEnc * enc, GstCmmlTagClip * clip,
|
|||
}
|
||||
done:
|
||||
return res;
|
||||
|
||||
granule_overflow:
|
||||
GST_ELEMENT_ERROR (enc, STREAM, ENCODE, (NULL), ("granulepos overflow"));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
@ -600,7 +579,7 @@ gst_cmml_enc_push (GstCmmlEnc * enc, GstBuffer * buffer)
|
|||
res = gst_pad_push (enc->srcpad, buffer);
|
||||
if (GST_FLOW_IS_FATAL (res))
|
||||
GST_ELEMENT_ERROR (enc, STREAM, ENCODE,
|
||||
(NULL), ("could not push the buffer: %s", gst_flow_get_name (res)));
|
||||
(NULL), ("could not push buffer: %s", gst_flow_get_name (res)));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -22,12 +22,17 @@
|
|||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include "gstcmmlparser.h"
|
||||
#include "gstannodex.h"
|
||||
#include "gstcmmlutils.h"
|
||||
|
||||
GST_DEBUG_CATEGORY (cmmlparser);
|
||||
#define GST_CAT_DEFAULT cmmlparser
|
||||
|
||||
static void gst_cmml_parser_generic_error (void *ctx, const char *msg, ...);
|
||||
static xmlNodePtr gst_cmml_parser_new_node (GstCmmlParser * parser,
|
||||
const gchar * name, ...);
|
||||
static void
|
||||
|
@ -42,6 +47,15 @@ static void gst_cmml_parser_parse_processing_instruction (xmlParserCtxtPtr ctxt,
|
|||
static void gst_cmml_parser_meta_to_string (GstCmmlParser * parser,
|
||||
xmlNodePtr parent, GValueArray * meta);
|
||||
|
||||
/* initialize the parser */
|
||||
void
|
||||
gst_cmml_parser_init (void)
|
||||
{
|
||||
GST_DEBUG_CATEGORY_INIT (cmmlparser, "cmmlparser", 0, "annodex CMML parser");
|
||||
|
||||
xmlGenericError = gst_cmml_parser_generic_error;
|
||||
}
|
||||
|
||||
/* create a new CMML parser
|
||||
*/
|
||||
GstCmmlParser *
|
||||
|
@ -58,7 +72,8 @@ gst_cmml_parser_new (GstCmmlParserMode mode)
|
|||
(startElementNsSAX2Func) gst_cmml_parser_parse_start_element_ns;
|
||||
parser->context->sax->endElementNs =
|
||||
(endElementNsSAX2Func) gst_cmml_parser_parse_end_element_ns;
|
||||
parser->context->sax->processingInstruction = (processingInstructionSAXFunc)
|
||||
parser->context->sax->processingInstruction =
|
||||
(processingInstructionSAXFunc)
|
||||
gst_cmml_parser_parse_processing_instruction;
|
||||
parser->preamble_callback = NULL;
|
||||
parser->cmml_end_callback = NULL;
|
||||
|
@ -463,13 +478,18 @@ gst_cmml_parser_parse_clip (GstCmmlParser * parser, xmlNodePtr clip)
|
|||
GstClockTime start_time = GST_CLOCK_TIME_NONE;
|
||||
GstClockTime end_time = GST_CLOCK_TIME_NONE;
|
||||
|
||||
g_value_init (&str_val, G_TYPE_STRING);
|
||||
start = xmlGetProp (clip, (xmlChar *) "start");
|
||||
if (parser->mode == GST_CMML_PARSER_ENCODE && start == NULL)
|
||||
/* XXX: validate the document */
|
||||
return;
|
||||
|
||||
id = xmlGetProp (clip, (xmlChar *) "id");
|
||||
track = xmlGetProp (clip, (xmlChar *) "track");
|
||||
start = xmlGetProp (clip, (xmlChar *) "start");
|
||||
end = xmlGetProp (clip, (xmlChar *) "end");
|
||||
|
||||
if (track == NULL)
|
||||
track = (guchar *) g_strdup ("default");
|
||||
|
||||
if (start) {
|
||||
if (!strncmp ((gchar *) start, "smpte", 5))
|
||||
start_time = gst_cmml_clock_time_from_smpte ((gchar *) start);
|
||||
|
@ -484,11 +504,7 @@ gst_cmml_parser_parse_clip (GstCmmlParser * parser, xmlNodePtr clip)
|
|||
end_time = gst_cmml_clock_time_from_npt ((gchar *) end);
|
||||
}
|
||||
|
||||
if (track == NULL)
|
||||
track = (guchar *) g_strdup ("default");
|
||||
|
||||
clip_tag = g_object_new (GST_TYPE_CMML_TAG_CLIP,
|
||||
"id", id,
|
||||
clip_tag = g_object_new (GST_TYPE_CMML_TAG_CLIP, "id", id,
|
||||
"track", track, "start-time", start_time, "end-time", end_time, NULL);
|
||||
|
||||
g_free (id);
|
||||
|
@ -496,6 +512,8 @@ gst_cmml_parser_parse_clip (GstCmmlParser * parser, xmlNodePtr clip)
|
|||
g_free (start);
|
||||
g_free (end);
|
||||
|
||||
g_value_init (&str_val, G_TYPE_STRING);
|
||||
|
||||
/* parse the children */
|
||||
for (walk = clip->children; walk; walk = walk->next) {
|
||||
/* the clip is not empty */
|
||||
|
@ -545,6 +563,17 @@ gst_cmml_parser_meta_to_string (GstCmmlParser * parser,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_cmml_parser_generic_error (void *ctx, const char *msg, ...)
|
||||
{
|
||||
va_list varargs;
|
||||
|
||||
va_start (varargs, msg);
|
||||
gst_debug_log_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING,
|
||||
"", "", 0, NULL, msg, varargs);
|
||||
va_end (varargs);
|
||||
}
|
||||
|
||||
/* sax handler called when an element start tag is found
|
||||
* this is used to parse the cmml start tag
|
||||
*/
|
||||
|
|
|
@ -69,6 +69,8 @@ struct _GstCmmlParser
|
|||
GstCmmlParserClipCallback clip_callback;
|
||||
};
|
||||
|
||||
void gst_cmml_parser_init (void);
|
||||
|
||||
GstCmmlParser *gst_cmml_parser_new (GstCmmlParserMode mode);
|
||||
void gst_cmml_parser_free (GstCmmlParser * parser);
|
||||
|
||||
|
|
|
@ -186,13 +186,28 @@ gst_cmml_clock_time_to_granule (GstClockTime prev_time,
|
|||
if (prev_time > current_time)
|
||||
return -1;
|
||||
|
||||
/* GST_SECOND / (granulerate_n / granulerate_d) */
|
||||
granulerate = gst_util_uint64_scale (GST_SECOND,
|
||||
granulerate_n, granulerate_d);
|
||||
keyindex = prev_time / granulerate << granuleshift;
|
||||
keyoffset = (current_time - prev_time) / granulerate;
|
||||
granulerate_d, granulerate_n);
|
||||
|
||||
prev_time = prev_time / granulerate;
|
||||
if (prev_time > (((guint64) 1 << (64 - granuleshift)) - 1))
|
||||
/* we need more than 64 - granuleshift bits to encode prev_time */
|
||||
goto overflow;
|
||||
|
||||
keyindex = prev_time << granuleshift;
|
||||
|
||||
keyoffset = (current_time / granulerate) - prev_time;
|
||||
if (keyoffset > ((guint64) 1 << granuleshift) - 1)
|
||||
/* we need more than granuleshift bits to encode prev_time - current_time */
|
||||
goto overflow;
|
||||
|
||||
granulepos = keyindex + keyoffset;
|
||||
|
||||
return granulepos;
|
||||
|
||||
overflow:
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* track list */
|
||||
|
@ -221,8 +236,6 @@ gst_cmml_track_list_destroy_track (gchar * key,
|
|||
void
|
||||
gst_cmml_track_list_destroy (GHashTable * tracks)
|
||||
{
|
||||
g_return_if_fail (tracks != NULL);
|
||||
|
||||
g_hash_table_foreach_remove (tracks,
|
||||
(GHRFunc) gst_cmml_track_list_destroy_track, NULL);
|
||||
g_hash_table_destroy (tracks);
|
||||
|
@ -240,28 +253,24 @@ gst_cmml_track_list_compare_clips (GstCmmlTagClip * a, GstCmmlTagClip * b)
|
|||
void
|
||||
gst_cmml_track_list_add_clip (GHashTable * tracks, GstCmmlTagClip * clip)
|
||||
{
|
||||
GstCmmlTrack *track = NULL;
|
||||
gchar *track_name = NULL;
|
||||
void *key = NULL, *value = NULL;
|
||||
gpointer key, value;
|
||||
GstCmmlTrack *track;
|
||||
gchar *track_name;
|
||||
|
||||
/* find clip's track */
|
||||
g_hash_table_lookup_extended (tracks, clip->track, &key, &value);
|
||||
g_return_if_fail (clip->track != NULL);
|
||||
|
||||
if (g_hash_table_lookup_extended (tracks, clip->track, &key, &value)) {
|
||||
track_name = (gchar *) key;
|
||||
track = (GstCmmlTrack *) track;
|
||||
|
||||
if (track_name == NULL)
|
||||
/* it doesn't exist yet: create its key */
|
||||
track = (GstCmmlTrack *) value;
|
||||
} else {
|
||||
track_name = g_strdup ((gchar *) clip->track);
|
||||
|
||||
if (track == NULL)
|
||||
track = g_new0 (GstCmmlTrack, 1);
|
||||
g_hash_table_insert (tracks, track_name, track);
|
||||
}
|
||||
|
||||
/* add clip to the tracklist */
|
||||
track->clips = g_list_insert_sorted (track->clips, g_object_ref (clip),
|
||||
(GCompareFunc) gst_cmml_track_list_compare_clips);
|
||||
|
||||
/* reset the head every time as it could change */
|
||||
g_hash_table_insert (tracks, track_name, track);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -271,6 +280,8 @@ gst_cmml_track_list_del_clip (GHashTable * tracks, GstCmmlTagClip * clip)
|
|||
GList *link;
|
||||
gboolean res = FALSE;
|
||||
|
||||
g_return_val_if_fail (clip->track != NULL, FALSE);
|
||||
|
||||
track = g_hash_table_lookup (tracks, clip->track);
|
||||
if (track) {
|
||||
link = g_list_find (track->clips, clip);
|
||||
|
@ -293,6 +304,8 @@ gst_cmml_track_list_has_clip (GHashTable * tracks, GstCmmlTagClip * clip)
|
|||
gchar *clip_id = (gchar *) clip->id;
|
||||
gboolean res = FALSE;
|
||||
|
||||
g_return_val_if_fail (clip_id != NULL, FALSE);
|
||||
|
||||
track = g_hash_table_lookup (tracks, clip_id);
|
||||
if (track) {
|
||||
for (walk = track->clips; walk; walk = g_list_next (walk)) {
|
||||
|
@ -329,6 +342,8 @@ gst_cmml_track_list_get_track_clips (GHashTable * tracks,
|
|||
{
|
||||
GstCmmlTrack *track;
|
||||
|
||||
g_return_val_if_fail (track_name != NULL, NULL);
|
||||
|
||||
track = g_hash_table_lookup (tracks, track_name);
|
||||
return track ? track->clips : NULL;
|
||||
}
|
||||
|
@ -350,6 +365,8 @@ gst_cmml_track_list_get_track_last_clip (GHashTable * tracks,
|
|||
GstCmmlTrack *track;
|
||||
GList *res = NULL;
|
||||
|
||||
g_return_val_if_fail (track_name != NULL, NULL);
|
||||
|
||||
track = g_hash_table_lookup (tracks, track_name);
|
||||
if (track && track->clips)
|
||||
res = g_list_last (track->clips);
|
||||
|
@ -363,6 +380,8 @@ gst_cmml_track_list_set_data (GHashTable * tracks,
|
|||
{
|
||||
GstCmmlTrack *track;
|
||||
|
||||
g_return_if_fail (track_name != NULL);
|
||||
|
||||
track = g_hash_table_lookup (tracks, track_name);
|
||||
if (track)
|
||||
track->user_data = data;
|
||||
|
@ -373,6 +392,8 @@ gst_cmml_track_get_data (GHashTable * tracks, const gchar * track_name)
|
|||
{
|
||||
GstCmmlTrack *track;
|
||||
|
||||
g_return_val_if_fail (track_name != NULL, NULL);
|
||||
|
||||
track = g_hash_table_lookup (tracks, track_name);
|
||||
return track ? track->user_data : NULL;
|
||||
}
|
||||
|
|
4
po/af.po
4
po/af.po
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: gst-plugins 0.7.6\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2006-02-08 18:36+0100\n"
|
||||
"POT-Creation-Date: 2006-02-25 19:58+0100\n"
|
||||
"PO-Revision-Date: 2004-03-18 14:16+0200\n"
|
||||
"Last-Translator: Petri Jooste <rkwjpj@puk.ac.za>\n"
|
||||
"Language-Team: Afrikaans <i18n@af.org.za>\n"
|
||||
|
@ -16,7 +16,7 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ext/libpng/gstpngdec.c:275 ext/libpng/gstpngdec.c:438
|
||||
#: gst/wavparse/gstwavparse.c:1142
|
||||
#: gst/wavparse/gstwavparse.c:1149
|
||||
msgid "Internal data stream error."
|
||||
msgstr ""
|
||||
|
||||
|
|
4
po/az.po
4
po/az.po
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: gst-plugins-0.8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2006-02-08 18:36+0100\n"
|
||||
"POT-Creation-Date: 2006-02-25 19:58+0100\n"
|
||||
"PO-Revision-Date: 2004-03-19 18:29+0200\n"
|
||||
"Last-Translator: Metin Amiroff <metin@karegen.com>\n"
|
||||
"Language-Team: Azerbaijani <translation-team-az@lists.sourceforge.net>\n"
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
|||
"X-Generator: KBabel 1.0.2\n"
|
||||
|
||||
#: ext/libpng/gstpngdec.c:275 ext/libpng/gstpngdec.c:438
|
||||
#: gst/wavparse/gstwavparse.c:1142
|
||||
#: gst/wavparse/gstwavparse.c:1149
|
||||
msgid "Internal data stream error."
|
||||
msgstr ""
|
||||
|
||||
|
|
4
po/cs.po
4
po/cs.po
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: gst-plugins 0.8.3\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2006-02-08 18:36+0100\n"
|
||||
"POT-Creation-Date: 2006-02-25 19:58+0100\n"
|
||||
"PO-Revision-Date: 2004-08-08 22:58+0200\n"
|
||||
"Last-Translator: Miloslav Trmac <mitr@volny.cz>\n"
|
||||
"Language-Team: Czech <translation-team-cs@lists.sourceforge.net>\n"
|
||||
|
@ -19,7 +19,7 @@ msgstr ""
|
|||
"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||
|
||||
#: ext/libpng/gstpngdec.c:275 ext/libpng/gstpngdec.c:438
|
||||
#: gst/wavparse/gstwavparse.c:1142
|
||||
#: gst/wavparse/gstwavparse.c:1149
|
||||
msgid "Internal data stream error."
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: gst-plugins 0.8.1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2006-02-08 18:36+0100\n"
|
||||
"POT-Creation-Date: 2006-02-25 19:58+0100\n"
|
||||
"PO-Revision-Date: 2004-04-26 10:41-0400\n"
|
||||
"Last-Translator: Gareth Owen <gowen72@yahoo.com>\n"
|
||||
"Language-Team: English (British) <en_gb@li.org>\n"
|
||||
|
@ -15,7 +15,7 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ext/libpng/gstpngdec.c:275 ext/libpng/gstpngdec.c:438
|
||||
#: gst/wavparse/gstwavparse.c:1142
|
||||
#: gst/wavparse/gstwavparse.c:1149
|
||||
msgid "Internal data stream error."
|
||||
msgstr ""
|
||||
|
||||
|
|
4
po/hu.po
4
po/hu.po
|
@ -6,7 +6,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: gst-plugins 0.8.2\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2006-02-08 18:36+0100\n"
|
||||
"POT-Creation-Date: 2006-02-25 19:58+0100\n"
|
||||
"PO-Revision-Date: 2004-07-18 11:03+0200\n"
|
||||
"Last-Translator: Laszlo Dvornik <dvornik@invitel.hu>\n"
|
||||
"Language-Team: Hungarian <translation-team-hu@lists.sourceforge.net>\n"
|
||||
|
@ -15,7 +15,7 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ext/libpng/gstpngdec.c:275 ext/libpng/gstpngdec.c:438
|
||||
#: gst/wavparse/gstwavparse.c:1142
|
||||
#: gst/wavparse/gstwavparse.c:1149
|
||||
msgid "Internal data stream error."
|
||||
msgstr ""
|
||||
|
||||
|
|
4
po/it.po
4
po/it.po
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: gst-plugins 0.8.3\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2006-02-08 18:36+0100\n"
|
||||
"POT-Creation-Date: 2006-02-25 19:58+0100\n"
|
||||
"PO-Revision-Date: 2004-11-07 19:11+0100\n"
|
||||
"Last-Translator: Luca Ferretti <elle.uca@infinito.it>\n"
|
||||
"Language-Team: Italian <tp@lists.linux.it>\n"
|
||||
|
@ -16,7 +16,7 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ext/libpng/gstpngdec.c:275 ext/libpng/gstpngdec.c:438
|
||||
#: gst/wavparse/gstwavparse.c:1142
|
||||
#: gst/wavparse/gstwavparse.c:1149
|
||||
msgid "Internal data stream error."
|
||||
msgstr ""
|
||||
|
||||
|
|
4
po/nb.po
4
po/nb.po
|
@ -6,7 +6,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: gst-plugins 0.8.3\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2006-02-08 18:36+0100\n"
|
||||
"POT-Creation-Date: 2006-02-25 19:58+0100\n"
|
||||
"PO-Revision-Date: 2004-10-04 15:54+0200\n"
|
||||
"Last-Translator: Kjartan Maraas <kmaraas@broadpark.no>\n"
|
||||
"Language-Team: Norwegian Bokmaal <i18n-nb@lister.ping.uio.no>\n"
|
||||
|
@ -15,7 +15,7 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ext/libpng/gstpngdec.c:275 ext/libpng/gstpngdec.c:438
|
||||
#: gst/wavparse/gstwavparse.c:1142
|
||||
#: gst/wavparse/gstwavparse.c:1149
|
||||
msgid "Internal data stream error."
|
||||
msgstr ""
|
||||
|
||||
|
|
4
po/nl.po
4
po/nl.po
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: gst-plugins 0.8.3\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2006-02-08 18:36+0100\n"
|
||||
"POT-Creation-Date: 2006-02-25 19:58+0100\n"
|
||||
"PO-Revision-Date: 2004-08-05 16:26+0200\n"
|
||||
"Last-Translator: Elros Cyriatan <cyriatan@fastmail.fm>\n"
|
||||
"Language-Team: Dutch <vertaling@nl.linux.org>\n"
|
||||
|
@ -16,7 +16,7 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ext/libpng/gstpngdec.c:275 ext/libpng/gstpngdec.c:438
|
||||
#: gst/wavparse/gstwavparse.c:1142
|
||||
#: gst/wavparse/gstwavparse.c:1149
|
||||
msgid "Internal data stream error."
|
||||
msgstr ""
|
||||
|
||||
|
|
6
po/or.po
6
po/or.po
|
@ -2,13 +2,13 @@
|
|||
# Copyright (C) 2004, Free Software Foundation, Inc.
|
||||
# This file is distributed under the same license as the gst-plugins-0.8.3 package.
|
||||
# Gora Mohanty <gora_mohanty@yahoo.co.in>, 2004.
|
||||
# $Id: or.po,v 1.19 2006/01/11 11:39:10 thomasvs Exp $
|
||||
# $Id: or.po,v 1.20 2006/02/08 17:35:05 thaytan Exp $
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: gst-plugins-0.8.3\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2006-02-08 18:36+0100\n"
|
||||
"POT-Creation-Date: 2006-02-25 19:58+0100\n"
|
||||
"PO-Revision-Date: 2004-09-27 13:32+0530\n"
|
||||
"Last-Translator: Gora Mohanty <gora_mohanty@yahoo.co.in>\n"
|
||||
"Language-Team: Oriya <gora_mohanty@yahoo.co.in>\n"
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ext/libpng/gstpngdec.c:275 ext/libpng/gstpngdec.c:438
|
||||
#: gst/wavparse/gstwavparse.c:1142
|
||||
#: gst/wavparse/gstwavparse.c:1149
|
||||
msgid "Internal data stream error."
|
||||
msgstr ""
|
||||
|
||||
|
|
4
po/sq.po
4
po/sq.po
|
@ -6,7 +6,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: gst-plugins 0.8.3\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2006-02-08 18:36+0100\n"
|
||||
"POT-Creation-Date: 2006-02-25 19:58+0100\n"
|
||||
"PO-Revision-Date: 2004-08-07 20:29+0200\n"
|
||||
"Last-Translator: Laurent Dhima <laurenti@alblinux.net>\n"
|
||||
"Language-Team: Albanian <begraj@hotmail.com>\n"
|
||||
|
@ -15,7 +15,7 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ext/libpng/gstpngdec.c:275 ext/libpng/gstpngdec.c:438
|
||||
#: gst/wavparse/gstwavparse.c:1142
|
||||
#: gst/wavparse/gstwavparse.c:1149
|
||||
msgid "Internal data stream error."
|
||||
msgstr ""
|
||||
|
||||
|
|
4
po/sr.po
4
po/sr.po
|
@ -6,7 +6,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: gst-plugins 0.7.6\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2006-02-08 18:36+0100\n"
|
||||
"POT-Creation-Date: 2006-02-25 19:58+0100\n"
|
||||
"PO-Revision-Date: 2004-03-13 00:18+0100\n"
|
||||
"Last-Translator: Danilo Segan <dsegan@gmx.net>\n"
|
||||
"Language-Team: Serbian <gnu@prevod.org>\n"
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
|||
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||
|
||||
#: ext/libpng/gstpngdec.c:275 ext/libpng/gstpngdec.c:438
|
||||
#: gst/wavparse/gstwavparse.c:1142
|
||||
#: gst/wavparse/gstwavparse.c:1149
|
||||
msgid "Internal data stream error."
|
||||
msgstr ""
|
||||
|
||||
|
|
4
po/sv.po
4
po/sv.po
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: gst-plugins 0.8.3\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2006-02-08 18:36+0100\n"
|
||||
"POT-Creation-Date: 2006-02-25 19:58+0100\n"
|
||||
"PO-Revision-Date: 2004-08-03 20:53+0200\n"
|
||||
"Last-Translator: Christian Rose <menthos@menthos.com>\n"
|
||||
"Language-Team: Swedish <sv@li.org>\n"
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ext/libpng/gstpngdec.c:275 ext/libpng/gstpngdec.c:438
|
||||
#: gst/wavparse/gstwavparse.c:1142
|
||||
#: gst/wavparse/gstwavparse.c:1149
|
||||
msgid "Internal data stream error."
|
||||
msgstr ""
|
||||
|
||||
|
|
4
po/uk.po
4
po/uk.po
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: gst-plugins 0.8.2\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2006-02-08 18:36+0100\n"
|
||||
"POT-Creation-Date: 2006-02-25 19:58+0100\n"
|
||||
"PO-Revision-Date: 2004-08-03 15:40+0200\n"
|
||||
"Last-Translator: Maxim V. Dziumanenko <mvd@mylinux.com.ua>\n"
|
||||
"Language-Team: Ukrainian <translation-team-uk@lists.sourceforge.net>\n"
|
||||
|
@ -16,7 +16,7 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ext/libpng/gstpngdec.c:275 ext/libpng/gstpngdec.c:438
|
||||
#: gst/wavparse/gstwavparse.c:1142
|
||||
#: gst/wavparse/gstwavparse.c:1149
|
||||
msgid "Internal data stream error."
|
||||
msgstr ""
|
||||
|
||||
|
|
4
po/vi.po
4
po/vi.po
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: gst-plugins-0.8.3\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2006-02-08 18:36+0100\n"
|
||||
"POT-Creation-Date: 2006-02-25 19:58+0100\n"
|
||||
"PO-Revision-Date: 2005-01-22 17:17+0930\n"
|
||||
"Last-Translator: Clytie Siddall <clytie@riverland.net.au>\n"
|
||||
"Language-Team: Vietnamese <gnomevi-list@lists.sourceforge.net> \n"
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ext/libpng/gstpngdec.c:275 ext/libpng/gstpngdec.c:438
|
||||
#: gst/wavparse/gstwavparse.c:1142
|
||||
#: gst/wavparse/gstwavparse.c:1149
|
||||
msgid "Internal data stream error."
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -25,14 +25,14 @@
|
|||
|
||||
#include <gst/tag/tag.h>
|
||||
|
||||
#define SINK_CAPS "text/xml"
|
||||
#define SINK_CAPS "text/x-cmml"
|
||||
#define SRC_CAPS "text/x-cmml"
|
||||
|
||||
#define IDENT_HEADER \
|
||||
"CMML\x00\x00\x00\x00"\
|
||||
"\x03\x00\x00\x00"\
|
||||
"\x01\x00\x00\x00\x00\x00\x00\x00"\
|
||||
"\xe8\x03\x00\x00\x00\x00\x00\x00"\
|
||||
"\x01\x00\x00\x00\x00\x00\x00\x00"\
|
||||
"\x20"
|
||||
|
||||
#define XML_PREAMBLE \
|
||||
|
@ -269,11 +269,8 @@ GST_START_TEST (test_dec)
|
|||
/* send EOS to flush clip-2 and clip-3 */
|
||||
gst_pad_send_event (GST_PAD_PEER (srcpad), gst_event_new_eos ());
|
||||
|
||||
printf ("Check1\n");
|
||||
check_clip ("clip-1", "default", "0:00:01.234", NULL);
|
||||
printf ("Check2\n");
|
||||
check_clip ("clip-2", "othertrack", "0:00:04.321", NULL);
|
||||
printf ("Check3\n");
|
||||
check_clip ("clip-3", "default", "100:59:59.678", NULL);
|
||||
check_end ();
|
||||
|
||||
|
|
|
@ -26,13 +26,13 @@
|
|||
#include <gst/tag/tag.h>
|
||||
|
||||
#define SINK_CAPS "text/x-cmml"
|
||||
#define SRC_CAPS "text/xml"
|
||||
#define SRC_CAPS "text/x-cmml"
|
||||
|
||||
#define IDENT_HEADER \
|
||||
"CMML\x00\x00\x00\x00"\
|
||||
"\x03\x00\x00\x00"\
|
||||
"\x01\x00\x00\x00\x00\x00\x00\x00"\
|
||||
"\xe8\x03\x00\x00\x00\x00\x00\x00"\
|
||||
"\x01\x00\x00\x00\x00\x00\x00\x00"\
|
||||
"\x20"
|
||||
|
||||
#define XML_PREAMBLE \
|
||||
|
@ -154,7 +154,7 @@ setup_cmmlenc ()
|
|||
"granule-rate-denominator", &granulerate_d,
|
||||
"granule-shift", &granuleshift, NULL);
|
||||
|
||||
granulerate = GST_SECOND * granulerate_n / granulerate_d;
|
||||
granulerate = GST_SECOND * granulerate_d / granulerate_n;
|
||||
buffers = NULL;
|
||||
return cmmlenc;
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ push_clip (const gchar * name, const gchar * track,
|
|||
if (track == NULL)
|
||||
track = "default";
|
||||
|
||||
clip = g_strdup_printf (CLIP_TEMPLATE, name, track, start, end);
|
||||
clip = g_strdup_printf (CLIP_TEMPLATE, name, track, start);
|
||||
push_data (name, clip, strlen (clip), expected_return);
|
||||
g_free (clip);
|
||||
}
|
||||
|
@ -317,17 +317,30 @@ GST_START_TEST (test_bad_start_time)
|
|||
|
||||
check_headers ();
|
||||
|
||||
push_clip ("clip-1", "default", "1.234", NULL, GST_FLOW_OK);
|
||||
check_clip ("clip-1", "default", 1234 * granulerate, 0);
|
||||
push_clip ("clip-1", "default", "1000:00:00.000", NULL, GST_FLOW_OK);
|
||||
check_clip ("clip-1", "default", (guint64) 3600000 * 1000 * granulerate, 0);
|
||||
|
||||
push_clip ("clip-bad", "default", "1.1000", NULL, GST_FLOW_ERROR);
|
||||
|
||||
push_clip ("clip-2", NULL, "5.678", NULL, GST_FLOW_OK);
|
||||
check_clip ("clip-2", "default", 5678 * granulerate, 1234 * granulerate);
|
||||
/* keyindex overflow: npt:1000:00:00.000 doesn't fit in 32 bits */
|
||||
push_clip ("clip-2", NULL, "5.678", NULL, GST_FLOW_ERROR);
|
||||
|
||||
/* other tracks should work */
|
||||
push_clip ("clip-3", "othertrack", "9.123", NULL, GST_FLOW_OK);
|
||||
check_clip ("clip-3", "othertrack", 9123 * granulerate, 0);
|
||||
|
||||
/* bad msecs */
|
||||
push_clip ("clip-bad-msecs", "default", "0.1000", NULL, GST_FLOW_ERROR);
|
||||
|
||||
/* bad secs */
|
||||
push_clip ("clip-bad-secs", "default", "00:00:60.123", NULL, GST_FLOW_ERROR);
|
||||
|
||||
/* bad minutes */
|
||||
push_clip ("clip-bad-minutes", "default", "00:60:12.345",
|
||||
NULL, GST_FLOW_ERROR);
|
||||
|
||||
/* bad hours */
|
||||
push_clip ("clip-bad-hours", "default", "10000:12:34.567",
|
||||
NULL, GST_FLOW_ERROR);
|
||||
|
||||
push_end ();
|
||||
check_end ();
|
||||
|
||||
|
|
Loading…
Reference in a new issue