summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2006-05-22 18:00:52 +0000
committerTim-Philipp Müller <tim@centricular.net>2006-05-22 18:00:52 +0000
commitbd10b5c348d59432dca81f7b3b31779797004f4f (patch)
treea02b9ad7ae6bb65a3160651d49ca206fa9e41297 /gst
parent4473ef89986a98297c89436fbd1b9933281b3039 (diff)
downloadgst-plugins-bad-bd10b5c348d59432dca81f7b3b31779797004f4f.tar.gz
gst-plugins-bad-bd10b5c348d59432dca81f7b3b31779797004f4f.tar.bz2
gst-plugins-bad-bd10b5c348d59432dca81f7b3b31779797004f4f.zip
gst/qtdemux/qtdemux.c: po/POTFILES.in:
Original commit message from CVS: * gst/qtdemux/qtdemux.c: (qtdemux_parse_trak), (plugin_init): po/POTFILES.in: Throw an error when the file is encrypted. Move plugin_init stuff to the end of the file, add stuff for i18n, make debug category static.
Diffstat (limited to 'gst')
-rw-r--r--gst/qtdemux/qtdemux.c59
1 files changed, 40 insertions, 19 deletions
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c
index 283c4b5a..9a932a40 100644
--- a/gst/qtdemux/qtdemux.c
+++ b/gst/qtdemux/qtdemux.c
@@ -22,13 +22,16 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+
+#include "gst/gst-i18n-plugin.h"
+
#include "qtdemux.h"
#include <stdlib.h>
#include <string.h>
#include <zlib.h>
-GST_DEBUG_CATEGORY_EXTERN (qtdemux_debug);
+GST_DEBUG_CATEGORY_STATIC (qtdemux_debug);
#define GST_CAT_DEFAULT qtdemux_debug
@@ -41,7 +44,7 @@ GST_DEBUG_CATEGORY_EXTERN (qtdemux_debug);
#define QTDEMUX_GUINT32_GET(a) (GST_READ_UINT32_BE(a))
#define QTDEMUX_GUINT24_GET(a) (GST_READ_UINT32_BE(a) >> 8)
#define QTDEMUX_GUINT16_GET(a) (GST_READ_UINT16_BE(a))
-#define QTDEMUX_GUINT8_GET(a) (*(guint8 *)(a))
+#define QTDEMUX_GUINT8_GET(a) (GST_READ_UINT8(a))
#define QTDEMUX_FP32_GET(a) ((GST_READ_UINT32_BE(a))/65536.0)
#define QTDEMUX_FP16_GET(a) ((GST_READ_UINT16_BE(a))/256.0)
#define QTDEMUX_FOURCC_GET(a) (GST_READ_UINT32_LE(a))
@@ -862,23 +865,6 @@ gst_qtdemux_handle_src_event (GstPad * pad, GstEvent * event)
return res;
}
-GST_DEBUG_CATEGORY (qtdemux_debug);
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (qtdemux_debug, "qtdemux", 0, "qtdemux plugin");
-
- return gst_element_register (plugin, "qtdemux",
- GST_RANK_PRIMARY, GST_TYPE_QTDEMUX);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "qtdemux",
- "Quicktime stream demuxer",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
-
static gboolean
gst_qtdemux_handle_sink_event (GstPad * sinkpad, GstEvent * event)
{
@@ -3052,6 +3038,9 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
QTDEMUX_GUINT16_GET (stsd->data + offset + 48));
stream->fourcc = fourcc = QTDEMUX_FOURCC_GET (stsd->data + offset + 4);
+ if (fourcc == GST_MAKE_FOURCC ('d', 'r', 'm', 's'))
+ goto error_encrypted;
+
stream->caps = qtdemux_video_caps (qtdemux, fourcc, stsd->data, &codec);
if (codec) {
list = gst_tag_list_new ();
@@ -3239,6 +3228,9 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
GST_WARNING ("unknown version %08x", version);
}
+ if (fourcc == GST_MAKE_FOURCC ('d', 'r', 'm', 's'))
+ goto error_encrypted;
+
stream->caps = qtdemux_audio_caps (qtdemux, stream, fourcc, NULL, 0,
&codec);
@@ -3593,6 +3585,15 @@ done3:
GST_DEBUG_OBJECT (qtdemux, "using %d segments", stream->n_segments);
gst_qtdemux_add_stream (qtdemux, stream, list);
+ return;
+
+/* ERRORS */
+error_encrypted:
+ {
+ GST_ELEMENT_ERROR (qtdemux, STREAM, DECODE,
+ (_("This file is encrypted and cannot be played.")), (NULL));
+ return;
+ }
}
static void
@@ -4152,3 +4153,23 @@ qtdemux_audio_caps (GstQTDemux * qtdemux, QtDemuxStream * stream,
}
}
}
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+#ifdef ENABLE_NLS
+ setlocale (LC_ALL, "");
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+#endif /* ENABLE_NLS */
+
+ GST_DEBUG_CATEGORY_INIT (qtdemux_debug, "qtdemux", 0, "qtdemux plugin");
+
+ return gst_element_register (plugin, "qtdemux",
+ GST_RANK_PRIMARY, GST_TYPE_QTDEMUX);
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "qtdemux",
+ "Quicktime stream demuxer",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);