Commit e7ecaedc authored by David Schleef's avatar David Schleef

Merge HEAD from CAPS-ROOT to CAPS-MERGE-3

Original commit message from CVS:
Merge HEAD from CAPS-ROOT to CAPS-MERGE-3
parent 9e875983
......@@ -291,7 +291,6 @@ GST_PLUGIN_DEFINE (
plugin_init,
VERSION,
"GPL",
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)
......
plugin_LTLIBRARIES = libgstavi.la
libgstavi_la_SOURCES = gstavidemux.c gstavimux.c
libgstavi_la_SOURCES = \
gstavi.c \
gstavidemux.c \
gstavimux.c
noinst_HEADERS = \
gstavimux.h \
gstavidemux.h
avi-ids.h \
gstavimux.h \
gstavidemux.h
libgstavi_la_CFLAGS = $(GST_CFLAGS)
libgstavi_la_LIBADD =
......
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
*
* gstossgst.h:
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -20,65 +17,32 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_OSSGST_H__
#define __GST_OSSGST_H__
#ifndef __GST_AVI_H__
#define __GST_AVI_H__
#include <gst/gst.h>
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define GST_TYPE_OSSGST \
(gst_ossgst_get_type())
#define GST_OSSGST(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OSSGST,GstOssGst))
#define GST_OSSGST_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OSSGST,GstOssGstClass))
#define GST_IS_OSSGST(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OSSGST))
#define GST_IS_OSSGST_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OSSGST))
typedef enum {
GST_OSSGST_OPEN = GST_ELEMENT_FLAG_LAST,
GST_OSSGST_FLAG_LAST = GST_ELEMENT_FLAG_LAST+2,
} GstOssGstFlags;
typedef struct _GstOssGst GstOssGst;
typedef struct _GstOssGstClass GstOssGstClass;
struct _GstOssGst {
GstElement element;
GstPad *srcpad;
gint fdout[2];
gint fdin[2];
pid_t childpid;
/* soundcard state */
gboolean mute;
gchar *command;
};
struct _GstOssGstClass {
GstElementClass parent_class;
/* signals */
};
GType gst_ossgst_get_type(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GST_OSSGST_H__ */
typedef struct _gst_riff_avih {
guint32 us_frame; /* microsec per frame */
guint32 max_bps; /* byte/s overall */
guint32 pad_gran; /* pad_granularity */
guint32 flags;
/* flags values */
#define GST_RIFF_AVIH_HASINDEX 0x00000010 /* has idx1 chunk */
#define GST_RIFF_AVIH_MUSTUSEINDEX 0x00000020 /* must use idx1 chunk to determine order */
#define GST_RIFF_AVIH_ISINTERLEAVED 0x00000100 /* AVI file is interleaved */
#define GST_RIFF_AVIH_WASCAPTUREFILE 0x00010000 /* specially allocated used for capturing real time video */
#define GST_RIFF_AVIH_COPYRIGHTED 0x00020000 /* contains copyrighted data */
guint32 tot_frames; /* # of frames (all) */
guint32 init_frames; /* initial frames (???) */
guint32 streams;
guint32 bufsize; /* suggested buffer size */
guint32 width;
guint32 height;
guint32 scale;
guint32 rate;
guint32 start;
guint32 length;
} gst_riff_avih;
#endif /* __GST_AVI_H__ */
/* Evil evil evil hack to get OSS apps to cooperate with esd
* Copyright (C) 1998, 1999 Manish Singh <yosh@gimp.org>
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@temple-baptist.com>
*
* gstavi.c: plugin registering
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -17,28 +19,35 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_OSSGST_HELPER_H__
#define __GST_OSSGST_HELPER_H__
#define HELPER_MAGIC_IN 500
#define HELPER_MAGIC_OUT 501
#define HELPER_MAGIC_SNDFD 502
#define CMD_DATA 1
#define CMD_FORMAT 2
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
typedef struct {
char id;
#include "gstavidemux.h"
#include "gstavimux.h"
union {
unsigned int length;
struct {
int format;
int stereo;
int rate;
} format;
} cmd;
} command;
static gboolean
plugin_init (GstPlugin *plugin)
{
if (!gst_library_load ("riff"))
return FALSE;
return (gst_element_register (plugin, "avidemux",
GST_RANK_PRIMARY,
GST_TYPE_AVI_DEMUX) &&
gst_element_register (plugin, "avimux",
GST_RANK_NONE,
GST_TYPE_AVIMUX));
}
#endif /* __GST_OSSGST_HELPER_H__ */
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"avi",
"AVI stream handling",
plugin_init,
VERSION,
"LGPL",
GST_PACKAGE,
GST_ORIGIN
)
This diff is collapsed.
......@@ -17,28 +17,26 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_AVI_DEMUX_H__
#define __GST_AVI_DEMUX_H__
#include <gst/gst.h>
#include <gst/bytestream/bytestream.h>
#include <gst/riff/riff.h>
#include "gst/riff/riff-ids.h"
#include "gst/riff/riff-read.h"
G_BEGIN_DECLS
#define GST_TYPE_AVI_DEMUX \
(gst_avi_demux_get_type())
(gst_avi_demux_get_type ())
#define GST_AVI_DEMUX(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AVI_DEMUX,GstAviDemux))
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_AVI_DEMUX, GstAviDemux))
#define GST_AVI_DEMUX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AVI_DEMUX,GstAviDemux))
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_AVI_DEMUX, GstAviDemux))
#define GST_IS_AVI_DEMUX(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AVI_DEMUX))
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_AVI_DEMUX))
#define GST_IS_AVI_DEMUX_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AVI_DEMUX))
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_AVI_DEMUX))
#define GST_AVI_DEMUX_MAX_STREAMS 16
......@@ -46,80 +44,82 @@ G_BEGIN_DECLS
((((chunkid) & 0xff) - '0') * 10 + \
(((chunkid) >> 8) & 0xff) - '0')
typedef struct _GstAviDemux GstAviDemux;
typedef struct _GstAviDemuxClass GstAviDemuxClass;
typedef struct
{
gint index_nr;
gint stream_nr;
guint64 ts;
guint32 flags;
guint32 offset;
gint size;
guint64 bytes_before;
guint32 frames_before;
typedef struct {
gint index_nr;
gint stream_nr;
guint64 ts;
guint32 flags;
guint32 offset;
gint size;
guint64 bytes_before;
guint32 frames_before;
} gst_avi_index_entry;
typedef struct
{
GstPad *pad;
gint num;
gst_riff_strh strh;
guint32 current_frame;
guint32 current_byte;
guint64 delay;
gboolean need_flush;
guint64 end_pos;
typedef struct {
/* index of this streamcontext */
guint num;
/* pad, strh */
GstPad *pad;
gst_riff_strh *strh;
guint64 total_bytes;
guint32 total_frames;
/* current position (byte, frame, time) */
guint current_frame;
guint64 current_byte;
gint current_entry;
guint32 skip;
/* delay in time (init_frames) */
guint64 delay;
/* stream length */
guint64 total_bytes;
guint32 total_frames;
guint32 skip;
} avi_stream_context;
typedef enum
{
typedef enum {
GST_AVI_DEMUX_START,
GST_AVI_DEMUX_HEADER,
GST_AVI_DEMUX_MOVI,
} GstAviDemuxState;
struct _GstAviDemux {
GstElement element;
typedef struct _GstAviDemux {
GstRiffRead parent;
/* pads */
GstPad *sinkpad, *srcpad;
GstPad *sinkpad;
/* AVI decoding state */
guint32 fcc_type;
GstAviDemuxState state;
guint level_up;
GstByteStream *bs;
/* index */
gst_avi_index_entry *index_entries;
gulong index_size;
gulong index_offset;
gst_riff_avih avih;
guint index_size;
guint64 index_offset;
/* streams */
guint num_streams;
guint num_v_streams;
guint num_a_streams;
avi_stream_context stream[GST_AVI_DEMUX_MAX_STREAMS];
gboolean seek_pending;
gint64 seek_offset;
guint64 last_seek;
/* some stream info for length */
guint32 us_per_frame;
guint32 num_frames;
/* seeking */
guint64 seek_offset;
guint64 last_seek;
GstStructure *metadata;
/* info */
GstCaps2 *streaminfo;
};
} GstAviDemux;
struct _GstAviDemuxClass {
GstElementClass parent_class;
};
typedef struct _GstAviDemuxClass {
GstRiffReadClass parent_class;
} GstAviDemuxClass;
GType gst_avi_demux_get_type (void);
......
......@@ -23,7 +23,8 @@
#include <gst/gst.h>
#include <gst/riff/riff.h>
#include <gst/riff/riff-ids.h>
#include "avi-ids.h"
#ifdef __cplusplus
......
......@@ -444,7 +444,6 @@ GST_PLUGIN_DEFINE (
plugin_init,
VERSION,
"LGPL",
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN)
......
......@@ -301,7 +301,6 @@ GST_PLUGIN_DEFINE (
plugin_init,
VERSION,
"LGPL",
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN)
......
......@@ -223,7 +223,6 @@ GST_PLUGIN_DEFINE (
plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)
......
......@@ -88,7 +88,6 @@ GST_PLUGIN_DEFINE (
plugin_init,
VERSION,
"LGPL",
"Wim Taymans <wim.taymans@chello.be>, (c) 2001 FUKUCHI Kentarou, (c) 2001 Sam Mertens, (c) 2002 Ed Tannenbaum",
GST_PACKAGE,
GST_ORIGIN
);
......@@ -651,7 +651,6 @@ GST_PLUGIN_DEFINE (
plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)
......@@ -357,7 +357,6 @@ GST_PLUGIN_DEFINE (
plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)
......@@ -60,7 +60,6 @@ GST_PLUGIN_DEFINE (
plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)
......@@ -64,7 +64,6 @@ GST_PLUGIN_DEFINE (
plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)
......@@ -455,7 +455,6 @@ GST_PLUGIN_DEFINE (
plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)
......@@ -2,14 +2,18 @@ plugin_LTLIBRARIES = libgstmatroska.la
libgstmatroska_la_SOURCES = \
ebml-read.c \
ebml-write.c \
matroska.c \
matroska-demux.c
matroska-demux.c \
matroska-mux.c
noinst_HEADERS = \
ebml-ids.h \
ebml-read.h \
ebml-write.h \
matroska-demux.h \
matroska-ids.h
matroska-ids.h \
matroska-mux.h
libgstmatroska_la_CFLAGS = $(GST_CFLAGS)
libgstmatroska_la_LIBADD =
......
......@@ -157,7 +157,20 @@ gst_ebml_read_element_id (GstEbmlRead *ebml,
guint32 total;
if (gst_bytestream_peek_bytes (ebml->bs, &data, 1) != 1) {
/*gst_element_error (GST_ELEMENT (ebml), "Read error");*/
GstEvent *event = NULL;
guint32 remaining;
/* Here, we might encounter EOS */
gst_bytestream_get_status (ebml->bs, &remaining, &event);
if (event && GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
gst_pad_event_default (ebml->sinkpad, event);
} else {
guint64 pos = gst_bytestream_tell (ebml->bs);
gst_event_unref (event);
gst_element_error (GST_ELEMENT (ebml),
"Read error at position %llu (0x%llx)",
pos, pos);
}
return -1;
}
total = data[0];
......@@ -166,13 +179,18 @@ gst_ebml_read_element_id (GstEbmlRead *ebml,
len_mask >>= 1;
}
if (read > 4) {
guint64 pos = gst_bytestream_tell (ebml->bs);
gst_element_error (GST_ELEMENT (ebml),
"Invalid EBML ID size tag (0x%x)", data[0]);
"Invalid EBML ID size tag (0x%x) at position %llu (0x%llx)",
data[0], pos, pos);
return -1;
}
if (gst_bytestream_peek_bytes (ebml->bs, &data, read) != read) {
/*gst_element_error (GST_ELEMENT (ebml), "Read error");*/
guint64 pos = gst_bytestream_tell (ebml->bs);
gst_element_error (GST_ELEMENT (ebml),
"Read error at position %llu (0x%llx)",
pos, pos);
return -1;
}
while (n < read)
......@@ -201,7 +219,10 @@ gst_ebml_read_element_length (GstEbmlRead *ebml,
guint64 total;
if (gst_bytestream_peek_bytes (ebml->bs, &data, 1) != 1) {
/*gst_element_error (GST_ELEMENT (ebml), "Read error");*/
guint64 pos = gst_bytestream_tell (ebml->bs);
gst_element_error (GST_ELEMENT (ebml),
"Read error at position %llu (0x%llx)",
pos, pos);
return -1;
}
total = data[0];
......@@ -210,15 +231,20 @@ gst_ebml_read_element_length (GstEbmlRead *ebml,
len_mask >>= 1;
}
if (read > 8) {
guint64 pos = gst_bytestream_tell (ebml->bs);
gst_element_error (GST_ELEMENT (ebml),
"Invalid EBML length size tag (0x%x)", data[0]);
"Invalid EBML length size tag (0x%x) at position %llu (0x%llx)",
data[0], pos, pos);
return -1;
}
if ((total &= (len_mask - 1)) == len_mask - 1)
num_ffs++;
if (gst_bytestream_peek_bytes (ebml->bs, &data, read) != read) {
/*gst_element_error (GST_ELEMENT (ebml), "Read error");*/
guint64 pos = gst_bytestream_tell (ebml->bs);
gst_element_error (GST_ELEMENT (ebml),
"Read error at position %llu (0x%llx)",
pos, pos);
return -1;
}
while (n < read) {
......@@ -228,12 +254,6 @@ gst_ebml_read_element_length (GstEbmlRead *ebml,
n++;
}
if (!total) {
gst_element_error (GST_ELEMENT (ebml),
"Invalid length 0");
return -1;
}
if (read == num_ffs)
*length = G_MAXUINT64;
else
......@@ -254,7 +274,10 @@ gst_ebml_read_element_data (GstEbmlRead *ebml,
GstBuffer *buf = NULL;
if (gst_bytestream_peek (ebml->bs, &buf, length) != length) {
/*gst_element_error (GST_ELEMENT (ebml), "Read error");*/
guint64 pos = gst_bytestream_tell (ebml->bs);
gst_element_error (GST_ELEMENT (ebml),
"Read error at position %llu (0x%llx)",
pos, pos);
if (buf)
gst_buffer_unref (buf);
return NULL;
......@@ -276,16 +299,12 @@ gst_ebml_peek_id (GstEbmlRead *ebml,
guint *level_up)
{
guint32 id;
guint my_level_up;
g_return_val_if_fail (level_up != NULL, 0);
g_assert (level_up);
if (gst_ebml_read_element_id (ebml, &id, &my_level_up) < 0)
if (gst_ebml_read_element_id (ebml, &id, level_up) < 0)
return 0;
if (level_up)
*level_up = my_level_up;
return id;
}
......@@ -293,11 +312,47 @@ gst_ebml_peek_id (GstEbmlRead *ebml,
* Seek to a given offset.
*/
void
GstEvent *
gst_ebml_read_seek (GstEbmlRead *ebml,
guint64 offset)
{
gst_bytestream_seek (ebml->bs, offset, GST_SEEK_METHOD_SET);
guint32 remaining;
GstEvent *event;
guchar *data;
/* first, flush remaining buffers */
gst_bytestream_get_status (ebml->bs, &remaining, &event);
if (event) {
g_warning ("Unexpected event before seek");
gst_event_unref (event);
}
if (remaining)
gst_bytestream_flush_fast (ebml->bs, remaining);
/* now seek */
if (!gst_bytestream_seek (ebml->bs, offset, GST_SEEK_METHOD_SET)) {
gst_element_error (GST_ELEMENT (ebml),
"Seek to position %llu (0x%llx) failed",
offset, offset);
return NULL;
}