mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-21 06:38:19 +00:00
New base class for metadata elements.
Original commit message from CVS: New base class for metadata elements.
This commit is contained in:
parent
e4a1115a22
commit
1007d71503
15 changed files with 1698 additions and 2068 deletions
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
||||||
|
2007-12-19 Edgard Lima <edgard.lima@indt.org.br>
|
||||||
|
|
||||||
|
* ext/metadata/Makefile.am:
|
||||||
|
* ext/metadata/TODO:
|
||||||
|
* ext/metadata/gstbasemetadata.c:
|
||||||
|
* ext/metadata/gstbasemetadata.h:
|
||||||
|
* ext/metadata/gstmetadatacommon.c:
|
||||||
|
* ext/metadata/gstmetadatacommon.h:
|
||||||
|
* ext/metadata/gstmetadatademux.c:
|
||||||
|
* ext/metadata/gstmetadatademux.h:
|
||||||
|
* ext/metadata/gstmetadatamux.c:
|
||||||
|
* ext/metadata/gstmetadatamux.h:
|
||||||
|
* ext/metadata/metadata.c:
|
||||||
|
* ext/metadata/metadata.h:
|
||||||
|
* ext/metadata/metadataexif.c:
|
||||||
|
* ext/metadata/metadataparsejpeg.c:
|
||||||
|
* ext/metadata/metadataparsepng.c:
|
||||||
|
* ext/metadata/metadatatags.c:
|
||||||
|
* ext/metadata/metadatatags.h:
|
||||||
|
* ext/metadata/test/metadata_editor.c:
|
||||||
|
New base class for metadata elements.
|
||||||
|
|
||||||
2007-12-18 Andy Wingo <wingo@pobox.com>
|
2007-12-18 Andy Wingo <wingo@pobox.com>
|
||||||
|
|
||||||
* gst/switch/gstswitch-marshal.list:
|
* gst/switch/gstswitch-marshal.list:
|
||||||
|
|
|
@ -14,7 +14,8 @@ libgstmetadata_la_SOURCES = gstmetadata.c \
|
||||||
metadataparseutil.c \
|
metadataparseutil.c \
|
||||||
metadatatypes.c \
|
metadatatypes.c \
|
||||||
gstmetadatamux.c \
|
gstmetadatamux.c \
|
||||||
metadatatags.c
|
metadatatags.c \
|
||||||
|
gstbasemetadata.c
|
||||||
|
|
||||||
libgstmetadata_ladir = $(includedir)/gstreamer-@GST_MAJORMINOR@/metadata
|
libgstmetadata_ladir = $(includedir)/gstreamer-@GST_MAJORMINOR@/metadata
|
||||||
libgstmetadata_la_HEADERS = metadatatags.h
|
libgstmetadata_la_HEADERS = metadatatags.h
|
||||||
|
@ -35,5 +36,6 @@ noinst_HEADERS = gstmetadatademux.h \
|
||||||
metadataxmp.h \
|
metadataxmp.h \
|
||||||
metadataparseutil.h \
|
metadataparseutil.h \
|
||||||
metadatatypes.h \
|
metadatatypes.h \
|
||||||
gstmetadatamux.h
|
gstmetadatamux.h \
|
||||||
|
gstbasemetadata.h
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ This file contains a list of things to be done as well some open issues (questio
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
|
|
||||||
|
0- Remove "common" file (put inside class)
|
||||||
1- Add individual tags IPTC and XMP (and more for EXIF)
|
1- Add individual tags IPTC and XMP (and more for EXIF)
|
||||||
2- Get properties like 'width' and 'height' from caps
|
2- Get properties like 'width' and 'height' from caps
|
||||||
3- Review the code (in order to move to gst-plugins-good)
|
3- Review the code (in order to move to gst-plugins-good)
|
||||||
|
@ -17,3 +18,7 @@ OPEN ISSUES:
|
||||||
3- Add GST_TYPE_FRACTION support for GStreamer TAGS
|
3- Add GST_TYPE_FRACTION support for GStreamer TAGS
|
||||||
4- After decided issue (4) put more things to gstmetadatacommon (or else create a Class)
|
4- After decided issue (4) put more things to gstmetadatacommon (or else create a Class)
|
||||||
|
|
||||||
|
KNOWN BUGS
|
||||||
|
|
||||||
|
1- exposure-time, exposure-program and fnumber can't be read from a file saved from scratch (whithout WHOLE_CHUNK from previous file)
|
||||||
|
|
||||||
|
|
1123
ext/metadata/gstbasemetadata.c
Normal file
1123
ext/metadata/gstbasemetadata.c
Normal file
File diff suppressed because it is too large
Load diff
164
ext/metadata/gstbasemetadata.h
Normal file
164
ext/metadata/gstbasemetadata.h
Normal file
|
@ -0,0 +1,164 @@
|
||||||
|
/*
|
||||||
|
* GStreamer
|
||||||
|
* Copyright 2007 Edgard Lima <edgard.lima@indt.org.br>
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the
|
||||||
|
* GNU Lesser General Public License Version 2.1 (the "LGPL"), in
|
||||||
|
* which case the following provisions apply instead of the ones
|
||||||
|
* mentioned above:
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GST_BASE_METADATA_H__
|
||||||
|
#define __GST_BASE_METADATA_H__
|
||||||
|
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
#include "gstmetadatacommon.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
/* #defines don't like whitespacey bits */
|
||||||
|
#define GST_TYPE_BASE_METADATA (gst_base_metadata_get_type())
|
||||||
|
#define GST_BASE_METADATA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_METADATA,GstBaseMetadata))
|
||||||
|
#define GST_BASE_METADATA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_METADATA,GstBaseMetadataClass))
|
||||||
|
#define GST_BASE_METADATA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_METADATA, GstBaseMetadataClass))
|
||||||
|
#define GST_IS_BASE_METADATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_METADATA))
|
||||||
|
#define GST_IS_BASE_METADATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_METADATA))
|
||||||
|
#define GST_BASE_METADATA_CAST(obj) ((GstBaseMetadata *)(obj))
|
||||||
|
|
||||||
|
typedef struct _GstBaseMetadata GstBaseMetadata;
|
||||||
|
typedef struct _GstBaseMetadataClass GstBaseMetadataClass;
|
||||||
|
|
||||||
|
typedef enum _tag_BaseMetadataType {
|
||||||
|
BASE_METADATA_DEMUXING,
|
||||||
|
BASE_METADATA_MUXING
|
||||||
|
} BaseMetadataType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GST_BASE_METADATA_SRC_PAD:
|
||||||
|
* @obj: base metadata instance
|
||||||
|
*
|
||||||
|
* Gives the pointer to the #GstPad object of the element.
|
||||||
|
*/
|
||||||
|
#define GST_BASE_METADATA_SRC_PAD(obj) (GST_BASE_METADATA_CAST (obj)->srcpad)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GST_BASE_METADATA_SINK_PAD:
|
||||||
|
* @obj: base metadata instance
|
||||||
|
*
|
||||||
|
* Gives the pointer to the #GstPad object of the element.
|
||||||
|
*/
|
||||||
|
#define GST_BASE_METADATA_SINK_PAD(obj) (GST_BASE_METADATA_CAST (obj)->sinkpad)
|
||||||
|
|
||||||
|
#define GST_BASE_METADATA_EXIF_ADAPTER(obj) (GST_BASE_METADATA_CAST (obj)->common.metadata.exif_adapter)
|
||||||
|
#define GST_BASE_METADATA_IPTC_ADAPTER(obj) (GST_BASE_METADATA_CAST (obj)->common.metadata.iptc_adapter)
|
||||||
|
#define GST_BASE_METADATA_XMP_ADAPTER(obj) (GST_BASE_METADATA_CAST (obj)->common.metadata.xmp_adapter)
|
||||||
|
|
||||||
|
#define GST_BASE_METADATA_IMG_TYPE(obj) (GST_BASE_METADATA_CAST (obj)->img_type)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstBaseMetadata:
|
||||||
|
* @element: the parent element.
|
||||||
|
*
|
||||||
|
* The opaque #GstBaseMetadata data structure.
|
||||||
|
*/
|
||||||
|
struct _GstBaseMetadata
|
||||||
|
{
|
||||||
|
GstElement element;
|
||||||
|
|
||||||
|
/*< protected >*/
|
||||||
|
GstPad *sinkpad, *srcpad;
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
|
GstMetadataCommon common;
|
||||||
|
|
||||||
|
MetaOptions options;
|
||||||
|
|
||||||
|
gboolean need_processing;
|
||||||
|
|
||||||
|
GstAdapter *adapter_parsing;
|
||||||
|
GstAdapter *adapter_holding;
|
||||||
|
guint32 next_offset;
|
||||||
|
guint32 next_size;
|
||||||
|
ImageType img_type;
|
||||||
|
|
||||||
|
gint64 offset_orig; /* offset in original stream */
|
||||||
|
gint64 offset; /* offset in current stream */
|
||||||
|
|
||||||
|
GstBuffer * prepend_buffer;
|
||||||
|
|
||||||
|
gboolean need_more_data;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GstBaseMetadataClass
|
||||||
|
{
|
||||||
|
GstElementClass parent_class;
|
||||||
|
|
||||||
|
void (*processing) (GstBaseMetadata *basemetadata);
|
||||||
|
|
||||||
|
gboolean (*set_caps) (GstPad * pad, GstCaps * caps);
|
||||||
|
|
||||||
|
GstCaps* (*get_src_caps) (GstPad * pad);
|
||||||
|
GstCaps* (*get_sink_caps) (GstPad * pad);
|
||||||
|
|
||||||
|
gboolean (*sink_event) (GstPad * pad, GstEvent * event);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
extern GType
|
||||||
|
gst_base_metadata_get_type (void);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
gst_base_metadata_set_option_flag(GstBaseMetadata *metadata, const MetaOptions options);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
gst_base_metadata_unset_option_flag(GstBaseMetadata *metadata, const MetaOptions options);
|
||||||
|
|
||||||
|
extern MetaOptions
|
||||||
|
gst_base_metadata_get_option_flag(const GstBaseMetadata *metadata);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
gst_base_metadata_update_segment_with_new_buffer (GstBaseMetadata *metadata,
|
||||||
|
guint8 ** buf, guint32 * size, MetadataChunkType type);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
gst_base_metadata_chunk_array_remove_zero_size (GstBaseMetadata *metadata);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
#endif /* __GST_BASE_METADATA_H__ */
|
|
@ -150,10 +150,9 @@ done:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_metadata_common_init (GstMetadataCommon * common, gboolean parse,
|
gst_metadata_common_init (GstMetadataCommon * common, MetaOptions options)
|
||||||
guint8 options)
|
|
||||||
{
|
{
|
||||||
metadata_init (&common->metadata, parse, options);
|
metadata_init (&common->metadata, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -69,7 +69,7 @@ struct _GstMetadataCommon {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
gst_metadata_common_init(GstMetadataCommon *common, gboolean parse, guint8 options);
|
gst_metadata_common_init(GstMetadataCommon *common, MetaOptions options);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
gst_metadata_common_dispose(GstMetadataCommon *common);
|
gst_metadata_common_dispose(GstMetadataCommon *common);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
#include "gstmetadatacommon.h"
|
#include "gstbasemetadata.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
/* #defines don't like whitespacey bits */
|
/* #defines don't like whitespacey bits */
|
||||||
|
@ -65,36 +65,12 @@ typedef struct _GstMetadataDemuxClass GstMetadataDemuxClass;
|
||||||
|
|
||||||
struct _GstMetadataDemux
|
struct _GstMetadataDemux
|
||||||
{
|
{
|
||||||
GstElement element;
|
GstBaseMetadata element;
|
||||||
|
|
||||||
GstPad *sinkpad, *srcpad;
|
|
||||||
|
|
||||||
GstMetadataCommon common;
|
|
||||||
|
|
||||||
guint8 options;
|
|
||||||
|
|
||||||
gboolean need_send_tag;
|
|
||||||
|
|
||||||
GstAdapter *adapter_parsing;
|
|
||||||
GstAdapter *adapter_holding;
|
|
||||||
guint32 next_offset;
|
|
||||||
guint32 next_size;
|
|
||||||
ImageType img_type;
|
|
||||||
|
|
||||||
gint64 offset_orig; /* offset in original stream */
|
|
||||||
gint64 offset; /* offset in current stream */
|
|
||||||
|
|
||||||
GstBuffer * prepend_buffer;
|
|
||||||
|
|
||||||
gboolean need_more_data;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstMetadataDemuxClass
|
struct _GstMetadataDemuxClass
|
||||||
{
|
{
|
||||||
GstElementClass parent_class;
|
GstBaseMetadataClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern GType gst_metadata_demux_get_type (void);
|
extern GType gst_metadata_demux_get_type (void);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
#include "gstmetadatacommon.h"
|
#include "gstbasemetadata.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
/* #defines don't like whitespacey bits */
|
/* #defines don't like whitespacey bits */
|
||||||
|
@ -65,34 +65,12 @@ typedef struct _GstMetadataMuxClass GstMetadataMuxClass;
|
||||||
|
|
||||||
struct _GstMetadataMux
|
struct _GstMetadataMux
|
||||||
{
|
{
|
||||||
GstElement element;
|
GstBaseMetadata element;
|
||||||
|
|
||||||
GstPad *sinkpad, *srcpad;
|
|
||||||
|
|
||||||
GstMetadataCommon common;
|
|
||||||
|
|
||||||
guint8 options;
|
|
||||||
|
|
||||||
GstAdapter *adapter_parsing;
|
|
||||||
GstAdapter *adapter_holding;
|
|
||||||
guint32 next_offset;
|
|
||||||
guint32 next_size;
|
|
||||||
ImageType img_type;
|
|
||||||
|
|
||||||
gint64 offset_orig; /* offset in original stream */
|
|
||||||
gint64 offset; /* offset in current stream */
|
|
||||||
|
|
||||||
GstBuffer * prepend_buffer;
|
|
||||||
|
|
||||||
gboolean need_more_data;
|
|
||||||
|
|
||||||
gboolean need_calculate_offset; /* mux need to calculate offsets of insert chunks */
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstMetadataMuxClass
|
struct _GstMetadataMuxClass
|
||||||
{
|
{
|
||||||
GstElementClass parent_class;
|
GstBaseMetadataClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern GType gst_metadata_mux_get_type (void);
|
extern GType gst_metadata_mux_get_type (void);
|
||||||
|
|
|
@ -65,10 +65,10 @@ metadata_parse_none (MetaData * meta_data, const guint8 * buf,
|
||||||
* meta_data [in]: metadata handler to be inited
|
* meta_data [in]: metadata handler to be inited
|
||||||
* parse [in]: pass TRUE for demuxing and FALSE for muxing
|
* parse [in]: pass TRUE for demuxing and FALSE for muxing
|
||||||
* options [in]: which types of metadata will be processed (EXIF, IPTC and/or XMP).
|
* options [in]: which types of metadata will be processed (EXIF, IPTC and/or XMP).
|
||||||
* Look at 'MetaOption' to see the available options.
|
* Look at 'MetaOptions' to see the available options.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
metadata_init (MetaData * meta_data, const gboolean parse, const guint8 options)
|
metadata_init (MetaData * meta_data, const MetaOptions options)
|
||||||
{
|
{
|
||||||
meta_data->state = STATE_NULL;
|
meta_data->state = STATE_NULL;
|
||||||
meta_data->img_type = IMG_NONE;
|
meta_data->img_type = IMG_NONE;
|
||||||
|
@ -77,9 +77,8 @@ metadata_init (MetaData * meta_data, const gboolean parse, const guint8 options)
|
||||||
meta_data->exif_adapter = NULL;
|
meta_data->exif_adapter = NULL;
|
||||||
meta_data->iptc_adapter = NULL;
|
meta_data->iptc_adapter = NULL;
|
||||||
meta_data->xmp_adapter = NULL;
|
meta_data->xmp_adapter = NULL;
|
||||||
meta_data->parse = parse;
|
|
||||||
|
|
||||||
if (parse) {
|
if (meta_data->options & META_OPT_DEMUX) {
|
||||||
/* when parsing we will probably strip only 3 chunk (exif, iptc and xmp)
|
/* when parsing we will probably strip only 3 chunk (exif, iptc and xmp)
|
||||||
so we use 4 just in case there is more than one chunk of them.
|
so we use 4 just in case there is more than one chunk of them.
|
||||||
But this is just for convinience, 'cause the chunk_array incriases dinamically */
|
But this is just for convinience, 'cause the chunk_array incriases dinamically */
|
||||||
|
@ -105,13 +104,13 @@ metadata_dispose (MetaData * meta_data)
|
||||||
|
|
||||||
switch (meta_data->img_type) {
|
switch (meta_data->img_type) {
|
||||||
case IMG_JPEG:
|
case IMG_JPEG:
|
||||||
if (G_LIKELY (meta_data->parse))
|
if (G_LIKELY (meta_data->options & META_OPT_DEMUX))
|
||||||
metadataparse_jpeg_dispose (&meta_data->format_data.jpeg_parse);
|
metadataparse_jpeg_dispose (&meta_data->format_data.jpeg_parse);
|
||||||
else
|
else
|
||||||
metadatamux_jpeg_dispose (&meta_data->format_data.jpeg_mux);
|
metadatamux_jpeg_dispose (&meta_data->format_data.jpeg_mux);
|
||||||
break;
|
break;
|
||||||
case IMG_PNG:
|
case IMG_PNG:
|
||||||
if (G_LIKELY (meta_data->parse))
|
if (G_LIKELY (meta_data->options & META_OPT_DEMUX))
|
||||||
metadataparse_png_dispose (&meta_data->format_data.png_parse);
|
metadataparse_png_dispose (&meta_data->format_data.png_parse);
|
||||||
else
|
else
|
||||||
metadatamux_png_dispose (&meta_data->format_data.png_mux);
|
metadatamux_png_dispose (&meta_data->format_data.png_mux);
|
||||||
|
@ -176,7 +175,7 @@ metadata_parse (MetaData * meta_data, const guint8 * buf,
|
||||||
|
|
||||||
switch (meta_data->img_type) {
|
switch (meta_data->img_type) {
|
||||||
case IMG_JPEG:
|
case IMG_JPEG:
|
||||||
if (G_LIKELY (meta_data->parse))
|
if (G_LIKELY (meta_data->options & META_OPT_DEMUX))
|
||||||
ret =
|
ret =
|
||||||
metadataparse_jpeg_parse (&meta_data->format_data.jpeg_parse,
|
metadataparse_jpeg_parse (&meta_data->format_data.jpeg_parse,
|
||||||
(guint8 *) buf, &bufsize, meta_data->offset_orig, &next_start,
|
(guint8 *) buf, &bufsize, meta_data->offset_orig, &next_start,
|
||||||
|
@ -188,7 +187,7 @@ metadata_parse (MetaData * meta_data, const guint8 * buf,
|
||||||
next_size);
|
next_size);
|
||||||
break;
|
break;
|
||||||
case IMG_PNG:
|
case IMG_PNG:
|
||||||
if (G_LIKELY (meta_data->parse))
|
if (G_LIKELY (meta_data->options & META_OPT_DEMUX))
|
||||||
ret =
|
ret =
|
||||||
metadataparse_png_parse (&meta_data->format_data.png_parse,
|
metadataparse_png_parse (&meta_data->format_data.png_parse,
|
||||||
(guint8 *) buf, &bufsize, meta_data->offset_orig, &next_start,
|
(guint8 *) buf, &bufsize, meta_data->offset_orig, &next_start,
|
||||||
|
@ -233,13 +232,13 @@ metadata_lazy_update (MetaData * meta_data)
|
||||||
{
|
{
|
||||||
switch (meta_data->img_type) {
|
switch (meta_data->img_type) {
|
||||||
case IMG_JPEG:
|
case IMG_JPEG:
|
||||||
if (G_LIKELY (meta_data->parse))
|
if (G_LIKELY (meta_data->options & META_OPT_DEMUX))
|
||||||
metadataparse_jpeg_lazy_update (&meta_data->format_data.jpeg_parse);
|
metadataparse_jpeg_lazy_update (&meta_data->format_data.jpeg_parse);
|
||||||
else
|
else
|
||||||
metadatamux_jpeg_lazy_update (&meta_data->format_data.jpeg_mux);
|
metadatamux_jpeg_lazy_update (&meta_data->format_data.jpeg_mux);
|
||||||
break;
|
break;
|
||||||
case IMG_PNG:
|
case IMG_PNG:
|
||||||
if (G_LIKELY (meta_data->parse))
|
if (G_LIKELY (meta_data->options & META_OPT_DEMUX))
|
||||||
metadataparse_png_lazy_update (&meta_data->format_data.png_parse);
|
metadataparse_png_lazy_update (&meta_data->format_data.png_parse);
|
||||||
else
|
else
|
||||||
metadatamux_png_lazy_update (&meta_data->format_data.png_mux);
|
metadatamux_png_lazy_update (&meta_data->format_data.png_mux);
|
||||||
|
@ -293,7 +292,7 @@ metadata_parse_none (MetaData * meta_data, const guint8 * buf,
|
||||||
xmp = &meta_data->xmp_adapter;
|
xmp = &meta_data->xmp_adapter;
|
||||||
|
|
||||||
if (buf[0] == 0xFF && buf[1] == 0xD8 && buf[2] == 0xFF) {
|
if (buf[0] == 0xFF && buf[1] == 0xD8 && buf[2] == 0xFF) {
|
||||||
if (G_LIKELY (meta_data->parse))
|
if (G_LIKELY (meta_data->options & META_OPT_DEMUX))
|
||||||
metadataparse_jpeg_init (&meta_data->format_data.jpeg_parse, exif, iptc,
|
metadataparse_jpeg_init (&meta_data->format_data.jpeg_parse, exif, iptc,
|
||||||
xmp, &meta_data->strip_chunks, &meta_data->inject_chunks,
|
xmp, &meta_data->strip_chunks, &meta_data->inject_chunks,
|
||||||
meta_data->options & META_OPT_PARSE_ONLY);
|
meta_data->options & META_OPT_PARSE_ONLY);
|
||||||
|
@ -314,7 +313,7 @@ metadata_parse_none (MetaData * meta_data, const guint8 * buf,
|
||||||
|
|
||||||
if (buf[0] == 0x89 && buf[1] == 0x50 && buf[2] == 0x4E && buf[3] == 0x47 &&
|
if (buf[0] == 0x89 && buf[1] == 0x50 && buf[2] == 0x4E && buf[3] == 0x47 &&
|
||||||
buf[4] == 0x0D && buf[5] == 0x0A && buf[6] == 0x1A && buf[7] == 0x0A) {
|
buf[4] == 0x0D && buf[5] == 0x0A && buf[6] == 0x1A && buf[7] == 0x0A) {
|
||||||
if (G_LIKELY (meta_data->parse))
|
if (G_LIKELY (meta_data->options & META_OPT_DEMUX))
|
||||||
metadataparse_png_init (&meta_data->format_data.png_parse, exif, iptc,
|
metadataparse_png_init (&meta_data->format_data.png_parse, exif, iptc,
|
||||||
xmp, &meta_data->strip_chunks, &meta_data->inject_chunks,
|
xmp, &meta_data->strip_chunks, &meta_data->inject_chunks,
|
||||||
meta_data->options & META_OPT_PARSE_ONLY);
|
meta_data->options & META_OPT_PARSE_ONLY);
|
||||||
|
|
|
@ -56,14 +56,16 @@ G_BEGIN_DECLS
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
|
|
||||||
typedef enum _tag_MetaOption
|
typedef enum _tag_MetaOptions
|
||||||
{
|
{
|
||||||
META_OPT_EXIF = (1 << 0),
|
META_OPT_EXIF = (1 << 0),
|
||||||
META_OPT_IPTC = (1 << 1),
|
META_OPT_IPTC = (1 << 1),
|
||||||
META_OPT_XMP = (1 << 2),
|
META_OPT_XMP = (1 << 2),
|
||||||
META_OPT_PARSE_ONLY = (1 << 3),
|
META_OPT_PARSE_ONLY = (1 << 3), /* only makes sense with META_OPT_DEMUX */
|
||||||
META_OPT_ALL = (1 << 4) - 1
|
META_OPT_DEMUX = (1 << 4),
|
||||||
} MetaOption;
|
META_OPT_MUX = (1 << 5),
|
||||||
|
META_OPT_ALL = (1 << 6) - 1
|
||||||
|
} MetaOptions;
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
typedef enum _tag_MetaState
|
typedef enum _tag_MetaState
|
||||||
|
@ -100,13 +102,11 @@ typedef struct _tag_MetaData
|
||||||
MetadataChunkArray strip_chunks;
|
MetadataChunkArray strip_chunks;
|
||||||
MetadataChunkArray inject_chunks;
|
MetadataChunkArray inject_chunks;
|
||||||
|
|
||||||
gboolean parse; /* true - parsing, false - muxing */
|
|
||||||
|
|
||||||
} MetaData;
|
} MetaData;
|
||||||
|
|
||||||
#define META_DATA_IMG_TYPE(p) (p).img_type
|
#define META_DATA_IMG_TYPE(p) (p).img_type
|
||||||
|
|
||||||
extern void metadata_init (MetaData * meta_data, const gboolean parse, const guint8 options);
|
extern void metadata_init (MetaData * meta_data, const MetaOptions options);
|
||||||
|
|
||||||
extern void metadata_dispose (MetaData * meta_data);
|
extern void metadata_dispose (MetaData * meta_data);
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ typedef enum {
|
||||||
#define GST_TAG_IMAGE_XRESOLUTION "image-xresolution"
|
#define GST_TAG_IMAGE_XRESOLUTION "image-xresolution"
|
||||||
#define GST_TAG_IMAGE_YRESOLUTION "image-yresolution"
|
#define GST_TAG_IMAGE_YRESOLUTION "image-yresolution"
|
||||||
|
|
||||||
#define GST_TAG_CAPTURE_EXPOSURE_TIME "capture-exposute-time"
|
#define GST_TAG_CAPTURE_EXPOSURE_TIME "capture-exposure-time"
|
||||||
#define GST_TAG_CAPTURE_FNUMBER "captute-fnumber"
|
#define GST_TAG_CAPTURE_FNUMBER "captute-fnumber"
|
||||||
#define GST_TAG_CAPTURE_EXPOSURE_PROGRAM "capture-exposure-program"
|
#define GST_TAG_CAPTURE_EXPOSURE_PROGRAM "capture-exposure-program"
|
||||||
#define GST_TAG_CAPTURE_BRIGHTNESS "capture-brightness"
|
#define GST_TAG_CAPTURE_BRIGHTNESS "capture-brightness"
|
||||||
|
|
|
@ -928,6 +928,7 @@ me_gst_setup_view_pipeline (const gchar * filename, GdkWindow * window)
|
||||||
|
|
||||||
/* set elements's properties */
|
/* set elements's properties */
|
||||||
g_object_set (gst_source, "location", filename, NULL);
|
g_object_set (gst_source, "location", filename, NULL);
|
||||||
|
g_object_set (gst_metadata_demux, "parse-only", TRUE, NULL);
|
||||||
g_object_set (gst_video_sink, "force-aspect-ratio", TRUE, NULL);
|
g_object_set (gst_video_sink, "force-aspect-ratio", TRUE, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue