diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | configure.ac | 16 | ||||
-rw-r--r-- | ext/dirac/gstdiracdec.cc | 16 | ||||
-rw-r--r-- | gst/qtdemux/qtdemux.c | 113 |
4 files changed, 101 insertions, 56 deletions
@@ -1,3 +1,15 @@ +2004-09-15 David Schleef <ds@schleef.org> + + * configure.ac: remove NASM check, since we don't use it. Update + dirac check to 0.4 + * ext/dirac/gstdiracdec.cc: update to current 0.4 API + * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_link): + Initialized variables. + * gst/qtdemux/qtdemux.c: (gst_qtdemux_change_state), + (gst_qtdemux_loop_header), (qtdemux_parse), (qtdemux_parse_trak), + (gst_qtdemux_handle_esds), (qtdemux_audio_caps): Fix seeking, add + SVQ3 format + 2004-09-15 Ronald S. Bultje <rbultje@ronald.bitfreak.net> * gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_query), diff --git a/configure.ac b/configure.ac index 220e081a..37a4cad9 100644 --- a/configure.ac +++ b/configure.ac @@ -156,17 +156,6 @@ AC_ARG_WITH(pkg-config-path, dnl check architecture GST_ARCH() -dnl Check for nasm -AC_PATH_PROG(NASM_PATH, nasm, no) -AC_SUBST(NASM_PATH) -if test x$NASM_PATH = xno; then - AC_MSG_WARN(Couldn't find nasm) - HAVE_NASM="no" -else - AC_DEFINE(HAVE_NASM, 1, [Define if NASM, the netwide assembler, is available]) - HAVE_NASM="yes" -fi - dnl check for gconftool-2 translit(dnm, m, l) AM_CONDITIONAL(USE_GCONFTOOL, true) GST_CHECK_FEATURE(GCONFTOOL, [GConf schemas], , [ @@ -817,7 +806,10 @@ dnl AC_CHECK_HEADER(cdda_paranoia.h, :, HAVE_CDPARANOIA=no) dnl *** dirac *** translit(dnm, m, l) AM_CONDITIONAL(USE_DIRAC, true) GST_CHECK_FEATURE(DIRAC, [dirac plug-ins], dirac, [ - PKG_CHECK_MODULES(DIRAC, dirac, HAVE_DIRAC="yes", HAVE_DIRAC="no") + PKG_CHECK_MODULES(DIRAC, dirac-pic >= 0.4, HAVE_DIRAC="yes", HAVE_DIRAC="no") + if test x$HAVE_DIRAC = xno ; then + PKG_CHECK_MODULES(DIRAC, dirac >= 0.4, HAVE_DIRAC="yes", HAVE_DIRAC="no") + fi AC_SUBST(DIRAC_CFLAGS) AC_SUBST(DIRAC_LIBS) ]) diff --git a/ext/dirac/gstdiracdec.cc b/ext/dirac/gstdiracdec.cc index d5eb4a47..5a767c45 100644 --- a/ext/dirac/gstdiracdec.cc +++ b/ext/dirac/gstdiracdec.cc @@ -25,8 +25,8 @@ #include <gst/gst.h> #include <gst/video/video.h> -#include <seq_decompress.h> -#include <pic_io.h> +#include <libdirac_decoder/seq_decompress.h> +#include <libdirac_common/pic_io.h> #define GST_TYPE_DIRACDEC \ (gst_diracdec_get_type()) @@ -51,6 +51,7 @@ struct _GstDiracDec SequenceDecompressor *decompress; + std::istream * input_stream; PicOutput *output_image; }; @@ -104,7 +105,7 @@ gst_diracdec_get_type (void) if (!diracdec_type) { static const GTypeInfo diracdec_info = { - sizeof (GstDiracDec), + sizeof (GstDiracDecClass), gst_diracdec_base_init, NULL, (GClassInitFunc) gst_diracdec_class_init, @@ -165,6 +166,8 @@ gst_diracdec_class_init (GstDiracDec * klass) static void gst_diracdec_init (GstDiracDec * diracdec) { + SeqParams params; + GST_DEBUG ("gst_diracdec_init: initializing"); /* create the sink and src pads */ @@ -181,8 +184,11 @@ gst_diracdec_init (GstDiracDec * diracdec) gst_pad_use_explicit_caps (diracdec->srcpad); gst_element_add_pad (GST_ELEMENT (diracdec), diracdec->srcpad); - diracdec->decompress = new SequenceDecompressor; - diracdec->output_image = new PicOutput; + //diracdec->input_stream = new std::istream (); + diracdec->input_stream = NULL; + diracdec->decompress = + new SequenceDecompressor (diracdec->input_stream, FALSE); + diracdec->output_image = new PicOutput ("moo", params, (bool) FALSE); } static GstPadLinkReturn diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index 1abaf0f2..415a3d43 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -32,7 +32,7 @@ GST_DEBUG_CATEGORY_EXTERN (qtdemux_debug); /* temporary hack */ #define g_print(...) /* */ -#define gst_util_dump_mem(a,b) /* */ +//#define gst_util_dump_mem(a,b) /* */ #define QTDEMUX_GUINT32_GET(a) (GST_READ_UINT32_BE(a)) #define QTDEMUX_GUINT24_GET(a) (GST_READ_UINT32_BE(a) >> 8) @@ -510,12 +510,10 @@ gst_qtdemux_change_state (GstElement * element) switch (GST_STATE_TRANSITION (element)) { case GST_STATE_NULL_TO_READY: - qtdemux->bs = gst_bytestream_new (qtdemux->sinkpad); - qtdemux->state = QTDEMUX_STATE_HEADER; - GST_DEBUG ("new bytestream"); - /* FIXME */ break; case GST_STATE_READY_TO_PAUSED: + qtdemux->bs = gst_bytestream_new (qtdemux->sinkpad); + qtdemux->state = QTDEMUX_STATE_HEADER; break; case GST_STATE_PAUSED_TO_PLAYING: break; @@ -525,9 +523,9 @@ gst_qtdemux_change_state (GstElement * element) qtdemux->last_ts = GST_CLOCK_TIME_NONE; qtdemux->need_discont = FALSE; qtdemux->need_flush = FALSE; + gst_bytestream_destroy (qtdemux->bs); break; case GST_STATE_READY_TO_NULL: - gst_bytestream_destroy (qtdemux->bs); break; default: break; @@ -615,7 +613,6 @@ gst_qtdemux_loop_header (GstElement * element) break; } } while (1); - qtdemux->offset += length; qtdemux_parse_moov (qtdemux, GST_BUFFER_DATA (moov), length); if (1) { @@ -634,18 +631,11 @@ gst_qtdemux_loop_header (GstElement * element) } ret = gst_bytestream_seek (qtdemux->bs, cur_offset + length, GST_SEEK_METHOD_SET); - GST_DEBUG ("seek returned %d", ret); - if (ret == FALSE) { - length = cur_offset + length; - cur_offset = qtdemux->offset; - length -= cur_offset; - if (gst_bytestream_flush (qtdemux->bs, length) == FALSE) { - if (!gst_qtdemux_handle_sink_event (qtdemux)) { - return; - } - } + if (!ret) { + g_warning ("seek failed"); } qtdemux->offset = cur_offset + length; + GST_DEBUG ("seek returned %d", ret); break; } case QTDEMUX_STATE_SEEKING_EOS: @@ -694,10 +684,10 @@ gst_qtdemux_loop_header (GstElement * element) GST_DATA (gst_event_new (GST_EVENT_EOS))); } ret = gst_bytestream_seek (qtdemux->bs, 0, GST_SEEK_METHOD_END); - GST_DEBUG ("seek returned %d", ret); - if (ret == FALSE) { - gst_bytestream_flush (qtdemux->bs, 0xffffffff); + if (!ret) { + g_warning ("seek failed"); } + GST_DEBUG ("seek returned %d", ret); qtdemux->state = QTDEMUX_STATE_SEEKING_EOS; return; @@ -713,22 +703,17 @@ gst_qtdemux_loop_header (GstElement * element) index, stream->sample_index, offset, size, stream->samples[stream->sample_index].timestamp); - // cur_offset = gst_bytestream_tell (qtdemux->bs); - cur_offset = qtdemux->offset; + /* don't believe bytestream */ + //cur_offset = gst_bytestream_tell (qtdemux->bs); + if (offset != cur_offset) { - GST_DEBUG ("seeking to offset %d", offset); - GST_LOG ("seeking to offset %d", offset); + GST_DEBUG ("seeking to offset %d (currently at %d)", offset, + cur_offset); ret = gst_bytestream_seek (qtdemux->bs, offset, GST_SEEK_METHOD_SET); + if (!ret) { + g_warning ("seek failed"); + } GST_DEBUG ("seek returned %d", ret); - if (ret == FALSE && offset > cur_offset) { - if (gst_bytestream_flush (qtdemux->bs, offset - cur_offset) == FALSE) { - if (!gst_qtdemux_handle_sink_event (qtdemux)) { - return; - } - } - } else if (ret == FALSE && offset < cur_offset) - GST_ERROR ("cannot flush backwards"); - qtdemux->offset = offset; return; } @@ -745,7 +730,6 @@ gst_qtdemux_loop_header (GstElement * element) break; } } while (TRUE); - qtdemux->offset += size; if (buf) { /* hum... */ @@ -920,6 +904,7 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux, QtDemuxStream * stream) #define FOURCC_____ GST_MAKE_FOURCC('-','-','-','-') #define FOURCC_free GST_MAKE_FOURCC('f','r','e','e') #define FOURCC_data GST_MAKE_FOURCC('d','a','t','a') +#define FOURCC_SVQ3 GST_MAKE_FOURCC('S','V','Q','3') static void qtdemux_dump_mvhd (GstQTDemux * qtdemux, void *buffer, int depth); @@ -1000,6 +985,7 @@ QtNodeType qt_node_types[] = { {FOURCC_mp4v, "mp4v", 0,}, {FOURCC_wave, "wave", QT_CONTAINER}, {FOURCC_appl, "appl", QT_CONTAINER}, + {FOURCC_esds, "esds", QT_CONTAINER}, {FOURCC_hnti, "hnti", QT_CONTAINER}, {FOURCC_rtp_, "rtp ", 0, qtdemux_dump_unknown}, {FOURCC_sdp_, "sdp ", 0, qtdemux_dump_unknown}, @@ -1016,6 +1002,7 @@ QtNodeType qt_node_types[] = { {FOURCC_____, "----", QT_CONTAINER,}, {FOURCC_data, "data", 0, qtdemux_dump_unknown}, {FOURCC_free, "free", 0,}, + {FOURCC_SVQ3, "SVQ3", 0,}, {0, "unknown", 0}, }; static int n_qt_node_types = sizeof (qt_node_types) / sizeof (qt_node_types[0]); @@ -1161,7 +1148,6 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length) void *buf; guint32 len; - gst_util_dump_mem (buffer, length); GST_DEBUG_OBJECT (qtdemux, "parsing stsd (sample table, sample description) atom"); buf = buffer + 16; @@ -1271,6 +1257,48 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length) buf += len; } + } else if (fourcc == FOURCC_SVQ3) { + void *buf; + guint32 len; + guint32 version; + int tlen; + + GST_LOG ("parsing in SVQ3\n"); + buf = buffer + 12; + end = buffer + length; + version = QTDEMUX_GUINT32_GET (buffer + 16); + g_print ("version %08x\n", version); + if (1 || version == 0x00000000) { + + buf = buffer + 0x32; + end = buffer + length; + + tlen = QTDEMUX_GUINT8_GET (buf); + g_print ("tlen = %d\n", tlen); + buf++; + g_print ("string = %.*s\n", tlen, (char *) buf); + buf += tlen; + buf += 23; + + gst_util_dump_mem (buf, end - buf); + while (buf < end) { + GNode *child; + + if (buf + 8 >= end) { + /* FIXME: get annoyed */ + GST_LOG ("buffer overrun"); + } + len = QTDEMUX_GUINT32_GET (buf); + if (len == 0) + break; + + child = g_node_new (buf); + g_node_append (node, child); + qtdemux_parse (qtdemux, child, buf, len); + + buf += len; + } + } } #if 0 if (fourcc == FOURCC_cmvd) { @@ -1893,10 +1921,15 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak) fourcc = QTDEMUX_FOURCC_GET (stsd->data + offset + 4); stream->caps = qtdemux_video_caps (qtdemux, fourcc, stsd->data); - mp4v = qtdemux_tree_get_child_by_type (stsd, FOURCC_mp4v); esds = NULL; + mp4v = qtdemux_tree_get_child_by_type (stsd, FOURCC_mp4v); + if (mp4v == NULL) { + /* HACK */ + mp4v = qtdemux_tree_get_child_by_type (stsd, FOURCC_SVQ3); + } if (mp4v) esds = qtdemux_tree_get_child_by_type (mp4v, FOURCC_esds); + if (esds) { gst_qtdemux_handle_esds (qtdemux, stream, esds); } @@ -2271,7 +2304,7 @@ gst_qtdemux_handle_esds (GstQTDemux * qtdemux, QtDemuxStream * stream, guint8 *data_ptr = NULL; int data_len = 0; - gst_util_dump_mem (ptr, len); + //gst_util_dump_mem (ptr, len); ptr += 8; g_print ("version/flags = %08x\n", QTDEMUX_GUINT32_GET (ptr)); ptr += 4; @@ -2529,12 +2562,14 @@ qtdemux_audio_caps (GstQTDemux * qtdemux, guint32 fourcc, const guint8 * data, "mpegversion", G_TYPE_INT, 4, NULL); case GST_MAKE_FOURCC ('Q', 'D', 'M', '2'): /* FIXME: QDesign music version 2 (no constant) */ - if (data) + if (data) { return gst_caps_new_simple ("audio/x-qdm2", "framesize", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 52), "bitrate", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 40), "blocksize", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 44), NULL); - return gst_caps_new_simple ("audio/x-qdm2", NULL); + } else { + return gst_caps_new_simple ("audio/x-qdm2", NULL); + } case GST_MAKE_FOURCC ('a', 'g', 's', 'm'): /* GSM */ return gst_caps_new_simple ("audio/x-gsm", NULL); |