qtmux: remove qtmux plugin, it has moved to -good

https://bugzilla.gnome.org/show_bug.cgi?id=636699
This commit is contained in:
Tim-Philipp Müller 2011-04-12 21:47:14 +01:00
parent 5af34d15f3
commit 6b4e797513
30 changed files with 3 additions and 13572 deletions

View file

@ -10,7 +10,6 @@ GST_PLUGINS_BAD_BUILT_SOURCES := \
gst-libs/gst/basecamerabinsrc/Android.mk \
gst-libs/gst/interfaces/Android.mk \
gst/h264parse/Android.mk \
gst/qtmux/Android.mk \
gst/videoparsers/Android.mk \
gst/audiobuffer/Android.mk \
gst/autoconvert/Android.mk \
@ -102,7 +101,6 @@ CONFIGURE_TARGETS += gst-plugins-bad-configure
-include $(GST_PLUGINS_BAD_TOP)/gst-libs/gst/basecamerabinsrc/Android.mk
-include $(GST_PLUGINS_BAD_TOP)/gst-libs/gst/interfaces/Android.mk
-include $(GST_PLUGINS_BAD_TOP)/gst/h264parse/Android.mk
-include $(GST_PLUGINS_BAD_TOP)/gst/qtmux/Android.mk
-include $(GST_PLUGINS_BAD_TOP)/gst/audiobuffer/Android.mk
-include $(GST_PLUGINS_BAD_TOP)/gst/autoconvert/Android.mk
-include $(GST_PLUGINS_BAD_TOP)/gst/bayer/Android.mk

View file

@ -52,6 +52,7 @@ CRUFT_FILES = \
$(top_builddir)/gst/audioparsers/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/gst/flacparse/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/gst/imagefreeze/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/gst/qtmux/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/gst/selector/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/gst/shapewipe/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/gst/valve/.libs/*.{so,dll,DLL,dylib} \
@ -62,6 +63,7 @@ CRUFT_FILES = \
$(top_builddir)/tests/check/elements/autocolorspace \
$(top_builddir)/tests/check/elements/capssetter \
$(top_builddir)/tests/check/elements/imagefreeze \
$(top_builddir)/tests/check/elements/qtmux \
$(top_builddir)/tests/check/elements/selector \
$(top_builddir)/tests/check/elements/valve \
$(top_builddir)/tests/check/pipelines/metadata \
@ -76,6 +78,7 @@ CRUFT_DIRS = \
$(top_srcdir)/gst/amrparse \
$(top_srcdir)/gst/flacparse \
$(top_srcdir)/gst/imagefreeze \
$(top_srcdir)/gst/qtmux \
$(top_srcdir)/gst/selector \
$(top_srcdir)/gst/shapewipe \
$(top_srcdir)/gst/valve \

View file

@ -341,7 +341,6 @@ AG_GST_CHECK_PLUGIN(nuvdemux)
AG_GST_CHECK_PLUGIN(patchdetect)
AG_GST_CHECK_PLUGIN(pcapparse)
AG_GST_CHECK_PLUGIN(pnm)
AG_GST_CHECK_PLUGIN(qtmux)
AG_GST_CHECK_PLUGIN(rawparse)
AG_GST_CHECK_PLUGIN(real)
AG_GST_CHECK_PLUGIN(rtpmux)
@ -1784,7 +1783,6 @@ gst/nuvdemux/Makefile
gst/patchdetect/Makefile
gst/pcapparse/Makefile
gst/pnm/Makefile
gst/qtmux/Makefile
gst/rawparse/Makefile
gst/real/Makefile
gst/rtpmux/Makefile

View file

@ -182,7 +182,6 @@ EXTRA_HFILES = \
$(top_srcdir)/gst/mxf/mxfmux.h \
$(top_srcdir)/gst/nuvdemux/gstnuvdemux.h \
$(top_srcdir)/gst/pcapparse/gstpcapparse.h \
$(top_srcdir)/gst/qtmux/gstqtmux.h \
$(top_srcdir)/gst/rawparse/gstaudioparse.h \
$(top_srcdir)/gst/rawparse/gstvideoparse.h \
$(top_srcdir)/gst/rtpmux/gstrtpmux.h \

View file

@ -88,7 +88,6 @@
<xi:include href="xml/element-pcapparse.xml" />
<xi:include href="xml/element-pinch.xml" />
<xi:include href="xml/element-pyramidsegment.xml" />
<xi:include href="xml/element-qtmux.xml" />
<xi:include href="xml/element-rsvgdec.xml" />
<xi:include href="xml/element-rsvgoverlay.xml" />
<xi:include href="xml/element-rtpdtmfdepay.xml" />
@ -188,7 +187,6 @@
<xi:include href="xml/plugin-nuvdemux.xml" />
<xi:include href="xml/plugin-opencv.xml" />
<xi:include href="xml/plugin-pcapparse.xml" />
<xi:include href="xml/plugin-qtmux.xml" />
<xi:include href="xml/plugin-rawparse.xml" />
<xi:include href="xml/plugin-real.xml" />
<xi:include href="xml/plugin-rfbsrc.xml" />

View file

@ -1118,20 +1118,6 @@ gst_pyramidsegment_get_type
gst_pyramidsegment_plugin_init
</SECTION>
<SECTION>
<FILE>element-qtmux</FILE>
<TITLE>qtmux</TITLE>
GstQTMux
<SUBSECTION Standard>
GstQTMuxClass
GST_QT_MUX
GST_QT_MUX_CLASS
GST_IS_QT_MUX
GST_IS_QT_MUX_CLASS
GST_TYPE_QT_MUX
gst_qt_mux_get_type
</SECTION>
<SECTION>
<FILE>element-rsvgoverlay</FILE>
<TITLE>rsvgoverlay</TITLE>

View file

@ -1,157 +0,0 @@
<plugin>
<name>qtmux</name>
<description>Quicktime Muxer plugin</description>
<filename>../../gst/qtmux/.libs/libgstqtmux.so</filename>
<basename>libgstqtmux.so</basename>
<version>0.10.21.1</version>
<license>LGPL</license>
<source>gst-plugins-bad</source>
<package>GStreamer Bad Plug-ins git</package>
<origin>Unknown package origin</origin>
<elements>
<element>
<name>gppmux</name>
<longname>3GPP Muxer</longname>
<class>Codec/Muxer</class>
<description>Multiplex audio and video into a 3GPP file</description>
<author>Thiago Sousa Santos &lt;thiagoss@embedded.ufcg.edu.br&gt;</author>
<pads>
<caps>
<name>audio_%d</name>
<direction>sink</direction>
<presence>request</presence>
<details>audio/AMR, rate=(int)8000, channels=(int)[ 1, 2 ]; audio/AMR-WB, rate=(int)16000, channels=(int)[ 1, 2 ]; audio/mpeg, mpegversion=(int)1, layer=(int)3, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]; audio/mpeg, mpegversion=(int)4, stream-format=(string)raw, channels=(int)[ 1, 8 ], rate=(int)[ 1, 2147483647 ]</details>
</caps>
<caps>
<name>video_%d</name>
<direction>sink</direction>
<presence>request</presence>
<details>video/x-h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/mpeg, mpegversion=(int)4, systemstream=(boolean)false, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-divx, divxversion=(int)5, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-h264, stream-format=(string)avc, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
</caps>
<caps>
<name>src</name>
<direction>source</direction>
<presence>always</presence>
<details>video/quicktime, variant=(string)3gpp</details>
</caps>
</pads>
</element>
<element>
<name>ismlmux</name>
<longname>ISML Muxer</longname>
<class>Codec/Muxer</class>
<description>Multiplex audio and video into a ISML file</description>
<author>Thiago Sousa Santos &lt;thiagoss@embedded.ufcg.edu.br&gt;</author>
<pads>
<caps>
<name>audio_%d</name>
<direction>sink</direction>
<presence>request</presence>
<details>audio/mpeg, mpegversion=(int)1, layer=(int)3, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]; audio/mpeg, mpegversion=(int)4, stream-format=(string)raw, channels=(int)[ 1, 8 ], rate=(int)[ 1, 2147483647 ]</details>
</caps>
<caps>
<name>video_%d</name>
<direction>sink</direction>
<presence>request</presence>
<details>video/mpeg, mpegversion=(int)4, systemstream=(boolean)false, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-divx, divxversion=(int)5, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-h264, stream-format=(string)avc, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
</caps>
<caps>
<name>src</name>
<direction>source</direction>
<presence>always</presence>
<details>video/quicktime, variant=(string)iso</details>
</caps>
</pads>
</element>
<element>
<name>mj2mux</name>
<longname>MJ2 Muxer</longname>
<class>Codec/Muxer</class>
<description>Multiplex audio and video into a MJ2 file</description>
<author>Thiago Sousa Santos &lt;thiagoss@embedded.ufcg.edu.br&gt;</author>
<pads>
<caps>
<name>audio_%d</name>
<direction>sink</direction>
<presence>request</presence>
<details>audio/x-raw-int, width=(int)8, depth=(int)8, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean){ true, false }; audio/x-raw-int, width=(int)16, depth=(int)16, endianness=(int){ 4321, 1234 }, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean)true</details>
</caps>
<caps>
<name>video_%d</name>
<direction>sink</direction>
<presence>request</presence>
<details>image/x-j2c, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; image/x-jpc, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
</caps>
<caps>
<name>src</name>
<direction>source</direction>
<presence>always</presence>
<details>video/mj2</details>
</caps>
</pads>
</element>
<element>
<name>mp4mux</name>
<longname>MP4 Muxer</longname>
<class>Codec/Muxer</class>
<description>Multiplex audio and video into a MP4 file</description>
<author>Thiago Sousa Santos &lt;thiagoss@embedded.ufcg.edu.br&gt;</author>
<pads>
<caps>
<name>audio_%d</name>
<direction>sink</direction>
<presence>request</presence>
<details>audio/mpeg, mpegversion=(int)1, layer=(int)3, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]; audio/mpeg, mpegversion=(int)4, stream-format=(string)raw, channels=(int)[ 1, 8 ], rate=(int)[ 1, 2147483647 ]; audio/x-alac, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]</details>
</caps>
<caps>
<name>video_%d</name>
<direction>sink</direction>
<presence>request</presence>
<details>video/mpeg, mpegversion=(int)4, systemstream=(boolean)false, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-divx, divxversion=(int)5, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-h264, stream-format=(string)avc, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-mp4-part, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
</caps>
<caps>
<name>src</name>
<direction>source</direction>
<presence>always</presence>
<details>video/quicktime, variant=(string)iso</details>
</caps>
</pads>
</element>
<element>
<name>qtmoovrecover</name>
<longname>QT Moov Recover</longname>
<class>Util</class>
<description>Recovers unfinished qtmux files</description>
<author>Thiago Santos &lt;thiago.sousa.santos@collabora.co.uk&gt;</author>
<pads>
</pads>
</element>
<element>
<name>qtmux</name>
<longname>QuickTime Muxer</longname>
<class>Codec/Muxer</class>
<description>Multiplex audio and video into a QuickTime file</description>
<author>Thiago Sousa Santos &lt;thiagoss@embedded.ufcg.edu.br&gt;</author>
<pads>
<caps>
<name>audio_%d</name>
<direction>sink</direction>
<presence>request</presence>
<details>audio/x-raw-int, width=(int)8, depth=(int)8, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean){ true, false }; audio/x-raw-int, width=(int)16, depth=(int)16, endianness=(int){ 4321, 1234 }, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean)true; audio/x-raw-int, width=(int)24, depth=(int)24, endianness=(int){ 4321, 1234 }, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean)true; audio/x-raw-int, width=(int)32, depth=(int)32, endianness=(int){ 4321, 1234 }, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean)true; audio/mpeg, mpegversion=(int)1, layer=(int)3, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]; audio/mpeg, mpegversion=(int)4, stream-format=(string)raw, channels=(int)[ 1, 8 ], rate=(int)[ 1, 2147483647 ]; audio/x-adpcm, layout=(string)dvi, block_align=(int)[ 64, 8096 ], channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]; audio/x-alaw, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]; audio/AMR, rate=(int)8000, channels=(int)[ 1, 2 ]; audio/AMR-WB, rate=(int)16000, channels=(int)[ 1, 2 ]; audio/x-alac, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]</details>
</caps>
<caps>
<name>video_%d</name>
<direction>sink</direction>
<presence>request</presence>
<details>video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/mpeg, mpegversion=(int)4, systemstream=(boolean)false, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-divx, divxversion=(int)5, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-h264, stream-format=(string)avc, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-svq, svqversion=(int)3, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-dv, systemstream=(boolean)false, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; image/jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-vp8, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-qt-part, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
</caps>
<caps>
<name>src</name>
<direction>source</direction>
<presence>always</presence>
<details>video/quicktime, variant=(string)apple</details>
</caps>
</pads>
</element>
</elements>
</plugin>

View file

@ -106,7 +106,6 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/gstreamer-%{majorminor}/libgstmpegtsdemux.so
%{_libdir}/gstreamer-%{majorminor}/libgstjp2k.so
%{_libdir}/gstreamer-%{majorminor}/libgstapexsink.so
%{_libdir}/gstreamer-%{majorminor}/libgstqtmux.so
%{_libdir}/gstreamer-%{majorminor}/libgstlegacyresample.so
%{_libdir}/gstreamer-%{majorminor}/libgstmxf.so
%{_libdir}/gstreamer-%{majorminor}/libgstvmnc.so
@ -124,7 +123,6 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/gstreamer-%{majorminor}/libgstasfmux.so
%{_libdir}/gstreamer-%{majorminor}/libgstpnm.so
%{_libdir}/gstreamer-%{majorminor}/libgstvideomeasure.so
%{_libdir}/gstreamer-%{majorminor}/libgstaudioparsersbad.so
%{_libdir}/gstreamer-%{majorminor}/libgstrsvg.so
%{_includedir}/gstreamer-%{majorminor}/gst/video/gstbasevideocodec.h

View file

@ -1,45 +0,0 @@
# plugindir is set in configure
plugin_LTLIBRARIES = libgstqtmux.la
# sources used to compile this plug-in
libgstqtmux_la_SOURCES = gstqtmux.c \
gstqtmoovrecover.c \
gstqtmuxplugin.c \
atoms.c \
atomsrecovery.c \
descriptors.c \
properties.c \
gstqtmuxmap.c
# flags used to compile this plugin
# add other _CFLAGS and _LIBS as needed
libgstqtmux_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
libgstqtmux_la_LIBADD = -lgstinterfaces-$(GST_MAJORMINOR) $(GST_LIBS) $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgsttag-$(GST_MAJORMINOR)
libgstqtmux_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstqtmux_la_LIBTOOLFLAGS = --tag=disable-static
# headers we need but don't want installed
noinst_HEADERS = gstqtmux.h \
gstqtmoovrecover.h \
atoms.h \
atomsrecovery.h \
descriptors.h \
properties.h \
fourcc.h \
ftypcc.h \
gstqtmuxmap.h
Android.mk: Makefile.am $(BUILT_SOURCES)
androgenizer \
-:PROJECT libgstqtmux -:SHARED libgstqtmux \
-:TAGS eng debug \
-:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
-:SOURCES $(libgstqtmux_la_SOURCES) \
-:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstqtmux_la_CFLAGS) \
-:LDFLAGS $(libgstqtmux_la_LDFLAGS) \
$(libgstqtmux_la_LIBADD) \
-ldl \
-:PASSTHROUGH LOCAL_ARM_MODE:=arm \
LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \
> $@

File diff suppressed because it is too large Load diff

View file

@ -1,956 +0,0 @@
/* Quicktime muxer plugin for GStreamer
* Copyright (C) 2008-2010 Thiago Santos <thiagoss@embedded.ufcg.edu.br>
*
* 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.
*/
/*
* Unless otherwise indicated, Source Code is licensed under MIT license.
* See further explanation attached in License Statement (distributed in the file
* LICENSE).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __ATOMS_H__
#define __ATOMS_H__
#include <glib.h>
#include <string.h>
#include "descriptors.h"
#include "properties.h"
#include "fourcc.h"
#include "ftypcc.h"
/* helper storage struct */
#define ATOM_ARRAY(struct_type) \
struct { \
guint size; \
guint len; \
struct_type *data; \
}
/* storage helpers */
#define atom_array_init(array, reserve) \
G_STMT_START { \
(array)->len = 0; \
(array)->size = reserve; \
(array)->data = g_malloc (sizeof (*(array)->data) * reserve); \
} G_STMT_END
#define atom_array_append(array, elmt, inc) \
G_STMT_START { \
g_assert ((array)->data); \
g_assert (inc > 0); \
if (G_UNLIKELY ((array)->len == (array)->size)) { \
(array)->size += inc; \
(array)->data = \
g_realloc ((array)->data, sizeof (*((array)->data)) * (array)->size); \
} \
(array)->data[(array)->len] = elmt; \
(array)->len++; \
} G_STMT_END
#define atom_array_get_len(array) ((array)->len)
#define atom_array_index(array, index) ((array)->data[index])
#define atom_array_clear(array) \
G_STMT_START { \
(array)->size = (array)->len = 0; \
g_free ((array)->data); \
(array)->data = NULL; \
} G_STMT_END
/* light-weight context that may influence header atom tree construction */
typedef enum _AtomsTreeFlavor
{
ATOMS_TREE_FLAVOR_MOV,
ATOMS_TREE_FLAVOR_ISOM,
ATOMS_TREE_FLAVOR_3GP,
ATOMS_TREE_FLAVOR_ISML
} AtomsTreeFlavor;
typedef struct _AtomsContext
{
AtomsTreeFlavor flavor;
} AtomsContext;
AtomsContext* atoms_context_new (AtomsTreeFlavor flavor);
void atoms_context_free (AtomsContext *context);
#define METADATA_DATA_FLAG 0x0
#define METADATA_TEXT_FLAG 0x1
/* atom defs and functions */
/**
* Used for storing time related values for some atoms.
*/
typedef struct _TimeInfo
{
guint64 creation_time;
guint64 modification_time;
guint32 timescale;
guint64 duration;
} TimeInfo;
typedef struct _Atom
{
guint32 size;
guint32 type;
guint64 extended_size;
} Atom;
typedef struct _AtomFull
{
Atom header;
guint8 version;
guint8 flags[3];
} AtomFull;
/*
* Generic extension atom
*/
typedef struct _AtomData
{
Atom header;
/* not written */
guint32 datalen;
guint8 *data;
} AtomData;
typedef struct _AtomUUID
{
Atom header;
guint8 uuid[16];
/* not written */
guint32 datalen;
guint8 *data;
} AtomUUID;
typedef struct _AtomFTYP
{
Atom header;
guint32 major_brand;
guint32 version;
guint32 *compatible_brands;
/* not written */
guint32 compatible_brands_size;
} AtomFTYP;
typedef struct _AtomMVHD
{
AtomFull header;
/* version 0: 32 bits */
TimeInfo time_info;
guint32 prefered_rate; /* ISO: 0x00010000 */
guint16 volume; /* ISO: 0x0100 */
guint16 reserved3; /* ISO: 0x0 */
guint32 reserved4[2]; /* ISO: 0, 0 */
/* ISO: identity matrix =
* { 0x00010000, 0, 0, 0, 0x00010000, 0, 0, 0, 0x40000000 } */
guint32 matrix[9];
/* ISO: all 0 */
guint32 preview_time;
guint32 preview_duration;
guint32 poster_time;
guint32 selection_time;
guint32 selection_duration;
guint32 current_time;
guint32 next_track_id;
} AtomMVHD;
typedef struct _AtomTKHD
{
AtomFull header;
/* version 0: 32 bits */
/* like the TimeInfo struct, but it has this track_ID inside */
guint64 creation_time;
guint64 modification_time;
guint32 track_ID;
guint32 reserved;
guint64 duration;
guint32 reserved2[2];
guint16 layer;
guint16 alternate_group;
guint16 volume;
guint16 reserved3;
/* ISO: identity matrix =
* { 0x00010000, 0, 0, 0, 0x00010000, 0, 0, 0, 0x40000000 } */
guint32 matrix[9];
guint32 width;
guint32 height;
} AtomTKHD;
typedef struct _AtomMDHD
{
AtomFull header;
/* version 0: 32 bits */
TimeInfo time_info;
/* ISO: packed ISO-639-2/T language code (first bit must be 0) */
guint16 language_code;
/* ISO: 0 */
guint16 quality;
} AtomMDHD;
typedef struct _AtomHDLR
{
AtomFull header;
/* ISO: 0 */
guint32 component_type;
guint32 handler_type;
guint32 manufacturer;
guint32 flags;
guint32 flags_mask;
gchar *name;
} AtomHDLR;
typedef struct _AtomVMHD
{
AtomFull header; /* ISO: flags = 1 */
guint16 graphics_mode;
/* RGB */
guint16 opcolor[3];
} AtomVMHD;
typedef struct _AtomSMHD
{
AtomFull header;
guint16 balance;
guint16 reserved;
} AtomSMHD;
typedef struct _AtomHMHD
{
AtomFull header;
guint16 max_pdu_size;
guint16 avg_pdu_size;
guint32 max_bitrate;
guint32 avg_bitrate;
guint32 sliding_avg_bitrate;
} AtomHMHD;
typedef struct _AtomURL
{
AtomFull header;
gchar *location;
} AtomURL;
typedef struct _AtomDREF
{
AtomFull header;
GList *entries;
} AtomDREF;
typedef struct _AtomDINF
{
Atom header;
AtomDREF dref;
} AtomDINF;
typedef struct _STTSEntry
{
guint32 sample_count;
gint32 sample_delta;
} STTSEntry;
typedef struct _AtomSTTS
{
AtomFull header;
ATOM_ARRAY (STTSEntry) entries;
} AtomSTTS;
typedef struct _AtomSTSS
{
AtomFull header;
ATOM_ARRAY (guint32) entries;
} AtomSTSS;
typedef struct _AtomESDS
{
AtomFull header;
ESDescriptor es;
} AtomESDS;
typedef struct _AtomFRMA
{
Atom header;
guint32 media_type;
} AtomFRMA;
typedef enum _SampleEntryKind
{
UNKNOWN,
AUDIO,
VIDEO
} SampleEntryKind;
typedef struct _SampleTableEntry
{
Atom header;
guint8 reserved[6];
guint16 data_reference_index;
/* sort of entry */
SampleEntryKind kind;
} SampleTableEntry;
typedef struct _AtomHintSampleEntry
{
SampleTableEntry se;
guint32 size;
guint8 *data;
} AtomHintSampleEntry;
typedef struct _SampleTableEntryMP4V
{
SampleTableEntry se;
guint16 version;
guint16 revision_level;
guint32 vendor; /* fourcc code */
guint32 temporal_quality;
guint32 spatial_quality;
guint16 width;
guint16 height;
guint32 horizontal_resolution;
guint32 vertical_resolution;
guint32 datasize;
guint16 frame_count; /* usually 1 */
guint8 compressor[32]; /* pascal string, i.e. first byte = length */
guint16 depth;
guint16 color_table_id;
/* (optional) list of AtomInfo */
GList *extension_atoms;
} SampleTableEntryMP4V;
typedef struct _SampleTableEntryMP4A
{
SampleTableEntry se;
guint16 version;
guint16 revision_level;
guint32 vendor;
guint16 channels;
guint16 sample_size;
guint16 compression_id;
guint16 packet_size;
guint32 sample_rate; /* fixed point 16.16 */
guint32 samples_per_packet;
guint32 bytes_per_packet;
guint32 bytes_per_frame;
guint32 bytes_per_sample;
/* (optional) list of AtomInfo */
GList *extension_atoms;
} SampleTableEntryMP4A;
typedef struct _SampleTableEntryMP4S
{
SampleTableEntry se;
AtomESDS es;
} SampleTableEntryMP4S;
typedef struct _AtomSTSD
{
AtomFull header;
guint n_entries;
/* list of subclasses of SampleTableEntry */
GList *entries;
} AtomSTSD;
typedef struct _AtomSTSZ
{
AtomFull header;
guint32 sample_size;
/* need the size here because when sample_size is constant,
* the list is empty */
guint32 table_size;
ATOM_ARRAY (guint32) entries;
} AtomSTSZ;
typedef struct _STSCEntry
{
guint32 first_chunk;
guint32 samples_per_chunk;
guint32 sample_description_index;
} STSCEntry;
typedef struct _AtomSTSC
{
AtomFull header;
ATOM_ARRAY (STSCEntry) entries;
} AtomSTSC;
/*
* used for both STCO and CO64
* if used as STCO, entries should be truncated to use only 32bits
*/
typedef struct _AtomSTCO64
{
AtomFull header;
ATOM_ARRAY (guint64) entries;
} AtomSTCO64;
typedef struct _CTTSEntry
{
guint32 samplecount;
guint32 sampleoffset;
} CTTSEntry;
typedef struct _AtomCTTS
{
AtomFull header;
/* also entry count here */
ATOM_ARRAY (CTTSEntry) entries;
gboolean do_pts;
} AtomCTTS;
typedef struct _AtomSTBL
{
Atom header;
AtomSTSD stsd;
AtomSTTS stts;
AtomSTSS stss;
AtomSTSC stsc;
AtomSTSZ stsz;
/* NULL if not present */
AtomCTTS *ctts;
AtomSTCO64 stco64;
} AtomSTBL;
typedef struct _AtomMINF
{
Atom header;
/* only (exactly) one of those must be present */
AtomVMHD *vmhd;
AtomSMHD *smhd;
AtomHMHD *hmhd;
AtomHDLR *hdlr;
AtomDINF dinf;
AtomSTBL stbl;
} AtomMINF;
typedef struct _EditListEntry
{
/* duration in movie's timescale */
guint32 duration;
/* start time in media's timescale, -1 for empty */
guint32 media_time;
guint32 media_rate; /* fixed point 32 bit */
} EditListEntry;
typedef struct _AtomELST
{
AtomFull header;
/* number of entries is implicit */
GSList *entries;
} AtomELST;
typedef struct _AtomEDTS
{
Atom header;
AtomELST elst;
} AtomEDTS;
typedef struct _AtomMDIA
{
Atom header;
AtomMDHD mdhd;
AtomHDLR hdlr;
AtomMINF minf;
} AtomMDIA;
typedef struct _AtomILST
{
Atom header;
/* list of AtomInfo */
GList* entries;
} AtomILST;
typedef struct _AtomTagData
{
AtomFull header;
guint32 reserved;
guint32 datalen;
guint8* data;
} AtomTagData;
typedef struct _AtomTag
{
Atom header;
AtomTagData data;
} AtomTag;
typedef struct _AtomMETA
{
AtomFull header;
AtomHDLR hdlr;
AtomILST *ilst;
} AtomMETA;
typedef struct _AtomUDTA
{
Atom header;
/* list of AtomInfo */
GList* entries;
/* or list is further down */
AtomMETA *meta;
} AtomUDTA;
enum TrFlags
{
TR_DATA_OFFSET = 0x01, /* data-offset-present */
TR_FIRST_SAMPLE_FLAGS = 0x04, /* first-sample-flags-present */
TR_SAMPLE_DURATION = 0x0100, /* sample-duration-present */
TR_SAMPLE_SIZE = 0x0200, /* sample-size-present */
TR_SAMPLE_FLAGS = 0x0400, /* sample-flags-present */
TR_COMPOSITION_TIME_OFFSETS = 0x0800 /* sample-composition-time-offsets-presents */
};
enum TfFlags
{
TF_BASE_DATA_OFFSET = 0x01, /* base-data-offset-present */
TF_SAMPLE_DESCRIPTION_INDEX = 0x02, /* sample-description-index-present */
TF_DEFAULT_SAMPLE_DURATION = 0x08, /* default-sample-duration-present */
TF_DEFAULT_SAMPLE_SIZE = 0x010, /* default-sample-size-present */
TF_DEFAULT_SAMPLE_FLAGS = 0x020, /* default-sample-flags-present */
TF_DURATION_IS_EMPTY = 0x010000 /* sample-composition-time-offsets-presents */
};
typedef struct _AtomTRAK
{
Atom header;
AtomTKHD tkhd;
AtomEDTS *edts;
AtomMDIA mdia;
/* some helper info for structural conformity checks */
gboolean is_video;
gboolean is_h264;
} AtomTRAK;
typedef struct _AtomTREX
{
AtomFull header;
guint32 track_ID;
guint32 default_sample_description_index;
guint32 default_sample_duration;
guint32 default_sample_size;
guint32 default_sample_flags;
} AtomTREX;
typedef struct _AtomMEHD
{
AtomFull header;
guint64 fragment_duration;
} AtomMEHD;
typedef struct _AtomMVEX
{
Atom header;
AtomMEHD mehd;
/* list of AtomTREX */
GList *trexs;
} AtomMVEX;
typedef struct _AtomMFHD
{
AtomFull header;
guint32 sequence_number;
} AtomMFHD;
typedef struct _AtomTFHD
{
AtomFull header;
guint32 track_ID;
guint64 base_data_offset;
guint32 sample_description_index;
guint32 default_sample_duration;
guint32 default_sample_size;
guint32 default_sample_flags;
} AtomTFHD;
typedef struct _TRUNSampleEntry
{
guint32 sample_duration;
guint32 sample_size;
guint32 sample_flags;
guint32 sample_composition_time_offset;
} TRUNSampleEntry;
typedef struct _AtomTRUN
{
AtomFull header;
guint32 sample_count;
gint32 data_offset;
guint32 first_sample_flags;
/* array of fields */
ATOM_ARRAY (TRUNSampleEntry) entries;
} AtomTRUN;
typedef struct _AtomSDTP
{
AtomFull header;
/* not serialized */
guint32 sample_count;
/* array of fields */
ATOM_ARRAY (guint8) entries;
} AtomSDTP;
typedef struct _AtomTRAF
{
Atom header;
AtomTFHD tfhd;
/* list of AtomTRUN */
GList *truns;
/* list of AtomSDTP */
GList *sdtps;
} AtomTRAF;
typedef struct _AtomMOOF
{
Atom header;
AtomMFHD mfhd;
/* list of AtomTRAF */
GList *trafs;
} AtomMOOF;
typedef struct _AtomMOOV
{
/* style */
AtomsContext context;
Atom header;
AtomMVHD mvhd;
AtomMVEX mvex;
/* list of AtomTRAK */
GList *traks;
AtomUDTA *udta;
gboolean fragmented;
} AtomMOOV;
typedef struct _AtomWAVE
{
Atom header;
/* list of AtomInfo */
GList *extension_atoms;
} AtomWAVE;
typedef struct _TFRAEntry
{
guint64 time;
guint64 moof_offset;
guint32 traf_number;
guint32 trun_number;
guint32 sample_number;
} TFRAEntry;
typedef struct _AtomTFRA
{
AtomFull header;
guint32 track_ID;
guint32 lengths;
/* array of entries */
ATOM_ARRAY (TFRAEntry) entries;
} AtomTFRA;
typedef struct _AtomMFRA
{
Atom header;
/* list of tfra */
GList *tfras;
} AtomMFRA;
/*
* Function to serialize an atom
*/
typedef guint64 (*AtomCopyDataFunc) (Atom *atom, guint8 **buffer, guint64 *size, guint64 *offset);
/*
* Releases memory allocated by an atom
*/
typedef guint64 (*AtomFreeFunc) (Atom *atom);
/*
* Some atoms might have many optional different kinds of child atoms, so this
* is useful for enabling generic handling of any atom.
* All we need are the two functions (copying it to an array
* for serialization and the memory releasing function).
*/
typedef struct _AtomInfo
{
Atom *atom;
AtomCopyDataFunc copy_data_func;
AtomFreeFunc free_func;
} AtomInfo;
guint64 atom_copy_data (Atom *atom, guint8 **buffer,
guint64 *size, guint64* offset);
AtomFTYP* atom_ftyp_new (AtomsContext *context, guint32 major,
guint32 version, GList *brands);
guint64 atom_ftyp_copy_data (AtomFTYP *ftyp, guint8 **buffer,
guint64 *size, guint64 *offset);
void atom_ftyp_free (AtomFTYP *ftyp);
AtomTRAK* atom_trak_new (AtomsContext *context);
void atom_trak_add_samples (AtomTRAK * trak, guint32 nsamples, guint32 delta,
guint32 size, guint64 chunk_offset, gboolean sync,
gint64 pts_offset);
void atom_trak_add_elst_entry (AtomTRAK * trak, guint32 duration,
guint32 media_time, guint32 rate);
guint32 atom_trak_get_timescale (AtomTRAK *trak);
guint32 atom_trak_get_id (AtomTRAK * trak);
void atom_stbl_add_samples (AtomSTBL * stbl, guint32 nsamples,
guint32 delta, guint32 size,
guint64 chunk_offset, gboolean sync,
gint64 pts_offset);
AtomMOOV* atom_moov_new (AtomsContext *context);
void atom_moov_free (AtomMOOV *moov);
guint64 atom_moov_copy_data (AtomMOOV *atom, guint8 **buffer, guint64 *size, guint64* offset);
void atom_moov_update_timescale (AtomMOOV *moov, guint32 timescale);
void atom_moov_update_duration (AtomMOOV *moov);
void atom_moov_set_fragmented (AtomMOOV *moov, gboolean fragmented);
void atom_moov_chunks_add_offset (AtomMOOV *moov, guint32 offset);
void atom_moov_add_trak (AtomMOOV *moov, AtomTRAK *trak);
guint64 atom_mvhd_copy_data (AtomMVHD * atom, guint8 ** buffer,
guint64 * size, guint64 * offset);
void atom_stco64_chunks_add_offset (AtomSTCO64 * stco64, guint32 offset);
guint64 atom_trak_copy_data (AtomTRAK * atom, guint8 ** buffer,
guint64 * size, guint64 * offset);
void atom_stbl_clear (AtomSTBL * stbl);
void atom_stbl_init (AtomSTBL * stbl);
guint64 atom_stss_copy_data (AtomSTSS *atom, guint8 **buffer,
guint64 *size, guint64* offset);
guint64 atom_stts_copy_data (AtomSTTS *atom, guint8 **buffer,
guint64 *size, guint64* offset);
guint64 atom_stsc_copy_data (AtomSTSC *atom, guint8 **buffer,
guint64 *size, guint64* offset);
guint64 atom_stsz_copy_data (AtomSTSZ *atom, guint8 **buffer,
guint64 *size, guint64* offset);
guint64 atom_ctts_copy_data (AtomCTTS *atom, guint8 **buffer,
guint64 *size, guint64* offset);
guint64 atom_stco64_copy_data (AtomSTCO64 *atom, guint8 **buffer,
guint64 *size, guint64* offset);
AtomMOOF* atom_moof_new (AtomsContext *context, guint32 sequence_number);
void atom_moof_free (AtomMOOF *moof);
guint64 atom_moof_copy_data (AtomMOOF *moof, guint8 **buffer, guint64 *size, guint64* offset);
AtomTRAF * atom_traf_new (AtomsContext * context, guint32 track_ID);
void atom_traf_free (AtomTRAF * traf);
void atom_traf_add_samples (AtomTRAF * traf, guint32 delta,
guint32 size, gboolean sync, gint64 pts_offset,
gboolean sdtp_sync);
guint32 atom_traf_get_sample_num (AtomTRAF * traf);
void atom_moof_add_traf (AtomMOOF *moof, AtomTRAF *traf);
AtomMFRA* atom_mfra_new (AtomsContext *context);
void atom_mfra_free (AtomMFRA *mfra);
AtomTFRA* atom_tfra_new (AtomsContext *context, guint32 track_ID);
void atom_tfra_add_entry (AtomTFRA *tfra, guint64 dts, guint32 sample_num);
void atom_tfra_update_offset (AtomTFRA * tfra, guint64 offset);
void atom_mfra_add_tfra (AtomMFRA *mfra, AtomTFRA *tfra);
guint64 atom_mfra_copy_data (AtomMFRA *mfra, guint8 **buffer, guint64 *size, guint64* offset);
/* media sample description related helpers */
typedef struct
{
guint16 version;
guint32 fourcc;
guint width;
guint height;
guint depth;
guint frame_count;
gint color_table_id;
guint par_n;
guint par_d;
GstBuffer *codec_data;
} VisualSampleEntry;
typedef struct
{
guint32 fourcc;
guint version;
gint compression_id;
guint sample_rate;
guint channels;
guint sample_size;
guint bytes_per_packet;
guint samples_per_packet;
guint bytes_per_sample;
guint bytes_per_frame;
GstBuffer *codec_data;
} AudioSampleEntry;
void atom_trak_set_audio_type (AtomTRAK * trak, AtomsContext * context,
AudioSampleEntry * entry, guint32 scale,
AtomInfo * ext, gint sample_size);
void atom_trak_set_video_type (AtomTRAK * trak, AtomsContext * context,
VisualSampleEntry * entry, guint32 rate,
GList * ext_atoms_list);
AtomInfo * build_codec_data_extension (guint32 fourcc, const GstBuffer * codec_data);
AtomInfo * build_mov_aac_extension (AtomTRAK * trak, const GstBuffer * codec_data,
guint32 avg_bitrate, guint32 max_bitrate);
AtomInfo * build_mov_alac_extension (AtomTRAK * trak, const GstBuffer * codec_data);
AtomInfo * build_esds_extension (AtomTRAK * trak, guint8 object_type,
guint8 stream_type, const GstBuffer * codec_data,
guint32 avg_bitrate, guint32 max_bitrate);
AtomInfo * build_btrt_extension (guint32 buffer_size_db, guint32 avg_bitrate,
guint32 max_bitrate);
AtomInfo * build_jp2h_extension (AtomTRAK * trak, gint width, gint height,
guint32 fourcc, gint ncomp,
const GValue * cmap_array,
const GValue * cdef_array);
AtomInfo * build_jp2x_extension (const GstBuffer * prefix);
AtomInfo * build_fiel_extension (gint fields);
AtomInfo * build_amr_extension (void);
AtomInfo * build_h263_extension (void);
AtomInfo * build_gama_atom (gdouble gamma);
AtomInfo * build_SMI_atom (const GstBuffer *seqh);
AtomInfo * build_ima_adpcm_extension (gint channels, gint rate,
gint blocksize);
AtomInfo * build_uuid_xmp_atom (GstBuffer * xmp);
/*
* Meta tags functions
*/
void atom_moov_add_str_tag (AtomMOOV *moov, guint32 fourcc, const gchar *value);
void atom_moov_add_uint_tag (AtomMOOV *moov, guint32 fourcc, guint32 flags,
guint32 value);
void atom_moov_add_tag (AtomMOOV *moov, guint32 fourcc, guint32 flags,
const guint8 * data, guint size);
void atom_moov_add_blob_tag (AtomMOOV *moov, guint8 *data, guint size);
void atom_moov_add_3gp_str_tag (AtomMOOV * moov, guint32 fourcc, const gchar * value);
void atom_moov_add_3gp_uint_tag (AtomMOOV * moov, guint32 fourcc, guint16 value);
void atom_moov_add_3gp_str_int_tag (AtomMOOV * moov, guint32 fourcc, const gchar * value,
gint16 ivalue);
void atom_moov_add_3gp_tag (AtomMOOV * moov, guint32 fourcc, guint8 * data,
guint size);
void atom_moov_add_xmp_tags (AtomMOOV * moov, GstBuffer * xmp);
#define GST_QT_MUX_DEFAULT_TAG_LANGUAGE "eng"
guint16 language_code (const char * lang);
#endif /* __ATOMS_H__ */

File diff suppressed because it is too large Load diff

View file

@ -1,159 +0,0 @@
/* Quicktime muxer plugin for GStreamer
* Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
*
* 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.
*/
/*
* Unless otherwise indicated, Source Code is licensed under MIT license.
* See further explanation attached in License Statement (distributed in the file
* LICENSE).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __ATOMS_RECOVERY_H__
#define __ATOMS_RECOVERY_H__
#include <glib.h>
#include <string.h>
#include <stdio.h>
#include <gst/gst.h>
#include "atoms.h"
/* Version to be incremented each time we decide
* to change the file layout */
#define ATOMS_RECOV_FILE_VERSION 1
#define ATOMS_RECOV_QUARK (g_quark_from_string ("qtmux-atoms-recovery"))
/* gerror error codes */
#define ATOMS_RECOV_ERR_GENERIC 1
#define ATOMS_RECOV_ERR_FILE 2
#define ATOMS_RECOV_ERR_PARSING 3
#define ATOMS_RECOV_ERR_VERSION 4
/* this struct represents each buffer in a moov file, containing the info
* that is placed in the stsd children atoms
* Fields should be writen in BE order, and booleans should be writen as
* 1byte with 0 for false, anything otherwise */
#define TRAK_BUFFER_ENTRY_INFO_SIZE 34
typedef struct
{
guint32 track_id;
guint32 nsamples;
guint32 delta;
guint32 size;
guint64 chunk_offset;
guint64 pts_offset;
gboolean sync;
gboolean do_pts;
} TrakBufferEntryInfo;
typedef struct
{
guint32 trak_id;
guint32 duration; /* duration in trak timescale */
guint32 timescale; /* trak's timescale */
guint64 file_offset;
/* need for later updating duration */
guint64 tkhd_file_offset;
guint64 mdhd_file_offset;
/* need these offsets to update size */
guint32 trak_size;
guint64 mdia_file_offset;
guint32 mdia_size;
guint64 minf_file_offset;
guint32 minf_size;
guint64 stbl_file_offset;
guint32 stbl_size;
guint64 post_stsd_offset;
guint32 stsd_size;
/* for storing the samples info */
AtomSTBL stbl;
} TrakRecovData;
typedef struct
{
FILE * file;
gboolean rawfile;
/* results from parsing the input file */
guint64 data_size;
guint32 mdat_header_size;
guint mdat_start;
guint64 mdat_size;
} MdatRecovFile;
typedef struct
{
FILE * file;
guint32 timescale;
guint32 mvhd_pos;
guint32 mvhd_size;
guint32 prefix_size; /* prefix + ftyp total size */
gint num_traks;
TrakRecovData *traks_rd;
} MoovRecovFile;
gboolean atoms_recov_write_trak_info (FILE * f, AtomTRAK * trak);
gboolean atoms_recov_write_headers (FILE * f, AtomFTYP * ftyp,
GstBuffer * prefix, AtomMOOV * moov,
guint32 timescale,
guint32 traks_number);
gboolean atoms_recov_write_trak_samples (FILE * f, AtomTRAK * trak,
guint32 nsamples, guint32 delta,
guint32 size, guint64 chunk_offset,
gboolean sync, gboolean do_pts,
gint64 pts_offset);
MdatRecovFile * mdat_recov_file_create (FILE * file, gboolean datafile,
GError ** err);
void mdat_recov_file_free (MdatRecovFile * mrf);
MoovRecovFile * moov_recov_file_create (FILE * file, GError ** err);
void moov_recov_file_free (MoovRecovFile * moovrf);
gboolean moov_recov_parse_buffers (MoovRecovFile * moovrf,
MdatRecovFile * mdatrf,
GError ** err);
gboolean moov_recov_write_file (MoovRecovFile * moovrf,
MdatRecovFile * mdatrf, FILE * outf,
GError ** err);
#endif /* __ATOMS_RECOVERY_H__ */

View file

@ -1,458 +0,0 @@
/* Quicktime muxer plugin for GStreamer
* Copyright (C) 2008 Thiago Sousa Santos <thiagoss@embedded.ufcg.edu.br>
*
* 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.
*/
/*
* Unless otherwise indicated, Source Code is licensed under MIT license.
* See further explanation attached in License Statement (distributed in the file
* LICENSE).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "descriptors.h"
/*
* Some mp4 structures (descriptors) use a coding scheme for
* representing its size.
* It is grouped in bytes. The 1st bit set to 1 means we need another byte,
* 0 otherwise. The remaining 7 bits are the useful values.
*
* The next set of functions handle those values
*/
/*
* Gets an unsigned integer and packs it into a 'expandable size' format
* (as used by mp4 descriptors)
* @size: the integer to be parsed
* @ptr: the array to place the result
* @array_size: the size of ptr array
*/
static void
expandable_size_parse (guint64 size, guint8 * ptr, guint32 array_size)
{
int index = 0;
memset (ptr, 0, sizeof (array_size));
while (size > 0 && index < array_size) {
ptr[index++] = (size > 0x7F ? 0x80 : 0x0) | (size & 0x7F);
size = size >> 7;
}
}
/*
* Gets how many positions in an array holding an 'expandable size'
* are really used
*
* @ptr: the array with the 'expandable size'
* @array_size: the size of ptr array
*
* Returns: the number of really used positions
*/
static guint64
expandable_size_get_length (guint8 * ptr, guint32 array_size)
{
gboolean next = TRUE;
guint32 index = 0;
while (next && index < array_size) {
next = ((ptr[index] & 0x80) == 1);
index++;
}
return index;
}
/*
* Initializers below
*/
static void
desc_base_descriptor_init (BaseDescriptor * bd, guint8 tag, guint32 size)
{
bd->tag = tag;
expandable_size_parse (size, bd->size, 4);
}
static void
desc_dec_specific_info_init (DecoderSpecificInfoDescriptor * dsid)
{
desc_base_descriptor_init (&dsid->base, DECODER_SPECIFIC_INFO_TAG, 0);
dsid->length = 0;
dsid->data = NULL;
}
DecoderSpecificInfoDescriptor *
desc_dec_specific_info_new (void)
{
DecoderSpecificInfoDescriptor *desc =
g_new0 (DecoderSpecificInfoDescriptor, 1);
desc_dec_specific_info_init (desc);
return desc;
}
static void
desc_dec_conf_desc_init (DecoderConfigDescriptor * dcd)
{
desc_base_descriptor_init (&dcd->base, DECODER_CONFIG_DESC_TAG, 0);
dcd->dec_specific_info = NULL;
}
static void
desc_sl_conf_desc_init (SLConfigDescriptor * sl)
{
desc_base_descriptor_init (&sl->base, SL_CONFIG_DESC_TAG, 0);
sl->predefined = 0x2;
}
void
desc_es_init (ESDescriptor * es)
{
desc_base_descriptor_init (&es->base, ES_DESCRIPTOR_TAG, 0);
es->id = 0;
es->flags = 0;
es->depends_on_es_id = 0;
es->ocr_es_id = 0;
es->url_length = 0;
es->url_string = NULL;
desc_dec_conf_desc_init (&es->dec_conf_desc);
desc_sl_conf_desc_init (&es->sl_conf_desc);
}
ESDescriptor *
desc_es_descriptor_new (void)
{
ESDescriptor *es = g_new0 (ESDescriptor, 1);
desc_es_init (es);
return es;
}
/*
* Deinitializers/Destructors below
*/
static void
desc_base_descriptor_clear (BaseDescriptor * base)
{
}
void
desc_dec_specific_info_free (DecoderSpecificInfoDescriptor * dsid)
{
desc_base_descriptor_clear (&dsid->base);
if (dsid->data) {
g_free (dsid->data);
dsid->data = NULL;
}
g_free (dsid);
}
static void
desc_dec_conf_desc_clear (DecoderConfigDescriptor * dec)
{
desc_base_descriptor_clear (&dec->base);
if (dec->dec_specific_info) {
desc_dec_specific_info_free (dec->dec_specific_info);
}
}
static void
desc_sl_config_descriptor_clear (SLConfigDescriptor * sl)
{
desc_base_descriptor_clear (&sl->base);
}
void
desc_es_descriptor_clear (ESDescriptor * es)
{
desc_base_descriptor_clear (&es->base);
if (es->url_string) {
g_free (es->url_string);
es->url_string = NULL;
}
desc_dec_conf_desc_clear (&es->dec_conf_desc);
desc_sl_config_descriptor_clear (&es->sl_conf_desc);
}
/*
* Size handling functions below
*/
void
desc_dec_specific_info_alloc_data (DecoderSpecificInfoDescriptor * dsid,
guint32 size)
{
if (dsid->data) {
g_free (dsid->data);
}
dsid->data = g_new0 (guint8, size);
dsid->length = size;
}
static void
desc_base_descriptor_set_size (BaseDescriptor * bd, guint32 size)
{
expandable_size_parse (size, bd->size, 4);
}
static guint64
desc_base_descriptor_get_size (BaseDescriptor * bd)
{
guint64 size = 0;
size += sizeof (guint8);
size += expandable_size_get_length (bd->size, 4) * sizeof (guint8);
return size;
}
static guint64
desc_sl_config_descriptor_get_size (SLConfigDescriptor * sl_desc)
{
guint64 size = 0;
guint64 extra_size = 0;
size += desc_base_descriptor_get_size (&sl_desc->base);
/* predefined */
extra_size += sizeof (guint8);
desc_base_descriptor_set_size (&sl_desc->base, extra_size);
return size + extra_size;
}
static guint64
desc_dec_specific_info_get_size (DecoderSpecificInfoDescriptor * dsid)
{
guint64 size = 0;
guint64 extra_size = 0;
size += desc_base_descriptor_get_size (&dsid->base);
extra_size += sizeof (guint8) * dsid->length;
desc_base_descriptor_set_size (&dsid->base, extra_size);
return size + extra_size;
}
static guint64
desc_dec_config_descriptor_get_size (DecoderConfigDescriptor * dec_desc)
{
guint64 size = 0;
guint64 extra_size = 0;
size += desc_base_descriptor_get_size (&dec_desc->base);
/* object type */
extra_size += sizeof (guint8);
/* stream type */
extra_size += sizeof (guint8);
/* buffer size */
extra_size += sizeof (guint8) * 3;
/* max bitrate */
extra_size += sizeof (guint32);
/* avg bitrate */
extra_size += sizeof (guint32);
if (dec_desc->dec_specific_info) {
extra_size += desc_dec_specific_info_get_size (dec_desc->dec_specific_info);
}
desc_base_descriptor_set_size (&dec_desc->base, extra_size);
return size + extra_size;
}
static guint64
desc_es_descriptor_get_size (ESDescriptor * es)
{
guint64 size = 0;
guint64 extra_size = 0;
size += desc_base_descriptor_get_size (&es->base);
/* id */
extra_size += sizeof (guint16);
/* flags */
extra_size += sizeof (guint8);
/* depends_on_es_id */
if (es->flags & 0x80) {
extra_size += sizeof (guint16);
}
if (es->flags & 0x40) {
/* url_length */
extra_size += sizeof (guint8);
/* url */
extra_size += sizeof (gchar) * es->url_length;
}
if (es->flags & 0x20) {
/* ocr_es_id */
extra_size += sizeof (guint16);
}
extra_size += desc_dec_config_descriptor_get_size (&es->dec_conf_desc);
extra_size += desc_sl_config_descriptor_get_size (&es->sl_conf_desc);
desc_base_descriptor_set_size (&es->base, extra_size);
return size + extra_size;
}
static gboolean
desc_es_descriptor_check_stream_dependency (ESDescriptor * es)
{
return es->flags & 0x80;
}
static gboolean
desc_es_descriptor_check_url_flag (ESDescriptor * es)
{
return es->flags & 0x40;
}
static gboolean
desc_es_descriptor_check_ocr (ESDescriptor * es)
{
return es->flags & 0x20;
}
/* Copy/Serializations Functions below */
static guint64
desc_base_descriptor_copy_data (BaseDescriptor * desc, guint8 ** buffer,
guint64 * size, guint64 * offset)
{
guint64 original_offset = *offset;
prop_copy_uint8 (desc->tag, buffer, size, offset);
prop_copy_uint8_array (desc->size, expandable_size_get_length (desc->size, 4),
buffer, size, offset);
return original_offset - *offset;
}
static guint64
desc_sl_config_descriptor_copy_data (SLConfigDescriptor * desc,
guint8 ** buffer, guint64 * size, guint64 * offset)
{
guint64 original_offset = *offset;
if (!desc_base_descriptor_copy_data (&desc->base, buffer, size, offset)) {
return 0;
}
/* predefined attribute */
prop_copy_uint8 (desc->predefined, buffer, size, offset);
return *offset - original_offset;
}
static guint64
desc_dec_specific_info_copy_data (DecoderSpecificInfoDescriptor * desc,
guint8 ** buffer, guint64 * size, guint64 * offset)
{
guint64 original_offset = *offset;
if (!desc_base_descriptor_copy_data (&desc->base, buffer, size, offset)) {
return 0;
}
prop_copy_uint8_array (desc->data, desc->length, buffer, size, offset);
return *offset - original_offset;
}
static guint64
desc_dec_config_descriptor_copy_data (DecoderConfigDescriptor * desc,
guint8 ** buffer, guint64 * size, guint64 * offset)
{
guint64 original_offset = *offset;
if (!desc_base_descriptor_copy_data (&desc->base, buffer, size, offset)) {
return 0;
}
prop_copy_uint8 (desc->object_type, buffer, size, offset);
prop_copy_uint8 (desc->stream_type, buffer, size, offset);
prop_copy_uint8_array (desc->buffer_size_DB, 3, buffer, size, offset);
prop_copy_uint32 (desc->max_bitrate, buffer, size, offset);
prop_copy_uint32 (desc->avg_bitrate, buffer, size, offset);
if (desc->dec_specific_info) {
if (!desc_dec_specific_info_copy_data (desc->dec_specific_info, buffer,
size, offset)) {
return 0;
}
}
return *offset - original_offset;
}
guint64
desc_es_descriptor_copy_data (ESDescriptor * desc, guint8 ** buffer,
guint64 * size, guint64 * offset)
{
guint64 desc_size;
guint64 original_offset = *offset;
/* must call this twice to have size fields of all contained descriptors set
* correctly, and to have the size of the size fields taken into account */
desc_size = desc_es_descriptor_get_size (desc);
desc_size = desc_es_descriptor_get_size (desc);
if (!desc_base_descriptor_copy_data (&desc->base, buffer, size, offset)) {
return 0;
}
/* id and flags */
prop_copy_uint16 (desc->id, buffer, size, offset);
prop_copy_uint8 (desc->flags, buffer, size, offset);
if (desc_es_descriptor_check_stream_dependency (desc)) {
prop_copy_uint16 (desc->depends_on_es_id, buffer, size, offset);
}
if (desc_es_descriptor_check_url_flag (desc)) {
prop_copy_size_string (desc->url_string, desc->url_length, buffer, size,
offset);
}
if (desc_es_descriptor_check_ocr (desc)) {
prop_copy_uint16 (desc->ocr_es_id, buffer, size, offset);
}
if (!desc_dec_config_descriptor_copy_data (&desc->dec_conf_desc, buffer, size,
offset)) {
return 0;
}
if (!desc_sl_config_descriptor_copy_data (&desc->sl_conf_desc, buffer, size,
offset)) {
return 0;
}
return *offset - original_offset;
}

View file

@ -1,151 +0,0 @@
/* Quicktime muxer plugin for GStreamer
* Copyright (C) 2008 Thiago Sousa Santos <thiagoss@embedded.ufcg.edu.br>
*
* 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.
*/
/*
* Unless otherwise indicated, Source Code is licensed under MIT license.
* See further explanation attached in License Statement (distributed in the file
* LICENSE).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __DESCRIPTORS_H__
#define __DESCRIPTORS_H__
#include <glib.h>
#include <string.h>
#include "properties.h"
/*
* Tags for descriptor (each kind is represented by a number, instead of fourcc as in atoms)
*/
#define OBJECT_DESC_TAG 0x01
#define INIT_OBJECT_DESC_TAG 0x02
#define ES_DESCRIPTOR_TAG 0x03
#define DECODER_CONFIG_DESC_TAG 0x04
#define DECODER_SPECIFIC_INFO_TAG 0x05
#define SL_CONFIG_DESC_TAG 0x06
#define ES_ID_INC_TAG 0x0E
#define MP4_INIT_OBJECT_DESC_TAG 0x10
#define ESDS_OBJECT_TYPE_MPEG1_P3 0x6B
#define ESDS_OBJECT_TYPE_MPEG2_P7_MAIN 0x66
#define ESDS_OBJECT_TYPE_MPEG4_P7_LC 0x67
#define ESDS_OBJECT_TYPE_MPEG4_P7_SSR 0x68
#define ESDS_OBJECT_TYPE_MPEG4_P2 0x20
#define ESDS_OBJECT_TYPE_MPEG4_P3 0x40
#define ESDS_STREAM_TYPE_VISUAL 0x04
#define ESDS_STREAM_TYPE_AUDIO 0x05
typedef struct _BaseDescriptor
{
guint8 tag;
/* the first bit of each byte indicates if the next byte should be used */
guint8 size[4];
} BaseDescriptor;
typedef struct _SLConfigDescriptor
{
BaseDescriptor base;
guint8 predefined; /* everything is supposed predefined */
} SLConfigDescriptor;
typedef struct _DecoderSpecificInfoDescriptor
{
BaseDescriptor base;
guint32 length;
guint8 *data;
} DecoderSpecificInfoDescriptor;
typedef struct _DecoderConfigDescriptor {
BaseDescriptor base;
guint8 object_type;
/* following are condensed into streamType:
* bit(6) streamType;
* bit(1) upStream;
* const bit(1) reserved=1;
*/
guint8 stream_type;
guint8 buffer_size_DB[3];
guint32 max_bitrate;
guint32 avg_bitrate;
DecoderSpecificInfoDescriptor *dec_specific_info;
} DecoderConfigDescriptor;
typedef struct _ESDescriptor
{
BaseDescriptor base;
guint16 id;
/* flags contains the following:
* bit(1) streamDependenceFlag;
* bit(1) URL_Flag;
* bit(1) OCRstreamFlag;
* bit(5) streamPriority;
*/
guint8 flags;
guint16 depends_on_es_id;
guint8 url_length; /* only if URL_flag is set */
guint8 *url_string; /* size is url_length */
guint16 ocr_es_id; /* only if OCRstreamFlag is set */
DecoderConfigDescriptor dec_conf_desc;
SLConfigDescriptor sl_conf_desc;
/* optional remainder of ESDescriptor is not used */
} ESDescriptor;
/* --- FUNCTIONS --- */
void desc_es_init (ESDescriptor *es);
ESDescriptor *desc_es_descriptor_new (void);
guint64 desc_es_descriptor_copy_data (ESDescriptor *es, guint8 **buffer,
guint64 *size, guint64 *offset);
void desc_es_descriptor_clear (ESDescriptor *es);
DecoderSpecificInfoDescriptor *desc_dec_specific_info_new(void);
void desc_dec_specific_info_free (DecoderSpecificInfoDescriptor *dsid);
void desc_dec_specific_info_alloc_data (DecoderSpecificInfoDescriptor *dsid,
guint32 size);
#endif /* __DESCRIPTORS_H__ */

View file

@ -1,243 +0,0 @@
/* GStreamer
* 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
* 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.
*/
/*
* Unless otherwise indicated, Source Code is licensed under MIT license.
* See further explanation attached in License Statement (distributed in the file
* LICENSE).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __FOURCC_H__
#define __FOURCC_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define FOURCC_null 0x0
#define FOURCC_moov GST_MAKE_FOURCC('m','o','o','v')
#define FOURCC_mvhd GST_MAKE_FOURCC('m','v','h','d')
#define FOURCC_clip GST_MAKE_FOURCC('c','l','i','p')
#define FOURCC_trak GST_MAKE_FOURCC('t','r','a','k')
#define FOURCC_udta GST_MAKE_FOURCC('u','d','t','a')
#define FOURCC_ctab GST_MAKE_FOURCC('c','t','a','b')
#define FOURCC_tkhd GST_MAKE_FOURCC('t','k','h','d')
#define FOURCC_crgn GST_MAKE_FOURCC('c','r','g','n')
#define FOURCC_matt GST_MAKE_FOURCC('m','a','t','t')
#define FOURCC_kmat GST_MAKE_FOURCC('k','m','a','t')
#define FOURCC_edts GST_MAKE_FOURCC('e','d','t','s')
#define FOURCC_elst GST_MAKE_FOURCC('e','l','s','t')
#define FOURCC_load GST_MAKE_FOURCC('l','o','a','d')
#define FOURCC_tref GST_MAKE_FOURCC('t','r','e','f')
#define FOURCC_imap GST_MAKE_FOURCC('i','m','a','p')
#define FOURCC___in GST_MAKE_FOURCC(' ',' ','i','n')
#define FOURCC___ty GST_MAKE_FOURCC(' ',' ','t','y')
#define FOURCC_mdia GST_MAKE_FOURCC('m','d','i','a')
#define FOURCC_mdhd GST_MAKE_FOURCC('m','d','h','d')
#define FOURCC_hdlr GST_MAKE_FOURCC('h','d','l','r')
#define FOURCC_dhlr GST_MAKE_FOURCC('d','h','l','r')
#define FOURCC_mhlr GST_MAKE_FOURCC('m','h','l','r')
#define FOURCC_minf GST_MAKE_FOURCC('m','i','n','f')
#define FOURCC_mdir GST_MAKE_FOURCC('m','d','i','r')
#define FOURCC_vmhd GST_MAKE_FOURCC('v','m','h','d')
#define FOURCC_smhd GST_MAKE_FOURCC('s','m','h','d')
#define FOURCC_gmhd GST_MAKE_FOURCC('g','m','h','d')
#define FOURCC_hmhd GST_MAKE_FOURCC('h','m','h','d')
#define FOURCC_gmin GST_MAKE_FOURCC('g','m','i','n')
#define FOURCC_dinf GST_MAKE_FOURCC('d','i','n','f')
#define FOURCC_dref GST_MAKE_FOURCC('d','r','e','f')
#define FOURCC_stbl GST_MAKE_FOURCC('s','t','b','l')
#define FOURCC_stsd GST_MAKE_FOURCC('s','t','s','d')
#define FOURCC_stts GST_MAKE_FOURCC('s','t','t','s')
#define FOURCC_stss GST_MAKE_FOURCC('s','t','s','s')
#define FOURCC_stsc GST_MAKE_FOURCC('s','t','s','c')
#define FOURCC_stsz GST_MAKE_FOURCC('s','t','s','z')
#define FOURCC_stco GST_MAKE_FOURCC('s','t','c','o')
#define FOURCC_vide GST_MAKE_FOURCC('v','i','d','e')
#define FOURCC_soun GST_MAKE_FOURCC('s','o','u','n')
#define FOURCC_strm GST_MAKE_FOURCC('s','t','r','m')
#define FOURCC_rtsp GST_MAKE_FOURCC('r','t','s','p')
#define FOURCC_co64 GST_MAKE_FOURCC('c','o','6','4')
#define FOURCC_cmov GST_MAKE_FOURCC('c','m','o','v')
#define FOURCC_dcom GST_MAKE_FOURCC('d','c','o','m')
#define FOURCC_cmvd GST_MAKE_FOURCC('c','m','v','d')
#define FOURCC_hint GST_MAKE_FOURCC('h','i','n','t')
#define FOURCC_mp4a GST_MAKE_FOURCC('m','p','4','a')
#define FOURCC__mp3 GST_MAKE_FOURCC('.','m','p','3')
#define FOURCC_mp4s GST_MAKE_FOURCC('m','p','4','s')
#define FOURCC_mp4v GST_MAKE_FOURCC('m','p','4','v')
#define FOURCC_2vuy GST_MAKE_FOURCC('2','v','u','y')
#define FOURCC_wave GST_MAKE_FOURCC('w','a','v','e')
#define FOURCC_appl GST_MAKE_FOURCC('a','p','p','l')
#define FOURCC_esds GST_MAKE_FOURCC('e','s','d','s')
#define FOURCC_pasp GST_MAKE_FOURCC('p','a','s','p')
#define FOURCC_hnti GST_MAKE_FOURCC('h','n','t','i')
#define FOURCC_rtp_ GST_MAKE_FOURCC('r','t','p',' ')
#define FOURCC_sdp_ GST_MAKE_FOURCC('s','d','p',' ')
#define FOURCC_meta GST_MAKE_FOURCC('m','e','t','a')
#define FOURCC_ilst GST_MAKE_FOURCC('i','l','s','t')
#define FOURCC__nam GST_MAKE_FOURCC(0xa9,'n','a','m')
#define FOURCC__ART GST_MAKE_FOURCC(0xa9,'A','R','T')
#define FOURCC_aART GST_MAKE_FOURCC('a','A','R','T')
#define FOURCC__wrt GST_MAKE_FOURCC(0xa9,'w','r','t')
#define FOURCC__grp GST_MAKE_FOURCC(0xa9,'g','r','p')
#define FOURCC__alb GST_MAKE_FOURCC(0xa9,'a','l','b')
#define FOURCC__day GST_MAKE_FOURCC(0xa9,'d','a','y')
#define FOURCC__des GST_MAKE_FOURCC(0xa9,'d','e','s')
#define FOURCC__lyr GST_MAKE_FOURCC(0xa9,'l','y','r')
#define FOURCC_gnre GST_MAKE_FOURCC('g','n','r','e')
#define FOURCC_disc GST_MAKE_FOURCC('d','i','s','c')
#define FOURCC_disk GST_MAKE_FOURCC('d','i','s','k')
#define FOURCC_trkn GST_MAKE_FOURCC('t','r','k','n')
#define FOURCC_cprt GST_MAKE_FOURCC('c','p','r','t')
#define FOURCC_covr GST_MAKE_FOURCC('c','o','v','r')
#define FOURCC_cpil GST_MAKE_FOURCC('c','p','i','l')
#define FOURCC_tmpo GST_MAKE_FOURCC('t','m','p','o')
#define FOURCC__too GST_MAKE_FOURCC(0xa9,'t','o','o')
#define FOURCC_keyw GST_MAKE_FOURCC('k','e','y','w')
#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')
#define FOURCC_rmra GST_MAKE_FOURCC('r','m','r','a')
#define FOURCC_rmda GST_MAKE_FOURCC('r','m','d','a')
#define FOURCC_rdrf GST_MAKE_FOURCC('r','d','r','f')
#define FOURCC__gen GST_MAKE_FOURCC(0xa9, 'g', 'e', 'n')
#define FOURCC_rmdr GST_MAKE_FOURCC('r','m','d','r')
#define FOURCC_rmvc GST_MAKE_FOURCC('r','m','v','c')
#define FOURCC_qtim GST_MAKE_FOURCC('q','t','i','m')
#define FOURCC_drms GST_MAKE_FOURCC('d','r','m','s')
#define FOURCC_avc1 GST_MAKE_FOURCC('a','v','c','1')
#define FOURCC_h263 GST_MAKE_FOURCC('h','2','6','3')
#define FOURCC_s263 GST_MAKE_FOURCC('s','2','6','3')
#define FOURCC_avcC GST_MAKE_FOURCC('a','v','c','C')
#define FOURCC_VP31 GST_MAKE_FOURCC('V','P','3','1')
#define FOURCC_VP80 GST_MAKE_FOURCC('V','P','8','0')
#define FOURCC_rle_ GST_MAKE_FOURCC('r','l','e',' ')
#define FOURCC_MAC6 GST_MAKE_FOURCC('M','A','C','6')
#define FOURCC_MAC3 GST_MAKE_FOURCC('M','A','C','3')
#define FOURCC_ima4 GST_MAKE_FOURCC('i','m','a','4')
#define FOURCC_ulaw GST_MAKE_FOURCC('u','l','a','w')
#define FOURCC_alaw GST_MAKE_FOURCC('a','l','a','w')
#define FOURCC_twos GST_MAKE_FOURCC('t','w','o','s')
#define FOURCC_sowt GST_MAKE_FOURCC('s','o','w','t')
#define FOURCC_raw_ GST_MAKE_FOURCC('r','a','w',' ')
#define FOURCC_QDM2 GST_MAKE_FOURCC('Q','D','M','2')
#define FOURCC_alac GST_MAKE_FOURCC('a','l','a','c')
#define FOURCC_samr GST_MAKE_FOURCC('s','a','m','r')
#define FOURCC_sawb GST_MAKE_FOURCC('s','a','w','b')
#define FOURCC_mdat GST_MAKE_FOURCC('m','d','a','t')
#define FOURCC_wide GST_MAKE_FOURCC('w','i','d','e')
#define FOURCC_PICT GST_MAKE_FOURCC('P','I','C','T')
#define FOURCC_pnot GST_MAKE_FOURCC('p','n','o','t')
#define FOURCC_zlib GST_MAKE_FOURCC('z','l','i','b')
#define FOURCC_alis GST_MAKE_FOURCC('a','l','i','s')
#define FOURCC_url_ GST_MAKE_FOURCC('u','r','l',' ')
#define FOURCC_frma GST_MAKE_FOURCC('f','r','m','a')
#define FOURCC_ctts GST_MAKE_FOURCC('c','t','t','s')
#define FOURCC_drac GST_MAKE_FOURCC('d','r','a','c')
#define FOURCC_jpeg GST_MAKE_FOURCC('j','p','e','g')
#define FOURCC_mjp2 GST_MAKE_FOURCC('m','j','p','2')
#define FOURCC_jp2h GST_MAKE_FOURCC('j','p','2','h')
#define FOURCC_jp2c GST_MAKE_FOURCC('j','p','2','c')
#define FOURCC_gama GST_MAKE_FOURCC('g','a','m','a')
#define FOURCC_tvsh GST_MAKE_FOURCC('t','v','s','h')
#define FOURCC_tven GST_MAKE_FOURCC('t','v','e','n')
#define FOURCC_tvsn GST_MAKE_FOURCC('t','v','s','n')
#define FOURCC_tves GST_MAKE_FOURCC('t','v','e','s')
#define FOURCC_sonm GST_MAKE_FOURCC('s','o','n','m')
#define FOURCC_soal GST_MAKE_FOURCC('s','o','a','l')
#define FOURCC_soar GST_MAKE_FOURCC('s','o','a','r')
#define FOURCC_soaa GST_MAKE_FOURCC('s','o','a','a')
#define FOURCC_soco GST_MAKE_FOURCC('s','o','c','o')
#define FOURCC_sosn GST_MAKE_FOURCC('s','o','s','n')
#define FOURCC_XMP_ GST_MAKE_FOURCC('X','M','P','_')
#define FOURCC_uuid GST_MAKE_FOURCC('u','u','i','d')
/* SVQ3 fourcc */
#define FOURCC_SEQH GST_MAKE_FOURCC('S','E','Q','H')
#define FOURCC_SMI_ GST_MAKE_FOURCC('S','M','I',' ')
/* fragmented mp4 */
#define FOURCC_mvex GST_MAKE_FOURCC('m','v','e','x')
#define FOURCC_mehd GST_MAKE_FOURCC('m','e','h','d')
#define FOURCC_trex GST_MAKE_FOURCC('t','r','e','x')
#define FOURCC_mfra GST_MAKE_FOURCC('m','f','r','a')
#define FOURCC_moof GST_MAKE_FOURCC('m','o','o','f')
#define FOURCC_tfra GST_MAKE_FOURCC('t','f','r','a')
#define FOURCC_tfhd GST_MAKE_FOURCC('t','f','h','d')
#define FOURCC_trun GST_MAKE_FOURCC('t','r','u','n')
#define FOURCC_sdtp GST_MAKE_FOURCC('s','d','t','p')
#define FOURCC_mfro GST_MAKE_FOURCC('m','f','r','o')
#define FOURCC_mfhd GST_MAKE_FOURCC('m','f','h','d')
#define FOURCC_mvhd GST_MAKE_FOURCC('m','v','h','d')
#define FOURCC_traf GST_MAKE_FOURCC('t','r','a','f')
/* Xiph fourcc */
#define FOURCC_XiTh GST_MAKE_FOURCC('X','i','T','h')
#define FOURCC_XdxT GST_MAKE_FOURCC('X','d','x','T')
#define FOURCC_tCtH GST_MAKE_FOURCC('t','C','t','H')
#define FOURCC_tCt_ GST_MAKE_FOURCC('t','C','t','#')
#define FOURCC_tCtC GST_MAKE_FOURCC('t','C','t','C')
/* ilst metatags */
#define FOURCC_titl GST_MAKE_FOURCC('t','i','t','l')
#define FOURCC__cmt GST_MAKE_FOURCC(0xa9, 'c','m','t')
/* 3gp tags */
#define FOURCC_dscp GST_MAKE_FOURCC('d','s','c','p')
#define FOURCC_perf GST_MAKE_FOURCC('p','e','r','f')
#define FOURCC_auth GST_MAKE_FOURCC('a','u','t','h')
#define FOURCC_yrrc GST_MAKE_FOURCC('y','r','r','c')
#define FOURCC_albm GST_MAKE_FOURCC('a','l','b','m')
#define FOURCC_loci GST_MAKE_FOURCC('l','o','c','i')
#define FOURCC_kywd GST_MAKE_FOURCC('k','y','w','d')
#define FOURCC_clsf GST_MAKE_FOURCC('c','l','s','f')
/* For Microsoft Wave formats embedded in quicktime, the FOURCC is
'm', 's', then the 16 bit wave codec id */
#define MS_WAVE_FOURCC(codecid) GST_MAKE_FOURCC( \
'm', 's', ((codecid)>>8)&0xff, ((codecid)&0xff))
#define FOURCC_owma GST_MAKE_FOURCC('o','w','m','a')
#define FOURCC_ovc1 GST_MAKE_FOURCC('o','v','c','1')
G_END_DECLS
#endif /* __FOURCC_H__ */

View file

@ -1,68 +0,0 @@
/* GStreamer
* Copyright (C) <2008> Thiago Sousa Santos <thiagoss@embedded.ufcg.edu.br>
*
* 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.
*/
/*
* Unless otherwise indicated, Source Code is licensed under MIT license.
* See further explanation attached in License Statement (distributed in the file
* LICENSE).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __FTYP_CC_H__
#define __FTYP_CC_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define FOURCC_ftyp GST_MAKE_FOURCC('f','t','y','p')
#define FOURCC_isom GST_MAKE_FOURCC('i','s','o','m')
#define FOURCC_iso2 GST_MAKE_FOURCC('i','s','o','2')
#define FOURCC_mp41 GST_MAKE_FOURCC('m','p','4','1')
#define FOURCC_mp42 GST_MAKE_FOURCC('m','p','4','2')
#define FOURCC_mjp2 GST_MAKE_FOURCC('m','j','p','2')
#define FOURCC_3gp4 GST_MAKE_FOURCC('3','g','p','4')
#define FOURCC_3gp6 GST_MAKE_FOURCC('3','g','p','6')
#define FOURCC_3gg6 GST_MAKE_FOURCC('3','g','g','6')
#define FOURCC_3gr6 GST_MAKE_FOURCC('3','g','r','6')
#define FOURCC_3gg7 GST_MAKE_FOURCC('3','g','g','7')
#define FOURCC_avc1 GST_MAKE_FOURCC('a','v','c','1')
#define FOURCC_qt__ GST_MAKE_FOURCC('q','t',' ',' ')
#define FOURCC_isml GST_MAKE_FOURCC('i','s','m','l')
#define FOURCC_piff GST_MAKE_FOURCC('p','i','f','f')
G_END_DECLS
#endif /* __FTYP_CC_H__ */

View file

