Branch data Line data Source code
1 : : /*
2 : : * GStreamer
3 : : * Copyright (C) 2009 Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com>
4 : : *
5 : : * This library is free software; you can redistribute it and/or
6 : : * modify it under the terms of the GNU Library General Public
7 : : * License as published by the Free Software Foundation; either
8 : : * version 2 of the License, or (at your option) any later version.
9 : : *
10 : : * This library is distributed in the hope that it will be useful,
11 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 : : * Library General Public License for more details.
14 : : *
15 : : * You should have received a copy of the GNU Library General Public
16 : : * License along with this library; if not, write to the
17 : : * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 : : * Boston, MA 02111-1307, USA.
19 : : */
20 : :
21 : : #ifdef HAVE_CONFIG_H
22 : : #include "config.h"
23 : : #endif
24 : :
25 : : #include "gstvdpmpegframe.h"
26 : :
27 : : GST_DEBUG_CATEGORY_STATIC (gst_vdp_mpeg_frame_debug);
28 : : #define GST_CAT_DEFAULT gst_vdp_mpeg_frame_debug
29 : :
30 : : #define DEBUG_INIT(bla) \
31 : : GST_DEBUG_CATEGORY_INIT (gst_vdp_mpeg_frame_debug, "gstvdpmpegframe", 0, "Video Frame");
32 : :
33 : : void
34 : 0 : gst_vdp_mpeg_frame_add_slice (GstVdpMpegFrame * mpeg_frame, GstBuffer * buf)
35 : : {
36 [ # # ]: 0 : if (!mpeg_frame->slices)
37 : 0 : mpeg_frame->slices = buf;
38 : : else
39 : 0 : mpeg_frame->slices = gst_buffer_join (mpeg_frame->slices, buf);
40 : 0 : mpeg_frame->n_slices++;
41 : 0 : }
42 : :
43 : : GstVdpMpegFrame *
44 : 0 : gst_vdp_mpeg_frame_new (void)
45 : : {
46 : : GstVdpMpegFrame *frame;
47 : :
48 : 0 : frame =
49 : 0 : GST_VDP_MPEG_FRAME_CAST (gst_mini_object_new (GST_TYPE_VDP_MPEG_FRAME));
50 : :
51 : 0 : return frame;
52 : : }
53 : :
54 : : static GObjectClass *gst_vdp_mpeg_frame_parent_class;
55 : :
56 : : static void
57 : 0 : gst_vdp_mpeg_frame_finalize (GstVdpMpegFrame * mpeg_frame)
58 : : {
59 [ # # ]: 0 : if (mpeg_frame->seq)
60 : 0 : gst_buffer_unref (mpeg_frame->seq);
61 [ # # ]: 0 : if (mpeg_frame->seq_ext)
62 : 0 : gst_buffer_unref (mpeg_frame->seq_ext);
63 : :
64 [ # # ]: 0 : if (mpeg_frame->pic)
65 : 0 : gst_buffer_unref (mpeg_frame->pic);
66 [ # # ]: 0 : if (mpeg_frame->pic_ext)
67 : 0 : gst_buffer_unref (mpeg_frame->pic_ext);
68 : :
69 [ # # ]: 0 : if (mpeg_frame->gop)
70 : 0 : gst_buffer_unref (mpeg_frame->gop);
71 [ # # ]: 0 : if (mpeg_frame->qm_ext)
72 : 0 : gst_buffer_unref (mpeg_frame->qm_ext);
73 : :
74 [ # # ]: 0 : if (mpeg_frame->slices)
75 : 0 : gst_buffer_unref (mpeg_frame->slices);
76 : :
77 : :
78 : 0 : GST_MINI_OBJECT_CLASS (gst_vdp_mpeg_frame_parent_class)->finalize
79 : 0 : (GST_MINI_OBJECT (mpeg_frame));
80 : 0 : }
81 : :
82 : : static void
83 : 0 : gst_vdp_mpeg_frame_init (GstVdpMpegFrame * mpeg_frame, gpointer g_class)
84 : : {
85 : 0 : mpeg_frame->seq = NULL;
86 : 0 : mpeg_frame->seq_ext = NULL;
87 : :
88 : 0 : mpeg_frame->pic = NULL;
89 : 0 : mpeg_frame->pic_ext = NULL;
90 : :
91 : 0 : mpeg_frame->gop = NULL;
92 : 0 : mpeg_frame->qm_ext = NULL;
93 : :
94 : 0 : mpeg_frame->n_slices = 0;
95 : 0 : mpeg_frame->slices = NULL;
96 : 0 : }
97 : :
98 : : static void
99 : 0 : gst_vdp_mpeg_frame_class_init (gpointer g_class, gpointer class_data)
100 : : {
101 : 0 : GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
102 : :
103 : 0 : gst_vdp_mpeg_frame_parent_class = g_type_class_peek_parent (g_class);
104 : :
105 : 0 : mini_object_class->finalize = (GstMiniObjectFinalizeFunction)
106 : : gst_vdp_mpeg_frame_finalize;
107 : 0 : }
108 : :
109 : :
110 : : GType
111 : 0 : gst_vdp_mpeg_frame_get_type (void)
112 : : {
113 : : static GType _gst_vdp_mpeg_frame_type = 0;
114 : :
115 [ # # ]: 0 : if (G_UNLIKELY (_gst_vdp_mpeg_frame_type == 0)) {
116 : : static const GTypeInfo info = {
117 : : sizeof (GstVdpMpegFrameClass),
118 : : NULL,
119 : : NULL,
120 : : gst_vdp_mpeg_frame_class_init,
121 : : NULL,
122 : : NULL,
123 : : sizeof (GstVdpMpegFrame),
124 : : 0,
125 : : (GInstanceInitFunc) gst_vdp_mpeg_frame_init,
126 : : NULL
127 : : };
128 : 0 : _gst_vdp_mpeg_frame_type = g_type_register_static (GST_TYPE_VIDEO_FRAME,
129 : : "GstVdpMpegFrame", &info, 0);
130 : :
131 [ # # ]: 0 : DEBUG_INIT ();
132 : : }
133 : 0 : return _gst_vdp_mpeg_frame_type;
134 : : }
|