ASF muxer, largely based on ffmpeg's one, but well-integrated in GStreamer. Demuxer still needs work.

Original commit message from CVS:
ASF muxer, largely based on ffmpeg's one, but well-integrated in GStreamer. Demuxer still needs work.
This commit is contained in:
Ronald S. Bultje 2003-08-26 19:28:20 +00:00
parent e6402c0f39
commit 1931927f08
5 changed files with 1491 additions and 5 deletions

View file

@ -1,9 +1,14 @@
plugin_LTLIBRARIES = libgstasfdemux.la
plugin_LTLIBRARIES = libgstasfdemux.la libgstasfmux.la
libgstasfdemux_la_SOURCES = gstasfdemux.c
libgstasfdemux_la_CFLAGS = $(GST_CFLAGS)
libgstasfdemux_la_LIBADD =
libgstasfdemux_la_LDFLAGS = $(GST_LIBS)
noinst_HEADERS = gstasfdemux.h asfheaders.h
libgstasfmux_la_SOURCES = gstasfmux.c
libgstasfmux_la_CFLAGS = $(GST_CFLAGS)
libgstasfmux_la_LIBADD =
libgstasfmux_la_LDFLAGS = $(GST_LIBS)
noinst_HEADERS = gstasfdemux.h asfheaders.h gstasfmux.h

View file

@ -43,6 +43,7 @@ enum {
ASF_OBJ_CONCEAL_NONE,
ASF_OBJ_COMMENT,
ASF_OBJ_CODEC_COMMENT,
ASF_OBJ_CODEC_COMMENT1,
ASF_OBJ_INDEX,
ASF_OBJ_HEAD1,
ASF_OBJ_HEAD2,
@ -148,7 +149,9 @@ struct _asf_stream_video {
guint32 height;
guint8 unknown;
guint16 size;
};
} __attribute__ ((__packed__));
/* the packed attribute is needed to prevent this thing
* from expanding 'unknown' to 16 bits */
typedef struct _asf_stream_video asf_stream_video;
@ -238,7 +241,7 @@ static ASFGuidHash asf_object_guids[] = {
{ ASF_OBJ_CONCEAL_NONE, { 0x20fb5700, 0x11cf5b55, 0x8000FDa8, 0x2B445C5f }},
{ ASF_OBJ_COMMENT, { 0x75b22633, 0x11cf668e, 0xAA00D9a6, 0x6Cce6200 }},
{ ASF_OBJ_CODEC_COMMENT, { 0x86D15240, 0x11D0311D, 0xA000A4A3, 0xF64803C9 }},
{ ASF_OBJ_CODEC_COMMENT, { 0x86d15241, 0x11d0311d, 0xA000A4a3, 0xF64803c9 }},
{ ASF_OBJ_CODEC_COMMENT1, { 0x86d15241, 0x11d0311d, 0xA000A4a3, 0xF64803c9 }},
{ ASF_OBJ_INDEX, { 0x33000890, 0x11cfe5b1, 0xA000F489, 0xCB4903c9 }},
{ ASF_OBJ_HEAD1, { 0x5fbf03b5, 0x11cfa92e, 0xC000E38e, 0x6553200c }},
{ ASF_OBJ_HEAD2, { 0xabd3d211, 0x11cfa9ba, 0xC000E68e, 0x6553200c }},

View file

@ -767,7 +767,7 @@ gst_asf_demux_process_stream (GstASFDemux *asf_demux, guint64 *filepos, guint64
case ASF_STREAM_VIDEO:
gst_asf_demux_read_object_header_rest (asf_demux, &ptr, 11);
video_object = (asf_stream_video *)ptr;
size = GUINT16_FROM_BE(video_object->size) - 40; /* Byte order gets
size = GUINT16_FROM_LE(video_object->size) - 40; /* Byte order gets
* offset by single
* byte */
GST_INFO ( "Object is a video stream with %u bytes of additional data.", size);
@ -1558,6 +1558,14 @@ gst_asf_demux_video_caps (guint32 codec_fcc,
"msmpegversion", GST_PROPS_INT (43));
break;
case GST_MAKE_FOURCC('D','I','V','3'):
case GST_MAKE_FOURCC('D','I','V','4'):
case GST_MAKE_FOURCC('D','I','V','5'):
caps = GST_ASF_VID_CAPS_NEW ("asf_demux_video_src_div345",
"video/x-divx",
"divxversion", GST_PROPS_INT (3));
break;
default:
g_warning ("asfdemux: unkown video format " GST_FOURCC_FORMAT "(0x%08x)",
GST_FOURCC_ARGS(codec_fcc), codec_fcc);

1381
gst/asfdemux/gstasfmux.c Normal file

File diff suppressed because it is too large Load diff

89
gst/asfdemux/gstasfmux.h Normal file
View file

@ -0,0 +1,89 @@
/* ASF muxer plugin for GStreamer
* Copyright (C) 2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_ASFMUX_H__
#define __GST_ASFMUX_H__
#include <gst/gst.h>
#include "asfheaders.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define GST_TYPE_ASFMUX \
(gst_asfmux_get_type())
#define GST_ASFMUX(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ASFMUX,GstAsfMux))
#define GST_ASFMUX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ASFMUX,GstAsfMux))
#define GST_IS_ASFMUX(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ASFMUX))
#define GST_IS_ASFMUX_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ASFMUX))
#define MAX_ASF_OUTPUTS 16
typedef struct _GstAsfMuxStream {
guint index;
gint type; /* ASF_STREAM_VIDEO/AUDIO */
GstPad *pad;
guint64 time;
GstBuffer *queue;
gboolean connected, eos;
guint seqnum;
guint bitrate;
union {
asf_stream_audio audio;
struct {
asf_stream_video stream;
asf_stream_video_format format;
} video;
} header;
} GstAsfMuxStream;
typedef struct _GstAsfMux {
GstElement element;
/* pads */
GstPad *srcpad;
GstAsfMuxStream output[MAX_ASF_OUTPUTS];
guint num_outputs, num_video, num_audio;
gboolean write_header;
/* packet */
GstBuffer *packet;
guint num_packets, packet_frames;
guint sequence;
guint64 data_offset;
} GstAsfMux;
typedef struct _GstAsfMuxClass {
GstElementClass parent_class;
} GstAsfMuxClass;
GType gst_asfmux_get_type(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GST_ASFMUX_H__ */