~ubuntu-branches/ubuntu/karmic/gst-plugins-bad0.10/karmic-proposed

« back to all changes in this revision

Viewing changes to gst/mxf/mxfdv-dif.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge, Fabian Greffrath, Sebastian Dröge
  • Date: 2009-05-12 09:51:24 UTC
  • mfrom: (18.3.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20090512095124-6h887drc2pk2imm3
Tags: 0.10.11.2-1
[ Fabian Greffrath ]
* debian/TODO.Debian:
  + Removed, I don't think any of these things are still relevant.

[ Sebastian Dröge ]
* New upstream pre-release:
  + debian/build-deps.in,
    debian/rules:
    - Update build dependencies.
  + debian/gstreamer-plugins-bad.install:
    - Add new debugutilsbad plugin.
* debian/build-deps.in:
  + Use unversioned libjack-dev b-d (Closes: #526109).

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
/* TODO:
25
25
 *  - playbin hangs on a lot of MXF/DV-DIF files (bug #563827)
26
26
 *  - decodebin2 creates loops inside the linking graph (bug #563828)
27
 
 *  - Forwarding of timestamps in dvdemux?
 
27
 *  - track descriptor might be multiple descriptor, one for sound, one for video
 
28
 *  - there might be 2 tracks for one essence, i.e. one audio/one video track
28
29
 */
29
30
 
30
31
#ifdef HAVE_CONFIG_H
32
33
#endif
33
34
 
34
35
#include <gst/gst.h>
 
36
#include <gst/video/video.h>
35
37
#include <string.h>
36
38
 
37
39
#include "mxfdv-dif.h"
 
40
#include "mxfessence.h"
38
41
 
39
42
GST_DEBUG_CATEGORY_EXTERN (mxf_debug);
40
43
#define GST_CAT_DEFAULT mxf_debug
41
44
 
42
 
static const guint8 picture_essence_coding_dv[13] = {
43
 
  0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x01, 0x04, 0x01, 0x02, 0x02, 0x02
 
45
static const MXFUL picture_essence_coding_dv = { {
 
46
        0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x01, 0x04, 0x01, 0x02, 0x02,
 
47
    0x02}
44
48
};
45
49
 
46
50
static gboolean
73
77
      p = MXF_METADATA_GENERIC_PICTURE_ESSENCE_DESCRIPTOR (d);
74
78
 
75
79
      key = &p->picture_essence_coding;
76
 
      if (memcmp (key, &picture_essence_coding_dv, 13) == 0)
 
80
      if (mxf_ul_is_subclass (&picture_essence_coding_dv, key))
77
81
        return TRUE;
78
82
    }
79
83
  }
104
108
    MXFEssenceElementHandleFunc * handler, gpointer * mapping_data)
105
109
{
106
110
  GstCaps *caps = NULL;
 
111
  guint i;
 
112
  MXFMetadataGenericPictureEssenceDescriptor *d = NULL;
107
113
 
108
114
  g_return_val_if_fail (track != NULL, NULL);
109
115
 
112
118
    return NULL;
113
119
  }
114
120
 
 
121
  for (i = 0; i < track->parent.n_descriptor; i++) {
 
122
    if (MXF_IS_METADATA_GENERIC_PICTURE_ESSENCE_DESCRIPTOR (track->
 
123
            parent.descriptor[i])) {
 
124
      d = MXF_METADATA_GENERIC_PICTURE_ESSENCE_DESCRIPTOR (track->
 
125
          parent.descriptor[i]);
 
126
      break;
 
127
    }
 
128
  }
 
129
 
115
130
  *handler = mxf_dv_dif_handle_essence_element;
116
131
  /* SMPTE 383M 8 */
117
132
 
123
138
      gst_caps_new_simple ("video/x-dv", "systemstream", G_TYPE_BOOLEAN, TRUE,
124
139
      NULL);
125
140
 
 
141
  if (d)
 
142
    mxf_metadata_generic_picture_essence_descriptor_set_caps (d, caps);
 
143
 
126
144
  if (!*tags)
127
145
    *tags = gst_tag_list_new ();
128
146
 
136
154
  mxf_dv_dif_create_caps
137
155
};
138
156
 
 
157
static GstFlowReturn
 
158
mxf_dv_dif_write_func (GstBuffer * buffer, GstCaps * caps,
 
159
    gpointer mapping_data, GstAdapter * adapter, GstBuffer ** outbuf,
 
160
    gboolean flush)
 
161
{
 
162
  *outbuf = buffer;
 
163
  return GST_FLOW_OK;
 
164
}
 
165
 
 
166
static const guint8 dv_dif_essence_container_ul[] = {
 
167
  0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x01,
 
168
  0x0d, 0x01, 0x03, 0x01, 0x02, 0x02, 0x7f, 0x01
 
169
};
 
170
 
 
171
static MXFMetadataFileDescriptor *
 
172
mxf_dv_dif_get_descriptor (GstPadTemplate * tmpl, GstCaps * caps,
 
173
    MXFEssenceElementWriteFunc * handler, gpointer * mapping_data)
 
174
{
 
175
  MXFMetadataCDCIPictureEssenceDescriptor *ret;
 
176
 
 
177
  ret = (MXFMetadataCDCIPictureEssenceDescriptor *)
 
178
      gst_mini_object_new (MXF_TYPE_METADATA_CDCI_PICTURE_ESSENCE_DESCRIPTOR);
 
179
 
 
180
  memcpy (&ret->parent.parent.essence_container, &dv_dif_essence_container_ul,
 
181
      16);
 
182
 
 
183
  if (!mxf_metadata_generic_picture_essence_descriptor_from_caps (&ret->parent,
 
184
          caps)) {
 
185
    gst_mini_object_unref (GST_MINI_OBJECT_CAST (ret));
 
186
    return NULL;
 
187
  }
 
188
  *handler = mxf_dv_dif_write_func;
 
189
 
 
190
  return (MXFMetadataFileDescriptor *) ret;
 
191
}
 
192
 
 
193
static void
 
194
mxf_dv_dif_update_descriptor (MXFMetadataFileDescriptor * d, GstCaps * caps,
 
195
    gpointer mapping_data, GstBuffer * buf)
 
196
{
 
197
  return;
 
198
}
 
199
 
 
200
static void
 
201
mxf_dv_dif_get_edit_rate (MXFMetadataFileDescriptor * a, GstCaps * caps,
 
202
    gpointer mapping_data, GstBuffer * buf, MXFMetadataSourcePackage * package,
 
203
    MXFMetadataTimelineTrack * track, MXFFraction * edit_rate)
 
204
{
 
205
  edit_rate->n = a->sample_rate.n;
 
206
  edit_rate->d = a->sample_rate.d;
 
207
}
 
208
 
 
209
static guint32
 
210
mxf_dv_dif_get_track_number_template (MXFMetadataFileDescriptor * a,
 
211
    GstCaps * caps, gpointer mapping_data)
 
212
{
 
213
  return (0x18 << 24) | (0x01 << 8);
 
214
}
 
215
 
 
216
static MXFEssenceElementWriter mxf_dv_dif_essence_element_writer = {
 
217
  mxf_dv_dif_get_descriptor,
 
218
  mxf_dv_dif_update_descriptor,
 
219
  mxf_dv_dif_get_edit_rate,
 
220
  mxf_dv_dif_get_track_number_template,
 
221
  NULL,
 
222
  {{0,}}
 
223
};
 
224
 
139
225
void
140
226
mxf_dv_dif_init (void)
141
227
{
142
228
  mxf_essence_element_handler_register (&mxf_dv_dif_essence_element_handler);
 
229
 
 
230
  mxf_dv_dif_essence_element_writer.pad_template =
 
231
      gst_pad_template_new ("dv_dif_video_sink_%u", GST_PAD_SINK,
 
232
      GST_PAD_REQUEST,
 
233
      gst_caps_from_string ("video/x-dv, width = "
 
234
          GST_VIDEO_SIZE_RANGE ", height = " GST_VIDEO_SIZE_RANGE
 
235
          ", framerate = " GST_VIDEO_FPS_RANGE ", systemstream = true"));
 
236
  memcpy (&mxf_dv_dif_essence_element_writer.data_definition,
 
237
      mxf_metadata_track_identifier_get (MXF_METADATA_TRACK_PICTURE_ESSENCE),
 
238
      16);
 
239
  mxf_essence_element_writer_register (&mxf_dv_dif_essence_element_writer);
143
240
}