mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-02 21:48:55 +00:00
validate: Move some method between GstMediaDescriptorParser and GstMediaDescriptor
So that method land where they actually belong.
This commit is contained in:
parent
c542d9c6bc
commit
8f5347c465
4 changed files with 96 additions and 87 deletions
|
@ -512,84 +512,3 @@ gst_media_descriptor_parser_all_tags_found (GstMediaDescriptorParser * parser)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptor_parser_detects_frames (GstMediaDescriptorParser * parser)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR_PARSER (parser), FALSE);
|
||||
g_return_val_if_fail (((GstMediaDescriptor *) parser)->filenode, FALSE);
|
||||
|
||||
return ((GstMediaDescriptor *) parser)->filenode->frame_detection;
|
||||
}
|
||||
|
||||
GstClockTime
|
||||
gst_media_descriptor_parser_get_duration (GstMediaDescriptorParser * parser)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR_PARSER (parser), FALSE);
|
||||
g_return_val_if_fail (((GstMediaDescriptor *) parser)->filenode, FALSE);
|
||||
|
||||
return ((GstMediaDescriptor *) parser)->filenode->duration;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptor_parser_get_seekable (GstMediaDescriptorParser * parser)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR_PARSER (parser), FALSE);
|
||||
g_return_val_if_fail (((GstMediaDescriptor *) parser)->filenode, FALSE);
|
||||
|
||||
return ((GstMediaDescriptor *) parser)->filenode->seekable;
|
||||
}
|
||||
|
||||
GList *
|
||||
gst_media_descriptor_parser_get_buffers (GstMediaDescriptorParser * parser,
|
||||
GstPad * pad, GCompareFunc compare_func)
|
||||
{
|
||||
GList *ret = NULL, *tmpstream, *tmpframe;
|
||||
gboolean check = (pad == NULL);
|
||||
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR_PARSER (parser), FALSE);
|
||||
g_return_val_if_fail (((GstMediaDescriptor *) parser)->filenode, FALSE);
|
||||
|
||||
for (tmpstream = ((GstMediaDescriptor *) parser)->filenode->streams;
|
||||
tmpstream; tmpstream = tmpstream->next) {
|
||||
StreamNode *streamnode = (StreamNode *) tmpstream->data;
|
||||
|
||||
if (pad && streamnode->pad == pad)
|
||||
check = TRUE;
|
||||
|
||||
if (check) {
|
||||
for (tmpframe = streamnode->frames; tmpframe; tmpframe = tmpframe->next) {
|
||||
if (compare_func)
|
||||
ret =
|
||||
g_list_insert_sorted (ret,
|
||||
gst_buffer_ref (((FrameNode *) tmpframe->data)->buf),
|
||||
compare_func);
|
||||
else
|
||||
ret =
|
||||
g_list_prepend (ret,
|
||||
gst_buffer_ref (((FrameNode *) tmpframe->data)->buf));
|
||||
}
|
||||
|
||||
if (pad != NULL)
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
GList *
|
||||
gst_media_descriptor_parser_get_pads (GstMediaDescriptorParser * parser)
|
||||
{
|
||||
GList *ret = NULL, *tmp;
|
||||
|
||||
for (tmp = ((GstMediaDescriptor *) parser)->filenode->streams; tmp;
|
||||
tmp = tmp->next) {
|
||||
StreamNode *snode = (StreamNode *) tmp->data;
|
||||
ret = g_list_append (ret, gst_pad_new (snode->padname, GST_PAD_UNKNOWN));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,6 @@ GstMediaDescriptorParser * gst_media_descriptor_parser_new (GstValidateRunner *r
|
|||
const gchar * xmlpath,
|
||||
GError **error);
|
||||
gchar * gst_media_descriptor_parser_get_xml_path (GstMediaDescriptorParser *parser);
|
||||
gboolean gst_media_descriptor_parser_detects_frames (GstMediaDescriptorParser *parser);
|
||||
GstClockTime gst_media_descriptor_parser_get_duration (GstMediaDescriptorParser *parser);
|
||||
gboolean gst_media_descriptor_parser_get_seekable (GstMediaDescriptorParser * parser);
|
||||
gboolean gst_media_descriptor_parser_add_stream (GstMediaDescriptorParser *parser,
|
||||
|
@ -72,10 +71,6 @@ gboolean gst_media_descriptor_parser_add_frame (GstMediaDescriptorParse
|
|||
GstPad *pad,
|
||||
GstBuffer *buf,
|
||||
GstBuffer *expected);
|
||||
GList * gst_media_descriptor_parser_get_buffers (GstMediaDescriptorParser * parser,
|
||||
GstPad *pad,
|
||||
GCompareFunc compare_func);
|
||||
GList * gst_media_descriptor_parser_get_pads (GstMediaDescriptorParser * parser);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -327,3 +327,93 @@ gst_media_descriptors_compare (GstMediaDescriptor * ref,
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptor_detects_frames (GstMediaDescriptor * self)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR (self), FALSE);
|
||||
g_return_val_if_fail (self->filenode, FALSE);
|
||||
|
||||
return self->filenode->frame_detection;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptor_get_buffers (GstMediaDescriptor * self,
|
||||
GstPad * pad, GCompareFunc compare_func, GList ** bufs)
|
||||
{
|
||||
GList *tmpstream, *tmpframe;
|
||||
gboolean check = (pad == NULL), ret = FALSE;
|
||||
GstCaps *pad_caps = gst_pad_get_current_caps (pad);
|
||||
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR (self), FALSE);
|
||||
g_return_val_if_fail (self->filenode, FALSE);
|
||||
|
||||
for (tmpstream = self->filenode->streams;
|
||||
tmpstream; tmpstream = tmpstream->next) {
|
||||
StreamNode *streamnode = (StreamNode *) tmpstream->data;
|
||||
|
||||
if (pad && streamnode->pad == pad)
|
||||
check = TRUE;
|
||||
|
||||
if (!streamnode->pad && gst_caps_is_subset (pad_caps, streamnode->caps)) {
|
||||
check = TRUE;
|
||||
}
|
||||
|
||||
if (check) {
|
||||
ret = TRUE;
|
||||
for (tmpframe = streamnode->frames; tmpframe; tmpframe = tmpframe->next) {
|
||||
if (compare_func)
|
||||
*bufs =
|
||||
g_list_insert_sorted (*bufs,
|
||||
gst_buffer_ref (((FrameNode *) tmpframe->data)->buf),
|
||||
compare_func);
|
||||
else
|
||||
*bufs =
|
||||
g_list_prepend (*bufs,
|
||||
gst_buffer_ref (((FrameNode *) tmpframe->data)->buf));
|
||||
}
|
||||
|
||||
if (pad != NULL)
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
done:
|
||||
|
||||
if (compare_func == NULL)
|
||||
*bufs = g_list_reverse (*bufs);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
GstClockTime
|
||||
gst_media_descriptor_get_duration (GstMediaDescriptor * self)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR (self), FALSE);
|
||||
g_return_val_if_fail (self->filenode, FALSE);
|
||||
|
||||
return self->filenode->duration;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptor_get_seekable (GstMediaDescriptor * self)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR (self), FALSE);
|
||||
g_return_val_if_fail (self->filenode, FALSE);
|
||||
|
||||
return self->filenode->seekable;
|
||||
}
|
||||
|
||||
GList *
|
||||
gst_media_descriptor_get_pads (GstMediaDescriptor * self)
|
||||
{
|
||||
GList *ret = NULL, *tmp;
|
||||
|
||||
for (tmp = self->filenode->streams; tmp; tmp = tmp->next) {
|
||||
StreamNode *snode = (StreamNode *) tmp->data;
|
||||
ret = g_list_append (ret, gst_pad_new (snode->padname, GST_PAD_UNKNOWN));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -147,7 +147,12 @@ typedef struct {
|
|||
|
||||
gboolean gst_media_descriptors_compare (GstMediaDescriptor *ref,
|
||||
GstMediaDescriptor *compared);
|
||||
|
||||
gboolean gst_media_descriptor_detects_frames (GstMediaDescriptor * self);
|
||||
gboolean gst_media_descriptor_get_buffers (GstMediaDescriptor * self,
|
||||
GstPad * pad, GCompareFunc compare_func, GList ** bufs);
|
||||
GstClockTime gst_media_descriptor_get_duration (GstMediaDescriptor * self);
|
||||
gboolean gst_media_descriptor_get_seekable (GstMediaDescriptor * self);
|
||||
GList * gst_media_descriptor_get_pads (GstMediaDescriptor * self);
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue