slomo gst-plugins-bad: gst-plugins-bad/ gst-plugins-bad/gst/mxf/
[email protected] Sun, 7 Dec 2008 10:53:09 -0800 (PST)
| Newsgroups | gmane.comp.video.gstreamer.cvs |
|---|---|
| Message-ID | <[email protected]> |
CVS Root: /cvs/gstreamer
Module: gst-plugins-bad
Changes by: slomo
Date: Sun Dec 07 2008 18:53:08 UTC
Log message:
* gst/mxf/mxfd10.c: (mxf_d10_sound_handle_essence_element),
(mxf_d10_create_caps):
Use the mapping data for storing the channel count and the
width instead of parsing caps for every buffer.
Modified files:
. : ChangeLog
gst/mxf : mxfd10.c
Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ChangeLog.diff?r1=1.3797&r2=1.3798
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/gst/mxf/mxfd10.c.diff?r1=1.2&r2=1.3
====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-bad/ChangeLog,v
retrieving revision 1.3797
retrieving revision 1.3798
diff -u -d -r1.3797 -r1.3798
--- ChangeLog 7 Dec 2008 18:39:38 -0000 1.3797
+++ ChangeLog 7 Dec 2008 18:52:53 -0000 1.3798
@@ -1,5 +1,12 @@
2008-12-07 Sebastian Dröge <[email protected]>
+ * gst/mxf/mxfd10.c: (mxf_d10_sound_handle_essence_element),
+ (mxf_d10_create_caps):
+ Use the mapping data for storing the channel count and the
+ width instead of parsing caps for every buffer.
+
+2008-12-07 Sebastian Dröge <[email protected]>
* gst/mxf/mxfup.c: (mxf_up_handle_essence_element),
(mxf_up_rgba_create_caps):
Handle the image start and end offsets, otherwise we output
Index: mxfd10.c
RCS file: /cvs/gstreamer/gst-plugins-bad/gst/mxf/mxfd10.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mxfd10.c 6 Dec 2008 19:46:05 -0000 1.2
+++ mxfd10.c 7 Dec 2008 18:52:54 -0000 1.3
@@ -35,6 +35,11 @@
GST_DEBUG_CATEGORY_EXTERN (mxf_debug);
#define GST_CAT_DEFAULT mxf_debug
+typedef struct
+{
+ guint width, channels;
+} MXFD10AudioMappingData;
gboolean
mxf_is_d10_essence_track (const MXFMetadataTrack * track)
{
@@ -83,18 +88,13 @@
gpointer mapping_data, GstBuffer ** outbuf)
guint i, j, nsamples;
- gint width, channels;
- GstStructure *s = gst_caps_get_structure (caps, 0);
const guint8 *indata;
guint8 *outdata;
+ MXFD10AudioMappingData *data = mapping_data;
- if (!gst_structure_get_int (s, "width", &width) ||
- !gst_structure_get_int (s, "channels", &channels)) {
- GST_ERROR ("Invalid caps");
- return GST_FLOW_ERROR;
- }
-
- width /= 8;
+ g_return_val_if_fail (data != NULL, GST_FLOW_ERROR);
+ g_return_val_if_fail (data->channels != 0
+ && data->width != 0, GST_FLOW_ERROR);
/* SMPTE 386M 5.3.1 */
if (key->u[12] != 0x06 || key->u[13] != 0x01 || key->u[14] != 0x10) {
@@ -110,7 +110,7 @@
nsamples = ((GST_BUFFER_SIZE (buffer) - 4) / 4) / 8;
- *outbuf = gst_buffer_new_and_alloc (nsamples * width * channels);
+ *outbuf = gst_buffer_new_and_alloc (nsamples * data->width * data->channels);
gst_buffer_copy_metadata (*outbuf, buffer,
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS |
GST_BUFFER_COPY_CAPS);
@@ -122,25 +122,25 @@
indata += 4;
for (i = 0; i < nsamples; i++) {
- for (j = 0; j < channels; j++) {
+ for (j = 0; j < data->channels; j++) {
guint32 in = GST_READ_UINT32_LE (indata);
/* Remove first 4 and last 4 bits as they only
* contain status data. Shift the 24 bit samples
* to the correct width afterwards. */
- if (width == 2) {
+ if (data->width == 2) {
in = (in >> 12) & 0xffff;
GST_WRITE_UINT16_LE (outdata, in);
- } else if (width == 3) {
+ } else if (data->width == 3) {
in = (in >> 4) & 0xffffff;
GST_WRITE_UINT24_LE (outdata, in);
}
indata += 4;
- outdata += width;
+ outdata += data->width;
}
/* There are always 8 channels but only the first
* ones contain valid data, skip the others */
- indata += 4 * (8 - channels);
+ indata += 4 * (8 - data->channels);
}
gst_buffer_unref (buffer);
@@ -195,6 +195,8 @@
*tags = gst_tag_list_new ();
if (s) {
+ MXFD10AudioMappingData *data;
if (s->channel_count == 0 ||
s->quantization_bits == 0 ||
s->audio_sampling_rate.n == 0 || s->audio_sampling_rate.d == 0) {
@@ -220,6 +222,11 @@
*handler = mxf_d10_sound_handle_essence_element;
+ data = g_new0 (MXFD10AudioMappingData, 1);
+ data->width = s->quantization_bits / 8;
+ data->channels = s->channel_count;
+ *mapping_data = data;
gst_tag_list_add (*tags, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC,
"SMPTE D-10 Audio", NULL);
} else if (p) {
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
gstreamer-cvs-verbose mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs-verbose