@ -1,390 +0,0 @@
/* Quicktime muxer plugin for GStreamer
* Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
*
* 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.
*/
/*
* Unless otherwise indicated, Source Code is licensed under MIT license.
* See further explanation attached in License Statement (distributed in the file
* LICENSE).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* SECTION:gstqtmoovrecover
* @short_description: Utility element for recovering unfinished quicktime files
*
* <refsect2>
* <para>
* This element recovers quicktime files created with qtmux using the moov recovery feature.
* </para>
* <title>Example pipelines</title>
* <para>
* <programlisting>
* TODO
* </programlisting>
* </refsect2>
*
* Last reviewed on 2010-02-01
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <glib/gstdio.h>
#include <gst/gst.h>
#include "gstqtmoovrecover.h"
GST_DEBUG_CATEGORY_STATIC (gst_qt_moov_recover_debug);
#define GST_CAT_DEFAULT gst_qt_moov_recover_debug
/* QTMoovRecover signals and args */
enum
{
/* FILL ME */
LAST_SIGNAL
};
enum
{
PROP_0,
PROP_RECOVERY_INPUT,
PROP_BROKEN_INPUT,
PROP_FIXED_OUTPUT,
PROP_FAST_START_MODE
};
GST_BOILERPLATE (GstQTMoovRecover, gst_qt_moov_recover, GstPipeline,
GST_TYPE_PIPELINE);
/* property functions */
static void gst_qt_moov_recover_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
static void gst_qt_moov_recover_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
static GstStateChangeReturn gst_qt_moov_recover_change_state (GstElement *
element, GstStateChange transition);
static void gst_qt_moov_recover_finalize (GObject * object);
static void
gst_qt_moov_recover_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
#if 0
GstQTMoovRecoverClass *klass = (GstQTMoovRecoverClass *) g_class;
#endif
gst_element_class_set_details_simple (element_class, "QT Moov Recover",
"Util", "Recovers unfinished qtmux files",
"Thiago Santos <thiago.sousa.santos@collabora.co.uk>");
}
static void
gst_qt_moov_recover_class_init (GstQTMoovRecoverClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
parent_class = g_type_class_peek_parent (klass);
gobject_class->finalize = gst_qt_moov_recover_finalize;
gobject_class->get_property = gst_qt_moov_recover_get_property;
gobject_class->set_property = gst_qt_moov_recover_set_property;
gstelement_class->change_state = gst_qt_moov_recover_change_state;
g_object_class_install_property (gobject_class, PROP_FIXED_OUTPUT,
g_param_spec_string ("fixed-output",
"Path to write the fixed file",
"Path to write the fixed file to (used as output)",
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_BROKEN_INPUT,
g_param_spec_string ("broken-input",
"Path to broken input file",
"Path to broken input file. (If qtmux was on faststart mode, this "
"file is the faststart file)", NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_RECOVERY_INPUT,
g_param_spec_string ("recovery-input",
"Path to recovery file",
"Path to recovery file (used as input)", NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_FAST_START_MODE,
g_param_spec_boolean ("faststart-mode",
"If the broken input is from faststart mode",
"If the broken input is from faststart mode",
FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
GST_DEBUG_CATEGORY_INIT (gst_qt_moov_recover_debug, "qtmoovrecover", 0,
"QT Moovie Recover");
}
static void
gst_qt_moov_recover_init (GstQTMoovRecover * qtmr,
GstQTMoovRecoverClass * qtmr_klass)
{
}
static void
gst_qt_moov_recover_finalize (GObject * object)
{
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gst_qt_moov_recover_run (void *data)
{
FILE *moovrec = NULL;
FILE *mdatinput = NULL;
FILE *output = NULL;
MdatRecovFile *mdat_recov = NULL;
MoovRecovFile *moov_recov = NULL;
GstQTMoovRecover *qtmr = GST_QT_MOOV_RECOVER_CAST (data);
GError *err = NULL;
GST_LOG_OBJECT (qtmr, "Starting task");
GST_DEBUG_OBJECT (qtmr, "Validating properties");
GST_OBJECT_LOCK (qtmr);
/* validate properties */
if (qtmr->broken_input == NULL) {
GST_OBJECT_UNLOCK (qtmr);
GST_ELEMENT_ERROR (qtmr, RESOURCE, SETTINGS,
("Please set broken-input property"), (NULL));
goto end;
}
if (qtmr->recovery_input == NULL) {
GST_OBJECT_UNLOCK (qtmr);
GST_ELEMENT_ERROR (qtmr, RESOURCE, SETTINGS,
("Please set recovery-input property"), (NULL));
goto end;
}
if (qtmr->fixed_output == NULL) {
GST_OBJECT_UNLOCK (qtmr);
GST_ELEMENT_ERROR (qtmr, RESOURCE, SETTINGS,
("Please set fixed-output property"), (NULL));
goto end;
}
GST_DEBUG_OBJECT (qtmr, "Opening input/output files");
/* open files */
moovrec = g_fopen (qtmr->recovery_input, "rb");
if (moovrec == NULL) {
GST_OBJECT_UNLOCK (qtmr);
GST_ELEMENT_ERROR (qtmr, RESOURCE, OPEN_READ,
("Failed to open recovery-input file"), (NULL));
goto end;
}
mdatinput = g_fopen (qtmr->broken_input, "rb");
if (mdatinput == NULL) {
GST_OBJECT_UNLOCK (qtmr);
GST_ELEMENT_ERROR (qtmr, RESOURCE, OPEN_READ,
("Failed to open broken-input file"), (NULL));
goto end;
}
output = g_fopen (qtmr->fixed_output, "wb+");
if (output == NULL) {
GST_OBJECT_UNLOCK (qtmr);
GST_ELEMENT_ERROR (qtmr, RESOURCE, OPEN_READ_WRITE,
("Failed to open fixed-output file"), (NULL));
goto end;
}
GST_OBJECT_UNLOCK (qtmr);
GST_DEBUG_OBJECT (qtmr, "Parsing input files");
/* now create our structures */
mdat_recov = mdat_recov_file_create (mdatinput, qtmr->faststart_mode, &err);
mdatinput = NULL;
if (mdat_recov == NULL) {
GST_ELEMENT_ERROR (qtmr, RESOURCE, FAILED,
("Broken file could not be parsed correctly"), (NULL));
goto end;
}
moov_recov = moov_recov_file_create (moovrec, &err);
moovrec = NULL;
if (moov_recov == NULL) {
GST_ELEMENT_ERROR (qtmr, RESOURCE, FAILED,
("Recovery file could not be parsed correctly"), (NULL));
goto end;
}
/* now parse the buffers data from moovrec */
if (!moov_recov_parse_buffers (moov_recov, mdat_recov, &err)) {
goto end;
}
GST_DEBUG_OBJECT (qtmr, "Writing fixed file to output");
if (!moov_recov_write_file (moov_recov, mdat_recov, output, &err)) {
goto end;
}
/* here means success */
GST_DEBUG_OBJECT (qtmr, "Finished successfully, posting EOS");
gst_element_post_message (GST_ELEMENT_CAST (qtmr),
gst_message_new_eos (GST_OBJECT_CAST (qtmr)));
end:
GST_LOG_OBJECT (qtmr, "Finalizing task");
if (err) {
GST_ELEMENT_ERROR (qtmr, RESOURCE, FAILED, ("%s", err->message), (NULL));
g_error_free (err);
}
if (moov_recov)
moov_recov_file_free (moov_recov);
if (moovrec)
fclose (moovrec);
if (mdat_recov)
mdat_recov_file_free (mdat_recov);
if (mdatinput)
fclose (mdatinput);
if (output)
fclose (output);
GST_LOG_OBJECT (qtmr, "Leaving task");
gst_task_stop (qtmr->task);
}
static void
gst_qt_moov_recover_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec)
{
GstQTMoovRecover *qtmr = GST_QT_MOOV_RECOVER_CAST (object);
GST_OBJECT_LOCK (qtmr);
switch (prop_id) {
case PROP_FAST_START_MODE:
g_value_set_boolean (value, qtmr->faststart_mode);
break;
case PROP_BROKEN_INPUT:
g_value_set_string (value, qtmr->broken_input);
break;
case PROP_RECOVERY_INPUT:
g_value_set_string (value, qtmr->recovery_input);
break;
case PROP_FIXED_OUTPUT:
g_value_set_string (value, qtmr->fixed_output);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_OBJECT_UNLOCK (qtmr);
}
static void
gst_qt_moov_recover_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec)
{
GstQTMoovRecover *qtmr = GST_QT_MOOV_RECOVER_CAST (object);
GST_OBJECT_LOCK (qtmr);
switch (prop_id) {
case PROP_FAST_START_MODE:
qtmr->faststart_mode = g_value_get_boolean (value);
break;
case PROP_BROKEN_INPUT:
g_free (qtmr->broken_input);
qtmr->broken_input = g_value_dup_string (value);
break;
case PROP_RECOVERY_INPUT:
g_free (qtmr->recovery_input);
qtmr->recovery_input = g_value_dup_string (value);
break;
case PROP_FIXED_OUTPUT:
g_free (qtmr->fixed_output);
qtmr->fixed_output = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_OBJECT_UNLOCK (qtmr);
}
static GstStateChangeReturn
gst_qt_moov_recover_change_state (GstElement * element,
GstStateChange transition)
{
GstStateChangeReturn ret;
GstQTMoovRecover *qtmr = GST_QT_MOOV_RECOVER_CAST (element);
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
qtmr->task = gst_task_create (gst_qt_moov_recover_run, qtmr);
qtmr->task_mutex = g_new (GStaticRecMutex, 1);
g_static_rec_mutex_init (qtmr->task_mutex);
gst_task_set_lock (qtmr->task, qtmr->task_mutex);
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
gst_task_start (qtmr->task);
break;
default:
break;
}
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (transition) {
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
gst_task_stop (qtmr->task);
gst_task_join (qtmr->task);
break;
case GST_STATE_CHANGE_READY_TO_NULL:
g_assert (gst_task_get_state (qtmr->task) == GST_TASK_STOPPED);
gst_object_unref (qtmr->task);
qtmr->task = NULL;
g_static_rec_mutex_free (qtmr->task_mutex);
break;
default:
break;
}
return ret;
}
gboolean
gst_qt_moov_recover_register (GstPlugin * plugin)
{
return gst_element_register (plugin, "qtmoovrecover", GST_RANK_NONE,
GST_TYPE_QT_MOOV_RECOVER);
}

View file

@ -1,88 +0,0 @@
/* Quicktime muxer plugin for GStreamer
* Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
*
* 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.
*/
/*
* Unless otherwise indicated, Source Code is licensed under MIT license.
* See further explanation attached in License Statement (distributed in the file
* LICENSE).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __GST_QT_MOOV_RECOVER_H__
#define __GST_QT_MOOV_RECOVER_H__
#include <gst/gst.h>
#include "atoms.h"
#include "atomsrecovery.h"
G_BEGIN_DECLS
#define GST_TYPE_QT_MOOV_RECOVER (gst_qt_moov_recover_get_type())
#define GST_QT_MOOV_RECOVER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_QT_MOOV_RECOVER, GstQTMoovRecover))
#define GST_QT_MOOV_RECOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_QT_MOOV_RECOVER, GstQTMoovRecover))
#define GST_IS_QT_MOOV_RECOVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_QT_MOOV_RECOVER))
#define GST_IS_QT_MOOV_RECOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_QT_MOOV_RECOVER))
#define GST_QT_MOOV_RECOVER_CAST(obj) ((GstQTMoovRecover*)(obj))
typedef struct _GstQTMoovRecover GstQTMoovRecover;
typedef struct _GstQTMoovRecoverClass GstQTMoovRecoverClass;
struct _GstQTMoovRecover
{
GstPipeline pipeline;
GstTask *task;
GStaticRecMutex *task_mutex;
/* properties */
gboolean faststart_mode;
gchar *recovery_input;
gchar *fixed_output;
gchar *broken_input;
};
struct _GstQTMoovRecoverClass
{
GstPipelineClass parent_class;
};
GType gst_qt_moov_recover_get_type (void);
gboolean gst_qt_moov_recover_register (GstPlugin * plugin);
G_END_DECLS
#endif /* __GST_QT_MOOV_RECOVER_H__ */

File diff suppressed because it is too large Load diff

View file

@ -1,228 +0,0 @@
/* Quicktime muxer plugin for GStreamer
* Copyright (C) 2008-2010 Thiago Santos <thiagoss@embedded.ufcg.edu.br>
*
* 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.
*/
/*
* Unless otherwise indicated, Source Code is licensed under MIT license.
* See further explanation attached in License Statement (distributed in the file
* LICENSE).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __GST_QT_MUX_H__
#define __GST_QT_MUX_H__
#include <gst/gst.h>
#include <gst/base/gstcollectpads.h>
#include "fourcc.h"
#include "atoms.h"
#include "atomsrecovery.h"
#include "gstqtmuxmap.h"
G_BEGIN_DECLS
#define GST_TYPE_QT_MUX (gst_qt_mux_get_type())
#define GST_QT_MUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_QT_MUX, GstQTMux))
#define GST_QT_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_QT_MUX, GstQTMux))
#define GST_IS_QT_MUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_QT_MUX))
#define GST_IS_QT_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_QT_MUX))
#define GST_QT_MUX_CAST(obj) ((GstQTMux*)(obj))
typedef struct _GstQTMux GstQTMux;
typedef struct _GstQTMuxClass GstQTMuxClass;
typedef struct _GstQTPad GstQTPad;
/*
* GstQTPadPrepareBufferFunc
*
* Receives a buffer (takes ref) and returns a new buffer that should
* replace the passed one.
*
* Useful for when the pad/datatype needs some manipulation before
* being muxed. (Originally added for image/x-jpc support, for which buffers
* need to be wrapped into a isom box)
*/
typedef GstBuffer * (*GstQTPadPrepareBufferFunc) (GstQTPad * pad,
GstBuffer * buf, GstQTMux * qtmux);
#define QTMUX_NO_OF_TS 10
struct _GstQTPad
{
GstCollectData collect; /* we extend the CollectData */
/* fourcc id of stream */
guint32 fourcc;
/* whether using format that have out of order buffers */
gboolean is_out_of_order;
/* whether upstream provides valid PTS data */
gboolean have_dts;
/* if not 0, track with constant sized samples, e.g. raw audio */
guint sample_size;
/* make sync table entry */
gboolean sync;
/* bitrates */
guint32 avg_bitrate, max_bitrate;
GstBuffer *last_buf;
/* dts of last_buf */
GstClockTime last_dts;
/* store the first timestamp for comparing with other streams and
* know if there are late streams */
GstClockTime first_ts;
GstClockTime ts_entries[QTMUX_NO_OF_TS + 2];
guint ts_n_entries;
GstBuffer *buf_entries[QTMUX_NO_OF_TS + 2];
guint buf_head;
guint buf_tail;
/* all the atom and chunk book-keeping is delegated here
* unowned/uncounted reference, parent MOOV owns */
AtomTRAK *trak;
/* fragmented support */
/* meta data book-keeping delegated here */
AtomTRAF *traf;
/* fragment buffers */
ATOM_ARRAY (GstBuffer *) fragment_buffers;
/* running fragment duration */
gint64 fragment_duration;
/* optional fragment index book-keeping */
AtomTFRA *tfra;
/* if nothing is set, it won't be called */
GstQTPadPrepareBufferFunc prepare_buf_func;
};
typedef enum _GstQTMuxState
{
GST_QT_MUX_STATE_NONE,
GST_QT_MUX_STATE_STARTED,
GST_QT_MUX_STATE_DATA,
GST_QT_MUX_STATE_EOS
} GstQTMuxState;
struct _GstQTMux
{
GstElement element;
GstPad *srcpad;
GstCollectPads *collect;
GSList *sinkpads;
/* state */
GstQTMuxState state;
/* size of header (prefix, atoms (ftyp, mdat)) */
guint64 header_size;
/* accumulated size of raw media data (a priori not including mdat header) */
guint64 mdat_size;
/* position of mdat atom (for later updating) */
guint64 mdat_pos;
/* keep track of the largest chunk to fine-tune brands */
GstClockTime longest_chunk;
/* atom helper objects */
AtomsContext *context;
AtomFTYP *ftyp;
AtomMOOV *moov;
GSList *extra_atoms; /* list of extra top-level atoms (e.g. UUID for xmp)
* Stored as AtomInfo structs */
/* fragmented file index */
AtomMFRA *mfra;
/* fast start */
FILE *fast_start_file;
/* moov recovery */
FILE *moov_recov_file;
/* fragment sequence */
guint32 fragment_sequence;
/* properties */
guint32 timescale;
guint32 trak_timescale;
AtomsTreeFlavor flavor;
gboolean fast_start;
gboolean guess_pts;
gint dts_method;
gchar *fast_start_file_path;
gchar *moov_recov_file_path;
guint32 fragment_duration;
gboolean streamable;
/* for collect pads event handling function */
GstPadEventFunction collect_event;
/* for request pad naming */
guint video_pads, audio_pads;
};
struct _GstQTMuxClass
{
GstElementClass parent_class;
GstQTMuxFormat format;
};
/* type register helper struct */
typedef struct _GstQTMuxClassParams
{
GstQTMuxFormatProp *prop;
GstCaps *src_caps;
GstCaps *video_sink_caps;
GstCaps *audio_sink_caps;
} GstQTMuxClassParams;
#define GST_QT_MUX_PARAMS_QDATA g_quark_from_static_string("qt-mux-params")
GType gst_qt_mux_get_type (void);
gboolean gst_qt_mux_register (GstPlugin * plugin);
/* FIXME: ideally classification tag should be added and
* registered in gstreamer core gsttaglist
*
* this tag is a string in the format: entityfourcc://table_num/content
* FIXME Shouldn't we add a field for 'language'?
*/
#define GST_TAG_3GP_CLASSIFICATION "classification"
G_END_DECLS
#endif /* __GST_QT_MUX_H__ */

View file

@ -1,368 +0,0 @@
/* Quicktime muxer plugin for GStreamer
* Copyright (C) 2008 Thiago Sousa Santos <thiagoss@embedded.ufcg.edu.br>
* Copyright (C) 2008 Mark Nauwelaerts <mnauw@users.sf.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.
*/
/*
* Unless otherwise indicated, Source Code is licensed under MIT license.
* See further explanation attached in License Statement (distributed in the file
* LICENSE).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "gstqtmuxmap.h"
#include "fourcc.h"
#include "ftypcc.h"
/* static info related to various format */
#define COMMON_VIDEO_CAPS \
"width = (int) [ 16, 4096 ], " \
"height = (int) [ 16, 4096 ], " \
"framerate = (fraction) [ 0, MAX ]"
#define COMMON_VIDEO_CAPS_NO_FRAMERATE \
"width = (int) [ 16, 4096 ], " \
"height = (int) [ 16, 4096 ] "
#define H263_CAPS \
"video/x-h263, " \
COMMON_VIDEO_CAPS
#define H264_CAPS \
"video/x-h264, " \
"stream-format = (string) avc, " \
COMMON_VIDEO_CAPS
#define MPEG4V_CAPS \
"video/mpeg, " \
"mpegversion = (int) 4, "\
"systemstream = (boolean) false, " \
COMMON_VIDEO_CAPS "; " \
"video/x-divx, " \
"divxversion = (int) 5, "\
COMMON_VIDEO_CAPS
#define SVQ_CAPS \
"video/x-svq, " \
"svqversion = (int) 3, " \
COMMON_VIDEO_CAPS
#define COMMON_AUDIO_CAPS(c, r) \
"channels = (int) [ 1, " G_STRINGIFY (c) " ], " \
"rate = (int) [ 1, " G_STRINGIFY (r) " ]"
#define PCM_CAPS \
"audio/x-raw-int, " \
"width = (int) 8, " \
"depth = (int) 8, " \
COMMON_AUDIO_CAPS (2, MAX) ", " \
"signed = (boolean) { true, false }; " \
"audio/x-raw-int, " \
"width = (int) 16, " \
"depth = (int) 16, " \
"endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }, " \
COMMON_AUDIO_CAPS (2, MAX) ", " \
"signed = (boolean) true " \
#define PCM_CAPS_FULL \
PCM_CAPS "; " \
"audio/x-raw-int, " \
"width = (int) 24, " \
"depth = (int) 24, " \
"endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }, " \
COMMON_AUDIO_CAPS (2, MAX) ", " \
"signed = (boolean) true; " \
"audio/x-raw-int, " \
"width = (int) 32, " \
"depth = (int) 32, " \
"endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }, " \
COMMON_AUDIO_CAPS (2, MAX) ", " \
"signed = (boolean) true "
#define MP3_CAPS \
"audio/mpeg, " \
"mpegversion = (int) 1, " \
"layer = (int) 3, " \
COMMON_AUDIO_CAPS (2, MAX)
#define AAC_CAPS \
"audio/mpeg, " \
"mpegversion = (int) 4, " \
"stream-format = (string) raw, " \
COMMON_AUDIO_CAPS (8, MAX)
#define AMR_CAPS \
"audio/AMR, " \
"rate = (int) 8000, " \
"channels = [ 1, 2 ]; " \
"audio/AMR-WB, " \
"rate = (int) 16000, " \
"channels = [ 1, 2 ] "
#define ADPCM_CAPS \
"audio/x-adpcm, " \
"layout = (string)dvi, " \
"block_align = (int)[64, 8096], " \
COMMON_AUDIO_CAPS(2, MAX)
#define ALAC_CAPS \
"audio/x-alac, " \
COMMON_AUDIO_CAPS(2, MAX)
/* FIXME 0.11 - take a look at bugs #580005 and #340375 */
GstQTMuxFormatProp gst_qt_mux_format_list[] = {
/* original QuickTime format; see Apple site (e.g. qtff.pdf) */
{
GST_QT_MUX_FORMAT_QT,
"qtmux",
"QuickTime",
"GstQTMux",
GST_STATIC_CAPS ("video/quicktime, variant = (string) apple"),
GST_STATIC_CAPS ("video/x-raw-rgb, "
COMMON_VIDEO_CAPS "; "
"video/x-raw-yuv, "
"format = (fourcc) UYVY, "
COMMON_VIDEO_CAPS "; "
MPEG4V_CAPS "; "
H263_CAPS "; "
H264_CAPS "; "
SVQ_CAPS "; "
"video/x-dv, "
"systemstream = (boolean) false, "
COMMON_VIDEO_CAPS "; "
"image/jpeg, "
COMMON_VIDEO_CAPS_NO_FRAMERATE "; "
"video/x-vp8, "
COMMON_VIDEO_CAPS "; " "video/x-qt-part, " COMMON_VIDEO_CAPS),
GST_STATIC_CAPS (PCM_CAPS_FULL "; "
MP3_CAPS " ; "
AAC_CAPS " ; "
ADPCM_CAPS " ; "
"audio/x-alaw, " COMMON_AUDIO_CAPS (2, MAX) "; "
AMR_CAPS " ; " ALAC_CAPS)
}
,
/* ISO 14496-14: mp42 as ISO base media extension
* (supersedes original ISO 144996-1 mp41) */
{
GST_QT_MUX_FORMAT_MP4,
"mp4mux",
"MP4",
"GstMP4Mux",
GST_STATIC_CAPS ("video/quicktime, variant = (string) iso"),
GST_STATIC_CAPS (MPEG4V_CAPS "; " H264_CAPS ";"
"video/x-mp4-part," COMMON_VIDEO_CAPS),
GST_STATIC_CAPS (MP3_CAPS "; " AAC_CAPS " ; " ALAC_CAPS)
}
,
/* Microsoft Smooth Streaming fmp4/isml */
/* TODO add WMV/WMA support */
{
GST_QT_MUX_FORMAT_ISML,
"ismlmux",
"ISML",
"GstISMLMux",
GST_STATIC_CAPS ("video/quicktime, variant = (string) iso"),
GST_STATIC_CAPS (MPEG4V_CAPS "; " H264_CAPS),
GST_STATIC_CAPS (MP3_CAPS "; " AAC_CAPS)
}
,
/* 3GPP Technical Specification 26.244 V7.3.0
* (extended in 3GPP2 File Formats for Multimedia Services) */
{
GST_QT_MUX_FORMAT_3GP,
"gppmux",
"3GPP",
"GstGPPMux",
GST_STATIC_CAPS ("video/quicktime, variant = (string) 3gpp"),
GST_STATIC_CAPS (H263_CAPS "; " MPEG4V_CAPS "; " H264_CAPS),
GST_STATIC_CAPS (AMR_CAPS "; " MP3_CAPS "; " AAC_CAPS)
}
,
/* ISO 15444-3: Motion-JPEG-2000 (also ISO base media extension) */
{
GST_QT_MUX_FORMAT_MJ2,
"mj2mux",
"MJ2",
"GstMJ2Mux",
GST_STATIC_CAPS ("video/mj2"),
GST_STATIC_CAPS ("image/x-j2c, " COMMON_VIDEO_CAPS "; "
"image/x-jpc, " COMMON_VIDEO_CAPS),
GST_STATIC_CAPS (PCM_CAPS)
}
,
{
GST_QT_MUX_FORMAT_NONE,
}
,
};
/* pretty static, but may turn out needed a few times */
AtomsTreeFlavor
gst_qt_mux_map_format_to_flavor (GstQTMuxFormat format)
{
if (format == GST_QT_MUX_FORMAT_QT)
return ATOMS_TREE_FLAVOR_MOV;
else if (format == GST_QT_MUX_FORMAT_3GP)
return ATOMS_TREE_FLAVOR_3GP;
else if (format == GST_QT_MUX_FORMAT_ISML)
return ATOMS_TREE_FLAVOR_ISML;
else
return ATOMS_TREE_FLAVOR_ISOM;
}
static void
gst_qt_mux_map_check_tracks (AtomMOOV * moov, gint * _video, gint * _audio,
gboolean * _has_h264)
{
GList *it;
gint video = 0, audio = 0;
gboolean has_h264 = FALSE;
for (it = moov->traks; it != NULL; it = g_list_next (it)) {
AtomTRAK *track = it->data;
if (track->is_video) {
video++;
if (track->is_h264)
has_h264 = TRUE;
} else
audio++;
}
if (_video)
*_video = video;
if (_audio)
*_audio = audio;
if (_has_h264)
*_has_h264 = has_h264;
}
/* pretty static, but possibly dynamic format info */
/* notes:
* - avc1 brand is not used, since the specific extensions indicated by it
* are not used (e.g. sample groupings, etc)
* - TODO: maybe even more 3GPP brand fine-tuning ??
* (but that might need ftyp rewriting at the end) */
void
gst_qt_mux_map_format_to_header (GstQTMuxFormat format, GstBuffer ** _prefix,
guint32 * _major, guint32 * _version, GList ** _compatible, AtomMOOV * moov,
GstClockTime longest_chunk, gboolean faststart)
{
static guint32 qt_brands[] = { 0 };
static guint32 mp4_brands[] = { FOURCC_mp41, FOURCC_isom, FOURCC_iso2, 0 };
static guint32 isml_brands[] = { FOURCC_iso2, 0 };
static guint32 gpp_brands[] = { FOURCC_isom, FOURCC_iso2, 0 };
static guint32 mjp2_brands[] = { FOURCC_isom, FOURCC_iso2, 0 };
static guint8 mjp2_prefix[] =
{ 0, 0, 0, 12, 'j', 'P', ' ', ' ', 0x0D, 0x0A, 0x87, 0x0A };
guint32 *comp = NULL;
guint32 major = 0, version = 0;
GstBuffer *prefix = NULL;
GList *result = NULL;
g_return_if_fail (_prefix != NULL);
g_return_if_fail (_major != NULL);
g_return_if_fail (_version != NULL);
g_return_if_fail (_compatible != NULL);
switch (format) {
case GST_QT_MUX_FORMAT_QT:
major = FOURCC_qt__;
comp = qt_brands;
version = 0x20050300;
break;
case GST_QT_MUX_FORMAT_MP4:
major = FOURCC_mp42;
comp = mp4_brands;
break;
case GST_QT_MUX_FORMAT_ISML:
major = FOURCC_isml;
comp = isml_brands;
break;
case GST_QT_MUX_FORMAT_3GP:
{
gint video, audio;
gboolean has_h264;
gst_qt_mux_map_check_tracks (moov, &video, &audio, &has_h264);
/* only track restriction really matters for Basic Profile */
if (video <= 1 && audio <= 1) {
/* it seems only newer spec knows about H264 */
major = has_h264 ? FOURCC_3gp6 : FOURCC_3gp4;
version = has_h264 ? 0x100 : 0x200;
} else {
major = FOURCC_3gg6;
version = 0x100;
}
comp = gpp_brands;
/*
* We assume that we have chunks in dts order
*/
if (faststart && longest_chunk <= GST_SECOND) {
/* add progressive download profile */
result = g_list_append (result, GUINT_TO_POINTER (FOURCC_3gr6));
}
break;
}
case GST_QT_MUX_FORMAT_MJ2:
major = FOURCC_mjp2;
comp = mjp2_brands;
version = 0;
prefix = gst_buffer_new_and_alloc (sizeof (mjp2_prefix));
memcpy (GST_BUFFER_DATA (prefix), mjp2_prefix, GST_BUFFER_SIZE (prefix));
break;
default:
g_assert_not_reached ();
break;
}
/* convert list to list, hm */
while (comp && *comp != 0) {
/* order matters over efficiency */
result = g_list_append (result, GUINT_TO_POINTER (*comp));
comp++;
}
*_major = major;
*_version = version;
*_prefix = prefix;
*_compatible = result;
/* TODO 3GPP may include mp42 as compatible if applicable */
/* TODO 3GPP major brand 3gp7 if at most 1 video and audio track */
}

View file

@ -1,83 +0,0 @@
/* Quicktime muxer plugin for GStreamer
* Copyright (C) 2008 Thiago Sousa Santos <thiagoss@embedded.ufcg.edu.br>
* Copyright (C) 2008 Mark Nauwelaerts <mnauw@users.sf.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.
*/
/*
* Unless otherwise indicated, Source Code is licensed under MIT license.
* See further explanation attached in License Statement (distributed in the file
* LICENSE).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __GST_QT_MUX_MAP_H__
#define __GST_QT_MUX_MAP_H__
#include "atoms.h"
#include <glib.h>
#include <gst/gst.h>
typedef enum _GstQTMuxFormat
{
GST_QT_MUX_FORMAT_NONE = 0,
GST_QT_MUX_FORMAT_QT,
GST_QT_MUX_FORMAT_MP4,
GST_QT_MUX_FORMAT_3GP,
GST_QT_MUX_FORMAT_MJ2,
GST_QT_MUX_FORMAT_ISML
} GstQTMuxFormat;
typedef struct _GstQTMuxFormatProp
{
GstQTMuxFormat format;
const gchar *name;
const gchar *long_name;
const gchar *type_name;
GstStaticCaps src_caps;
GstStaticCaps video_sink_caps;
GstStaticCaps audio_sink_caps;
} GstQTMuxFormatProp;
extern GstQTMuxFormatProp gst_qt_mux_format_list[];
void gst_qt_mux_map_format_to_header (GstQTMuxFormat format, GstBuffer ** _prefix,
guint32 * _major, guint32 * verson,
GList ** _compatible, AtomMOOV * moov,
GstClockTime longest_chunk,
gboolean faststart);
AtomsTreeFlavor gst_qt_mux_map_format_to_flavor (GstQTMuxFormat format);
#endif /* __GST_QT_MUX_MAP_H__ */

View file

@ -1,67 +0,0 @@
/* Quicktime muxer plugin for GStreamer
* Copyright (C) 2008-2010 Thiago Santos <thiagoss@embedded.ufcg.edu.br>
* Copyright (C) 2008 Mark Nauwelaerts <mnauw@users.sf.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.
*/
/*
* Unless otherwise indicated, Source Code is licensed under MIT license.
* See further explanation attached in License Statement (distributed in the file
* LICENSE).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gstqtmux.h"
#include "gstqtmoovrecover.h"
static gboolean
gst_qt_mux_plugin_init (GstPlugin * plugin)
{
if (!gst_qt_mux_register (plugin))
return FALSE;
if (!gst_qt_moov_recover_register (plugin))
return FALSE;
return TRUE;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"qtmux",
"Quicktime Muxer plugin",
gst_qt_mux_plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME,
GST_PACKAGE_ORIGIN);

View file

@ -1,210 +0,0 @@
/* Quicktime muxer plugin for GStreamer
* Copyright (C) 2008 Thiago Sousa Santos <thiagoss@embedded.ufcg.edu.br>
*
* 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.
*/
/*
* Unless otherwise indicated, Source Code is licensed under MIT license.
* See further explanation attached in License Statement (distributed in the file
* LICENSE).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "properties.h"
/* if needed, re-allocate buffer to ensure size bytes can be written into it
* at offset */
void
prop_copy_ensure_buffer (guint8 ** buffer, guint64 * bsize, guint64 * offset,
guint64 size)
{
if (buffer && *bsize - *offset < size) {
*bsize += size + 10 * 1024;
*buffer = g_realloc (*buffer, *bsize);
}
}
static guint64
copy_func (void *prop, guint size, guint8 ** buffer, guint64 * bsize,
guint64 * offset)
{
if (buffer) {
prop_copy_ensure_buffer (buffer, bsize, offset, size);
memcpy (*buffer + *offset, prop, size);
}
*offset += size;
return size;
}
#define INT_ARRAY_COPY_FUNC_FAST(name, datatype) \
guint64 prop_copy_ ## name ## _array (datatype *prop, guint size, \
guint8 ** buffer, guint64 * bsize, guint64 * offset) { \
return copy_func (prop, sizeof (datatype) * size, buffer, bsize, offset);\
}
#define INT_ARRAY_COPY_FUNC(name, datatype) \
guint64 prop_copy_ ## name ## _array (datatype *prop, guint size, \
guint8 ** buffer, guint64 * bsize, guint64 * offset) { \
guint i; \
\
for (i = 0; i < size; i++) { \
prop_copy_ ## name (prop[i], buffer, bsize, offset); \
} \
return sizeof (datatype) * size; \
}
/* INTEGERS */
guint64
prop_copy_uint8 (guint8 prop, guint8 ** buffer, guint64 * size,
guint64 * offset)
{
return copy_func (&prop, sizeof (guint8), buffer, size, offset);
}
guint64
prop_copy_uint16 (guint16 prop, guint8 ** buffer, guint64 * size,
guint64 * offset)
{
prop = GUINT16_TO_BE (prop);
return copy_func (&prop, sizeof (guint16), buffer, size, offset);
}
guint64
prop_copy_uint32 (guint32 prop, guint8 ** buffer, guint64 * size,
guint64 * offset)
{
prop = GUINT32_TO_BE (prop);
return copy_func (&prop, sizeof (guint32), buffer, size, offset);
}
guint64
prop_copy_uint64 (guint64 prop, guint8 ** buffer, guint64 * size,
guint64 * offset)
{
prop = GUINT64_TO_BE (prop);
return copy_func (&prop, sizeof (guint64), buffer, size, offset);
}
guint64
prop_copy_int32 (gint32 prop, guint8 ** buffer, guint64 * size,
guint64 * offset)
{
prop = GINT32_TO_BE (prop);
return copy_func (&prop, sizeof (guint32), buffer, size, offset);
}
/* uint8 can use direct copy in any case, and may be used for large quantity */
INT_ARRAY_COPY_FUNC_FAST (uint8, guint8);
/* not used in large quantity anyway */
INT_ARRAY_COPY_FUNC (uint16, guint16);
INT_ARRAY_COPY_FUNC (uint32, guint32);
INT_ARRAY_COPY_FUNC (uint64, guint64);
/* FOURCC */
guint64
prop_copy_fourcc (guint32 prop, guint8 ** buffer, guint64 * size,
guint64 * offset)
{
prop = GINT32_TO_LE (prop);
return copy_func (&prop, sizeof (guint32), buffer, size, offset);
}
INT_ARRAY_COPY_FUNC (fourcc, guint32);
/**
* prop_copy_fixed_size_string:
* @string: the string to be copied
* @str_size: size of the string
* @buffer: the array to copy the string to
* @offset: the position in the buffer array.
* This value is updated to the point right after the copied string.
*
* Copies a string of bytes without placing its size at the beginning.
*
* Returns: the number of bytes copied
*/
guint64
prop_copy_fixed_size_string (guint8 * string, guint str_size, guint8 ** buffer,
guint64 * size, guint64 * offset)
{
return copy_func (string, str_size * sizeof (guint8), buffer, size, offset);
}
/**
* prop_copy_size_string:
*
* @string: the string to be copied
* @str_size: size of the string
* @buffer: the array to copy the string to
* @offset: the position in the buffer array.
* This value is updated to the point right after the copied string.
*
* Copies a string and its size to an array. Example:
* string = 'abc\0'
* result in the array: [3][a][b][c] (each [x] represents a position)
*
* Returns: the number of bytes copied
*/
guint64
prop_copy_size_string (guint8 * string, guint str_size, guint8 ** buffer,
guint64 * size, guint64 * offset)
{
guint64 original_offset = *offset;
prop_copy_uint8 (str_size, buffer, size, offset);
prop_copy_fixed_size_string (string, str_size, buffer, size, offset);
return *offset - original_offset;
}
/**
* prop_copy_null_terminated_string:
* @string: the string to be copied
* @buffer: the array to copy the string to
* @offset: the position in the buffer array.
* This value is updated to the point right after the copied string.
*
* Copies a string including its null terminating char to an array.
*
* Returns: the number of bytes copied
*/
guint64
prop_copy_null_terminated_string (gchar * string, guint8 ** buffer,
guint64 * size, guint64 * offset)
{
guint64 original_offset = *offset;
guint len = strlen (string);
prop_copy_fixed_size_string ((guint8 *) string, len, buffer, size, offset);
prop_copy_uint8 ('\0', buffer, size, offset);
return *offset - original_offset;
}

View file

@ -1,87 +0,0 @@
/* Quicktime muxer plugin for GStreamer
* Copyright (C) 2008 Thiago Sousa Santos <thiagoss@embedded.ufcg.edu.br>
*
* 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.
*/
/*
* Unless otherwise indicated, Source Code is licensed under MIT license.
* See further explanation attached in License Statement (distributed in the file
* LICENSE).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __PROPERTIES_H__
#define __PROPERTIES_H__
#include <glib.h>
#include <string.h>
/**
* Functions for copying atoms properties.
*
* All of them receive, as the input, the property to be copied, the destination
* buffer, and a pointer to an offset in the destination buffer to copy to the right place.
* This offset will be updated to the new value (offset + copied_size)
* The functions return the size of the property that has been copied or 0
* if it couldn't copy.
*/
void prop_copy_ensure_buffer (guint8 ** buffer, guint64 * bsize, guint64 * offset, guint64 size);
guint64 prop_copy_uint8 (guint8 prop, guint8 **buffer, guint64 *size, guint64 *offset);
guint64 prop_copy_uint16 (guint16 prop, guint8 **buffer, guint64 *size, guint64 *offset);
guint64 prop_copy_uint32 (guint32 prop, guint8 **buffer, guint64 *size, guint64 *offset);
guint64 prop_copy_uint64 (guint64 prop, guint8 **buffer, guint64 *size, guint64 *offset);
guint64 prop_copy_int32 (gint32 prop, guint8 **buffer, guint64 *size, guint64 *offset);
guint64 prop_copy_uint8_array (guint8 *prop, guint size,
guint8 **buffer, guint64 *bsize, guint64 *offset);
guint64 prop_copy_uint16_array (guint16 *prop, guint size,
guint8 **buffer, guint64 *bsize, guint64 *offset);
guint64 prop_copy_uint32_array (guint32 *prop, guint size,
guint8 **buffer, guint64 *bsize, guint64 *offset);
guint64 prop_copy_uint64_array (guint64 *prop, guint size,
guint8 **buffer, guint64 *bsize, guint64 *offset);
guint64 prop_copy_fourcc (guint32 prop, guint8 **buffer, guint64 *size, guint64 *offset);
guint64 prop_copy_fourcc_array (guint32 *prop, guint size,
guint8 **buffer, guint64 *bsize, guint64 *offset);
guint64 prop_copy_fixed_size_string (guint8 *string, guint str_size,
guint8 **buffer, guint64 *size, guint64 *offset);
guint64 prop_copy_size_string (guint8 *string, guint str_size,
guint8 **buffer, guint64 *size, guint64 *offset);
guint64 prop_copy_null_terminated_string (gchar *string,
guint8 **buffer, guint64 *size, guint64 *offset);
#endif /* __PROPERTIES_H__ */

View file

@ -163,7 +163,6 @@ check_PROGRAMS = \
$(check_jifmux) \
elements/jpegparse \
$(check_logoinsert) \
elements/qtmux \
elements/mxfdemux \
elements/mxfmux \
elements/id3mux \
@ -174,7 +173,6 @@ check_PROGRAMS = \
$(check_vp8) \
$(check_zbar) \
$(check_orc) \
pipelines/tagschecking \
$(EXPERIMENTAL_CHECKS)
noinst_HEADERS = elements/mxfdemux.h

View file

@ -25,7 +25,6 @@ mxfdemux
mxfmux
neonhttpsrc
ofa
qtmux
rganalysis
rglimiter
rgvolume

View file

@ -1,422 +0,0 @@
/* GStreamer
*
* unit test for qtmux
*
* Copyright (C) <2008> Mark Nauwelaerts <mnauw@users.sf.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.
*/
#include <unistd.h>
#include <gst/check/gstcheck.h>
/* For ease of programming we use globals to keep refs for our floating
* src and sink pads we create; otherwise we always have to do get_pad,
* get_peer, and then remove references in every test function */
static GstPad *mysrcpad, *mysinkpad;
#define AUDIO_CAPS_STRING "audio/mpeg, " \
"mpegversion = (int) 1, " \
"layer = (int) 3, " \
"channels = (int) 2, " \
"rate = (int) 48000"
#define VIDEO_CAPS_STRING "video/mpeg, " \
"mpegversion = (int) 4, " \
"width = (int) 384, " \
"height = (int) 288, " \
"framerate = (fraction) 25/1"
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/quicktime"));
static GstStaticPadTemplate srcvideotemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (VIDEO_CAPS_STRING));
static GstStaticPadTemplate srcaudiotemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (AUDIO_CAPS_STRING));
/* setup and teardown needs some special handling for muxer */
static GstPad *
setup_src_pad (GstElement * element,
GstStaticPadTemplate * template, GstCaps * caps, const gchar * sinkname)
{
GstPad *srcpad, *sinkpad;
GST_DEBUG_OBJECT (element, "setting up sending pad");
/* sending pad */
srcpad = gst_pad_new_from_static_template (template, "src");
fail_if (srcpad == NULL, "Could not create a srcpad");
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
if (!(sinkpad = gst_element_get_static_pad (element, sinkname)))
sinkpad = gst_element_get_request_pad (element, sinkname);
fail_if (sinkpad == NULL, "Could not get sink pad from %s",
GST_ELEMENT_NAME (element));
/* references are owned by: 1) us, 2) qtmux, 3) collect pads */
ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 3);
if (caps)
fail_unless (gst_pad_set_caps (srcpad, caps));
fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK,
"Could not link source and %s sink pads", GST_ELEMENT_NAME (element));
gst_object_unref (sinkpad); /* because we got it higher up */
/* references are owned by: 1) qtmux, 2) collect pads */
ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
return srcpad;
}
static void
teardown_src_pad (GstPad * srcpad)
{
GstPad *sinkpad;
/* clean up floating src pad */
sinkpad = gst_pad_get_peer (srcpad);
fail_if (sinkpad == NULL);
/* pad refs held by 1) qtmux 2) collectpads and 3) us (through _get_peer) */
ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 3);
gst_pad_unlink (srcpad, sinkpad);
/* after unlinking, pad refs still held by
* 1) qtmux and 2) collectpads and 3) us (through _get_peer) */
ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 3);
gst_object_unref (sinkpad);
/* one more ref is held by element itself */
/* pad refs held by creator */
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
gst_object_unref (srcpad);
}
static GstElement *
setup_qtmux (GstStaticPadTemplate * srctemplate, const gchar * sinkname)
{
GstElement *qtmux;
GST_DEBUG ("setup_qtmux");
qtmux = gst_check_setup_element ("qtmux");
mysrcpad = setup_src_pad (qtmux, srctemplate, NULL, sinkname);
mysinkpad = gst_check_setup_sink_pad (qtmux, &sinktemplate, NULL);
gst_pad_set_active (mysrcpad, TRUE);
gst_pad_set_active (mysinkpad, TRUE);
return qtmux;
}
static void
cleanup_qtmux (GstElement * qtmux, const gchar * sinkname)
{
GST_DEBUG ("cleanup_qtmux");
gst_element_set_state (qtmux, GST_STATE_NULL);
gst_pad_set_active (mysrcpad, FALSE);
gst_pad_set_active (mysinkpad, FALSE);
teardown_src_pad (mysrcpad);
gst_check_teardown_sink_pad (qtmux);
gst_check_teardown_element (qtmux);
}
static void
check_qtmux_pad (GstStaticPadTemplate * srctemplate, const gchar * sinkname)
{
GstElement *qtmux;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
int num_buffers;
int i;
guint8 data0[12] = "\000\000\000\024ftypqt ";
guint8 data1[8] = "\000\000\000\001mdat";
guint8 data2[4] = "moov";
qtmux = setup_qtmux (srctemplate, sinkname);
fail_unless (gst_element_set_state (qtmux,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (1);
caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
gst_buffer_set_caps (inbuffer, caps);
gst_caps_unref (caps);
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
GST_BUFFER_DURATION (inbuffer) = 40 * GST_MSECOND;
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
/* send eos to have moov written */
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()) == TRUE);
num_buffers = g_list_length (buffers);
/* at least expect ftyp, mdat header, buffer chunk and moov */
fail_unless (num_buffers >= 4);
for (i = 0; i < num_buffers; ++i) {
outbuffer = GST_BUFFER (buffers->data);
fail_if (outbuffer == NULL);
buffers = g_list_remove (buffers, outbuffer);
switch (i) {
case 0:
{
/* ftyp header */
guint8 *data = GST_BUFFER_DATA (outbuffer);
fail_unless (GST_BUFFER_SIZE (outbuffer) >= 20);
fail_unless (memcmp (data, data0, sizeof (data0)) == 0);
fail_unless (memcmp (data + 16, data0 + 8, 4) == 0);
break;
}
case 1: /* mdat header */
fail_unless (GST_BUFFER_SIZE (outbuffer) == 16);
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), data1, sizeof (data1))
== 0);
break;
case 2: /* buffer we put in */
fail_unless (GST_BUFFER_SIZE (outbuffer) == 1);
break;
case 3: /* moov */
fail_unless (GST_BUFFER_SIZE (outbuffer) > 8);
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer) + 4, data2,
sizeof (data2)) == 0);
break;
default:
break;
}
ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
gst_buffer_unref (outbuffer);
outbuffer = NULL;
}
g_list_free (buffers);
buffers = NULL;
cleanup_qtmux (qtmux, sinkname);
}
static void
check_qtmux_pad_fragmented (GstStaticPadTemplate * srctemplate,
const gchar * sinkname, gboolean streamable)
{
GstElement *qtmux;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
int num_buffers;
int i;
guint8 data0[12] = "\000\000\000\024ftypqt ";
guint8 data1[4] = "mdat";
guint8 data2[4] = "moov";
guint8 data3[4] = "moof";
guint8 data4[4] = "mfra";
qtmux = setup_qtmux (srctemplate, sinkname);
g_object_set (qtmux, "fragment-duration", 2000, NULL);
g_object_set (qtmux, "streamable", streamable, NULL);
fail_unless (gst_element_set_state (qtmux,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (1);
caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
gst_buffer_set_caps (inbuffer, caps);
gst_caps_unref (caps);
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
GST_BUFFER_DURATION (inbuffer) = 40 * GST_MSECOND;
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
/* send eos to have all written */
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()) == TRUE);
num_buffers = g_list_length (buffers);
/* at least expect ftyp, moov, moof, mdat header, buffer chunk
* and optionally mfra */
fail_unless (num_buffers >= 5);
for (i = 0; i < num_buffers; ++i) {
outbuffer = GST_BUFFER (buffers->data);
fail_if (outbuffer == NULL);
buffers = g_list_remove (buffers, outbuffer);
switch (i) {
case 0:
{
/* ftyp header */
guint8 *data = GST_BUFFER_DATA (outbuffer);
fail_unless (GST_BUFFER_SIZE (outbuffer) >= 20);
fail_unless (memcmp (data, data0, sizeof (data0)) == 0);
fail_unless (memcmp (data + 16, data0 + 8, 4) == 0);
break;
}
case 1: /* moov */
fail_unless (GST_BUFFER_SIZE (outbuffer) > 8);
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer) + 4, data2,
sizeof (data2)) == 0);
break;
case 2: /* moof */
fail_unless (GST_BUFFER_SIZE (outbuffer) > 8);
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer) + 4, data3,
sizeof (data3)) == 0);
break;
case 3: /* mdat header */
fail_unless (GST_BUFFER_SIZE (outbuffer) == 8);
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer) + 4, data1,
sizeof (data1)) == 0);
break;
case 4: /* buffer we put in */
fail_unless (GST_BUFFER_SIZE (outbuffer) == 1);
break;
case 5: /* mfra */
fail_unless (GST_BUFFER_SIZE (outbuffer) > 8);
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer) + 4, data4,
sizeof (data4)) == 0);
break;
default:
break;
}
ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
gst_buffer_unref (outbuffer);
outbuffer = NULL;
}
g_list_free (buffers);
buffers = NULL;
cleanup_qtmux (qtmux, sinkname);
}
GST_START_TEST (test_video_pad)
{
check_qtmux_pad (&srcvideotemplate, "video_%d");
}
GST_END_TEST;
GST_START_TEST (test_audio_pad)
{
check_qtmux_pad (&srcaudiotemplate, "audio_%d");
}
GST_END_TEST;
GST_START_TEST (test_video_pad_frag)
{
check_qtmux_pad_fragmented (&srcvideotemplate, "video_%d", FALSE);
}
GST_END_TEST;
GST_START_TEST (test_audio_pad_frag)
{
check_qtmux_pad_fragmented (&srcaudiotemplate, "audio_%d", FALSE);
}
GST_END_TEST;
GST_START_TEST (test_video_pad_frag_streamable)
{
check_qtmux_pad_fragmented (&srcvideotemplate, "video_%d", TRUE);
}
GST_END_TEST;
GST_START_TEST (test_audio_pad_frag_streamable)
{
check_qtmux_pad_fragmented (&srcaudiotemplate, "audio_%d", TRUE);
}
GST_END_TEST;
GST_START_TEST (test_reuse)
{
GstElement *qtmux = setup_qtmux (&srcvideotemplate, "video_%d");
GstBuffer *inbuffer;
GstCaps *caps;
gst_element_set_state (qtmux, GST_STATE_PLAYING);
gst_element_set_state (qtmux, GST_STATE_NULL);
gst_element_set_state (qtmux, GST_STATE_PLAYING);
gst_pad_set_active (mysrcpad, TRUE);
gst_pad_set_active (mysinkpad, TRUE);
inbuffer = gst_buffer_new_and_alloc (1);
fail_unless (inbuffer != NULL);
caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
gst_buffer_set_caps (inbuffer, caps);
gst_caps_unref (caps);
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
GST_BUFFER_DURATION (inbuffer) = 40 * GST_MSECOND;
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
/* send eos to have all written */
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()) == TRUE);
cleanup_qtmux (qtmux, "video_%d");
}
GST_END_TEST;
static Suite *
qtmux_suite (void)
{
Suite *s = suite_create ("qtmux");
TCase *tc_chain = tcase_create ("general");
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_video_pad);
tcase_add_test (tc_chain, test_audio_pad);
tcase_add_test (tc_chain, test_video_pad_frag);
tcase_add_test (tc_chain, test_audio_pad_frag);
tcase_add_test (tc_chain, test_video_pad_frag_streamable);
tcase_add_test (tc_chain, test_audio_pad_frag_streamable);
tcase_add_test (tc_chain, test_reuse);
return s;
}
int
main (int argc, char **argv)
{
int nf;
Suite *s = qtmux_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -1,350 +0,0 @@
/* GStreamer
* Copyright (C) 2008 Nokia Corporation. (contact <stefan.kost@nokia.com>)
* Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
*
* 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.
*/
#include <gst/check/gstcheck.h>
static GstTagList *received_tags = NULL;
static gboolean
bus_handler (GstBus * bus, GstMessage * message, gpointer data)
{
GMainLoop *loop = (GMainLoop *) data;
switch (message->type) {
case GST_MESSAGE_EOS:
g_main_loop_quit (loop);
break;
case GST_MESSAGE_WARNING:
case GST_MESSAGE_ERROR:{
GError *gerror;
gchar *debug;
gst_message_parse_error (message, &gerror, &debug);
gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug);
g_error_free (gerror);
g_free (debug);
g_main_loop_quit (loop);
break;
}
case GST_MESSAGE_TAG:{
if (received_tags == NULL) {
gst_message_parse_tag (message, &received_tags);
} else {
GstTagList *tl = NULL, *ntl = NULL;
gst_message_parse_tag (message, &tl);
if (tl) {
ntl = gst_tag_list_merge (received_tags, tl, GST_TAG_MERGE_PREPEND);
if (ntl) {
GST_LOG ("taglists merged: %" GST_PTR_FORMAT, ntl);
gst_tag_list_free (received_tags);
received_tags = ntl;
}
gst_tag_list_free (tl);
}
}
break;
}
default:
break;
}
return TRUE;
}
/*
* Creates a pipeline in the form:
* fakesrc num-buffers=1 ! caps ! muxer ! filesink location=file
*
* And sets the tags in tag_str into the muxer via tagsetter.
*/
static void
test_mux_tags (const gchar * tag_str, const gchar * caps,
const gchar * muxer, const gchar * file)
{
GstElement *pipeline;
GstBus *bus;
GMainLoop *loop;
GstTagList *sent_tags;
GstElement *mux;
GstTagSetter *setter;
gchar *launch_str;
GST_DEBUG ("testing xmp muxing on : %s", muxer);
launch_str = g_strdup_printf ("fakesrc num-buffers=1 ! %s ! %s name=mux ! "
"filesink location=%s name=sink", caps, muxer, file);
pipeline = gst_parse_launch (launch_str, NULL);
g_free (launch_str);
fail_unless (pipeline != NULL);
mux = gst_bin_get_by_name (GST_BIN (pipeline), "mux");
fail_unless (mux != NULL);
loop = g_main_loop_new (NULL, TRUE);
fail_unless (loop != NULL);
bus = gst_element_get_bus (pipeline);
fail_unless (bus != NULL);
gst_bus_add_watch (bus, bus_handler, loop);
gst_object_unref (bus);
gst_element_set_state (pipeline, GST_STATE_READY);
setter = GST_TAG_SETTER (mux);
fail_unless (setter != NULL);
sent_tags = gst_structure_from_string (tag_str, NULL);
fail_unless (sent_tags != NULL);
gst_tag_setter_merge_tags (setter, sent_tags, GST_TAG_MERGE_REPLACE);
gst_tag_list_free (sent_tags);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_main_loop_run (loop);
gst_element_set_state (pipeline, GST_STATE_NULL);
g_main_loop_unref (loop);
g_object_unref (mux);
g_object_unref (pipeline);
}
/*
* Makes a pipeline in the form:
* filesrc location=file ! demuxer ! fakesink
*
* And gets the tags that are posted on the bus to compare
* with the tags in 'tag_str'
*/
static void
test_demux_tags (const gchar * tag_str, const gchar * demuxer,
const gchar * file)
{
GstElement *pipeline;
GstBus *bus;
GMainLoop *loop;
GstTagList *sent_tags;
gint i, j, n_recv, n_sent;
const gchar *name_sent, *name_recv;
const GValue *value_sent, *value_recv;
gboolean found;
gint comparison;
GstElement *demux;
gchar *launch_str;
GST_DEBUG ("testing tags : %s", tag_str);
if (received_tags) {
gst_tag_list_free (received_tags);
received_tags = NULL;
}
launch_str = g_strdup_printf ("filesrc location=%s ! %s name=demux ! "
"fakesink", file, demuxer);
pipeline = gst_parse_launch (launch_str, NULL);
g_free (launch_str);
fail_unless (pipeline != NULL);
demux = gst_bin_get_by_name (GST_BIN (pipeline), "demux");
fail_unless (demux != NULL);
loop = g_main_loop_new (NULL, TRUE);
fail_unless (loop != NULL);
bus = gst_element_get_bus (pipeline);
fail_unless (bus != NULL);
gst_bus_add_watch (bus, bus_handler, loop);
gst_object_unref (bus);
sent_tags = gst_structure_from_string (tag_str, NULL);
fail_unless (sent_tags != NULL);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_main_loop_run (loop);
GST_DEBUG ("mainloop done : %p", received_tags);
/* verify tags */
fail_unless (received_tags != NULL);
n_recv = gst_structure_n_fields (received_tags);
n_sent = gst_structure_n_fields (sent_tags);
fail_unless (n_recv >= n_sent);
/* FIXME: compare taglits values */
for (i = 0; i < n_sent; i++) {
name_sent = gst_structure_nth_field_name (sent_tags, i);
value_sent = gst_structure_get_value (sent_tags, name_sent);
found = FALSE;
for (j = 0; j < n_recv; j++) {
name_recv = gst_structure_nth_field_name (received_tags, j);
if (!strcmp (name_sent, name_recv)) {
value_recv = gst_structure_get_value (received_tags, name_recv);
comparison = gst_value_compare (value_sent, value_recv);
if (comparison != GST_VALUE_EQUAL) {
gchar *vs = g_strdup_value_contents (value_sent);
gchar *vr = g_strdup_value_contents (value_recv);
GST_DEBUG ("sent = %s:'%s', recv = %s:'%s'",
G_VALUE_TYPE_NAME (value_sent), vs,
G_VALUE_TYPE_NAME (value_recv), vr);
g_free (vs);
g_free (vr);
}
fail_unless (comparison == GST_VALUE_EQUAL,
"tag item %s has been received with different type or value",
name_sent);
found = TRUE;
break;
}
}
fail_unless (found, "tag item %s is lost", name_sent);
}
gst_tag_list_free (received_tags);
received_tags = NULL;
gst_tag_list_free (sent_tags);
gst_element_set_state (pipeline, GST_STATE_NULL);
g_main_loop_unref (loop);
g_object_unref (demux);
g_object_unref (pipeline);
}
/*
* Tests if the muxer/demuxer pair can serialize the tags in 'tag_str'
* to a file and recover them correctly.
*
* 'caps' are used to assure the muxer accepts the fake buffer fakesrc
* will send to it.
*/
static void
test_tags (const gchar * tag_str, const gchar * caps, const gchar * muxer,
const gchar * demuxer)
{
gchar *tmpfile;
gchar *tmp;
tmp = g_strdup_printf ("%s%d", "gst-check-xmp-test-", g_random_int ());
tmpfile = g_build_filename (g_get_tmp_dir (), tmp, NULL);
g_free (tmp);
GST_DEBUG ("testing tags : %s", tag_str);
test_mux_tags (tag_str, caps, muxer, tmpfile);
test_demux_tags (tag_str, demuxer, tmpfile);
g_free (tmpfile);
}
#define H264_CAPS "video/x-h264, width=(int)320, height=(int)240," \
" framerate=(fraction)30/1, codec_data=(buffer)" \
"01401592ffe10017674d401592540a0fd8088000000300" \
"8000001e478b175001000468ee3c80, stream-format=(string)avc"
#define COMMON_TAGS \
"taglist,title=test_title," \
"artist=test_artist," \
"keywords=\"key1,key2\"," \
"description=test_desc"
GST_START_TEST (test_common_tags)
{
if (!gst_default_registry_check_feature_version ("qtdemux", 0, 10, 23)) {
GST_INFO ("Skipping test, qtdemux either not available or too old");
return;
}
test_tags (COMMON_TAGS, H264_CAPS, "qtmux", "qtdemux");
test_tags (COMMON_TAGS, H264_CAPS, "mp4mux", "qtdemux");
test_tags (COMMON_TAGS, H264_CAPS, "gppmux", "qtdemux");
}
GST_END_TEST;
#define GEO_LOCATION_TAGS \
"taglist,geo-location-country=Brazil," \
"geo-location-city=\"Campina Grande\"," \
"geo-location-sublocation=Bodocongo," \
"geo-location-latitude=-12.125," \
"geo-location-longitude=56.75," \
"geo-location-elevation=327.5"
GST_START_TEST (test_geo_location_tags)
{
if (!gst_default_registry_check_feature_version ("qtdemux", 0, 10, 23)) {
GST_INFO ("Skipping test, qtdemux either not available or too old");
return;
}
test_tags (GEO_LOCATION_TAGS, H264_CAPS, "qtmux", "qtdemux");
test_tags (GEO_LOCATION_TAGS, H264_CAPS, "mp4mux", "qtdemux");
test_tags (GEO_LOCATION_TAGS, H264_CAPS, "gppmux", "qtdemux");
}
GST_END_TEST;
#define USER_TAGS \
"taglist,user-rating=(uint)85"
GST_START_TEST (test_user_tags)
{
if (!gst_default_registry_check_feature_version ("qtdemux", 0, 10, 23)) {
GST_INFO ("Skipping test, qtdemux either not available or too old");
return;
}
test_tags (USER_TAGS, H264_CAPS, "qtmux", "qtdemux");
test_tags (USER_TAGS, H264_CAPS, "mp4mux", "qtdemux");
test_tags (USER_TAGS, H264_CAPS, "gppmux", "qtdemux");
}
GST_END_TEST;
static Suite *
metadata_suite (void)
{
Suite *s = suite_create ("tagschecking");
TCase *tc_chain = tcase_create ("general");
/* time out after 60s, not the default 3 */
tcase_set_timeout (tc_chain, 60);
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_common_tags);
tcase_add_test (tc_chain, test_geo_location_tags);
tcase_add_test (tc_chain, test_user_tags);
return s;
}
int
main (int argc, char **argv)
{
int nf;
Suite *s = metadata_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}