1 /* GStreamer
2  * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
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., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef __MXF_ESSENCE_H__
21 #define __MXF_ESSENCE_H__
22 
23 #include <gst/gst.h>
24 #include <gst/base/gstadapter.h>
25 
26 #include "mxftypes.h"
27 #include "mxfmetadata.h"
28 
29 typedef enum {
30   MXF_ESSENCE_WRAPPING_FRAME_WRAPPING,
31   MXF_ESSENCE_WRAPPING_CLIP_WRAPPING,
32   MXF_ESSENCE_WRAPPING_CUSTOM_WRAPPING
33 } MXFEssenceWrapping;
34 
35 typedef GstFlowReturn (*MXFEssenceElementHandleFunc) (const MXFUL *key, GstBuffer *buffer, GstCaps *caps, MXFMetadataTimelineTrack *track, gpointer mapping_data, GstBuffer **outbuf);
36 
37 typedef struct {
38   gboolean (*handles_track) (const MXFMetadataTimelineTrack *track);
39   MXFEssenceWrapping (*get_track_wrapping) (const MXFMetadataTimelineTrack *track);
40   GstCaps * (*create_caps) (MXFMetadataTimelineTrack *track, GstTagList **tags, gboolean * intra_only, MXFEssenceElementHandleFunc *handler, gpointer *mapping_data);
41 } MXFEssenceElementHandler;
42 
43 typedef GstFlowReturn (*MXFEssenceElementWriteFunc) (GstBuffer *buffer, gpointer mapping_data, GstAdapter *adapter, GstBuffer **outbuf, gboolean flush);
44 
45 typedef struct {
46    MXFMetadataFileDescriptor * (*get_descriptor) (GstPadTemplate *tmpl, GstCaps *caps, MXFEssenceElementWriteFunc *handler, gpointer *mapping_data);
47    void (*update_descriptor) (MXFMetadataFileDescriptor *d, GstCaps *caps, gpointer mapping_data, GstBuffer *buf);
48    void (*get_edit_rate) (MXFMetadataFileDescriptor *a, GstCaps *caps, gpointer mapping_data, GstBuffer *buf, MXFMetadataSourcePackage *package, MXFMetadataTimelineTrack *track, MXFFraction *edit_rate);
49    guint32 (*get_track_number_template) (MXFMetadataFileDescriptor *a, GstCaps *caps, gpointer mapping_data);
50    const GstPadTemplate *pad_template;
51    MXFUL data_definition;
52 } MXFEssenceElementWriter;
53 
54 void mxf_essence_element_handler_register (const MXFEssenceElementHandler *handler);
55 const MXFEssenceElementHandler * mxf_essence_element_handler_find (const MXFMetadataTimelineTrack *track);
56 
57 void mxf_essence_element_writer_register (const MXFEssenceElementWriter *writer);
58 const GstPadTemplate ** mxf_essence_element_writer_get_pad_templates (void);
59 const MXFEssenceElementWriter *mxf_essence_element_writer_find (const GstPadTemplate *templ);
60 
61 #endif /* __MXF_ESSENCE_H__ */
62