mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
ext/mad/gstid3tag.c: move from "Codec/(Dem/M)uxer" to "Codec/(Dem/M)uxer/Audio"
Original commit message from CVS: * ext/mad/gstid3tag.c : move from "Codec/(Dem/M)uxer" to "Codec/(Dem/M)uxer/Audio" * gst/wavenc/gstwavenc.c : move from "Codec/Encoder/Audio" to "Codec/Muxer/Audio" * gst/auparse/gstauparse.c : - add code (commented for now) to support audio/x-adpcm on src pad (we have no decoder for those layout yet) * gst/cdxaparse/gstcdxaparse.c : * gst/cdxaparse/gstcdxaparse.h : - partial rewrite using RiffRead (ripped iain's wavparse code) * gst/rtp/gstrtpL16enc.c : typo * gst/rtp/gstrtpgsmenc.c : typo
This commit is contained in:
parent
9a1f739d23
commit
7710c86dc7
3 changed files with 238 additions and 167 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
||||||
|
2004-05-13 Stephane Loeuillet <stephane.loeuillet@tiscali.fr>
|
||||||
|
|
||||||
|
* ext/mad/gstid3tag.c : move from "Codec/(Dem/M)uxer" to "Codec/(Dem/M)uxer/Audio"
|
||||||
|
* gst/wavenc/gstwavenc.c : move from "Codec/Encoder/Audio" to "Codec/Muxer/Audio"
|
||||||
|
|
||||||
|
* gst/auparse/gstauparse.c :
|
||||||
|
- add code (commented for now) to support audio/x-adpcm on src pad
|
||||||
|
(we have no decoder for those layout yet)
|
||||||
|
|
||||||
|
* gst/cdxaparse/gstcdxaparse.c :
|
||||||
|
* gst/cdxaparse/gstcdxaparse.h :
|
||||||
|
- partial rewrite using RiffRead (ripped iain's wavparse code)
|
||||||
|
|
||||||
|
* gst/rtp/gstrtpL16enc.c : typo
|
||||||
|
* gst/rtp/gstrtpgsmenc.c : typo
|
||||||
|
|
||||||
2004-05-13 Benjamin Otte <otte@gnome.org>
|
2004-05-13 Benjamin Otte <otte@gnome.org>
|
||||||
|
|
||||||
* configure.ac:
|
* configure.ac:
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */
|
||||||
/* GStreamer
|
/* GStreamer
|
||||||
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||||
* <2002> Wim Taymans <wim.taymans@chello.be>
|
* <2002> Wim Taymans <wim.taymans@chello.be>
|
||||||
|
@ -25,27 +26,37 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "gstcdxaparse.h"
|
#include "gstcdxaparse.h"
|
||||||
|
#include "gst/riff/riff-ids.h"
|
||||||
|
#include "gst/riff/riff-media.h"
|
||||||
|
|
||||||
#define MAKE_FOUR_CC(a,b,c,d) ( ((guint32)a) | (((guint32)b)<< 8) | \
|
static void gst_cdxa_parse_base_init (gpointer g_class);
|
||||||
((guint32)c)<<16 | (((guint32)d)<<24) )
|
static void gst_cdxa_parse_class_init (GstCDXAParseClass * klass);
|
||||||
|
static void gst_cdxa_parse_init (GstCDXAParse * cdxa_parse);
|
||||||
|
|
||||||
|
static GstElementStateReturn gst_cdxa_parse_change_state (GstElement * element);
|
||||||
|
|
||||||
/* RIFF types */
|
static void gst_cdxa_parse_loop (GstElement * element);
|
||||||
#define GST_RIFF_TAG_RIFF MAKE_FOUR_CC('R','I','F','F')
|
|
||||||
#define GST_RIFF_RIFF_CDXA MAKE_FOUR_CC('C','D','X','A')
|
|
||||||
|
|
||||||
|
|
||||||
#define GST_RIFF_TAG_fmt MAKE_FOUR_CC('f','m','t',' ')
|
|
||||||
#define GST_RIFF_TAG_data MAKE_FOUR_CC('d','a','t','a')
|
|
||||||
|
|
||||||
|
|
||||||
/* elementfactory information */
|
/* elementfactory information */
|
||||||
static GstElementDetails gst_cdxa_parse_details = {
|
static GstElementDetails gst_cdxa_parse_details =
|
||||||
".dat parser",
|
GST_ELEMENT_DETAILS (".dat parser",
|
||||||
"Codec/Parser",
|
"Codec/Parser",
|
||||||
"Parse a .dat file (VCD) into raw mpeg1",
|
"Parse a .dat file (VCD) into raw mpeg1",
|
||||||
"Wim Taymans <wim.taymans@tvd.be>",
|
"Wim Taymans <wim.taymans@tvd.be>");
|
||||||
};
|
|
||||||
|
static GstStaticPadTemplate sink_template_factory =
|
||||||
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
|
GST_PAD_SINK,
|
||||||
|
GST_PAD_ALWAYS,
|
||||||
|
GST_STATIC_CAPS ("video/x-cdxa")
|
||||||
|
);
|
||||||
|
|
||||||
|
static GstStaticPadTemplate src_template_factory =
|
||||||
|
GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
|
GST_PAD_SRC,
|
||||||
|
GST_PAD_ALWAYS,
|
||||||
|
GST_STATIC_CAPS ("video/mpeg, " "systemstream = (boolean) TRUE")
|
||||||
|
);
|
||||||
|
|
||||||
/* CDXAParse signals and args */
|
/* CDXAParse signals and args */
|
||||||
enum
|
enum
|
||||||
|
@ -60,28 +71,6 @@ enum
|
||||||
/* FILL ME */
|
/* FILL ME */
|
||||||
};
|
};
|
||||||
|
|
||||||
static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
||||||
GST_PAD_SINK,
|
|
||||||
GST_PAD_ALWAYS,
|
|
||||||
GST_STATIC_CAPS ("video/x-cdxa")
|
|
||||||
);
|
|
||||||
|
|
||||||
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
|
|
||||||
GST_PAD_SRC,
|
|
||||||
GST_PAD_ALWAYS,
|
|
||||||
GST_STATIC_CAPS ("video/mpeg, " "systemstream = (boolean) TRUE, "
|
|
||||||
"mpegversion = (int) 1")
|
|
||||||
);
|
|
||||||
|
|
||||||
static void gst_cdxa_parse_base_init (gpointer g_class);
|
|
||||||
static void gst_cdxa_parse_class_init (GstCDXAParseClass * klass);
|
|
||||||
static void gst_cdxa_parse_init (GstCDXAParse * cdxa_parse);
|
|
||||||
|
|
||||||
static void gst_cdxa_parse_loop (GstElement * element);
|
|
||||||
|
|
||||||
static GstElementStateReturn gst_cdxa_parse_change_state (GstElement * element);
|
|
||||||
|
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
|
|
||||||
/*static guint gst_cdxa_parse_signals[LAST_SIGNAL] = { 0 }; */
|
/*static guint gst_cdxa_parse_signals[LAST_SIGNAL] = { 0 }; */
|
||||||
|
@ -105,34 +94,37 @@ gst_cdxa_parse_get_type (void)
|
||||||
};
|
};
|
||||||
|
|
||||||
cdxa_parse_type =
|
cdxa_parse_type =
|
||||||
g_type_register_static (GST_TYPE_ELEMENT, "GstCDXAParse",
|
g_type_register_static (GST_TYPE_RIFF_READ, "GstCDXAParse",
|
||||||
&cdxa_parse_info, 0);
|
&cdxa_parse_info, 0);
|
||||||
}
|
}
|
||||||
return cdxa_parse_type;
|
return cdxa_parse_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_cdxa_parse_base_init (gpointer g_class)
|
gst_cdxa_parse_base_init (gpointer g_class)
|
||||||
{
|
{
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||||
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&src_templ));
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&sink_templ));
|
|
||||||
gst_element_class_set_details (element_class, &gst_cdxa_parse_details);
|
gst_element_class_set_details (element_class, &gst_cdxa_parse_details);
|
||||||
|
|
||||||
|
/* register src pads */
|
||||||
|
gst_element_class_add_pad_template (element_class,
|
||||||
|
gst_static_pad_template_get (&sink_template_factory));
|
||||||
|
gst_element_class_add_pad_template (element_class,
|
||||||
|
gst_static_pad_template_get (&src_template_factory));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_cdxa_parse_class_init (GstCDXAParseClass * klass)
|
gst_cdxa_parse_class_init (GstCDXAParseClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class;
|
|
||||||
GstElementClass *gstelement_class;
|
GstElementClass *gstelement_class;
|
||||||
|
GObjectClass *object_class;
|
||||||
|
|
||||||
gobject_class = (GObjectClass *) klass;
|
|
||||||
gstelement_class = (GstElementClass *) klass;
|
gstelement_class = (GstElementClass *) klass;
|
||||||
|
object_class = (GObjectClass *) klass;
|
||||||
|
|
||||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
parent_class = g_type_class_ref (GST_TYPE_RIFF_READ);
|
||||||
|
|
||||||
gstelement_class->change_state = gst_cdxa_parse_change_state;
|
gstelement_class->change_state = gst_cdxa_parse_change_state;
|
||||||
}
|
}
|
||||||
|
@ -140,144 +132,181 @@ gst_cdxa_parse_class_init (GstCDXAParseClass * klass)
|
||||||
static void
|
static void
|
||||||
gst_cdxa_parse_init (GstCDXAParse * cdxa_parse)
|
gst_cdxa_parse_init (GstCDXAParse * cdxa_parse)
|
||||||
{
|
{
|
||||||
GST_FLAG_SET (cdxa_parse, GST_ELEMENT_EVENT_AWARE);
|
/* sink */
|
||||||
|
|
||||||
cdxa_parse->sinkpad =
|
cdxa_parse->sinkpad =
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get (&sink_templ),
|
gst_pad_new_from_template (gst_static_pad_template_get
|
||||||
"sink");
|
(&sink_template_factory), "sink");
|
||||||
gst_element_add_pad (GST_ELEMENT (cdxa_parse), cdxa_parse->sinkpad);
|
gst_element_add_pad (GST_ELEMENT (cdxa_parse), cdxa_parse->sinkpad);
|
||||||
|
GST_RIFF_READ (cdxa_parse)->sinkpad = cdxa_parse->sinkpad;
|
||||||
|
|
||||||
cdxa_parse->srcpad =
|
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get (&src_templ),
|
|
||||||
"src");
|
|
||||||
gst_element_add_pad (GST_ELEMENT (cdxa_parse), cdxa_parse->srcpad);
|
|
||||||
|
|
||||||
gst_element_set_loop_function (GST_ELEMENT (cdxa_parse), gst_cdxa_parse_loop);
|
gst_element_set_loop_function (GST_ELEMENT (cdxa_parse), gst_cdxa_parse_loop);
|
||||||
|
|
||||||
|
|
||||||
|
cdxa_parse->srcpad =
|
||||||
|
gst_pad_new_from_template (gst_static_pad_template_get
|
||||||
|
(&src_template_factory), "src");
|
||||||
|
gst_element_add_pad (GST_ELEMENT (cdxa_parse), cdxa_parse->srcpad);
|
||||||
|
|
||||||
|
cdxa_parse->state = GST_CDXA_PARSE_START;
|
||||||
|
|
||||||
|
cdxa_parse->seek_pending = FALSE;
|
||||||
|
cdxa_parse->seek_offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_cdxa_parse_handle_event (GstCDXAParse * cdxa_parse)
|
gst_cdxa_parse_stream_init (GstCDXAParse * cdxa_parse)
|
||||||
{
|
{
|
||||||
guint32 remaining;
|
GstRiffRead *riff = GST_RIFF_READ (cdxa_parse);
|
||||||
GstEvent *event;
|
guint32 doctype;
|
||||||
GstEventType type;
|
|
||||||
|
|
||||||
gst_bytestream_get_status (cdxa_parse->bs, &remaining, &event);
|
if (!gst_riff_read_header (riff, &doctype))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
|
if (doctype != GST_RIFF_RIFF_CDXA) {
|
||||||
|
GST_ELEMENT_ERROR (cdxa_parse, STREAM, WRONG_TYPE, (NULL), (NULL));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
switch (type) {
|
return TRUE;
|
||||||
case GST_EVENT_EOS:
|
}
|
||||||
gst_pad_event_default (cdxa_parse->sinkpad, event);
|
|
||||||
break;
|
/* Read 'fmt ' header */
|
||||||
case GST_EVENT_SEEK:
|
static gboolean
|
||||||
g_warning ("seek event\n");
|
gst_cdxa_parse_fmt (GstCDXAParse * cdxa_parse)
|
||||||
break;
|
{
|
||||||
case GST_EVENT_FLUSH:
|
GstRiffRead *riff = GST_RIFF_READ (cdxa_parse);
|
||||||
g_warning ("flush event\n");
|
gst_riff_strf_auds *header;
|
||||||
break;
|
|
||||||
case GST_EVENT_DISCONTINUOUS:
|
if (!gst_riff_read_strf_auds (riff, &header)) {
|
||||||
g_warning ("discont event\n");
|
g_warning ("Not fmt");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* As we don't know what is in this fmt field, we do nothing */
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_cdxa_parse_other (GstCDXAParse * cdxa_parse)
|
||||||
|
{
|
||||||
|
GstRiffRead *riff = GST_RIFF_READ (cdxa_parse);
|
||||||
|
guint32 tag, length;
|
||||||
|
|
||||||
|
/* Fixme, need to handle a seek...can you seek in cdxa? */
|
||||||
|
|
||||||
|
if (!gst_riff_peek_head (riff, &tag, &length, NULL)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (tag) {
|
||||||
|
case GST_RIFF_TAG_data:
|
||||||
|
gst_bytestream_flush (riff->bs, 8);
|
||||||
|
|
||||||
|
cdxa_parse->state = GST_CDXA_PARSE_DATA;
|
||||||
|
cdxa_parse->dataleft = (guint64) length;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_warning ("unhandled event %d\n", type);
|
gst_riff_read_skip (riff);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
#define MAX_BUFFER_SIZE 4096
|
||||||
|
|
||||||
CDXA starts with the following header:
|
static void
|
||||||
|
gst_cdxa_parse_loop (GstElement * element)
|
||||||
! RIFF:4 ! size:4 ! "CDXA" ! "fmt " ! size:4 ! (size+1)&~1 bytes of crap !
|
|
||||||
! "data" ! data_size:4 ! (data_size/2352) sectors...
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
{
|
||||||
gchar RIFF_tag[4];
|
GstCDXAParse *cdxa_parse = GST_CDXA_PARSE (element);
|
||||||
guint32 riff_size;
|
GstRiffRead *riff = GST_RIFF_READ (cdxa_parse);
|
||||||
gchar CDXA_tag[4];
|
|
||||||
gchar fmt_tag[4];
|
if (cdxa_parse->state == GST_CDXA_PARSE_DATA) {
|
||||||
guint32 fmt_size;
|
if (cdxa_parse->dataleft > 0) {
|
||||||
}
|
guint32 got_bytes, desired;
|
||||||
CDXAParseHeader;
|
GstBuffer *buf, *outbuf;
|
||||||
|
|
||||||
|
desired = GST_CDXA_SECTOR_SIZE;
|
||||||
|
|
||||||
|
buf = gst_riff_read_element_data (riff, desired, &got_bytes);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
A sectors is 2352 bytes long and is composed of:
|
|
||||||
|
A sector is 2352 bytes long and is composed of:
|
||||||
|
|
||||||
! sync ! header ! subheader ! data ... ! edc !
|
! sync ! header ! subheader ! data ... ! edc !
|
||||||
! 12 bytes ! 4 bytes ! 8 bytes ! 2324 bytes ! 4 bytes !
|
! 12 bytes ! 4 bytes ! 8 bytes ! 2324 bytes ! 4 bytes !
|
||||||
!-------------------------------------------------------!
|
!-------------------------------------------------------!
|
||||||
|
|
||||||
We parse the data out of it and send it to the srcpad.
|
We parse the data out of it and send it to the srcpad.
|
||||||
|
|
||||||
|
sync : 00 FF FF FF FF FF FF FF FF FF FF 00
|
||||||
|
header : hour minute second mode
|
||||||
|
sub-header : track channel sub_mode coding repeat (4 bytes)
|
||||||
|
edc : checksum
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
/*
|
||||||
gst_cdxa_parse_loop (GstElement * element)
|
if (got_bytes < GST_CDXA_SECTOR_SIZE) {
|
||||||
{
|
gst_cdxa_parse_handle_event (cdxa_parse);
|
||||||
GstCDXAParse *cdxa_parse;
|
return;
|
||||||
CDXAParseHeader *header;
|
}
|
||||||
guint8 *headerdata;
|
*/
|
||||||
|
|
||||||
g_return_if_fail (element != NULL);
|
/* Extract time from CDXA header */
|
||||||
g_return_if_fail (GST_IS_CDXA_PARSE (element));
|
/* printf( "%02u:%02u:%02u\n", (unsigned char) *(GST_BUFFER_DATA(buf)+12), (unsigned char) *(GST_BUFFER_DATA(buf)+13), (unsigned char) *(GST_BUFFER_DATA(buf)+14) );*/
|
||||||
|
|
||||||
cdxa_parse = GST_CDXA_PARSE (element);
|
/* Jump CDXA headers, only keep data */
|
||||||
|
outbuf = gst_buffer_create_sub (buf, 24, GST_CDXA_DATA_SIZE);
|
||||||
|
gst_buffer_unref (buf);
|
||||||
|
|
||||||
if (cdxa_parse->state == CDXA_PARSE_HEADER) {
|
gst_pad_push (cdxa_parse->srcpad, GST_DATA (outbuf));
|
||||||
guint32 fmt_size;
|
|
||||||
guint8 *buf;
|
|
||||||
guint32 got_bytes;
|
|
||||||
|
|
||||||
got_bytes = gst_bytestream_peek_bytes (cdxa_parse->bs, &headerdata, 20);
|
cdxa_parse->byteoffset += got_bytes;
|
||||||
header = (CDXAParseHeader *) headerdata;
|
if (got_bytes < cdxa_parse->dataleft) {
|
||||||
if (got_bytes < 20)
|
cdxa_parse->dataleft -= got_bytes;
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
cdxa_parse->riff_size = GUINT32_FROM_LE (header->riff_size);
|
cdxa_parse->dataleft = 0;
|
||||||
fmt_size = (GUINT32_FROM_LE (header->fmt_size) + 1) & ~1;
|
cdxa_parse->state = GST_CDXA_PARSE_OTHER;
|
||||||
|
}
|
||||||
/* flush the header + fmt_size bytes + 4 bytes "data" */
|
} else {
|
||||||
if (!gst_bytestream_flush (cdxa_parse->bs, 20 + fmt_size + 4))
|
cdxa_parse->state = GST_CDXA_PARSE_OTHER;
|
||||||
return;
|
|
||||||
|
|
||||||
/* get the data size */
|
|
||||||
got_bytes =
|
|
||||||
gst_bytestream_peek_bytes (cdxa_parse->bs, (guint8 **) & buf, 4);
|
|
||||||
if (got_bytes < 4)
|
|
||||||
return;
|
|
||||||
cdxa_parse->data_size = GST_READ_UINT32_LE (buf);
|
|
||||||
|
|
||||||
/* flush the data size */
|
|
||||||
if (!gst_bytestream_flush (cdxa_parse->bs, 4))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (cdxa_parse->data_size % CDXA_SECTOR_SIZE)
|
|
||||||
g_warning ("cdxa_parse: size not multiple of %d bytes", CDXA_SECTOR_SIZE);
|
|
||||||
|
|
||||||
cdxa_parse->sectors = cdxa_parse->data_size / CDXA_SECTOR_SIZE;
|
|
||||||
|
|
||||||
cdxa_parse->state = CDXA_PARSE_DATA;
|
|
||||||
} else {
|
|
||||||
GstBuffer *buf;
|
|
||||||
GstBuffer *outbuf;
|
|
||||||
guint32 got_bytes;
|
|
||||||
|
|
||||||
got_bytes = gst_bytestream_read (cdxa_parse->bs, &buf, CDXA_SECTOR_SIZE);
|
|
||||||
if (got_bytes < CDXA_SECTOR_SIZE) {
|
|
||||||
gst_cdxa_parse_handle_event (cdxa_parse);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
outbuf = gst_buffer_create_sub (buf, 24, CDXA_DATA_SIZE);
|
switch (cdxa_parse->state) {
|
||||||
gst_buffer_unref (buf);
|
case GST_CDXA_PARSE_START:
|
||||||
|
if (!gst_cdxa_parse_stream_init (cdxa_parse)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gst_pad_push (cdxa_parse->srcpad, GST_DATA (outbuf));
|
cdxa_parse->state = GST_CDXA_PARSE_FMT;
|
||||||
|
/* fall-through */
|
||||||
|
|
||||||
|
case GST_CDXA_PARSE_FMT:
|
||||||
|
if (!gst_cdxa_parse_fmt (cdxa_parse)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cdxa_parse->state = GST_CDXA_PARSE_OTHER;
|
||||||
|
/* fall-through */
|
||||||
|
|
||||||
|
case GST_CDXA_PARSE_OTHER:
|
||||||
|
if (!gst_cdxa_parse_other (cdxa_parse)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GST_CDXA_PARSE_DATA:
|
||||||
|
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,24 +318,31 @@ gst_cdxa_parse_change_state (GstElement * element)
|
||||||
switch (GST_STATE_TRANSITION (element)) {
|
switch (GST_STATE_TRANSITION (element)) {
|
||||||
case GST_STATE_NULL_TO_READY:
|
case GST_STATE_NULL_TO_READY:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GST_STATE_READY_TO_PAUSED:
|
case GST_STATE_READY_TO_PAUSED:
|
||||||
cdxa_parse->state = CDXA_PARSE_HEADER;
|
cdxa_parse->state = GST_CDXA_PARSE_START;
|
||||||
cdxa_parse->bs = gst_bytestream_new (cdxa_parse->sinkpad);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GST_STATE_PAUSED_TO_PLAYING:
|
case GST_STATE_PAUSED_TO_PLAYING:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GST_STATE_PLAYING_TO_PAUSED:
|
case GST_STATE_PLAYING_TO_PAUSED:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GST_STATE_PAUSED_TO_READY:
|
case GST_STATE_PAUSED_TO_READY:
|
||||||
gst_bytestream_destroy (cdxa_parse->bs);
|
cdxa_parse->state = GST_CDXA_PARSE_START;
|
||||||
|
|
||||||
|
|
||||||
|
cdxa_parse->seek_pending = FALSE;
|
||||||
|
cdxa_parse->seek_offset = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GST_STATE_READY_TO_NULL:
|
case GST_STATE_READY_TO_NULL:
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parent_class->change_state (element);
|
if (GST_ELEMENT_CLASS (parent_class)->change_state)
|
||||||
|
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
|
||||||
|
|
||||||
return GST_STATE_SUCCESS;
|
return GST_STATE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -314,14 +350,12 @@ gst_cdxa_parse_change_state (GstElement * element)
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GstPlugin * plugin)
|
plugin_init (GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
if (!gst_library_load ("gstbytestream"))
|
if (!gst_library_load ("riff")) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!gst_element_register (plugin, "cdxaparse", GST_RANK_SECONDARY,
|
return gst_element_register (plugin, "cdxaparse", GST_RANK_SECONDARY,
|
||||||
GST_TYPE_CDXA_PARSE))
|
GST_TYPE_CDXA_PARSE);
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
#define __GST_CDXA_PARSE_H__
|
#define __GST_CDXA_PARSE_H__
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/bytestream/bytestream.h>
|
#include "gst/riff/riff-ids.h"
|
||||||
|
#include "gst/riff/riff-read.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -40,31 +41,49 @@ extern "C" {
|
||||||
#define GST_IS_CDXA_PARSE_CLASS(obj) \
|
#define GST_IS_CDXA_PARSE_CLASS(obj) \
|
||||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CDXA_PARSE))
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CDXA_PARSE))
|
||||||
|
|
||||||
#define CDXA_SECTOR_SIZE 2352
|
#define GST_CDXA_SECTOR_SIZE 2352
|
||||||
#define CDXA_DATA_SIZE 2324
|
#define GST_CDXA_DATA_SIZE 2324
|
||||||
|
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
GST_CDXA_PARSE_START,
|
||||||
CDXA_PARSE_HEADER,
|
GST_CDXA_PARSE_FMT,
|
||||||
CDXA_PARSE_DATA,
|
GST_CDXA_PARSE_OTHER,
|
||||||
|
GST_CDXA_PARSE_DATA,
|
||||||
} GstCDXAParseState;
|
} GstCDXAParseState;
|
||||||
|
|
||||||
typedef struct _GstCDXAParse GstCDXAParse;
|
typedef struct _GstCDXAParse GstCDXAParse;
|
||||||
typedef struct _GstCDXAParseClass GstCDXAParseClass;
|
typedef struct _GstCDXAParseClass GstCDXAParseClass;
|
||||||
|
|
||||||
struct _GstCDXAParse {
|
struct _GstCDXAParse {
|
||||||
GstElement element;
|
GstRiffRead parent;
|
||||||
|
|
||||||
/* pads */
|
/* pads */
|
||||||
GstPad *sinkpad, *srcpad;
|
GstPad *sinkpad,*srcpad;
|
||||||
|
|
||||||
GstByteStream *bs;
|
|
||||||
|
|
||||||
|
/* CDXA decoding state */
|
||||||
GstCDXAParseState state;
|
GstCDXAParseState state;
|
||||||
|
|
||||||
|
/* useful CDXA data
|
||||||
guint32 riff_size;
|
guint32 riff_size;
|
||||||
guint32 data_size;
|
guint32 data_size;
|
||||||
guint32 sectors;
|
guint32 sectors;
|
||||||
|
|
||||||
|
#define CDXA_SUB_MODE_EOF(c) ((c&0x80)>>7)
|
||||||
|
#define CDXA_SUB_MODE_RT(c) ((c&0x40)>>6)
|
||||||
|
#define CDXA_SUB_MODE_FORM(c) ((c&0x20)>>5)
|
||||||
|
#define CDXA_SUB_MODE_TRIGGER(c)((c&0x10)>>4)
|
||||||
|
#define CDXA_SUB_MODE_DATA(c) ((c&0x08)>>3)
|
||||||
|
#define CDXA_SUB_MODE_VIDEO(c) ((c&0x04)>>2)
|
||||||
|
#define CDXA_SUB_MODE_AUDIO(c) ((c&0x02)>>1)
|
||||||
|
#define CDXA_SUB_MODE_EOR(c) ((c&0x01) )
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
guint64 dataleft;
|
||||||
|
int byteoffset;
|
||||||
|
|
||||||
|
gboolean seek_pending;
|
||||||
|
guint64 seek_offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstCDXAParseClass {
|
struct _GstCDXAParseClass {
|
||||||
|
@ -77,4 +96,6 @@ GType gst_cdxa_parse_get_type (void);
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GST_CDXA_PARSE_H__ */
|
#endif /* __GST_CDXA_PARSE_H__ */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue