applemedia: rewrite VideoToolbox decoder based on GstVideoDecoder

This commit is contained in:
Alessandro Decina 2013-12-07 23:55:13 +01:00
parent 4a5a1e568e
commit b1a756fda7
4 changed files with 424 additions and 544 deletions

View file

@ -54,6 +54,10 @@ libgstapplemedia_la_LDFLAGS = \
-Wl,-framework -Wl,CoreVideo \
-Wl,-framework -Wl,AudioToolbox
if !HAVE_IOS
libgstapplemedia_la_LDFLAGS += -Wl,-framework -Wl,VideoToolbox
endif
noinst_HEADERS = \
qtkitvideosrc.h \
avfvideosrc.h \

View file

@ -32,11 +32,12 @@
#endif
#include "vth264decbin.h"
#include "vth264encbin.h"
#include "vtenc.h"
#include "vtdec.h"
#include "atdec.h"
#ifndef HAVE_IOS
void gst_vtenc_register_elements (GstPlugin * plugin);
static void
enable_mt_mode (void)
{
@ -76,8 +77,8 @@ plugin_init (GstPlugin * plugin)
res &= gst_element_register (plugin, "atdec", GST_RANK_PRIMARY, GST_TYPE_ATDEC);
#ifndef HAVE_IOS
res &= gst_element_register (plugin, "vtdec", GST_RANK_PRIMARY, GST_TYPE_VTDEC);
gst_vtenc_register_elements (plugin);
gst_vtdec_register_elements (plugin);
#endif
return res;

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 Ole André Vadla Ravnås <oleavr@soundrop.com>
/* GStreamer
* Copyright (C) 2010, 2013 Ole André Vadla Ravnås <oleavr@soundrop.com>
* Copyright (C) 2012, 2013 Alessandro Decina <alessandro.d@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -17,62 +18,42 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_VTDEC_H__
#define __GST_VTDEC_H__
#ifndef _GST_VTDEC_H_
#define _GST_VTDEC_H_
#include <gst/gst.h>
#include <gst/video/video.h>
#include "coremediactx.h"
#include <gst/video/gstvideodecoder.h>
#include <CoreMedia/CoreMedia.h>
#include <VideoToolbox/VideoToolbox.h>
G_BEGIN_DECLS
#define GST_VTDEC_CAST(obj) \
((GstVTDec *) (obj))
#define GST_VTDEC_CLASS_GET_CODEC_DETAILS(klass) \
((const GstVTDecoderDetails *) g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), \
GST_VTDEC_CODEC_DETAILS_QDATA))
#define GST_TYPE_VTDEC (gst_vtdec_get_type())
#define GST_VTDEC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VTDEC,GstVtdec))
#define GST_VTDEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VTDEC,GstVtdecClass))
#define GST_IS_VTDEC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VTDEC))
#define GST_IS_VTDEC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VTDEC))
typedef struct _GstVTDecoderDetails GstVTDecoderDetails;
typedef struct _GstVtdec GstVtdec;
typedef struct _GstVtdecClass GstVtdecClass;
typedef struct _GstVTDecClassParams GstVTDecClassParams;
typedef struct _GstVTDecClass GstVTDecClass;
typedef struct _GstVTDec GstVTDec;
struct _GstVTDecoderDetails
struct _GstVtdec
{
const gchar * name;
const gchar * element_name;
const gchar * mimetype;
VTFormatId format_id;
};
struct _GstVTDecClass
{
GstElementClass parent_class;
};
struct _GstVTDec
{
GstElement parent;
const GstVTDecoderDetails * details;
GstPad * sinkpad;
GstPad * srcpad;
GstCoreMediaCtx * ctx;
GstVideoInfo vinfo;
CMFormatDescriptionRef fmt_desc;
GstVideoDecoder base_vtdec;
GstVideoInfo video_info;
CMFormatDescriptionRef format_description;
VTDecompressionSessionRef session;
GQueue * cur_outbufs;
gboolean flush;
GAsyncQueue *reorder_queue;
gint reorder_queue_frame_delay;
};
void gst_vtdec_register_elements (GstPlugin * plugin);
struct _GstVtdecClass
{
GstVideoDecoderClass base_vtdec_class;
};
GType gst_vtdec_get_type (void);
G_END_DECLS
#endif /* __GST_VTDEC_H__ */
#endif