1 /* Gstreamer
2  * Copyright (C) <2012> Edward Hervey <edward@collabora.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef __GST_MPEG_VIDEO_META_H__
21 #define __GST_MPEG_VIDEO_META_H__
22 
23 #ifndef GST_USE_UNSTABLE_API
24 #warning "The Mpeg video parsing library is unstable API and may change in future."
25 #warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
26 #endif
27 
28 #include <gst/gst.h>
29 #include <gst/codecparsers/gstmpegvideoparser.h>
30 
31 G_BEGIN_DECLS
32 
33 typedef struct _GstMpegVideoMeta GstMpegVideoMeta;
34 
35 GST_CODEC_PARSERS_API
36 GType gst_mpeg_video_meta_api_get_type (void);
37 #define GST_MPEG_VIDEO_META_API_TYPE  (gst_mpeg_video_meta_api_get_type())
38 #define GST_MPEG_VIDEO_META_INFO  (gst_mpeg_video_meta_get_info())
39 GST_CODEC_PARSERS_API
40 const GstMetaInfo * gst_mpeg_video_meta_get_info (void);
41 
42 /**
43  * GstMpegVideoMeta:
44  * @meta: parent #GstMeta
45  * @sequencehdr: the #GstMpegVideoSequenceHdr if present in the buffer
46  * @sequenceext: the #GstMpegVideoSequenceExt if present in the buffer
47  * @sequencedispext: the #GstMpegVideoSequenceDisplayExt if present in the
48  * buffer.
49  * @pichdr: the #GstMpegVideoPictureHdr if present in the buffer.
50  * @picext: the #GstMpegVideoPictureExt if present in the buffer.
51  * @quantext: the #GstMpegVideoQuantMatrixExt if present in the buffer
52  *
53  * Extra buffer metadata describing the contents of a MPEG1/2 Video frame
54  *
55  * Can be used by elements (mainly decoders) to avoid having to parse
56  * Mpeg video 1/2 packets if it can be done upstream.
57  *
58  * The various fields are only valid during the lifetime of the #GstMpegVideoMeta.
59  * If elements wish to use those for longer, they are required to make a copy.
60  *
61  * Since: 1.2
62  */
63 struct _GstMpegVideoMeta {
64   GstMeta            meta;
65 
66   GstMpegVideoSequenceHdr        *sequencehdr;
67   GstMpegVideoSequenceExt        *sequenceext;
68   GstMpegVideoSequenceDisplayExt *sequencedispext;
69   GstMpegVideoPictureHdr         *pichdr;
70   GstMpegVideoPictureExt         *picext;
71   GstMpegVideoQuantMatrixExt     *quantext;
72 
73   guint num_slices;
74   gsize slice_offset;
75 };
76 
77 
78 #define gst_buffer_get_mpeg_video_meta(b) ((GstMpegVideoMeta*)gst_buffer_get_meta((b),GST_MPEG_VIDEO_META_API_TYPE))
79 
80 GST_CODEC_PARSERS_API
81 GstMpegVideoMeta *
82 gst_buffer_add_mpeg_video_meta (GstBuffer * buffer,
83                                 const GstMpegVideoSequenceHdr *seq_hdr,
84                                 const GstMpegVideoSequenceExt *seq_ext,
85                                 const GstMpegVideoSequenceDisplayExt *disp_ext,
86                                 const GstMpegVideoPictureHdr *pic_hdr,
87                                 const GstMpegVideoPictureExt *pic_ext,
88                                 const GstMpegVideoQuantMatrixExt *quant_ext);
89 
90 G_END_DECLS
91 
92 #endif
93