mxf: add a return to fix the build when turning assert off

This commit is contained in:
Stefan Kost 2010-01-22 17:45:20 +02:00
parent 7e067615ff
commit 68ca62b369
3 changed files with 16 additions and 50 deletions

View file

@ -69,8 +69,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, 6 ], "
"endianness = (int) BYTE_ORDER, "
"width = (int) { 16, 32 }, "
"depth = (int) 16, " "signed = (boolean) true")
"width = (int) 32, " "depth = (int) 16, " "signed = (boolean) true")
);
static GstStaticPadTemplate vorbis_dec_sink_factory =
@ -238,7 +237,7 @@ vorbis_dec_convert (GstPad * pad,
case GST_FORMAT_TIME:
switch (*dest_format) {
case GST_FORMAT_BYTES:
scale = dec->width * dec->vi.channels;
scale = sizeof (gint32) * dec->vi.channels;
case GST_FORMAT_DEFAULT:
*dest_value =
scale * gst_util_uint64_scale_int (src_value, dec->vi.rate,
@ -251,7 +250,7 @@ vorbis_dec_convert (GstPad * pad,
case GST_FORMAT_DEFAULT:
switch (*dest_format) {
case GST_FORMAT_BYTES:
*dest_value = src_value * dec->width * dec->vi.channels;
*dest_value = src_value * sizeof (gint32) * dec->vi.channels;
break;
case GST_FORMAT_TIME:
*dest_value =
@ -264,11 +263,11 @@ vorbis_dec_convert (GstPad * pad,
case GST_FORMAT_BYTES:
switch (*dest_format) {
case GST_FORMAT_DEFAULT:
*dest_value = src_value / (dec->width * dec->vi.channels);
*dest_value = src_value / (sizeof (gint32) * dec->vi.channels);
break;
case GST_FORMAT_TIME:
*dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND,
dec->vi.rate * dec->width * dec->vi.channels);
dec->vi.rate * sizeof (gint32) * dec->vi.channels);
break;
default:
res = FALSE;
@ -575,7 +574,6 @@ vorbis_handle_identification_packet (GstIVorbisDec * vd)
{
GstCaps *caps;
const GstAudioChannelPosition *pos = NULL;
gint width = 16;
switch (vd->vi.channels) {
case 1:
@ -628,24 +626,10 @@ vorbis_handle_identification_packet (GstIVorbisDec * vd)
goto channel_count_error;
}
/* negotiate with downstream */
caps = gst_pad_get_allowed_caps (vd->srcpad);
if (caps) {
if (!gst_caps_is_empty (caps)) {
GstStructure *s;
s = gst_caps_get_structure (caps, 0);
/* template ensures 16 or 32 */
gst_structure_get_int (s, "width", &width);
}
gst_caps_unref (caps);
}
vd->width = width >> 3;
caps = gst_caps_new_simple ("audio/x-raw-int",
"rate", G_TYPE_INT, vd->vi.rate,
"channels", G_TYPE_INT, vd->vi.channels,
"endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, width,
"endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32,
"depth", G_TYPE_INT, 16, "signed", G_TYPE_BOOLEAN, TRUE, NULL);
if (pos) {
@ -846,18 +830,6 @@ copy_samples (gint32 * out, ogg_int32_t ** in, guint samples, gint channels)
}
}
static void
copy_samples_16 (gint16 * out, ogg_int32_t ** in, guint samples, gint channels)
{
gint i, j;
for (j = 0; j < samples; j++) {
for (i = 0; i < channels; i++) {
*out++ = CLIP_TO_15 (in[i][j] >> 9);
}
}
}
/* clip output samples to the segment boundaries
*/
static gboolean
@ -881,7 +853,7 @@ vorbis_do_clip (GstIVorbisDec * dec, GstBuffer * buf)
/* bring clipped time to samples */
diff = gst_util_uint64_scale_int (diff, dec->vi.rate, GST_SECOND);
/* samples to bytes */
diff *= (dec->width * dec->vi.channels);
diff *= (sizeof (gint32) * dec->vi.channels);
GST_DEBUG_OBJECT (dec, "clipping start to %" GST_TIME_FORMAT " %"
G_GUINT64_FORMAT " bytes", GST_TIME_ARGS (cstart), diff);
GST_BUFFER_DATA (buf) += diff;
@ -893,7 +865,7 @@ vorbis_do_clip (GstIVorbisDec * dec, GstBuffer * buf)
/* bring clipped time to samples and then to bytes */
diff = gst_util_uint64_scale_int (diff, dec->vi.rate, GST_SECOND);
diff *= (dec->width * dec->vi.channels);
diff *= (sizeof (gint32) * dec->vi.channels);
GST_DEBUG_OBJECT (dec, "clipping stop to %" GST_TIME_FORMAT " %"
G_GUINT64_FORMAT " bytes", GST_TIME_ARGS (cstop), diff);
GST_BUFFER_SIZE (buf) -= diff;
@ -932,7 +904,8 @@ vorbis_dec_push (GstIVorbisDec * dec, GstBuffer * buf)
walk = g_list_previous (walk)) {
GstBuffer *buffer = GST_BUFFER (walk->data);
outoffset -= GST_BUFFER_SIZE (buffer) / (dec->width * dec->vi.channels);
outoffset -=
GST_BUFFER_SIZE (buffer) / (sizeof (gint32) * dec->vi.channels);
GST_BUFFER_OFFSET (buffer) = outoffset;
GST_BUFFER_TIMESTAMP (buffer) =
@ -1013,7 +986,7 @@ vorbis_handle_data_packet (GstIVorbisDec * vd, ogg_packet * packet)
if ((sample_count = vorbis_synthesis_pcmout (&vd->vd, NULL)) == 0)
goto done;
size = sample_count * vd->vi.channels * vd->width;
size = sample_count * vd->vi.channels * sizeof (gint32);
/* alloc buffer for it */
result =
@ -1027,15 +1000,8 @@ vorbis_handle_data_packet (GstIVorbisDec * vd, ogg_packet * packet)
goto wrong_samples;
/* copy samples in buffer */
if (vd->width == 4) {
copy_samples ((gint32 *) GST_BUFFER_DATA (out), pcm, sample_count,
vd->vi.channels);
} else if (vd->width == 2) {
copy_samples_16 ((gint16 *) GST_BUFFER_DATA (out), pcm, sample_count,
vd->vi.channels);
} else {
g_assert_not_reached ();
}
copy_samples ((gint32 *) GST_BUFFER_DATA (out), pcm, sample_count,
vd->vi.channels);
GST_BUFFER_SIZE (out) = size;
GST_BUFFER_OFFSET (out) = vd->granulepos;
@ -1217,7 +1183,6 @@ vorbis_dec_change_state (GstElement * element, GstStateChange transition)
vorbis_info_init (&vd->vi);
vorbis_comment_init (&vd->vc);
vd->initialized = FALSE;
vd->width = 2;
gst_ivorbis_dec_reset (vd);
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:

View file

@ -524,6 +524,7 @@ mxf_up_get_descriptor (GstPadTemplate * tmpl, GstCaps * caps,
}
g_assert_not_reached ();
return NULL;
}
static void

View file

@ -6,7 +6,7 @@
#undef ENABLE_NLS
/* gettext package name */
#define GETTEXT_PACKAGE "gst-plugins-bad-0.10"
#define GETTEXT_PACKAGE "NULL"
/* PREFIX - specifically added for Windows for easier moving */
#define PREFIX "C:\\gstreamer"
@ -27,7 +27,7 @@
#define GST_PACKAGE_NAME "GStreamer Bad Plug-ins git"
/* package origin */
#define GST_PACKAGE_ORIGIN "Unknown package origin"
#define GST_PACKAGE_ORIGIN "http://gstreamer.freedesktop.org"
/* Define if the host CPU is an Alpha */
#undef HAVE_CPU_ALPHA