2010-06-10 10:13:50 +00:00
|
|
|
/*
|
|
|
|
* GStreamer
|
|
|
|
* Copyright (C) 2009 Carl-Anton Ingmarsson <ca.ingmarsson@gmail.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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2010-06-26 23:27:28 +00:00
|
|
|
#include "gsth264frame.h"
|
2010-06-10 10:13:50 +00:00
|
|
|
|
2010-06-26 23:27:28 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_h264_frame_debug);
|
|
|
|
#define GST_CAT_DEFAULT gst_h264_frame_debug
|
2010-06-10 10:13:50 +00:00
|
|
|
|
|
|
|
#define DEBUG_INIT(bla) \
|
2010-06-26 23:27:28 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_h264_frame_debug, "gsth264frame", 0, "H264 Frame");
|
2010-06-10 10:13:50 +00:00
|
|
|
|
|
|
|
void
|
2010-06-26 23:27:28 +00:00
|
|
|
gst_h264_frame_add_slice (GstH264Frame * h264_frame, GstBuffer * buf)
|
2010-06-10 10:13:50 +00:00
|
|
|
{
|
|
|
|
gst_buffer_ref (buf);
|
|
|
|
g_ptr_array_add (h264_frame->slices, buf);
|
|
|
|
}
|
|
|
|
|
2010-06-26 23:27:28 +00:00
|
|
|
GstH264Frame *
|
|
|
|
gst_h264_frame_new (void)
|
2010-06-10 10:13:50 +00:00
|
|
|
{
|
2010-06-26 23:27:28 +00:00
|
|
|
GstH264Frame *frame;
|
2010-06-10 10:13:50 +00:00
|
|
|
|
2010-06-26 23:27:28 +00:00
|
|
|
frame = (GstH264Frame *) gst_mini_object_new (GST_TYPE_H264_FRAME);
|
2010-06-10 10:13:50 +00:00
|
|
|
|
|
|
|
return frame;
|
|
|
|
}
|
|
|
|
|
2010-06-26 23:27:28 +00:00
|
|
|
static GObjectClass *gst_h264_frame_parent_class;
|
2010-06-10 10:13:50 +00:00
|
|
|
|
|
|
|
static void
|
2010-06-26 23:27:28 +00:00
|
|
|
gst_h264_frame_finalize (GstH264Frame * h264_frame)
|
2010-06-10 10:13:50 +00:00
|
|
|
{
|
2010-06-28 09:08:56 +00:00
|
|
|
g_ptr_array_foreach (h264_frame->slices, (GFunc) gst_buffer_unref, NULL);
|
2010-06-28 10:00:55 +00:00
|
|
|
|
|
|
|
g_ptr_array_unref (h264_frame->slices);
|
2010-06-10 10:13:50 +00:00
|
|
|
|
2010-06-26 23:27:28 +00:00
|
|
|
GST_MINI_OBJECT_CLASS (gst_h264_frame_parent_class)->finalize
|
2010-06-10 10:13:50 +00:00
|
|
|
(GST_MINI_OBJECT (h264_frame));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-06-26 23:27:28 +00:00
|
|
|
gst_h264_frame_init (GstH264Frame * h264_frame, gpointer g_class)
|
2010-06-10 10:13:50 +00:00
|
|
|
{
|
2010-06-28 09:08:56 +00:00
|
|
|
h264_frame->slices = g_ptr_array_new ();
|
2010-06-10 10:13:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-06-26 23:27:28 +00:00
|
|
|
gst_h264_frame_class_init (gpointer g_class, gpointer class_data)
|
2010-06-10 10:13:50 +00:00
|
|
|
{
|
|
|
|
GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
|
|
|
|
|
2010-06-26 23:27:28 +00:00
|
|
|
gst_h264_frame_parent_class = g_type_class_peek_parent (g_class);
|
2010-06-10 10:13:50 +00:00
|
|
|
|
|
|
|
mini_object_class->finalize = (GstMiniObjectFinalizeFunction)
|
2010-06-26 23:27:28 +00:00
|
|
|
gst_h264_frame_finalize;
|
2010-06-10 10:13:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GType
|
2010-06-26 23:27:28 +00:00
|
|
|
gst_h264_frame_get_type (void)
|
2010-06-10 10:13:50 +00:00
|
|
|
{
|
2010-06-26 23:27:28 +00:00
|
|
|
static GType _gst_h264_frame_type = 0;
|
2010-06-10 10:13:50 +00:00
|
|
|
|
2010-06-26 23:27:28 +00:00
|
|
|
if (G_UNLIKELY (_gst_h264_frame_type == 0)) {
|
2010-06-10 10:13:50 +00:00
|
|
|
static const GTypeInfo info = {
|
2010-06-26 23:27:28 +00:00
|
|
|
sizeof (GstH264FrameClass),
|
2010-06-10 10:13:50 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2010-06-26 23:27:28 +00:00
|
|
|
gst_h264_frame_class_init,
|
2010-06-10 10:13:50 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2010-06-26 23:27:28 +00:00
|
|
|
sizeof (GstH264Frame),
|
2010-06-10 10:13:50 +00:00
|
|
|
0,
|
2010-06-26 23:27:28 +00:00
|
|
|
(GInstanceInitFunc) gst_h264_frame_init,
|
2010-06-10 10:13:50 +00:00
|
|
|
NULL
|
|
|
|
};
|
2010-06-26 23:27:28 +00:00
|
|
|
_gst_h264_frame_type = g_type_register_static (GST_TYPE_VIDEO_FRAME,
|
|
|
|
"GstH264Frame", &info, 0);
|
2010-06-10 10:13:50 +00:00
|
|
|
|
|
|
|
DEBUG_INIT ();
|
|
|
|
}
|
2010-06-26 23:27:28 +00:00
|
|
|
return _gst_h264_frame_type;
|
2010-06-10 10:13:50 +00:00
|
|
|
}
|