[prev in list] [next in list] [prev in thread] [next in thread]
List: gstreamer-devel
Subject: [gst-devel] OGM support for oggdemux
From: David Voit <david.voit () weihenstephan ! org>
Date: 2004-06-27 16:32:19
Message-ID: 1088353939.23713.5.camel () home
[Download RAW message or body]
Hi everybody
Here is a patch witch add OGM support to the oggdemux plugin.
Things witch need to be worked on:
- Drop 2 packets after creating the caps (OGM header + comment header)
- Add audio support
- Clean it up
- Modify it for CVS (I am using gst-plugins-0.8)
Please contact me directly i'm not a member of the list
Bye
David Voit
["ogm-patch" (ogm-patch)]
diff -urpN -x '*.*lo' -x Makefile -x Makefile.in -x '*.sgml' -x '*.html' -x '*.xml' \
-x '*.txt' gst-plugins-0.8.2/ext/ogg/gstogg.c \
gst-plugins0.8-0.8.2.withogm/ext/ogg/gstogg.c
--- gst-plugins-0.8.2/ext/ogg/gstogg.c 2004-05-10 15:34:57.000000000 +0200
+++ gst-plugins0.8-0.8.2.withogm/ext/ogg/gstogg.c 2004-06-27 17:46:54.000000000 +0200
@@ -31,6 +31,9 @@ GST_DEBUG_CATEGORY (vorbisdec_debug);
static gboolean
plugin_init (GstPlugin * plugin)
{
+ if (!gst_library_load ("riff"))
+ return FALSE;
+
gst_ogg_demux_plugin_init (plugin);
gst_ogg_mux_plugin_init (plugin);
diff -urpN -x '*.*lo' -x Makefile -x Makefile.in -x '*.sgml' -x '*.html' -x '*.xml' \
-x '*.txt' gst-plugins-0.8.2/ext/ogg/gstoggdemux.c \
gst-plugins0.8-0.8.2.withogm/ext/ogg/gstoggdemux.c
--- gst-plugins-0.8.2/ext/ogg/gstoggdemux.c 2004-05-30 14:26:14.000000000 +0200
+++ gst-plugins0.8-0.8.2.withogm/ext/ogg/gstoggdemux.c 2004-06-27 18:17:54.000000000 \
+0200 @@ -28,6 +28,8 @@
* note: the ogg docs even say you need this... */
#include <string.h>
+#include "ogmstreams.h"
+
GST_DEBUG_CATEGORY_STATIC (gst_ogg_demux_debug);
#define GST_CAT_DEFAULT gst_ogg_demux_debug
@@ -782,9 +784,27 @@ gst_ogg_pad_push (GstOggDemux * ogg, Gst
gchar *name = g_strdup_printf ("serial_%d", pad->serial);
if (caps == NULL) {
+ /* FIXME: Need to drop 2 packets after creating caps. Howto? */
+ /* Maybe a ogm stream (stolen from ogmtools) */
+ if (((*packet.packet & PACKET_TYPE_BITS ) == PACKET_TYPE_HEADER) &&
+ (packet.bytes >= ((int)sizeof(stream_header) + 1))) {
+ stream_header ogm_header;
+ memcpy (&ogm_header, packet.packet+1, sizeof(stream_header));
+ if (!strncmp (ogm_header.streamtype, "video", 5))
+ {
+ caps = gst_riff_create_video_caps (GST_STR_FOURCC(ogm_header.subtype), NULL, \
NULL, NULL); + gst_caps_set_simple (caps, "framerate", G_TYPE_DOUBLE, \
(double)10000000 / (double)ogm_header.time_unit, NULL); + gst_caps_set_simple \
(caps, "width", G_TYPE_INT, ogm_header.sh.video.width, "height", G_TYPE_INT, \
ogm_header.sh.video.height, NULL); + }
+ else /*Audio not supported now*/
+ caps = gst_caps_new_simple ("application/octet-stream", NULL);
+ }
+ else
+ {
GST_WARNING_OBJECT (ogg,
"couldn't find caps for stream with serial %d", pad->serial);
caps = gst_caps_new_simple ("application/octet-stream", NULL);
+ }
}
pad->pad =
gst_pad_new_from_template (gst_static_pad_template_get
diff -urpN -x '*.*lo' -x Makefile -x Makefile.in -x '*.sgml' -x '*.html' -x '*.xml' \
-x '*.txt' gst-plugins-0.8.2/ext/ogg/ogmstreams.h \
gst-plugins0.8-0.8.2.withogm/ext/ogg/ogmstreams.h
--- gst-plugins-0.8.2/ext/ogg/ogmstreams.h 1970-01-01 01:00:00.000000000 +0100
+++ gst-plugins0.8-0.8.2.withogm/ext/ogg/ogmstreams.h 2004-06-27 17:01:50.000000000 \
+0200 @@ -0,0 +1,100 @@
+#ifndef __OGGSTREAMS_H
+#define __OGGSTREAMS_H
+
+/*
+ * Taken from http://tobias.everwicked.com/packfmt.htm
+ *
+
+ First packet (header)
+ ---------------------
+
+ pos | content | description
+ -------+-------------------------+----------------------------------
+ 0x0000 | 0x01 | indicates 'header packet'
+ -------+-------------------------+----------------------------------
+ 0x0001 | stream_header | the size is indicated in the
+ | | size member
+
+
+ Second packet (comment)
+ -----------------------
+
+ pos | content | description
+ -------+-------------------------+----------------------------------
+ 0x0000 | 0x03 | indicates 'comment packet'
+ -------+-------------------------+----------------------------------
+ 0x0001 | data | see vorbis doc on www.xiph.org
+
+ Data packets
+ ------------
+
+ pos | content | description
+ ---------+-------------------------+----------------------------------
+ 0x0000 | Bit0 0 | indicates data packet
+ | Bit1 Bit 2 of lenbytes |
+ | Bit2 unused |
+ | Bit3 keyframe |
+ | Bit4 unused |
+ | Bit5 unused |
+ | Bit6 Bit 0 of lenbytes |
+ | Bit7 Bit 1 of lenbytes |
+ ---------+-------------------------+----------------------------------
+ 0x0001 | LowByte | Length of this packet in samples
+ | ... | (frames for video, samples for
+ | HighByte | audio, 1ms units for text)
+ ---------+-------------------------+----------------------------------
+ 0x0001+ | data | packet contents
+ lenbytes | |
+
+ *
+ *
+ */
+
+//// OggDS headers
+// Header for the new header format
+typedef struct stream_header_video
+{
+ gint32 width;
+ gint32 height;
+} stream_header_video;
+
+typedef struct stream_header_audio
+{
+ gint16 channels;
+ gint16 blockalign;
+ gint32 avgbytespersec;
+} stream_header_audio;
+
+typedef struct stream_header
+{
+ char streamtype[8];
+ char subtype[4];
+
+ gint32 size; // size of the structure
+
+ gint64 time_unit; // in reference time
+ gint64 samples_per_unit;
+ gint32 default_len; // in media time
+
+ gint32 buffersize;
+ gint16 bits_per_sample;
+
+ union
+ {
+ // Video specific
+ stream_header_video video;
+ // Audio specific
+ stream_header_audio audio;
+ } sh;
+
+} stream_header;
+
+/// Some defines from OggDS
+#define PACKET_TYPE_HEADER 0x01
+#define PACKET_TYPE_COMMENT 0x03
+#define PACKET_TYPE_BITS 0x07
+#define PACKET_LEN_BITS01 0xc0
+#define PACKET_LEN_BITS2 0x02
+#define PACKET_IS_SYNCPOINT 0x08
+
+#endif /* __OGGSTREAMS_H */
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic