pad->granulerate_n = GST_READ_UINT32_BE (data + 22);
pad->granulerate_d = GST_READ_UINT32_BE (data + 26);
+ if (pad->granulerate_n == 0 || pad->granulerate_d == 0) {
+ GST_WARNING ("frame rate %d/%d", pad->granulerate_n, pad->granulerate_d);
+ pad->granulerate_n = 0;
+ pad->granulerate_d = 0;
+ return FALSE;
+ }
par_n = GST_READ_UINT24_BE (data + 30);
par_d = GST_READ_UINT24_BE (data + 33);
if (pad->granuleshift >= 63) {
/* Granuleshift can't be greater than the storage size of a granule */
GST_WARNING ("Invalid granuleshift (%u >= 63)", pad->granuleshift);
+ pad->granulerate_n = 0;
+ pad->granulerate_d = 0;
+ pad->granuleshift = -1;
return FALSE;
}
GST_LOG ("granshift: %d", pad->granuleshift);
pad->bitrate = GST_READ_UINT24_BE (data + 37);
GST_LOG ("bit rate: %d", pad->bitrate);
- if (pad->granulerate_n == 0 || pad->granulerate_d == 0) {
- GST_WARNING ("frame rate %d/%d", pad->granulerate_n, pad->granulerate_d);
- return FALSE;
- }
-
/* The interpretation of the granule position has changed with 3.2.1.
The granule is now made from the number of frames encoded, rather than
the index of the frame being encoded - so there is a difference of 1. */
return FALSE;
}
+ if (header.interlaced_coding != 0) {
+ GST_DEBUG ("non-progressive Dirac coding not implemented");
+ return FALSE;
+ }
+
pad->is_video = TRUE;
pad->always_flush_page = TRUE;
pad->granulerate_n = header.frame_rate_numerator * 2;
pad->n_header_packets = 1;
pad->frame_size = 2;
- if (header.interlaced_coding != 0) {
- GST_DEBUG ("non-progressive Dirac coding not implemented");
- return FALSE;
- }
-
pad->caps = gst_caps_new_simple ("video/x-dirac",
"width", G_TYPE_INT, header.width,
"height", G_TYPE_INT, header.height,
data += 4;
chans = GST_READ_UINT8 (data);
data += 1;
+
pad->granulerate_n = GST_READ_UINT32_LE (data);
pad->granulerate_d = 1;
+ if (pad->granulerate_n == 0) {
+ pad->granulerate_n = 0;
+ pad->granulerate_d = 0;
+ return FALSE;
+ }
+
pad->granuleshift = 0;
pad->preroll = 2;
pad->last_size = 0;
pad->n_header_packets = 3;
- if (pad->granulerate_n == 0)
- return FALSE;
-
gst_parse_vorbis_header_packet (pad, packet);
pad->caps = gst_caps_new_simple ("audio/x-vorbis",
guint chans;
data += 8 + 20 + 4 + 4;
+
pad->granulerate_n = GST_READ_UINT32_LE (data);
pad->granulerate_d = 1;
+ if (pad->granulerate_n == 0) {
+ pad->granulerate_n = 0;
+ pad->granulerate_d = 0;
+ return FALSE;
+ }
+
pad->granuleshift = 0;
data += 4 + 4 + 4;
pad->frame_size = GST_READ_UINT32_LE (packet->packet + 64) *
GST_READ_UINT32_LE (packet->packet + 56);
- if (pad->granulerate_n == 0)
- return FALSE;
-
pad->caps = gst_caps_new_simple ("audio/x-speex", "rate", G_TYPE_INT,
pad->granulerate_n, "channels", G_TYPE_INT, chans, NULL);
pad->granulerate_n = (GST_READ_UINT32_BE (data + 27) & 0xFFFFF000) >> 12;
pad->granulerate_d = 1;
+
+ if (pad->granulerate_n == 0) {
+ pad->granulerate_n = 0;
+ pad->granulerate_d = 0;
+ return FALSE;
+ }
+
pad->granuleshift = 0;
chans = ((GST_READ_UINT32_BE (data + 27) & 0x00000E00) >> 9) + 1;
pad->n_header_packets = GST_READ_UINT16_BE (packet->packet + 7);
- if (pad->granulerate_n == 0)
- return FALSE;
-
pad->caps = gst_caps_new_simple ("audio/x-flac", "rate", G_TYPE_INT,
pad->granulerate_n, "channels", G_TYPE_INT, chans, NULL);
/* skip "fisbone\0" + headers offset + serialno + num headers */
data += 8 + 4 + 4 + 4;
- pad->have_fisbone = TRUE;
-
/* We don't overwrite whatever was set before by the format-specific
setup: skeleton contains wrong information sometimes, and the codec
headers are authoritative.
if (pad->granuleshift >= 63) {
/* Granuleshift can't be greater than the storage size of a granule */
GST_WARNING ("Invalid granuleshift (%u >= 63)", pad->granuleshift);
+ pad->granulerate_n = 0;
+ pad->granulerate_d = 0;
+ pad->granuleshift = -1;
return FALSE;
}
}
+ pad->have_fisbone = TRUE;
+
start_granule = GST_READ_UINT64_LE (data + 16);
pad->preroll = GST_READ_UINT32_LE (data + 24);
pad->granulerate_n = GST_READ_UINT64_LE (data + 25);
pad->granulerate_d = 1;
+ GST_LOG ("sample rate: %d", pad->granulerate_n);
+ if (pad->granulerate_n == 0) {
+ pad->granulerate_n = 0;
+ pad->granulerate_d = 0;
+ return FALSE;
+ }
+
fourcc = GST_READ_UINT32_LE (data + 9);
fstr = g_strdup_printf ("%" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
GST_DEBUG ("fourcc: %s", fstr);
pad->caps =
gst_riff_create_audio_caps (fourcc, NULL, NULL, NULL, NULL, NULL, NULL);
- GST_LOG ("sample rate: %d", pad->granulerate_n);
- if (pad->granulerate_n == 0)
- return FALSE;
-
if (pad->caps) {
gst_caps_set_simple (pad->caps,
"rate", G_TYPE_INT, pad->granulerate_n, NULL);
pad->granulerate_n, pad->granulerate_d,
(double) pad->granulerate_n / pad->granulerate_d);
- if (pad->granulerate_d <= 0)
+ if (pad->granulerate_d <= 0) {
+ pad->granulerate_n = 0;
+ pad->granulerate_d = 0;
return FALSE;
+ }
pad->caps = gst_caps_new_simple ("text/x-raw", "format", G_TYPE_STRING,
"utf8", NULL);
pad->granulerate_d = 1;
GST_LOG ("sample rate: %d", pad->granulerate_n);
- format = GST_READ_UINT32_LE (data + 12);
- channels = GST_READ_UINT8 (data + 21);
-
- pad->n_header_packets = 2 + GST_READ_UINT32_LE (data + 24);
-
- if (pad->granulerate_n == 0)
+ if (pad->granulerate_n == 0) {
+ pad->granulerate_n = 0;
+ pad->granulerate_d = 0;
return FALSE;
+ }
+ format = GST_READ_UINT32_LE (data + 12);
+ channels = GST_READ_UINT8 (data + 21);
switch (format) {
case OGGPCM_FMT_S8:
caps = gst_caps_new_simple ("audio/x-raw",
"format", G_TYPE_STRING, "F64BE", NULL);
break;
default:
+ pad->granulerate_n = 0;
+ pad->granulerate_d = 0;
return FALSE;
}
+ pad->n_header_packets = 2 + GST_READ_UINT32_LE (data + 24);
+
gst_caps_set_simple (caps,
"layout", G_TYPE_STRING, "interleaved",
"rate", G_TYPE_INT, pad->granulerate_n,
pad->granulerate_n = GST_READ_UINT64_LE (data + 12);
pad->granulerate_d = GST_READ_UINT64_LE (data + 20);
pad->granuleshift = data[28];
+
if (pad->granuleshift >= 63) {
/* Granuleshift can't be greater than the storage size of a granule */
GST_WARNING ("Invalid granuleshift (%u >= 63)", pad->granuleshift);
+ pad->granulerate_n = 0;
+ pad->granulerate_d = 0;
+ pad->granuleshift = -1;
return FALSE;
}
GST_LOG ("sample rate: %d", pad->granulerate_n);
- pad->n_header_packets = 3;
-
- if (pad->granulerate_n == 0)
+ if (pad->granulerate_n == 0) {
+ pad->granulerate_n = 0;
+ pad->granulerate_d = 0;
+ pad->granuleshift = -1;
return FALSE;
+ }
+
+ pad->n_header_packets = 3;
data += 4 + (4 + 4 + 4);
GST_DEBUG ("blocksize0: %u", 1 << (data[0] >> 4));
pad->frame_size = GST_READ_UINT32_LE (packet->packet + 44);
pad->n_header_packets = GST_READ_UINT32_LE (packet->packet + 56) + 2;
- if (pad->granulerate_n == 0)
+ if (pad->granulerate_n == 0) {
+ pad->granulerate_n = 0;
+ pad->granulerate_d = 0;
+ pad->granuleshift = -1;
return FALSE;
+ }
pad->caps = gst_caps_new_simple ("audio/x-celt",
"rate", G_TYPE_INT, pad->granulerate_n, NULL);
if (pad->granuleshift >= 63) {
/* Granuleshift can't be greater than the storage size of a granule */
GST_WARNING ("Invalid granuleshift (%u >= 63)", pad->granuleshift);
+ pad->granulerate_n = 0;
+ pad->granulerate_d = 0;
+ pad->granuleshift = -1;
return FALSE;
}
GST_LOG ("sample rate: %d", pad->granulerate_n);
+ if (pad->granulerate_n == 0) {
+ pad->granulerate_n = 0;
+ pad->granulerate_d = 0;
+ pad->granuleshift = -1;
+ return FALSE;
+ }
+
pad->n_header_packets = GST_READ_UINT8 (data + 11);
GST_LOG ("kate header packets: %d", pad->n_header_packets);
- if (pad->granulerate_n == 0)
- return FALSE;
-
category = (const char *) data + 48;
if (strcmp (category, "subtitles") == 0 || strcmp (category, "SUB") == 0 ||
strcmp (category, "spu-subtitles") == 0 ||
if (pad->granuleshift >= 63) {
/* Granuleshift can't be greater than the storage size of a granule */
GST_WARNING ("Invalid granuleshift (%u >= 63)", pad->granuleshift);
+ pad->granulerate_n = 0;
+ pad->granulerate_d = 0;
+ pad->granuleshift = -1;
return FALSE;
}
GST_LOG ("granshift: %d", pad->granuleshift);
- pad->is_video = TRUE;
- pad->n_header_packets = 3;
- pad->frame_size = 1;
-
if (pad->granulerate_n == 0 || pad->granulerate_d == 0) {
GST_WARNING ("frame rate %d/%d", pad->granulerate_n, pad->granulerate_d);
+ pad->granulerate_n = 0;
+ pad->granulerate_d = 0;
+ pad->granuleshift = -1;
return FALSE;
}
+ pad->is_video = TRUE;
+ pad->n_header_packets = 3;
+ pad->frame_size = 1;
+
pad->caps = gst_caps_new_empty_simple ("video/x-daala");
if (w > 0 && h > 0) {