2002-11-06 23:53:46 +00:00
|
|
|
/* 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.
|
|
|
|
*/
|
|
|
|
|
2003-06-09 15:04:26 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2002-11-26 14:50:05 +00:00
|
|
|
#include "config.h"
|
2003-06-09 15:04:26 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <string.h>
|
2012-04-12 17:41:52 +00:00
|
|
|
#ifdef HAVE_LIBAV_UNINSTALLED
|
2002-11-26 14:50:05 +00:00
|
|
|
#include <avformat.h>
|
|
|
|
#else
|
2008-10-30 12:05:45 +00:00
|
|
|
#include <libavformat/avformat.h>
|
2002-11-26 14:50:05 +00:00
|
|
|
#endif
|
2002-11-06 23:53:46 +00:00
|
|
|
|
|
|
|
#include <gst/gst.h>
|
2012-04-17 13:36:12 +00:00
|
|
|
#include <gst/base/gstcollectpads.h>
|
2002-11-26 14:50:05 +00:00
|
|
|
|
2004-12-18 20:53:55 +00:00
|
|
|
#include "gstffmpeg.h"
|
2003-06-09 15:04:26 +00:00
|
|
|
#include "gstffmpegcodecmap.h"
|
2009-04-15 20:33:16 +00:00
|
|
|
#include "gstffmpegutils.h"
|
2003-06-09 15:04:26 +00:00
|
|
|
|
2002-11-06 23:53:46 +00:00
|
|
|
typedef struct _GstFFMpegMux GstFFMpegMux;
|
2006-09-08 15:25:51 +00:00
|
|
|
typedef struct _GstFFMpegMuxPad GstFFMpegMuxPad;
|
|
|
|
|
|
|
|
struct _GstFFMpegMuxPad
|
|
|
|
{
|
2012-04-17 13:36:12 +00:00
|
|
|
GstCollectData collect; /* we extend the CollectData */
|
2006-09-08 15:25:51 +00:00
|
|
|
|
|
|
|
gint padnum;
|
|
|
|
};
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2004-03-29 16:39:18 +00:00
|
|
|
struct _GstFFMpegMux
|
|
|
|
{
|
|
|
|
GstElement element;
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2012-04-17 13:36:12 +00:00
|
|
|
GstCollectPads *collect;
|
2002-11-06 23:53:46 +00:00
|
|
|
/* We need to keep track of our pads, so we do so here. */
|
2004-03-29 16:39:18 +00:00
|
|
|
GstPad *srcpad;
|
2003-06-09 15:04:26 +00:00
|
|
|
|
2004-03-29 16:39:18 +00:00
|
|
|
AVFormatContext *context;
|
|
|
|
gboolean opened;
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2011-11-04 11:43:17 +00:00
|
|
|
guint videopads, audiopads;
|
2006-09-08 15:25:51 +00:00
|
|
|
|
2007-02-09 16:17:50 +00:00
|
|
|
/*< private > */
|
2006-09-08 16:52:19 +00:00
|
|
|
/* event_function is the collectpads default eventfunction */
|
2007-02-09 16:17:50 +00:00
|
|
|
GstPadEventFunction event_function;
|
2009-03-05 07:52:11 +00:00
|
|
|
int preload;
|
|
|
|
int max_delay;
|
2002-11-06 23:53:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _GstFFMpegMuxClass GstFFMpegMuxClass;
|
|
|
|
|
2004-03-29 16:39:18 +00:00
|
|
|
struct _GstFFMpegMuxClass
|
|
|
|
{
|
|
|
|
GstElementClass parent_class;
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2004-03-29 16:39:18 +00:00
|
|
|
AVOutputFormat *in_plugin;
|
2002-11-06 23:53:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define GST_TYPE_FFMPEGMUX \
|
|
|
|
(gst_ffmpegdec_get_type())
|
|
|
|
#define GST_FFMPEGMUX(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGMUX,GstFFMpegMux))
|
|
|
|
#define GST_FFMPEGMUX_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGMUX,GstFFMpegMuxClass))
|
|
|
|
#define GST_IS_FFMPEGMUX(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGMUX))
|
2006-09-16 22:19:40 +00:00
|
|
|
#define GST_IS_FFMPEGMUX_CLASS(klass) \
|
2002-11-06 23:53:46 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGMUX))
|
|
|
|
|
2004-03-29 16:39:18 +00:00
|
|
|
enum
|
|
|
|
{
|
2002-11-06 23:53:46 +00:00
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2004-03-29 16:39:18 +00:00
|
|
|
enum
|
|
|
|
{
|
2002-11-06 23:53:46 +00:00
|
|
|
ARG_0,
|
|
|
|
/* FILL ME */
|
|
|
|
};
|
|
|
|
|
2009-03-05 07:52:11 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_PRELOAD,
|
|
|
|
PROP_MAXDELAY
|
|
|
|
};
|
|
|
|
|
2007-02-16 11:48:15 +00:00
|
|
|
/* A number of function prototypes are given so we can refer to them later. */
|
2004-03-29 16:39:18 +00:00
|
|
|
static void gst_ffmpegmux_class_init (GstFFMpegMuxClass * klass);
|
2006-09-08 15:25:51 +00:00
|
|
|
static void gst_ffmpegmux_base_init (gpointer g_class);
|
2007-02-09 16:17:50 +00:00
|
|
|
static void gst_ffmpegmux_init (GstFFMpegMux * ffmpegmux,
|
|
|
|
GstFFMpegMuxClass * g_class);
|
2005-05-01 10:15:33 +00:00
|
|
|
static void gst_ffmpegmux_finalize (GObject * object);
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2006-09-08 15:25:51 +00:00
|
|
|
static gboolean gst_ffmpegmux_setcaps (GstPad * pad, GstCaps * caps);
|
2004-03-29 16:39:18 +00:00
|
|
|
static GstPad *gst_ffmpegmux_request_new_pad (GstElement * element,
|
2011-06-02 14:23:19 +00:00
|
|
|
GstPadTemplate * templ, const gchar * name, const GstCaps * caps);
|
2012-04-17 13:36:12 +00:00
|
|
|
static GstFlowReturn gst_ffmpegmux_collected (GstCollectPads * pads,
|
2007-02-09 16:17:50 +00:00
|
|
|
gpointer user_data);
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2011-11-17 11:49:33 +00:00
|
|
|
static gboolean gst_ffmpegmux_sink_event (GstPad * pad, GstObject * parent,
|
|
|
|
GstEvent * event);
|
2006-09-08 16:52:19 +00:00
|
|
|
|
2005-09-05 14:06:29 +00:00
|
|
|
static GstStateChangeReturn gst_ffmpegmux_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2009-03-05 07:52:11 +00:00
|
|
|
static void gst_ffmpegmux_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_ffmpegmux_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
|
2009-11-02 07:49:43 +00:00
|
|
|
static GstCaps *gst_ffmpegmux_get_id_caps (enum CodecID *id_list);
|
|
|
|
static void gst_ffmpeg_mux_simple_caps_set_int_list (GstCaps * caps,
|
|
|
|
const gchar * field, guint num, const gint * values);
|
|
|
|
|
2012-04-12 17:41:52 +00:00
|
|
|
#define GST_FFMUX_PARAMS_QDATA g_quark_from_static_string("avmux-params")
|
2007-02-16 11:48:15 +00:00
|
|
|
|
2002-11-06 23:53:46 +00:00
|
|
|
static GstElementClass *parent_class = NULL;
|
|
|
|
|
|
|
|
/*static guint gst_ffmpegmux_signals[LAST_SIGNAL] = { 0 }; */
|
|
|
|
|
2010-06-25 22:59:24 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
const char *replacement;
|
|
|
|
} GstFFMpegMuxReplacement;
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
gst_ffmpegmux_get_replacement (const char *name)
|
|
|
|
{
|
|
|
|
static const GstFFMpegMuxReplacement blacklist[] = {
|
|
|
|
{"avi", "avimux"},
|
|
|
|
{"matroska", "matroskamux"},
|
|
|
|
{"mov", "qtmux"},
|
|
|
|
{"mpegts", "mpegtsmux"},
|
|
|
|
{"mp4", "mp4mux"},
|
|
|
|
{"mpjpeg", "multipartmux"},
|
|
|
|
{"ogg", "oggmux"},
|
|
|
|
{"wav", "wavenc"},
|
|
|
|
{"webm", "webmmux"},
|
|
|
|
{"mxf", "mxfmux"},
|
|
|
|
{"3gp", "gppmux"},
|
2010-07-06 11:58:05 +00:00
|
|
|
{"yuv4mpegpipe", "y4menc"},
|
|
|
|
{"aiff", "aiffmux"},
|
|
|
|
{"adts", "aacparse"},
|
|
|
|
{"asf", "asfmux"},
|
|
|
|
{"asf_stream", "asfmux"},
|
|
|
|
{"flv", "flvmux"},
|
|
|
|
{"mp3", "id3v2mux"},
|
|
|
|
{"mp2", "id3v2mux"}
|
2010-06-25 22:59:24 +00:00
|
|
|
};
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < sizeof (blacklist) / sizeof (blacklist[0]); i++) {
|
|
|
|
if (strcmp (blacklist[i].name, name) == 0) {
|
|
|
|
return blacklist[i].replacement;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-07-06 11:58:30 +00:00
|
|
|
static gboolean
|
|
|
|
gst_ffmpegmux_is_formatter (const char *name)
|
|
|
|
{
|
|
|
|
static const char *replace[] = {
|
|
|
|
"mp2", "mp3", NULL
|
|
|
|
};
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; replace[i]; i++)
|
|
|
|
if (strcmp (replace[i], name) == 0)
|
|
|
|
return TRUE;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2003-11-02 13:12:14 +00:00
|
|
|
static void
|
2006-09-08 15:25:51 +00:00
|
|
|
gst_ffmpegmux_base_init (gpointer g_class)
|
2003-11-02 13:12:14 +00:00
|
|
|
{
|
2006-09-08 15:25:51 +00:00
|
|
|
GstFFMpegMuxClass *klass = (GstFFMpegMuxClass *) g_class;
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
2003-11-02 13:12:14 +00:00
|
|
|
GstPadTemplate *videosinktempl, *audiosinktempl, *srctempl;
|
2009-11-02 07:49:43 +00:00
|
|
|
AVOutputFormat *in_plugin;
|
|
|
|
GstCaps *srccaps, *audiosinkcaps, *videosinkcaps;
|
|
|
|
enum CodecID *video_ids = NULL, *audio_ids = NULL;
|
2010-03-24 10:51:26 +00:00
|
|
|
gchar *longname, *description;
|
2010-06-25 22:59:24 +00:00
|
|
|
const char *replacement;
|
2010-07-06 11:58:30 +00:00
|
|
|
gboolean is_formatter;
|
2003-11-02 13:12:14 +00:00
|
|
|
|
2009-11-02 07:49:43 +00:00
|
|
|
in_plugin =
|
|
|
|
(AVOutputFormat *) g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
|
2007-02-16 11:48:15 +00:00
|
|
|
GST_FFMUX_PARAMS_QDATA);
|
2009-11-02 07:49:43 +00:00
|
|
|
g_assert (in_plugin != NULL);
|
2003-11-02 13:12:14 +00:00
|
|
|
|
|
|
|
/* construct the element details struct */
|
2010-06-25 22:59:24 +00:00
|
|
|
replacement = gst_ffmpegmux_get_replacement (in_plugin->name);
|
2010-07-06 11:58:30 +00:00
|
|
|
is_formatter = gst_ffmpegmux_is_formatter (in_plugin->name);
|
2010-06-25 22:59:24 +00:00
|
|
|
if (replacement != NULL) {
|
|
|
|
longname =
|
2012-04-12 17:41:52 +00:00
|
|
|
g_strdup_printf ("libav %s %s (not recommended, use %s instead)",
|
2010-07-06 11:58:30 +00:00
|
|
|
in_plugin->long_name, is_formatter ? "formatter" : "muxer",
|
|
|
|
replacement);
|
2010-06-25 22:59:24 +00:00
|
|
|
description =
|
2012-04-12 17:41:52 +00:00
|
|
|
g_strdup_printf ("libav %s %s (not recommended, use %s instead)",
|
2010-07-06 11:58:30 +00:00
|
|
|
in_plugin->long_name, is_formatter ? "formatter" : "muxer",
|
|
|
|
replacement);
|
2010-06-25 22:59:24 +00:00
|
|
|
} else {
|
2012-04-12 17:41:52 +00:00
|
|
|
longname = g_strdup_printf ("libav %s %s", in_plugin->long_name,
|
2010-07-06 11:58:30 +00:00
|
|
|
is_formatter ? "formatter" : "muxer");
|
2012-04-12 17:41:52 +00:00
|
|
|
description = g_strdup_printf ("libav %s %s", in_plugin->long_name,
|
2010-07-06 11:58:30 +00:00
|
|
|
is_formatter ? "formatter" : "muxer");
|
2010-06-25 22:59:24 +00:00
|
|
|
}
|
2012-04-09 23:59:24 +00:00
|
|
|
gst_element_class_set_metadata (element_class, longname,
|
2010-07-06 11:58:30 +00:00
|
|
|
is_formatter ? "Formatter/Metadata" : "Codec/Muxer", description,
|
2010-03-24 10:51:26 +00:00
|
|
|
"Wim Taymans <wim.taymans@chello.be>, "
|
|
|
|
"Ronald Bultje <rbultje@ronald.bitfreak.net>");
|
|
|
|
g_free (longname);
|
|
|
|
g_free (description);
|
2003-11-02 13:12:14 +00:00
|
|
|
|
2009-11-02 07:49:43 +00:00
|
|
|
/* Try to find the caps that belongs here */
|
|
|
|
srccaps = gst_ffmpeg_formatid_to_caps (in_plugin->name);
|
|
|
|
if (!srccaps) {
|
|
|
|
GST_DEBUG ("Couldn't get source caps for muxer '%s', skipping format",
|
|
|
|
in_plugin->name);
|
|
|
|
goto beach;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!gst_ffmpeg_formatid_get_codecids (in_plugin->name,
|
|
|
|
&video_ids, &audio_ids, in_plugin)) {
|
|
|
|
gst_caps_unref (srccaps);
|
|
|
|
GST_DEBUG
|
|
|
|
("Couldn't get sink caps for muxer '%s'. Most likely because no input format mapping exists.",
|
|
|
|
in_plugin->name);
|
|
|
|
goto beach;
|
|
|
|
}
|
|
|
|
|
|
|
|
videosinkcaps = video_ids ? gst_ffmpegmux_get_id_caps (video_ids) : NULL;
|
|
|
|
audiosinkcaps = audio_ids ? gst_ffmpegmux_get_id_caps (audio_ids) : NULL;
|
|
|
|
|
|
|
|
/* fix up allowed caps for some muxers */
|
|
|
|
/* FIXME : This should be in gstffmpegcodecmap.c ! */
|
|
|
|
if (strcmp (in_plugin->name, "flv") == 0) {
|
|
|
|
const gint rates[] = { 44100, 22050, 11025 };
|
|
|
|
|
|
|
|
gst_ffmpeg_mux_simple_caps_set_int_list (audiosinkcaps, "rate", 3, rates);
|
|
|
|
} else if (strcmp (in_plugin->name, "gif") == 0) {
|
|
|
|
if (videosinkcaps)
|
|
|
|
gst_caps_unref (videosinkcaps);
|
|
|
|
|
2011-08-19 16:33:11 +00:00
|
|
|
videosinkcaps = gst_caps_from_string ("video/x-raw, format=(string)RGB");
|
2009-11-02 07:49:43 +00:00
|
|
|
}
|
|
|
|
|
2003-11-02 13:12:14 +00:00
|
|
|
/* pad templates */
|
2009-11-02 07:49:43 +00:00
|
|
|
srctempl = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, srccaps);
|
2003-11-02 13:12:14 +00:00
|
|
|
gst_element_class_add_pad_template (element_class, srctempl);
|
2006-11-14 12:34:20 +00:00
|
|
|
|
2009-11-02 07:49:43 +00:00
|
|
|
if (audiosinkcaps) {
|
2011-11-04 11:43:17 +00:00
|
|
|
audiosinktempl = gst_pad_template_new ("audio_%u",
|
2009-11-02 07:49:43 +00:00
|
|
|
GST_PAD_SINK, GST_PAD_REQUEST, audiosinkcaps);
|
2006-11-14 12:34:20 +00:00
|
|
|
gst_element_class_add_pad_template (element_class, audiosinktempl);
|
|
|
|
}
|
|
|
|
|
2009-11-02 07:49:43 +00:00
|
|
|
if (videosinkcaps) {
|
2011-11-04 11:43:17 +00:00
|
|
|
videosinktempl = gst_pad_template_new ("video_%u",
|
2009-11-02 07:49:43 +00:00
|
|
|
GST_PAD_SINK, GST_PAD_REQUEST, videosinkcaps);
|
2006-11-14 12:34:20 +00:00
|
|
|
gst_element_class_add_pad_template (element_class, videosinktempl);
|
|
|
|
}
|
2003-11-02 13:12:14 +00:00
|
|
|
|
2009-11-02 07:49:43 +00:00
|
|
|
beach:
|
|
|
|
klass->in_plugin = in_plugin;
|
2003-11-02 13:12:14 +00:00
|
|
|
}
|
|
|
|
|
2002-11-06 23:53:46 +00:00
|
|
|
static void
|
2004-03-29 16:39:18 +00:00
|
|
|
gst_ffmpegmux_class_init (GstFFMpegMuxClass * klass)
|
2002-11-06 23:53:46 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
2004-03-29 16:39:18 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2006-04-08 21:55:22 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2009-03-05 07:52:11 +00:00
|
|
|
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_ffmpegmux_set_property);
|
|
|
|
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_ffmpegmux_get_property);
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_PRELOAD,
|
|
|
|
g_param_spec_int ("preload", "preload",
|
|
|
|
"Set the initial demux-decode delay (in microseconds)", 0, G_MAXINT,
|
2010-10-19 14:26:08 +00:00
|
|
|
0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2009-03-05 07:52:11 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_MAXDELAY,
|
|
|
|
g_param_spec_int ("maxdelay", "maxdelay",
|
|
|
|
"Set the maximum demux-decode delay (in microseconds)", 0, G_MAXINT,
|
2010-10-19 14:26:08 +00:00
|
|
|
0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2009-03-05 07:52:11 +00:00
|
|
|
|
2003-06-09 15:04:26 +00:00
|
|
|
gstelement_class->request_new_pad = gst_ffmpegmux_request_new_pad;
|
|
|
|
gstelement_class->change_state = gst_ffmpegmux_change_state;
|
2005-05-01 10:15:33 +00:00
|
|
|
gobject_class->finalize = gst_ffmpegmux_finalize;
|
2002-11-06 23:53:46 +00:00
|
|
|
}
|
|
|
|
|
2003-06-09 15:04:26 +00:00
|
|
|
static void
|
2006-09-08 15:25:51 +00:00
|
|
|
gst_ffmpegmux_init (GstFFMpegMux * ffmpegmux, GstFFMpegMuxClass * g_class)
|
2002-11-06 23:53:46 +00:00
|
|
|
{
|
2006-09-08 15:25:51 +00:00
|
|
|
GstElementClass *klass = GST_ELEMENT_CLASS (g_class);
|
2004-03-29 16:39:18 +00:00
|
|
|
GstFFMpegMuxClass *oclass = (GstFFMpegMuxClass *) klass;
|
HACKING: Add some basic documentation on how our wrapping works.
Original commit message from CVS:
* HACKING:
Add some basic documentation on how our wrapping works.
* TODO:
Add a list of things that could be worked on or that need doing.
* configure.ac:
Update snapshot.
* ext/ffmpeg/Makefile.am:
Changne .la links. See below (autotools patch).
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable demuxers. See below (gstffmpegdemux.c).
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):
Realmedia caused a crash - fix that.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_averror),
(gst_ffmpegdemux_base_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_dispose),
(gst_ffmpegdemux_stream_from_pad),
(gst_ffmpegdemux_src_event_mask), (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list),
(gst_ffmpegdemux_src_query_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_open), (gst_ffmpegdemux_loop),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Right. OK, so I fixed up the demuxing and have it basically-working,
and the best way to get some more people to test it is to actually
enable it. I'm not sure if we want this for 0.8.0, but we can at
least give it a try. I've tested avi, matroska and mpeg, all appear
to work. The cool thing is that this gives us instant support for
several exotic formats that we'd never care about ourselves. Again,
this needs more testing for it to still be enabled in 0.8.0, but I
want to give it a try...
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init),
(gst_ffmpegmux_init), (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
Add some fixups that I use locally. Make it work in the case of
MPEG encoding, but the muxer is still not in shape to be enabled.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_read), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Some small fixups that crept into it while it was disabled for the
last few years. Basically works.
* gst-libs/ext/ffmpeg/Makefile.am:
Instead of having our local-autotoolized version, I patch the ffmpeg
source to be fully autotoolized. That means a simple SUBDIRS here
is now enough.
* gst-libs/ext/ffmpeg/Tag:
Version update.
* gst-libs/ext/ffmpeg/patch/autotools.diff:
Autotoolize ffmpeg. Needs to be sent to ffmpeg-devel@...
* gst-libs/ext/ffmpeg/patch/disableinstalllibs.diff:
Don't install their libs.
* gst-libs/ext/ffmpeg/patch/disablemmx.diff:
Don't use MMX. It cannot ocmpile using PIC.
* gst-libs/ext/ffmpeg/patch/disabletools.diff:
Don't compile/install their tools, we don't use them.
* gst-libs/ext/ffmpeg/patch/functions.diff:
Prevent symbol conflicts.
* gst-libs/ext/ffmpeg/patch/matroska.diff:
Add a matroska demuxer. Needs to be sent to ffmpeg-devel@...
2004-03-01 04:59:17 +00:00
|
|
|
GstPadTemplate *templ = gst_element_class_get_pad_template (klass, "src");
|
2002-11-06 23:53:46 +00:00
|
|
|
|
HACKING: Add some basic documentation on how our wrapping works.
Original commit message from CVS:
* HACKING:
Add some basic documentation on how our wrapping works.
* TODO:
Add a list of things that could be worked on or that need doing.
* configure.ac:
Update snapshot.
* ext/ffmpeg/Makefile.am:
Changne .la links. See below (autotools patch).
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable demuxers. See below (gstffmpegdemux.c).
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):
Realmedia caused a crash - fix that.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_averror),
(gst_ffmpegdemux_base_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_dispose),
(gst_ffmpegdemux_stream_from_pad),
(gst_ffmpegdemux_src_event_mask), (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list),
(gst_ffmpegdemux_src_query_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_open), (gst_ffmpegdemux_loop),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Right. OK, so I fixed up the demuxing and have it basically-working,
and the best way to get some more people to test it is to actually
enable it. I'm not sure if we want this for 0.8.0, but we can at
least give it a try. I've tested avi, matroska and mpeg, all appear
to work. The cool thing is that this gives us instant support for
several exotic formats that we'd never care about ourselves. Again,
this needs more testing for it to still be enabled in 0.8.0, but I
want to give it a try...
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init),
(gst_ffmpegmux_init), (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
Add some fixups that I use locally. Make it work in the case of
MPEG encoding, but the muxer is still not in shape to be enabled.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_read), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Some small fixups that crept into it while it was disabled for the
last few years. Basically works.
* gst-libs/ext/ffmpeg/Makefile.am:
Instead of having our local-autotoolized version, I patch the ffmpeg
source to be fully autotoolized. That means a simple SUBDIRS here
is now enough.
* gst-libs/ext/ffmpeg/Tag:
Version update.
* gst-libs/ext/ffmpeg/patch/autotools.diff:
Autotoolize ffmpeg. Needs to be sent to ffmpeg-devel@...
* gst-libs/ext/ffmpeg/patch/disableinstalllibs.diff:
Don't install their libs.
* gst-libs/ext/ffmpeg/patch/disablemmx.diff:
Don't use MMX. It cannot ocmpile using PIC.
* gst-libs/ext/ffmpeg/patch/disabletools.diff:
Don't compile/install their tools, we don't use them.
* gst-libs/ext/ffmpeg/patch/functions.diff:
Prevent symbol conflicts.
* gst-libs/ext/ffmpeg/patch/matroska.diff:
Add a matroska demuxer. Needs to be sent to ffmpeg-devel@...
2004-03-01 04:59:17 +00:00
|
|
|
ffmpegmux->srcpad = gst_pad_new_from_template (templ, "src");
|
2009-03-15 09:19:53 +00:00
|
|
|
gst_pad_set_caps (ffmpegmux->srcpad, gst_pad_template_get_caps (templ));
|
2004-03-29 16:39:18 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (ffmpegmux), ffmpegmux->srcpad);
|
2003-06-09 15:04:26 +00:00
|
|
|
|
2012-04-17 13:36:12 +00:00
|
|
|
ffmpegmux->collect = gst_collect_pads_new ();
|
|
|
|
gst_collect_pads_set_function (ffmpegmux->collect,
|
|
|
|
(GstCollectPadsFunction) gst_ffmpegmux_collected, ffmpegmux);
|
2006-09-08 15:25:51 +00:00
|
|
|
|
2003-06-09 15:04:26 +00:00
|
|
|
ffmpegmux->context = g_new0 (AVFormatContext, 1);
|
|
|
|
ffmpegmux->context->oformat = oclass->in_plugin;
|
|
|
|
ffmpegmux->context->nb_streams = 0;
|
2007-11-08 14:44:36 +00:00
|
|
|
g_snprintf (ffmpegmux->context->filename,
|
2004-03-29 16:39:18 +00:00
|
|
|
sizeof (ffmpegmux->context->filename),
|
|
|
|
"gstreamer://%p", ffmpegmux->srcpad);
|
2003-06-09 15:04:26 +00:00
|
|
|
ffmpegmux->opened = FALSE;
|
|
|
|
|
|
|
|
ffmpegmux->videopads = 0;
|
|
|
|
ffmpegmux->audiopads = 0;
|
2009-03-05 07:52:11 +00:00
|
|
|
ffmpegmux->preload = 0;
|
|
|
|
ffmpegmux->max_delay = 0;
|
2003-06-09 15:04:26 +00:00
|
|
|
}
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2009-03-05 07:52:11 +00:00
|
|
|
static void
|
|
|
|
gst_ffmpegmux_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstFFMpegMux *src;
|
|
|
|
|
|
|
|
src = (GstFFMpegMux *) object;
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_PRELOAD:
|
|
|
|
src->preload = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case PROP_MAXDELAY:
|
|
|
|
src->max_delay = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ffmpegmux_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstFFMpegMux *src;
|
|
|
|
|
|
|
|
src = (GstFFMpegMux *) object;
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_PRELOAD:
|
|
|
|
g_value_set_int (value, src->preload);
|
|
|
|
break;
|
|
|
|
case PROP_MAXDELAY:
|
|
|
|
g_value_set_int (value, src->max_delay);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-06-09 15:04:26 +00:00
|
|
|
static void
|
2005-05-01 10:15:33 +00:00
|
|
|
gst_ffmpegmux_finalize (GObject * object)
|
2003-06-09 15:04:26 +00:00
|
|
|
{
|
|
|
|
GstFFMpegMux *ffmpegmux = (GstFFMpegMux *) object;
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2003-06-09 15:04:26 +00:00
|
|
|
g_free (ffmpegmux->context);
|
2006-09-08 15:25:51 +00:00
|
|
|
gst_object_unref (ffmpegmux->collect);
|
2005-05-01 10:15:33 +00:00
|
|
|
|
|
|
|
if (G_OBJECT_CLASS (parent_class)->finalize)
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2002-11-06 23:53:46 +00:00
|
|
|
}
|
|
|
|
|
2003-06-09 15:04:26 +00:00
|
|
|
static GstPad *
|
2004-03-29 16:39:18 +00:00
|
|
|
gst_ffmpegmux_request_new_pad (GstElement * element,
|
2011-06-02 14:23:19 +00:00
|
|
|
GstPadTemplate * templ, const gchar * name, const GstCaps * caps)
|
2002-11-06 23:53:46 +00:00
|
|
|
{
|
2003-06-09 15:04:26 +00:00
|
|
|
GstFFMpegMux *ffmpegmux = (GstFFMpegMux *) element;
|
HACKING: Add some basic documentation on how our wrapping works.
Original commit message from CVS:
* HACKING:
Add some basic documentation on how our wrapping works.
* TODO:
Add a list of things that could be worked on or that need doing.
* configure.ac:
Update snapshot.
* ext/ffmpeg/Makefile.am:
Changne .la links. See below (autotools patch).
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable demuxers. See below (gstffmpegdemux.c).
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):
Realmedia caused a crash - fix that.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_averror),
(gst_ffmpegdemux_base_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_dispose),
(gst_ffmpegdemux_stream_from_pad),
(gst_ffmpegdemux_src_event_mask), (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list),
(gst_ffmpegdemux_src_query_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_open), (gst_ffmpegdemux_loop),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Right. OK, so I fixed up the demuxing and have it basically-working,
and the best way to get some more people to test it is to actually
enable it. I'm not sure if we want this for 0.8.0, but we can at
least give it a try. I've tested avi, matroska and mpeg, all appear
to work. The cool thing is that this gives us instant support for
several exotic formats that we'd never care about ourselves. Again,
this needs more testing for it to still be enabled in 0.8.0, but I
want to give it a try...
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init),
(gst_ffmpegmux_init), (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
Add some fixups that I use locally. Make it work in the case of
MPEG encoding, but the muxer is still not in shape to be enabled.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_read), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Some small fixups that crept into it while it was disabled for the
last few years. Basically works.
* gst-libs/ext/ffmpeg/Makefile.am:
Instead of having our local-autotoolized version, I patch the ffmpeg
source to be fully autotoolized. That means a simple SUBDIRS here
is now enough.
* gst-libs/ext/ffmpeg/Tag:
Version update.
* gst-libs/ext/ffmpeg/patch/autotools.diff:
Autotoolize ffmpeg. Needs to be sent to ffmpeg-devel@...
* gst-libs/ext/ffmpeg/patch/disableinstalllibs.diff:
Don't install their libs.
* gst-libs/ext/ffmpeg/patch/disablemmx.diff:
Don't use MMX. It cannot ocmpile using PIC.
* gst-libs/ext/ffmpeg/patch/disabletools.diff:
Don't compile/install their tools, we don't use them.
* gst-libs/ext/ffmpeg/patch/functions.diff:
Prevent symbol conflicts.
* gst-libs/ext/ffmpeg/patch/matroska.diff:
Add a matroska demuxer. Needs to be sent to ffmpeg-devel@...
2004-03-01 04:59:17 +00:00
|
|
|
GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
|
2006-09-08 15:25:51 +00:00
|
|
|
GstFFMpegMuxPad *collect_pad;
|
2003-06-09 15:04:26 +00:00
|
|
|
gchar *padname;
|
|
|
|
GstPad *pad;
|
|
|
|
AVStream *st;
|
2011-04-19 17:29:57 +00:00
|
|
|
enum AVMediaType type;
|
2006-09-08 15:25:51 +00:00
|
|
|
gint bitrate = 0, framesize = 0;
|
2003-06-09 15:04:26 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (templ != NULL, NULL);
|
|
|
|
g_return_val_if_fail (templ->direction == GST_PAD_SINK, NULL);
|
|
|
|
g_return_val_if_fail (ffmpegmux->opened == FALSE, NULL);
|
|
|
|
|
|
|
|
/* figure out a name that *we* like */
|
2011-11-04 11:43:17 +00:00
|
|
|
if (templ == gst_element_class_get_pad_template (klass, "video_%u")) {
|
|
|
|
padname = g_strdup_printf ("video_%u", ffmpegmux->videopads++);
|
2011-04-19 17:29:57 +00:00
|
|
|
type = AVMEDIA_TYPE_VIDEO;
|
HACKING: Add some basic documentation on how our wrapping works.
Original commit message from CVS:
* HACKING:
Add some basic documentation on how our wrapping works.
* TODO:
Add a list of things that could be worked on or that need doing.
* configure.ac:
Update snapshot.
* ext/ffmpeg/Makefile.am:
Changne .la links. See below (autotools patch).
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable demuxers. See below (gstffmpegdemux.c).
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):
Realmedia caused a crash - fix that.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_averror),
(gst_ffmpegdemux_base_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_dispose),
(gst_ffmpegdemux_stream_from_pad),
(gst_ffmpegdemux_src_event_mask), (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list),
(gst_ffmpegdemux_src_query_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_open), (gst_ffmpegdemux_loop),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Right. OK, so I fixed up the demuxing and have it basically-working,
and the best way to get some more people to test it is to actually
enable it. I'm not sure if we want this for 0.8.0, but we can at
least give it a try. I've tested avi, matroska and mpeg, all appear
to work. The cool thing is that this gives us instant support for
several exotic formats that we'd never care about ourselves. Again,
this needs more testing for it to still be enabled in 0.8.0, but I
want to give it a try...
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init),
(gst_ffmpegmux_init), (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
Add some fixups that I use locally. Make it work in the case of
MPEG encoding, but the muxer is still not in shape to be enabled.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_read), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Some small fixups that crept into it while it was disabled for the
last few years. Basically works.
* gst-libs/ext/ffmpeg/Makefile.am:
Instead of having our local-autotoolized version, I patch the ffmpeg
source to be fully autotoolized. That means a simple SUBDIRS here
is now enough.
* gst-libs/ext/ffmpeg/Tag:
Version update.
* gst-libs/ext/ffmpeg/patch/autotools.diff:
Autotoolize ffmpeg. Needs to be sent to ffmpeg-devel@...
* gst-libs/ext/ffmpeg/patch/disableinstalllibs.diff:
Don't install their libs.
* gst-libs/ext/ffmpeg/patch/disablemmx.diff:
Don't use MMX. It cannot ocmpile using PIC.
* gst-libs/ext/ffmpeg/patch/disabletools.diff:
Don't compile/install their tools, we don't use them.
* gst-libs/ext/ffmpeg/patch/functions.diff:
Prevent symbol conflicts.
* gst-libs/ext/ffmpeg/patch/matroska.diff:
Add a matroska demuxer. Needs to be sent to ffmpeg-devel@...
2004-03-01 04:59:17 +00:00
|
|
|
bitrate = 64 * 1024;
|
|
|
|
framesize = 1152;
|
2011-11-04 11:43:17 +00:00
|
|
|
} else if (templ == gst_element_class_get_pad_template (klass, "audio_%u")) {
|
|
|
|
padname = g_strdup_printf ("audio_%u", ffmpegmux->audiopads++);
|
2011-04-19 17:29:57 +00:00
|
|
|
type = AVMEDIA_TYPE_AUDIO;
|
HACKING: Add some basic documentation on how our wrapping works.
Original commit message from CVS:
* HACKING:
Add some basic documentation on how our wrapping works.
* TODO:
Add a list of things that could be worked on or that need doing.
* configure.ac:
Update snapshot.
* ext/ffmpeg/Makefile.am:
Changne .la links. See below (autotools patch).
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable demuxers. See below (gstffmpegdemux.c).
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):
Realmedia caused a crash - fix that.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_averror),
(gst_ffmpegdemux_base_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_dispose),
(gst_ffmpegdemux_stream_from_pad),
(gst_ffmpegdemux_src_event_mask), (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list),
(gst_ffmpegdemux_src_query_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_open), (gst_ffmpegdemux_loop),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Right. OK, so I fixed up the demuxing and have it basically-working,
and the best way to get some more people to test it is to actually
enable it. I'm not sure if we want this for 0.8.0, but we can at
least give it a try. I've tested avi, matroska and mpeg, all appear
to work. The cool thing is that this gives us instant support for
several exotic formats that we'd never care about ourselves. Again,
this needs more testing for it to still be enabled in 0.8.0, but I
want to give it a try...
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init),
(gst_ffmpegmux_init), (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
Add some fixups that I use locally. Make it work in the case of
MPEG encoding, but the muxer is still not in shape to be enabled.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_read), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Some small fixups that crept into it while it was disabled for the
last few years. Basically works.
* gst-libs/ext/ffmpeg/Makefile.am:
Instead of having our local-autotoolized version, I patch the ffmpeg
source to be fully autotoolized. That means a simple SUBDIRS here
is now enough.
* gst-libs/ext/ffmpeg/Tag:
Version update.
* gst-libs/ext/ffmpeg/patch/autotools.diff:
Autotoolize ffmpeg. Needs to be sent to ffmpeg-devel@...
* gst-libs/ext/ffmpeg/patch/disableinstalllibs.diff:
Don't install their libs.
* gst-libs/ext/ffmpeg/patch/disablemmx.diff:
Don't use MMX. It cannot ocmpile using PIC.
* gst-libs/ext/ffmpeg/patch/disabletools.diff:
Don't compile/install their tools, we don't use them.
* gst-libs/ext/ffmpeg/patch/functions.diff:
Prevent symbol conflicts.
* gst-libs/ext/ffmpeg/patch/matroska.diff:
Add a matroska demuxer. Needs to be sent to ffmpeg-devel@...
2004-03-01 04:59:17 +00:00
|
|
|
bitrate = 285 * 1024;
|
2003-06-09 15:04:26 +00:00
|
|
|
} else {
|
2012-04-12 17:41:52 +00:00
|
|
|
g_warning ("avmux: unknown pad template!");
|
2003-06-09 15:04:26 +00:00
|
|
|
return NULL;
|
2002-11-06 23:53:46 +00:00
|
|
|
}
|
|
|
|
|
2003-06-09 15:04:26 +00:00
|
|
|
/* create pad */
|
|
|
|
pad = gst_pad_new_from_template (templ, padname);
|
2006-09-08 15:25:51 +00:00
|
|
|
collect_pad = (GstFFMpegMuxPad *)
|
2012-04-17 13:36:12 +00:00
|
|
|
gst_collect_pads_add_pad (ffmpegmux->collect, pad,
|
2007-02-09 16:17:50 +00:00
|
|
|
sizeof (GstFFMpegMuxPad));
|
2006-09-08 15:25:51 +00:00
|
|
|
collect_pad->padnum = ffmpegmux->context->nb_streams;
|
|
|
|
|
2006-09-08 16:52:19 +00:00
|
|
|
/* small hack to put our own event pad function and chain up to collect pad */
|
2007-02-09 16:17:50 +00:00
|
|
|
ffmpegmux->event_function = GST_PAD_EVENTFUNC (pad);
|
|
|
|
gst_pad_set_event_function (pad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_ffmpegmux_sink_event));
|
2006-09-08 16:52:19 +00:00
|
|
|
|
2003-06-09 15:04:26 +00:00
|
|
|
gst_element_add_pad (element, pad);
|
|
|
|
|
|
|
|
/* AVStream needs to be created */
|
2006-09-08 15:25:51 +00:00
|
|
|
st = av_new_stream (ffmpegmux->context, collect_pad->padnum);
|
ext/: Update to ffmpeg snapshot of Jul 20 2005 4:00 PM GMT. Mostly some added codecs, some API changes, etc. Also add...
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.h:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_caps_to_pixfmt), (gst_ffmpeg_formatid_get_codecids),
(gst_ffmpeg_caps_to_codecid), (gst_ffmpeg_get_codecid_longname),
(gst_ffmpeg_img_convert):
* ext/ffmpeg/gstffmpegcodecmap.h:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_chain),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegdeinterlace.c:
(gst_ffmpegdeinterlace_getcaps), (gst_ffmpegdeinterlace_pad_link):
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_link), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_write):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_pad_link):
* ext/libpostproc/gstpostproc.c: (gst_postproc_chain):
Update to ffmpeg snapshot of Jul 20 2005 4:00 PM GMT. Mostly
some added codecs, some API changes, etc. Also adds a VOB muxer
for MPEG-2 video and adds h264 to .mp4 muxing.
2005-07-20 15:40:57 +00:00
|
|
|
st->codec->codec_type = type;
|
2007-02-09 16:17:50 +00:00
|
|
|
st->codec->codec_id = CODEC_ID_NONE; /* this is a check afterwards */
|
2004-03-29 16:39:18 +00:00
|
|
|
st->stream_copy = 1; /* we're not the actual encoder */
|
ext/: Update to ffmpeg snapshot of Jul 20 2005 4:00 PM GMT. Mostly some added codecs, some API changes, etc. Also add...
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.h:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_caps_to_pixfmt), (gst_ffmpeg_formatid_get_codecids),
(gst_ffmpeg_caps_to_codecid), (gst_ffmpeg_get_codecid_longname),
(gst_ffmpeg_img_convert):
* ext/ffmpeg/gstffmpegcodecmap.h:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_chain),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegdeinterlace.c:
(gst_ffmpegdeinterlace_getcaps), (gst_ffmpegdeinterlace_pad_link):
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_link), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_write):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_pad_link):
* ext/libpostproc/gstpostproc.c: (gst_postproc_chain):
Update to ffmpeg snapshot of Jul 20 2005 4:00 PM GMT. Mostly
some added codecs, some API changes, etc. Also adds a VOB muxer
for MPEG-2 video and adds h264 to .mp4 muxing.
2005-07-20 15:40:57 +00:00
|
|
|
st->codec->bit_rate = bitrate;
|
|
|
|
st->codec->frame_size = framesize;
|
HACKING: Add some basic documentation on how our wrapping works.
Original commit message from CVS:
* HACKING:
Add some basic documentation on how our wrapping works.
* TODO:
Add a list of things that could be worked on or that need doing.
* configure.ac:
Update snapshot.
* ext/ffmpeg/Makefile.am:
Changne .la links. See below (autotools patch).
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable demuxers. See below (gstffmpegdemux.c).
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):
Realmedia caused a crash - fix that.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_averror),
(gst_ffmpegdemux_base_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_dispose),
(gst_ffmpegdemux_stream_from_pad),
(gst_ffmpegdemux_src_event_mask), (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list),
(gst_ffmpegdemux_src_query_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_open), (gst_ffmpegdemux_loop),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Right. OK, so I fixed up the demuxing and have it basically-working,
and the best way to get some more people to test it is to actually
enable it. I'm not sure if we want this for 0.8.0, but we can at
least give it a try. I've tested avi, matroska and mpeg, all appear
to work. The cool thing is that this gives us instant support for
several exotic formats that we'd never care about ourselves. Again,
this needs more testing for it to still be enabled in 0.8.0, but I
want to give it a try...
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init),
(gst_ffmpegmux_init), (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
Add some fixups that I use locally. Make it work in the case of
MPEG encoding, but the muxer is still not in shape to be enabled.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_read), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Some small fixups that crept into it while it was disabled for the
last few years. Basically works.
* gst-libs/ext/ffmpeg/Makefile.am:
Instead of having our local-autotoolized version, I patch the ffmpeg
source to be fully autotoolized. That means a simple SUBDIRS here
is now enough.
* gst-libs/ext/ffmpeg/Tag:
Version update.
* gst-libs/ext/ffmpeg/patch/autotools.diff:
Autotoolize ffmpeg. Needs to be sent to ffmpeg-devel@...
* gst-libs/ext/ffmpeg/patch/disableinstalllibs.diff:
Don't install their libs.
* gst-libs/ext/ffmpeg/patch/disablemmx.diff:
Don't use MMX. It cannot ocmpile using PIC.
* gst-libs/ext/ffmpeg/patch/disabletools.diff:
Don't compile/install their tools, we don't use them.
* gst-libs/ext/ffmpeg/patch/functions.diff:
Prevent symbol conflicts.
* gst-libs/ext/ffmpeg/patch/matroska.diff:
Add a matroska demuxer. Needs to be sent to ffmpeg-devel@...
2004-03-01 04:59:17 +00:00
|
|
|
/* we fill in codec during capsnego */
|
2003-06-09 15:04:26 +00:00
|
|
|
|
|
|
|
/* we love debug output (c) (tm) (r) */
|
2012-04-12 17:41:52 +00:00
|
|
|
GST_DEBUG ("Created %s pad for avmux_%s element",
|
2009-06-17 06:22:14 +00:00
|
|
|
padname, ((GstFFMpegMuxClass *) klass)->in_plugin->name);
|
2003-06-09 15:04:26 +00:00
|
|
|
g_free (padname);
|
|
|
|
|
|
|
|
return pad;
|
2002-11-06 23:53:46 +00:00
|
|
|
}
|
|
|
|
|
2006-09-08 15:25:51 +00:00
|
|
|
/**
|
|
|
|
* gst_ffmpegmux_setcaps
|
|
|
|
* @pad: #GstPad
|
|
|
|
* @caps: New caps.
|
|
|
|
*
|
|
|
|
* Set caps to pad.
|
|
|
|
*
|
|
|
|
* Returns: #TRUE on success.
|
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
gst_ffmpegmux_setcaps (GstPad * pad, GstCaps * caps)
|
2002-11-06 23:53:46 +00:00
|
|
|
{
|
2004-03-29 16:39:18 +00:00
|
|
|
GstFFMpegMux *ffmpegmux = (GstFFMpegMux *) (gst_pad_get_parent (pad));
|
2006-09-08 15:25:51 +00:00
|
|
|
GstFFMpegMuxPad *collect_pad;
|
2003-06-09 15:04:26 +00:00
|
|
|
AVStream *st;
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2006-09-08 15:25:51 +00:00
|
|
|
collect_pad = (GstFFMpegMuxPad *) gst_pad_get_element_private (pad);
|
|
|
|
|
|
|
|
st = ffmpegmux->context->streams[collect_pad->padnum];
|
2009-03-05 07:52:11 +00:00
|
|
|
ffmpegmux->context->preload = ffmpegmux->preload;
|
|
|
|
ffmpegmux->context->max_delay = ffmpegmux->max_delay;
|
2003-06-09 15:04:26 +00:00
|
|
|
|
|
|
|
/* for the format-specific guesses, we'll go to
|
|
|
|
* our famous codec mapper */
|
2008-11-11 17:18:46 +00:00
|
|
|
if (gst_ffmpeg_caps_to_codecid (caps, st->codec) == CODEC_ID_NONE)
|
|
|
|
goto not_accepted;
|
2009-01-27 10:39:18 +00:00
|
|
|
|
2008-11-11 17:18:46 +00:00
|
|
|
/* copy over the aspect ratios, ffmpeg expects the stream aspect to match the
|
|
|
|
* codec aspect. */
|
|
|
|
st->sample_aspect_ratio = st->codec->sample_aspect_ratio;
|
2009-01-27 10:39:18 +00:00
|
|
|
|
2008-11-11 17:18:46 +00:00
|
|
|
GST_LOG_OBJECT (pad, "accepted caps %" GST_PTR_FORMAT, caps);
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
not_accepted:
|
|
|
|
{
|
|
|
|
GST_LOG_OBJECT (pad, "rejecting caps %" GST_PTR_FORMAT, caps);
|
|
|
|
return FALSE;
|
2004-03-29 16:39:18 +00:00
|
|
|
}
|
2002-11-06 23:53:46 +00:00
|
|
|
}
|
|
|
|
|
2006-09-08 15:25:51 +00:00
|
|
|
|
2006-09-08 16:52:19 +00:00
|
|
|
static gboolean
|
2011-11-17 11:49:33 +00:00
|
|
|
gst_ffmpegmux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
2006-09-08 16:52:19 +00:00
|
|
|
{
|
2011-11-17 11:49:33 +00:00
|
|
|
GstFFMpegMux *ffmpegmux = (GstFFMpegMux *) parent;
|
2006-09-08 16:52:19 +00:00
|
|
|
gboolean res = TRUE;
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
2007-02-09 16:17:50 +00:00
|
|
|
case GST_EVENT_TAG:{
|
2008-12-16 14:24:05 +00:00
|
|
|
GstTagList *taglist;
|
|
|
|
GstTagSetter *setter = GST_TAG_SETTER (ffmpegmux);
|
|
|
|
const GstTagMergeMode mode = gst_tag_setter_get_tag_merge_mode (setter);
|
2007-02-09 16:17:50 +00:00
|
|
|
|
|
|
|
gst_event_parse_tag (event, &taglist);
|
2008-12-16 14:24:05 +00:00
|
|
|
gst_tag_setter_merge_tags (setter, taglist, mode);
|
2007-02-09 16:17:50 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-06-08 16:04:07 +00:00
|
|
|
case GST_EVENT_CAPS:{
|
|
|
|
GstCaps *caps;
|
|
|
|
gst_event_parse_caps (event, &caps);
|
|
|
|
if (!(res = gst_ffmpegmux_setcaps (pad, caps)))
|
|
|
|
goto beach;
|
|
|
|
break;
|
|
|
|
}
|
2007-02-09 16:17:50 +00:00
|
|
|
default:
|
|
|
|
break;
|
2006-09-08 16:52:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* chaining up to collectpads default event function */
|
2011-11-17 11:49:33 +00:00
|
|
|
res = ffmpegmux->event_function (pad, parent, event);
|
2006-09-08 16:52:19 +00:00
|
|
|
|
2011-06-08 16:04:07 +00:00
|
|
|
beach:
|
2006-09-08 16:52:19 +00:00
|
|
|
return res;
|
|
|
|
}
|
2006-09-08 15:25:51 +00:00
|
|
|
|
|
|
|
static GstFlowReturn
|
2012-04-17 13:36:12 +00:00
|
|
|
gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
|
2006-09-08 15:25:51 +00:00
|
|
|
{
|
|
|
|
GstFFMpegMux *ffmpegmux = (GstFFMpegMux *) user_data;
|
|
|
|
GSList *collected;
|
|
|
|
GstFFMpegMuxPad *best_pad;
|
|
|
|
GstClockTime best_time;
|
2011-04-20 15:37:34 +00:00
|
|
|
#if 0
|
|
|
|
/* Re-enable once converted to new AVMetaData API
|
|
|
|
* See #566605
|
|
|
|
*/
|
2008-12-16 14:24:05 +00:00
|
|
|
const GstTagList *tags;
|
2011-04-20 15:37:34 +00:00
|
|
|
#endif
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2003-06-09 15:04:26 +00:00
|
|
|
/* open "file" (gstreamer protocol to next element) */
|
|
|
|
if (!ffmpegmux->opened) {
|
2005-07-11 12:34:18 +00:00
|
|
|
int open_flags = URL_WRONLY;
|
ext/ffmpeg/gstffmpeg.c: Enable muxers (only mp4 muxer for now).
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable muxers (only mp4 muxer for now).
* ext/ffmpeg/gstffmpegcodecmap.c:
(gst_ffmpeg_formatid_get_codecids), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Fix a bunch of typos in codec-id lookup (false/true return value
mixup), add a codec-id list retrieval function (because ffmpeg
does not provide one). With that, we can make valid pad templates.
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_init),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_change_state), (gst_ffmpegmux_get_id_caps),
(gst_ffmpegmux_register):
Fix for whatever changed since I last tried this. Works for MP4
muxing.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Update obviously-untested write code...
2005-03-14 15:27:43 +00:00
|
|
|
|
HACKING: Add some basic documentation on how our wrapping works.
Original commit message from CVS:
* HACKING:
Add some basic documentation on how our wrapping works.
* TODO:
Add a list of things that could be worked on or that need doing.
* configure.ac:
Update snapshot.
* ext/ffmpeg/Makefile.am:
Changne .la links. See below (autotools patch).
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable demuxers. See below (gstffmpegdemux.c).
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):
Realmedia caused a crash - fix that.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_averror),
(gst_ffmpegdemux_base_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_dispose),
(gst_ffmpegdemux_stream_from_pad),
(gst_ffmpegdemux_src_event_mask), (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list),
(gst_ffmpegdemux_src_query_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_open), (gst_ffmpegdemux_loop),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Right. OK, so I fixed up the demuxing and have it basically-working,
and the best way to get some more people to test it is to actually
enable it. I'm not sure if we want this for 0.8.0, but we can at
least give it a try. I've tested avi, matroska and mpeg, all appear
to work. The cool thing is that this gives us instant support for
several exotic formats that we'd never care about ourselves. Again,
this needs more testing for it to still be enabled in 0.8.0, but I
want to give it a try...
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init),
(gst_ffmpegmux_init), (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
Add some fixups that I use locally. Make it work in the case of
MPEG encoding, but the muxer is still not in shape to be enabled.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_read), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Some small fixups that crept into it while it was disabled for the
last few years. Basically works.
* gst-libs/ext/ffmpeg/Makefile.am:
Instead of having our local-autotoolized version, I patch the ffmpeg
source to be fully autotoolized. That means a simple SUBDIRS here
is now enough.
* gst-libs/ext/ffmpeg/Tag:
Version update.
* gst-libs/ext/ffmpeg/patch/autotools.diff:
Autotoolize ffmpeg. Needs to be sent to ffmpeg-devel@...
* gst-libs/ext/ffmpeg/patch/disableinstalllibs.diff:
Don't install their libs.
* gst-libs/ext/ffmpeg/patch/disablemmx.diff:
Don't use MMX. It cannot ocmpile using PIC.
* gst-libs/ext/ffmpeg/patch/disabletools.diff:
Don't compile/install their tools, we don't use them.
* gst-libs/ext/ffmpeg/patch/functions.diff:
Prevent symbol conflicts.
* gst-libs/ext/ffmpeg/patch/matroska.diff:
Add a matroska demuxer. Needs to be sent to ffmpeg-devel@...
2004-03-01 04:59:17 +00:00
|
|
|
/* we do need all streams to have started capsnego,
|
|
|
|
* or things will go horribly wrong */
|
2006-09-08 15:25:51 +00:00
|
|
|
for (collected = ffmpegmux->collect->data; collected;
|
|
|
|
collected = g_slist_next (collected)) {
|
|
|
|
GstFFMpegMuxPad *collect_pad = (GstFFMpegMuxPad *) collected->data;
|
|
|
|
AVStream *st = ffmpegmux->context->streams[collect_pad->padnum];
|
HACKING: Add some basic documentation on how our wrapping works.
Original commit message from CVS:
* HACKING:
Add some basic documentation on how our wrapping works.
* TODO:
Add a list of things that could be worked on or that need doing.
* configure.ac:
Update snapshot.
* ext/ffmpeg/Makefile.am:
Changne .la links. See below (autotools patch).
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable demuxers. See below (gstffmpegdemux.c).
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):
Realmedia caused a crash - fix that.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_averror),
(gst_ffmpegdemux_base_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_dispose),
(gst_ffmpegdemux_stream_from_pad),
(gst_ffmpegdemux_src_event_mask), (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list),
(gst_ffmpegdemux_src_query_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_open), (gst_ffmpegdemux_loop),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Right. OK, so I fixed up the demuxing and have it basically-working,
and the best way to get some more people to test it is to actually
enable it. I'm not sure if we want this for 0.8.0, but we can at
least give it a try. I've tested avi, matroska and mpeg, all appear
to work. The cool thing is that this gives us instant support for
several exotic formats that we'd never care about ourselves. Again,
this needs more testing for it to still be enabled in 0.8.0, but I
want to give it a try...
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init),
(gst_ffmpegmux_init), (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
Add some fixups that I use locally. Make it work in the case of
MPEG encoding, but the muxer is still not in shape to be enabled.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_read), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Some small fixups that crept into it while it was disabled for the
last few years. Basically works.
* gst-libs/ext/ffmpeg/Makefile.am:
Instead of having our local-autotoolized version, I patch the ffmpeg
source to be fully autotoolized. That means a simple SUBDIRS here
is now enough.
* gst-libs/ext/ffmpeg/Tag:
Version update.
* gst-libs/ext/ffmpeg/patch/autotools.diff:
Autotoolize ffmpeg. Needs to be sent to ffmpeg-devel@...
* gst-libs/ext/ffmpeg/patch/disableinstalllibs.diff:
Don't install their libs.
* gst-libs/ext/ffmpeg/patch/disablemmx.diff:
Don't use MMX. It cannot ocmpile using PIC.
* gst-libs/ext/ffmpeg/patch/disabletools.diff:
Don't compile/install their tools, we don't use them.
* gst-libs/ext/ffmpeg/patch/functions.diff:
Prevent symbol conflicts.
* gst-libs/ext/ffmpeg/patch/matroska.diff:
Add a matroska demuxer. Needs to be sent to ffmpeg-devel@...
2004-03-01 04:59:17 +00:00
|
|
|
|
2004-03-29 16:39:18 +00:00
|
|
|
/* check whether the pad has successfully completed capsnego */
|
ext/: Update to ffmpeg snapshot of Jul 20 2005 4:00 PM GMT. Mostly some added codecs, some API changes, etc. Also add...
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.h:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_caps_to_pixfmt), (gst_ffmpeg_formatid_get_codecids),
(gst_ffmpeg_caps_to_codecid), (gst_ffmpeg_get_codecid_longname),
(gst_ffmpeg_img_convert):
* ext/ffmpeg/gstffmpegcodecmap.h:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_negotiate),
(gst_ffmpegdec_frame), (gst_ffmpegdec_chain),
(gst_ffmpegdec_register):
* ext/ffmpeg/gstffmpegdeinterlace.c:
(gst_ffmpegdeinterlace_getcaps), (gst_ffmpegdeinterlace_pad_link):
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_register):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_getcaps),
(gst_ffmpegenc_link), (gst_ffmpegenc_chain_video),
(gst_ffmpegenc_chain_audio):
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_write):
* ext/ffmpeg/gstffmpegscale.c: (gst_ffmpegscale_pad_link):
* ext/libpostproc/gstpostproc.c: (gst_postproc_chain):
Update to ffmpeg snapshot of Jul 20 2005 4:00 PM GMT. Mostly
some added codecs, some API changes, etc. Also adds a VOB muxer
for MPEG-2 video and adds h264 to .mp4 muxing.
2005-07-20 15:40:57 +00:00
|
|
|
if (st->codec->codec_id == CODEC_ID_NONE) {
|
2006-09-08 15:25:51 +00:00
|
|
|
GST_ELEMENT_ERROR (ffmpegmux, CORE, NEGOTIATION, (NULL),
|
|
|
|
("no caps set on stream %d (%s)", collect_pad->padnum,
|
2011-04-19 17:29:57 +00:00
|
|
|
(st->codec->codec_type == AVMEDIA_TYPE_VIDEO) ?
|
2004-03-29 16:39:18 +00:00
|
|
|
"video" : "audio"));
|
2006-09-08 15:25:51 +00:00
|
|
|
return GST_FLOW_ERROR;
|
HACKING: Add some basic documentation on how our wrapping works.
Original commit message from CVS:
* HACKING:
Add some basic documentation on how our wrapping works.
* TODO:
Add a list of things that could be worked on or that need doing.
* configure.ac:
Update snapshot.
* ext/ffmpeg/Makefile.am:
Changne .la links. See below (autotools patch).
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable demuxers. See below (gstffmpegdemux.c).
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):
Realmedia caused a crash - fix that.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_averror),
(gst_ffmpegdemux_base_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_dispose),
(gst_ffmpegdemux_stream_from_pad),
(gst_ffmpegdemux_src_event_mask), (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list),
(gst_ffmpegdemux_src_query_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_open), (gst_ffmpegdemux_loop),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Right. OK, so I fixed up the demuxing and have it basically-working,
and the best way to get some more people to test it is to actually
enable it. I'm not sure if we want this for 0.8.0, but we can at
least give it a try. I've tested avi, matroska and mpeg, all appear
to work. The cool thing is that this gives us instant support for
several exotic formats that we'd never care about ourselves. Again,
this needs more testing for it to still be enabled in 0.8.0, but I
want to give it a try...
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init),
(gst_ffmpegmux_init), (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
Add some fixups that I use locally. Make it work in the case of
MPEG encoding, but the muxer is still not in shape to be enabled.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_read), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Some small fixups that crept into it while it was disabled for the
last few years. Basically works.
* gst-libs/ext/ffmpeg/Makefile.am:
Instead of having our local-autotoolized version, I patch the ffmpeg
source to be fully autotoolized. That means a simple SUBDIRS here
is now enough.
* gst-libs/ext/ffmpeg/Tag:
Version update.
* gst-libs/ext/ffmpeg/patch/autotools.diff:
Autotoolize ffmpeg. Needs to be sent to ffmpeg-devel@...
* gst-libs/ext/ffmpeg/patch/disableinstalllibs.diff:
Don't install their libs.
* gst-libs/ext/ffmpeg/patch/disablemmx.diff:
Don't use MMX. It cannot ocmpile using PIC.
* gst-libs/ext/ffmpeg/patch/disabletools.diff:
Don't compile/install their tools, we don't use them.
* gst-libs/ext/ffmpeg/patch/functions.diff:
Prevent symbol conflicts.
* gst-libs/ext/ffmpeg/patch/matroska.diff:
Add a matroska demuxer. Needs to be sent to ffmpeg-devel@...
2004-03-01 04:59:17 +00:00
|
|
|
}
|
2006-09-08 15:25:51 +00:00
|
|
|
/* set framerate for audio */
|
2011-04-19 17:29:57 +00:00
|
|
|
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
|
2007-02-09 16:17:50 +00:00
|
|
|
switch (st->codec->codec_id) {
|
|
|
|
case CODEC_ID_PCM_S16LE:
|
|
|
|
case CODEC_ID_PCM_S16BE:
|
|
|
|
case CODEC_ID_PCM_U16LE:
|
|
|
|
case CODEC_ID_PCM_U16BE:
|
|
|
|
case CODEC_ID_PCM_S8:
|
|
|
|
case CODEC_ID_PCM_U8:
|
|
|
|
st->codec->frame_size = 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
GstBuffer *buffer;
|
|
|
|
|
|
|
|
/* FIXME : This doesn't work for RAW AUDIO...
|
|
|
|
* in fact I'm wondering if it even works for any kind of audio... */
|
2012-04-17 13:36:12 +00:00
|
|
|
buffer = gst_collect_pads_peek (ffmpegmux->collect,
|
|
|
|
(GstCollectData *) collect_pad);
|
2007-02-09 16:17:50 +00:00
|
|
|
if (buffer) {
|
|
|
|
st->codec->frame_size =
|
|
|
|
st->codec->sample_rate *
|
|
|
|
GST_BUFFER_DURATION (buffer) / GST_SECOND;
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
ext/ffmpeg/gstffmpeg.c: Enable muxers (only mp4 muxer for now).
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable muxers (only mp4 muxer for now).
* ext/ffmpeg/gstffmpegcodecmap.c:
(gst_ffmpeg_formatid_get_codecids), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Fix a bunch of typos in codec-id lookup (false/true return value
mixup), add a codec-id list retrieval function (because ffmpeg
does not provide one). With that, we can make valid pad templates.
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_init),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_change_state), (gst_ffmpegmux_get_id_caps),
(gst_ffmpegmux_register):
Fix for whatever changed since I last tried this. Works for MP4
muxing.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Update obviously-untested write code...
2005-03-14 15:27:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-20 15:37:34 +00:00
|
|
|
#if 0
|
|
|
|
/* Re-enable once converted to new AVMetaData API
|
|
|
|
* See #566605
|
|
|
|
*/
|
|
|
|
|
ext/ffmpeg/gstffmpeg.c: Enable muxers (only mp4 muxer for now).
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable muxers (only mp4 muxer for now).
* ext/ffmpeg/gstffmpegcodecmap.c:
(gst_ffmpeg_formatid_get_codecids), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Fix a bunch of typos in codec-id lookup (false/true return value
mixup), add a codec-id list retrieval function (because ffmpeg
does not provide one). With that, we can make valid pad templates.
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_init),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_change_state), (gst_ffmpegmux_get_id_caps),
(gst_ffmpegmux_register):
Fix for whatever changed since I last tried this. Works for MP4
muxing.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Update obviously-untested write code...
2005-03-14 15:27:43 +00:00
|
|
|
/* tags */
|
2008-12-16 14:24:05 +00:00
|
|
|
tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (ffmpegmux));
|
|
|
|
if (tags) {
|
ext/ffmpeg/gstffmpeg.c: Enable muxers (only mp4 muxer for now).
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable muxers (only mp4 muxer for now).
* ext/ffmpeg/gstffmpegcodecmap.c:
(gst_ffmpeg_formatid_get_codecids), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Fix a bunch of typos in codec-id lookup (false/true return value
mixup), add a codec-id list retrieval function (because ffmpeg
does not provide one). With that, we can make valid pad templates.
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_init),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_change_state), (gst_ffmpegmux_get_id_caps),
(gst_ffmpegmux_register):
Fix for whatever changed since I last tried this. Works for MP4
muxing.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Update obviously-untested write code...
2005-03-14 15:27:43 +00:00
|
|
|
gint i;
|
|
|
|
gchar *s;
|
|
|
|
|
|
|
|
/* get the interesting ones */
|
|
|
|
if (gst_tag_list_get_string (tags, GST_TAG_TITLE, &s)) {
|
|
|
|
strncpy (ffmpegmux->context->title, s,
|
|
|
|
sizeof (ffmpegmux->context->title));
|
|
|
|
}
|
|
|
|
if (gst_tag_list_get_string (tags, GST_TAG_ARTIST, &s)) {
|
|
|
|
strncpy (ffmpegmux->context->author, s,
|
|
|
|
sizeof (ffmpegmux->context->author));
|
|
|
|
}
|
|
|
|
if (gst_tag_list_get_string (tags, GST_TAG_COPYRIGHT, &s)) {
|
|
|
|
strncpy (ffmpegmux->context->copyright, s,
|
|
|
|
sizeof (ffmpegmux->context->copyright));
|
|
|
|
}
|
|
|
|
if (gst_tag_list_get_string (tags, GST_TAG_COMMENT, &s)) {
|
|
|
|
strncpy (ffmpegmux->context->comment, s,
|
|
|
|
sizeof (ffmpegmux->context->comment));
|
|
|
|
}
|
|
|
|
if (gst_tag_list_get_string (tags, GST_TAG_ALBUM, &s)) {
|
|
|
|
strncpy (ffmpegmux->context->album, s,
|
|
|
|
sizeof (ffmpegmux->context->album));
|
|
|
|
}
|
|
|
|
if (gst_tag_list_get_string (tags, GST_TAG_GENRE, &s)) {
|
|
|
|
strncpy (ffmpegmux->context->genre, s,
|
|
|
|
sizeof (ffmpegmux->context->genre));
|
|
|
|
}
|
2006-09-08 16:52:19 +00:00
|
|
|
if (gst_tag_list_get_int (tags, GST_TAG_TRACK_NUMBER, &i)) {
|
ext/ffmpeg/gstffmpeg.c: Enable muxers (only mp4 muxer for now).
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable muxers (only mp4 muxer for now).
* ext/ffmpeg/gstffmpegcodecmap.c:
(gst_ffmpeg_formatid_get_codecids), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Fix a bunch of typos in codec-id lookup (false/true return value
mixup), add a codec-id list retrieval function (because ffmpeg
does not provide one). With that, we can make valid pad templates.
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_init),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_change_state), (gst_ffmpegmux_get_id_caps),
(gst_ffmpegmux_register):
Fix for whatever changed since I last tried this. Works for MP4
muxing.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Update obviously-untested write code...
2005-03-14 15:27:43 +00:00
|
|
|
ffmpegmux->context->track = i;
|
|
|
|
}
|
HACKING: Add some basic documentation on how our wrapping works.
Original commit message from CVS:
* HACKING:
Add some basic documentation on how our wrapping works.
* TODO:
Add a list of things that could be worked on or that need doing.
* configure.ac:
Update snapshot.
* ext/ffmpeg/Makefile.am:
Changne .la links. See below (autotools patch).
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable demuxers. See below (gstffmpegdemux.c).
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):
Realmedia caused a crash - fix that.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_averror),
(gst_ffmpegdemux_base_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_dispose),
(gst_ffmpegdemux_stream_from_pad),
(gst_ffmpegdemux_src_event_mask), (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list),
(gst_ffmpegdemux_src_query_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_open), (gst_ffmpegdemux_loop),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Right. OK, so I fixed up the demuxing and have it basically-working,
and the best way to get some more people to test it is to actually
enable it. I'm not sure if we want this for 0.8.0, but we can at
least give it a try. I've tested avi, matroska and mpeg, all appear
to work. The cool thing is that this gives us instant support for
several exotic formats that we'd never care about ourselves. Again,
this needs more testing for it to still be enabled in 0.8.0, but I
want to give it a try...
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init),
(gst_ffmpegmux_init), (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
Add some fixups that I use locally. Make it work in the case of
MPEG encoding, but the muxer is still not in shape to be enabled.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_read), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Some small fixups that crept into it while it was disabled for the
last few years. Basically works.
* gst-libs/ext/ffmpeg/Makefile.am:
Instead of having our local-autotoolized version, I patch the ffmpeg
source to be fully autotoolized. That means a simple SUBDIRS here
is now enough.
* gst-libs/ext/ffmpeg/Tag:
Version update.
* gst-libs/ext/ffmpeg/patch/autotools.diff:
Autotoolize ffmpeg. Needs to be sent to ffmpeg-devel@...
* gst-libs/ext/ffmpeg/patch/disableinstalllibs.diff:
Don't install their libs.
* gst-libs/ext/ffmpeg/patch/disablemmx.diff:
Don't use MMX. It cannot ocmpile using PIC.
* gst-libs/ext/ffmpeg/patch/disabletools.diff:
Don't compile/install their tools, we don't use them.
* gst-libs/ext/ffmpeg/patch/functions.diff:
Prevent symbol conflicts.
* gst-libs/ext/ffmpeg/patch/matroska.diff:
Add a matroska demuxer. Needs to be sent to ffmpeg-devel@...
2004-03-01 04:59:17 +00:00
|
|
|
}
|
2011-04-20 15:37:34 +00:00
|
|
|
#endif
|
HACKING: Add some basic documentation on how our wrapping works.
Original commit message from CVS:
* HACKING:
Add some basic documentation on how our wrapping works.
* TODO:
Add a list of things that could be worked on or that need doing.
* configure.ac:
Update snapshot.
* ext/ffmpeg/Makefile.am:
Changne .la links. See below (autotools patch).
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable demuxers. See below (gstffmpegdemux.c).
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):
Realmedia caused a crash - fix that.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_averror),
(gst_ffmpegdemux_base_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_dispose),
(gst_ffmpegdemux_stream_from_pad),
(gst_ffmpegdemux_src_event_mask), (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list),
(gst_ffmpegdemux_src_query_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_open), (gst_ffmpegdemux_loop),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Right. OK, so I fixed up the demuxing and have it basically-working,
and the best way to get some more people to test it is to actually
enable it. I'm not sure if we want this for 0.8.0, but we can at
least give it a try. I've tested avi, matroska and mpeg, all appear
to work. The cool thing is that this gives us instant support for
several exotic formats that we'd never care about ourselves. Again,
this needs more testing for it to still be enabled in 0.8.0, but I
want to give it a try...
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init),
(gst_ffmpegmux_init), (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
Add some fixups that I use locally. Make it work in the case of
MPEG encoding, but the muxer is still not in shape to be enabled.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_read), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Some small fixups that crept into it while it was disabled for the
last few years. Basically works.
* gst-libs/ext/ffmpeg/Makefile.am:
Instead of having our local-autotoolized version, I patch the ffmpeg
source to be fully autotoolized. That means a simple SUBDIRS here
is now enough.
* gst-libs/ext/ffmpeg/Tag:
Version update.
* gst-libs/ext/ffmpeg/patch/autotools.diff:
Autotoolize ffmpeg. Needs to be sent to ffmpeg-devel@...
* gst-libs/ext/ffmpeg/patch/disableinstalllibs.diff:
Don't install their libs.
* gst-libs/ext/ffmpeg/patch/disablemmx.diff:
Don't use MMX. It cannot ocmpile using PIC.
* gst-libs/ext/ffmpeg/patch/disabletools.diff:
Don't compile/install their tools, we don't use them.
* gst-libs/ext/ffmpeg/patch/functions.diff:
Prevent symbol conflicts.
* gst-libs/ext/ffmpeg/patch/matroska.diff:
Add a matroska demuxer. Needs to be sent to ffmpeg-devel@...
2004-03-01 04:59:17 +00:00
|
|
|
|
2006-09-08 15:25:51 +00:00
|
|
|
/* set the streamheader flag for gstffmpegprotocol if codec supports it */
|
2007-02-09 16:17:50 +00:00
|
|
|
if (!strcmp (ffmpegmux->context->oformat->name, "flv")) {
|
|
|
|
open_flags |= GST_FFMPEG_URL_STREAMHEADER;
|
2006-09-08 15:25:51 +00:00
|
|
|
}
|
2005-07-11 12:34:18 +00:00
|
|
|
|
2003-06-09 15:04:26 +00:00
|
|
|
if (url_fopen (&ffmpegmux->context->pb,
|
2005-07-11 12:34:18 +00:00
|
|
|
ffmpegmux->context->filename, open_flags) < 0) {
|
2006-09-08 15:25:51 +00:00
|
|
|
GST_ELEMENT_ERROR (ffmpegmux, LIBRARY, TOO_LAZY, (NULL),
|
2012-04-12 17:41:52 +00:00
|
|
|
("Failed to open stream context in avmux"));
|
2006-09-08 15:25:51 +00:00
|
|
|
return GST_FLOW_ERROR;
|
2002-11-06 23:53:46 +00:00
|
|
|
}
|
|
|
|
|
ext/ffmpeg/gstffmpeg.c: Enable muxers (only mp4 muxer for now).
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable muxers (only mp4 muxer for now).
* ext/ffmpeg/gstffmpegcodecmap.c:
(gst_ffmpeg_formatid_get_codecids), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Fix a bunch of typos in codec-id lookup (false/true return value
mixup), add a codec-id list retrieval function (because ffmpeg
does not provide one). With that, we can make valid pad templates.
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_init),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_change_state), (gst_ffmpegmux_get_id_caps),
(gst_ffmpegmux_register):
Fix for whatever changed since I last tried this. Works for MP4
muxing.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Update obviously-untested write code...
2005-03-14 15:27:43 +00:00
|
|
|
if (av_set_parameters (ffmpegmux->context, NULL) < 0) {
|
2006-09-08 15:25:51 +00:00
|
|
|
GST_ELEMENT_ERROR (ffmpegmux, LIBRARY, INIT, (NULL),
|
2004-03-29 16:39:18 +00:00
|
|
|
("Failed to initialize muxer"));
|
2006-09-08 15:25:51 +00:00
|
|
|
return GST_FLOW_ERROR;
|
HACKING: Add some basic documentation on how our wrapping works.
Original commit message from CVS:
* HACKING:
Add some basic documentation on how our wrapping works.
* TODO:
Add a list of things that could be worked on or that need doing.
* configure.ac:
Update snapshot.
* ext/ffmpeg/Makefile.am:
Changne .la links. See below (autotools patch).
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable demuxers. See below (gstffmpegdemux.c).
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):
Realmedia caused a crash - fix that.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_averror),
(gst_ffmpegdemux_base_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_dispose),
(gst_ffmpegdemux_stream_from_pad),
(gst_ffmpegdemux_src_event_mask), (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list),
(gst_ffmpegdemux_src_query_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_open), (gst_ffmpegdemux_loop),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Right. OK, so I fixed up the demuxing and have it basically-working,
and the best way to get some more people to test it is to actually
enable it. I'm not sure if we want this for 0.8.0, but we can at
least give it a try. I've tested avi, matroska and mpeg, all appear
to work. The cool thing is that this gives us instant support for
several exotic formats that we'd never care about ourselves. Again,
this needs more testing for it to still be enabled in 0.8.0, but I
want to give it a try...
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init),
(gst_ffmpegmux_init), (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
Add some fixups that I use locally. Make it work in the case of
MPEG encoding, but the muxer is still not in shape to be enabled.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_read), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Some small fixups that crept into it while it was disabled for the
last few years. Basically works.
* gst-libs/ext/ffmpeg/Makefile.am:
Instead of having our local-autotoolized version, I patch the ffmpeg
source to be fully autotoolized. That means a simple SUBDIRS here
is now enough.
* gst-libs/ext/ffmpeg/Tag:
Version update.
* gst-libs/ext/ffmpeg/patch/autotools.diff:
Autotoolize ffmpeg. Needs to be sent to ffmpeg-devel@...
* gst-libs/ext/ffmpeg/patch/disableinstalllibs.diff:
Don't install their libs.
* gst-libs/ext/ffmpeg/patch/disablemmx.diff:
Don't use MMX. It cannot ocmpile using PIC.
* gst-libs/ext/ffmpeg/patch/disabletools.diff:
Don't compile/install their tools, we don't use them.
* gst-libs/ext/ffmpeg/patch/functions.diff:
Prevent symbol conflicts.
* gst-libs/ext/ffmpeg/patch/matroska.diff:
Add a matroska demuxer. Needs to be sent to ffmpeg-devel@...
2004-03-01 04:59:17 +00:00
|
|
|
}
|
|
|
|
|
2003-06-09 15:04:26 +00:00
|
|
|
/* now open the mux format */
|
ext/ffmpeg/gstffmpeg.c: Enable muxers (only mp4 muxer for now).
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable muxers (only mp4 muxer for now).
* ext/ffmpeg/gstffmpegcodecmap.c:
(gst_ffmpeg_formatid_get_codecids), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Fix a bunch of typos in codec-id lookup (false/true return value
mixup), add a codec-id list retrieval function (because ffmpeg
does not provide one). With that, we can make valid pad templates.
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_init),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_change_state), (gst_ffmpegmux_get_id_caps),
(gst_ffmpegmux_register):
Fix for whatever changed since I last tried this. Works for MP4
muxing.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Update obviously-untested write code...
2005-03-14 15:27:43 +00:00
|
|
|
if (av_write_header (ffmpegmux->context) < 0) {
|
2006-09-08 15:25:51 +00:00
|
|
|
GST_ELEMENT_ERROR (ffmpegmux, LIBRARY, SETTINGS, (NULL),
|
ext/ffmpeg/gstffmpeg.c: Enable muxers (only mp4 muxer for now).
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable muxers (only mp4 muxer for now).
* ext/ffmpeg/gstffmpegcodecmap.c:
(gst_ffmpeg_formatid_get_codecids), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Fix a bunch of typos in codec-id lookup (false/true return value
mixup), add a codec-id list retrieval function (because ffmpeg
does not provide one). With that, we can make valid pad templates.
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_init),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_change_state), (gst_ffmpegmux_get_id_caps),
(gst_ffmpegmux_register):
Fix for whatever changed since I last tried this. Works for MP4
muxing.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Update obviously-untested write code...
2005-03-14 15:27:43 +00:00
|
|
|
("Failed to write file header - check codec settings"));
|
2006-09-08 15:25:51 +00:00
|
|
|
return GST_FLOW_ERROR;
|
ext/ffmpeg/gstffmpeg.c: Enable muxers (only mp4 muxer for now).
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable muxers (only mp4 muxer for now).
* ext/ffmpeg/gstffmpegcodecmap.c:
(gst_ffmpeg_formatid_get_codecids), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Fix a bunch of typos in codec-id lookup (false/true return value
mixup), add a codec-id list retrieval function (because ffmpeg
does not provide one). With that, we can make valid pad templates.
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_init),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_change_state), (gst_ffmpegmux_get_id_caps),
(gst_ffmpegmux_register):
Fix for whatever changed since I last tried this. Works for MP4
muxing.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Update obviously-untested write code...
2005-03-14 15:27:43 +00:00
|
|
|
}
|
2006-09-08 15:25:51 +00:00
|
|
|
|
2007-02-09 16:17:50 +00:00
|
|
|
/* we're now opened */
|
|
|
|
ffmpegmux->opened = TRUE;
|
|
|
|
|
2005-07-11 12:34:18 +00:00
|
|
|
/* flush the header so it will be used as streamheader */
|
2007-12-17 12:43:06 +00:00
|
|
|
put_flush_packet (ffmpegmux->context->pb);
|
2002-11-06 23:53:46 +00:00
|
|
|
}
|
|
|
|
|
2003-06-09 15:04:26 +00:00
|
|
|
/* take the one with earliest timestamp,
|
|
|
|
* and push it forward */
|
2006-09-08 15:25:51 +00:00
|
|
|
best_pad = NULL;
|
|
|
|
best_time = GST_CLOCK_TIME_NONE;
|
|
|
|
for (collected = ffmpegmux->collect->data; collected;
|
|
|
|
collected = g_slist_next (collected)) {
|
|
|
|
GstFFMpegMuxPad *collect_pad = (GstFFMpegMuxPad *) collected->data;
|
2012-04-17 13:36:12 +00:00
|
|
|
GstBuffer *buffer = gst_collect_pads_peek (ffmpegmux->collect,
|
|
|
|
(GstCollectData *) collect_pad);
|
2006-09-08 15:25:51 +00:00
|
|
|
|
2003-06-09 15:04:26 +00:00
|
|
|
/* if there's no buffer, just continue */
|
2006-09-08 15:25:51 +00:00
|
|
|
if (buffer == NULL) {
|
2003-06-09 15:04:26 +00:00
|
|
|
continue;
|
|
|
|
}
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2003-06-09 15:04:26 +00:00
|
|
|
/* if we have no buffer yet, just use the first one */
|
2006-09-08 15:25:51 +00:00
|
|
|
if (best_pad == NULL) {
|
|
|
|
best_pad = collect_pad;
|
|
|
|
best_time = GST_BUFFER_TIMESTAMP (buffer);
|
|
|
|
goto next_pad;
|
2003-06-09 15:04:26 +00:00
|
|
|
}
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2003-06-09 15:04:26 +00:00
|
|
|
/* if we do have one, only use this one if it's older */
|
2006-09-08 15:25:51 +00:00
|
|
|
if (GST_BUFFER_TIMESTAMP (buffer) < best_time) {
|
|
|
|
best_time = GST_BUFFER_TIMESTAMP (buffer);
|
|
|
|
best_pad = collect_pad;
|
2003-06-09 15:04:26 +00:00
|
|
|
}
|
2006-09-08 15:25:51 +00:00
|
|
|
|
2007-02-09 16:17:50 +00:00
|
|
|
next_pad:
|
2006-09-08 15:25:51 +00:00
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
|
|
|
|
/* Mux buffers with invalid timestamp first */
|
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (best_time))
|
|
|
|
break;
|
2003-06-09 15:04:26 +00:00
|
|
|
}
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2003-06-09 15:04:26 +00:00
|
|
|
/* now handle the buffer, or signal EOS if we have
|
|
|
|
* no buffers left */
|
2006-09-08 15:25:51 +00:00
|
|
|
if (best_pad != NULL) {
|
HACKING: Add some basic documentation on how our wrapping works.
Original commit message from CVS:
* HACKING:
Add some basic documentation on how our wrapping works.
* TODO:
Add a list of things that could be worked on or that need doing.
* configure.ac:
Update snapshot.
* ext/ffmpeg/Makefile.am:
Changne .la links. See below (autotools patch).
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable demuxers. See below (gstffmpegdemux.c).
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):
Realmedia caused a crash - fix that.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_averror),
(gst_ffmpegdemux_base_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_dispose),
(gst_ffmpegdemux_stream_from_pad),
(gst_ffmpegdemux_src_event_mask), (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list),
(gst_ffmpegdemux_src_query_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_open), (gst_ffmpegdemux_loop),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Right. OK, so I fixed up the demuxing and have it basically-working,
and the best way to get some more people to test it is to actually
enable it. I'm not sure if we want this for 0.8.0, but we can at
least give it a try. I've tested avi, matroska and mpeg, all appear
to work. The cool thing is that this gives us instant support for
several exotic formats that we'd never care about ourselves. Again,
this needs more testing for it to still be enabled in 0.8.0, but I
want to give it a try...
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init),
(gst_ffmpegmux_init), (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
Add some fixups that I use locally. Make it work in the case of
MPEG encoding, but the muxer is still not in shape to be enabled.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_read), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Some small fixups that crept into it while it was disabled for the
last few years. Basically works.
* gst-libs/ext/ffmpeg/Makefile.am:
Instead of having our local-autotoolized version, I patch the ffmpeg
source to be fully autotoolized. That means a simple SUBDIRS here
is now enough.
* gst-libs/ext/ffmpeg/Tag:
Version update.
* gst-libs/ext/ffmpeg/patch/autotools.diff:
Autotoolize ffmpeg. Needs to be sent to ffmpeg-devel@...
* gst-libs/ext/ffmpeg/patch/disableinstalllibs.diff:
Don't install their libs.
* gst-libs/ext/ffmpeg/patch/disablemmx.diff:
Don't use MMX. It cannot ocmpile using PIC.
* gst-libs/ext/ffmpeg/patch/disabletools.diff:
Don't compile/install their tools, we don't use them.
* gst-libs/ext/ffmpeg/patch/functions.diff:
Prevent symbol conflicts.
* gst-libs/ext/ffmpeg/patch/matroska.diff:
Add a matroska demuxer. Needs to be sent to ffmpeg-devel@...
2004-03-01 04:59:17 +00:00
|
|
|
GstBuffer *buf;
|
2004-12-16 18:14:19 +00:00
|
|
|
AVPacket pkt;
|
2007-12-17 20:31:35 +00:00
|
|
|
gboolean need_free = FALSE;
|
2012-01-24 13:40:37 +00:00
|
|
|
GstMapInfo map;
|
HACKING: Add some basic documentation on how our wrapping works.
Original commit message from CVS:
* HACKING:
Add some basic documentation on how our wrapping works.
* TODO:
Add a list of things that could be worked on or that need doing.
* configure.ac:
Update snapshot.
* ext/ffmpeg/Makefile.am:
Changne .la links. See below (autotools patch).
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable demuxers. See below (gstffmpegdemux.c).
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):
Realmedia caused a crash - fix that.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_averror),
(gst_ffmpegdemux_base_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_dispose),
(gst_ffmpegdemux_stream_from_pad),
(gst_ffmpegdemux_src_event_mask), (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list),
(gst_ffmpegdemux_src_query_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_open), (gst_ffmpegdemux_loop),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Right. OK, so I fixed up the demuxing and have it basically-working,
and the best way to get some more people to test it is to actually
enable it. I'm not sure if we want this for 0.8.0, but we can at
least give it a try. I've tested avi, matroska and mpeg, all appear
to work. The cool thing is that this gives us instant support for
several exotic formats that we'd never care about ourselves. Again,
this needs more testing for it to still be enabled in 0.8.0, but I
want to give it a try...
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init),
(gst_ffmpegmux_init), (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
Add some fixups that I use locally. Make it work in the case of
MPEG encoding, but the muxer is still not in shape to be enabled.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_read), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Some small fixups that crept into it while it was disabled for the
last few years. Basically works.
* gst-libs/ext/ffmpeg/Makefile.am:
Instead of having our local-autotoolized version, I patch the ffmpeg
source to be fully autotoolized. That means a simple SUBDIRS here
is now enough.
* gst-libs/ext/ffmpeg/Tag:
Version update.
* gst-libs/ext/ffmpeg/patch/autotools.diff:
Autotoolize ffmpeg. Needs to be sent to ffmpeg-devel@...
* gst-libs/ext/ffmpeg/patch/disableinstalllibs.diff:
Don't install their libs.
* gst-libs/ext/ffmpeg/patch/disablemmx.diff:
Don't use MMX. It cannot ocmpile using PIC.
* gst-libs/ext/ffmpeg/patch/disabletools.diff:
Don't compile/install their tools, we don't use them.
* gst-libs/ext/ffmpeg/patch/functions.diff:
Prevent symbol conflicts.
* gst-libs/ext/ffmpeg/patch/matroska.diff:
Add a matroska demuxer. Needs to be sent to ffmpeg-devel@...
2004-03-01 04:59:17 +00:00
|
|
|
|
2003-06-09 15:04:26 +00:00
|
|
|
/* push out current buffer */
|
2012-04-17 13:36:12 +00:00
|
|
|
buf =
|
|
|
|
gst_collect_pads_pop (ffmpegmux->collect, (GstCollectData *) best_pad);
|
HACKING: Add some basic documentation on how our wrapping works.
Original commit message from CVS:
* HACKING:
Add some basic documentation on how our wrapping works.
* TODO:
Add a list of things that could be worked on or that need doing.
* configure.ac:
Update snapshot.
* ext/ffmpeg/Makefile.am:
Changne .la links. See below (autotools patch).
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable demuxers. See below (gstffmpegdemux.c).
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):
Realmedia caused a crash - fix that.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_averror),
(gst_ffmpegdemux_base_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_dispose),
(gst_ffmpegdemux_stream_from_pad),
(gst_ffmpegdemux_src_event_mask), (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list),
(gst_ffmpegdemux_src_query_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_open), (gst_ffmpegdemux_loop),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Right. OK, so I fixed up the demuxing and have it basically-working,
and the best way to get some more people to test it is to actually
enable it. I'm not sure if we want this for 0.8.0, but we can at
least give it a try. I've tested avi, matroska and mpeg, all appear
to work. The cool thing is that this gives us instant support for
several exotic formats that we'd never care about ourselves. Again,
this needs more testing for it to still be enabled in 0.8.0, but I
want to give it a try...
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init),
(gst_ffmpegmux_init), (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
Add some fixups that I use locally. Make it work in the case of
MPEG encoding, but the muxer is still not in shape to be enabled.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_read), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Some small fixups that crept into it while it was disabled for the
last few years. Basically works.
* gst-libs/ext/ffmpeg/Makefile.am:
Instead of having our local-autotoolized version, I patch the ffmpeg
source to be fully autotoolized. That means a simple SUBDIRS here
is now enough.
* gst-libs/ext/ffmpeg/Tag:
Version update.
* gst-libs/ext/ffmpeg/patch/autotools.diff:
Autotoolize ffmpeg. Needs to be sent to ffmpeg-devel@...
* gst-libs/ext/ffmpeg/patch/disableinstalllibs.diff:
Don't install their libs.
* gst-libs/ext/ffmpeg/patch/disablemmx.diff:
Don't use MMX. It cannot ocmpile using PIC.
* gst-libs/ext/ffmpeg/patch/disabletools.diff:
Don't compile/install their tools, we don't use them.
* gst-libs/ext/ffmpeg/patch/functions.diff:
Prevent symbol conflicts.
* gst-libs/ext/ffmpeg/patch/matroska.diff:
Add a matroska demuxer. Needs to be sent to ffmpeg-devel@...
2004-03-01 04:59:17 +00:00
|
|
|
|
2006-09-08 15:25:51 +00:00
|
|
|
ffmpegmux->context->streams[best_pad->padnum]->codec->frame_number++;
|
HACKING: Add some basic documentation on how our wrapping works.
Original commit message from CVS:
* HACKING:
Add some basic documentation on how our wrapping works.
* TODO:
Add a list of things that could be worked on or that need doing.
* configure.ac:
Update snapshot.
* ext/ffmpeg/Makefile.am:
Changne .la links. See below (autotools patch).
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable demuxers. See below (gstffmpegdemux.c).
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):
Realmedia caused a crash - fix that.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_averror),
(gst_ffmpegdemux_base_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_dispose),
(gst_ffmpegdemux_stream_from_pad),
(gst_ffmpegdemux_src_event_mask), (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list),
(gst_ffmpegdemux_src_query_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_open), (gst_ffmpegdemux_loop),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Right. OK, so I fixed up the demuxing and have it basically-working,
and the best way to get some more people to test it is to actually
enable it. I'm not sure if we want this for 0.8.0, but we can at
least give it a try. I've tested avi, matroska and mpeg, all appear
to work. The cool thing is that this gives us instant support for
several exotic formats that we'd never care about ourselves. Again,
this needs more testing for it to still be enabled in 0.8.0, but I
want to give it a try...
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init),
(gst_ffmpegmux_init), (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
Add some fixups that I use locally. Make it work in the case of
MPEG encoding, but the muxer is still not in shape to be enabled.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_read), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Some small fixups that crept into it while it was disabled for the
last few years. Basically works.
* gst-libs/ext/ffmpeg/Makefile.am:
Instead of having our local-autotoolized version, I patch the ffmpeg
source to be fully autotoolized. That means a simple SUBDIRS here
is now enough.
* gst-libs/ext/ffmpeg/Tag:
Version update.
* gst-libs/ext/ffmpeg/patch/autotools.diff:
Autotoolize ffmpeg. Needs to be sent to ffmpeg-devel@...
* gst-libs/ext/ffmpeg/patch/disableinstalllibs.diff:
Don't install their libs.
* gst-libs/ext/ffmpeg/patch/disablemmx.diff:
Don't use MMX. It cannot ocmpile using PIC.
* gst-libs/ext/ffmpeg/patch/disabletools.diff:
Don't compile/install their tools, we don't use them.
* gst-libs/ext/ffmpeg/patch/functions.diff:
Prevent symbol conflicts.
* gst-libs/ext/ffmpeg/patch/matroska.diff:
Add a matroska demuxer. Needs to be sent to ffmpeg-devel@...
2004-03-01 04:59:17 +00:00
|
|
|
|
|
|
|
/* set time */
|
2005-07-27 16:03:51 +00:00
|
|
|
pkt.pts = gst_ffmpeg_time_gst_to_ff (GST_BUFFER_TIMESTAMP (buf),
|
2006-09-08 15:25:51 +00:00
|
|
|
ffmpegmux->context->streams[best_pad->padnum]->time_base);
|
ext/ffmpeg/gstffmpeg.c: Enable muxers (only mp4 muxer for now).
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable muxers (only mp4 muxer for now).
* ext/ffmpeg/gstffmpegcodecmap.c:
(gst_ffmpeg_formatid_get_codecids), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Fix a bunch of typos in codec-id lookup (false/true return value
mixup), add a codec-id list retrieval function (because ffmpeg
does not provide one). With that, we can make valid pad templates.
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_init),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_change_state), (gst_ffmpegmux_get_id_caps),
(gst_ffmpegmux_register):
Fix for whatever changed since I last tried this. Works for MP4
muxing.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Update obviously-untested write code...
2005-03-14 15:27:43 +00:00
|
|
|
pkt.dts = pkt.pts;
|
2007-12-17 20:31:35 +00:00
|
|
|
|
|
|
|
if (strcmp (ffmpegmux->context->oformat->name, "gif") == 0) {
|
|
|
|
AVStream *st = ffmpegmux->context->streams[best_pad->padnum];
|
|
|
|
AVPicture src, dst;
|
|
|
|
|
|
|
|
need_free = TRUE;
|
|
|
|
pkt.size = st->codec->width * st->codec->height * 3;
|
|
|
|
pkt.data = g_malloc (pkt.size);
|
|
|
|
|
|
|
|
dst.data[0] = pkt.data;
|
|
|
|
dst.data[1] = NULL;
|
|
|
|
dst.data[2] = NULL;
|
|
|
|
dst.linesize[0] = st->codec->width * 3;
|
|
|
|
|
2012-01-24 13:40:37 +00:00
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
|
|
|
gst_ffmpeg_avpicture_fill (&src, map.data,
|
2007-12-17 20:31:35 +00:00
|
|
|
PIX_FMT_RGB24, st->codec->width, st->codec->height);
|
|
|
|
|
2008-05-26 07:39:19 +00:00
|
|
|
av_picture_copy (&dst, &src, PIX_FMT_RGB24,
|
|
|
|
st->codec->width, st->codec->height);
|
2012-01-24 13:40:37 +00:00
|
|
|
gst_buffer_unmap (buf, &map);
|
2007-12-17 20:31:35 +00:00
|
|
|
} else {
|
2012-01-24 13:40:37 +00:00
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
|
|
|
pkt.data = map.data;
|
|
|
|
pkt.size = map.size;
|
2007-12-17 20:31:35 +00:00
|
|
|
}
|
|
|
|
|
2006-09-08 15:25:51 +00:00
|
|
|
pkt.stream_index = best_pad->padnum;
|
2004-12-16 18:14:19 +00:00
|
|
|
pkt.flags = 0;
|
2005-06-27 20:41:55 +00:00
|
|
|
|
2006-09-08 15:25:51 +00:00
|
|
|
if (!GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT))
|
2011-04-19 17:30:44 +00:00
|
|
|
pkt.flags |= AV_PKT_FLAG_KEY;
|
2005-06-27 20:41:55 +00:00
|
|
|
|
2004-12-16 18:14:19 +00:00
|
|
|
if (GST_BUFFER_DURATION_IS_VALID (buf))
|
2007-02-09 16:17:50 +00:00
|
|
|
pkt.duration =
|
2008-07-06 21:06:45 +00:00
|
|
|
gst_ffmpeg_time_gst_to_ff (GST_BUFFER_DURATION (buf),
|
2008-10-30 12:05:45 +00:00
|
|
|
ffmpegmux->context->streams[best_pad->padnum]->time_base);
|
2004-12-16 18:14:19 +00:00
|
|
|
else
|
|
|
|
pkt.duration = 0;
|
|
|
|
av_write_frame (ffmpegmux->context, &pkt);
|
2011-04-04 11:18:13 +00:00
|
|
|
if (need_free) {
|
2007-12-17 20:31:35 +00:00
|
|
|
g_free (pkt.data);
|
2011-04-04 11:18:13 +00:00
|
|
|
} else {
|
2012-01-24 13:40:37 +00:00
|
|
|
gst_buffer_unmap (buf, &map);
|
2011-04-04 11:18:13 +00:00
|
|
|
}
|
|
|
|
gst_buffer_unref (buf);
|
2003-06-09 15:04:26 +00:00
|
|
|
} else {
|
|
|
|
/* close down */
|
HACKING: Add some basic documentation on how our wrapping works.
Original commit message from CVS:
* HACKING:
Add some basic documentation on how our wrapping works.
* TODO:
Add a list of things that could be worked on or that need doing.
* configure.ac:
Update snapshot.
* ext/ffmpeg/Makefile.am:
Changne .la links. See below (autotools patch).
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable demuxers. See below (gstffmpegdemux.c).
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):
Realmedia caused a crash - fix that.
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_averror),
(gst_ffmpegdemux_base_init), (gst_ffmpegdemux_init),
(gst_ffmpegdemux_close), (gst_ffmpegdemux_dispose),
(gst_ffmpegdemux_stream_from_pad),
(gst_ffmpegdemux_src_event_mask), (gst_ffmpegdemux_src_event),
(gst_ffmpegdemux_src_format_list),
(gst_ffmpegdemux_src_query_list), (gst_ffmpegdemux_src_query),
(gst_ffmpegdemux_src_convert), (gst_ffmpegdemux_add),
(gst_ffmpegdemux_open), (gst_ffmpegdemux_loop),
(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
Right. OK, so I fixed up the demuxing and have it basically-working,
and the best way to get some more people to test it is to actually
enable it. I'm not sure if we want this for 0.8.0, but we can at
least give it a try. I've tested avi, matroska and mpeg, all appear
to work. The cool thing is that this gives us instant support for
several exotic formats that we'd never care about ourselves. Again,
this needs more testing for it to still be enabled in 0.8.0, but I
want to give it a try...
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init),
(gst_ffmpegmux_init), (gst_ffmpegmux_request_new_pad),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_register):
Add some fixups that I use locally. Make it work in the case of
MPEG encoding, but the muxer is still not in shape to be enabled.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_read), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Some small fixups that crept into it while it was disabled for the
last few years. Basically works.
* gst-libs/ext/ffmpeg/Makefile.am:
Instead of having our local-autotoolized version, I patch the ffmpeg
source to be fully autotoolized. That means a simple SUBDIRS here
is now enough.
* gst-libs/ext/ffmpeg/Tag:
Version update.
* gst-libs/ext/ffmpeg/patch/autotools.diff:
Autotoolize ffmpeg. Needs to be sent to ffmpeg-devel@...
* gst-libs/ext/ffmpeg/patch/disableinstalllibs.diff:
Don't install their libs.
* gst-libs/ext/ffmpeg/patch/disablemmx.diff:
Don't use MMX. It cannot ocmpile using PIC.
* gst-libs/ext/ffmpeg/patch/disabletools.diff:
Don't compile/install their tools, we don't use them.
* gst-libs/ext/ffmpeg/patch/functions.diff:
Prevent symbol conflicts.
* gst-libs/ext/ffmpeg/patch/matroska.diff:
Add a matroska demuxer. Needs to be sent to ffmpeg-devel@...
2004-03-01 04:59:17 +00:00
|
|
|
av_write_trailer (ffmpegmux->context);
|
2003-06-09 15:04:26 +00:00
|
|
|
ffmpegmux->opened = FALSE;
|
2007-12-17 12:43:06 +00:00
|
|
|
put_flush_packet (ffmpegmux->context->pb);
|
|
|
|
url_fclose (ffmpegmux->context->pb);
|
2006-09-08 15:25:51 +00:00
|
|
|
gst_pad_push_event (ffmpegmux->srcpad, gst_event_new_eos ());
|
2012-01-03 14:27:54 +00:00
|
|
|
return GST_FLOW_EOS;
|
2002-11-06 23:53:46 +00:00
|
|
|
}
|
2006-09-08 15:25:51 +00:00
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
2002-11-06 23:53:46 +00:00
|
|
|
}
|
|
|
|
|
2005-09-05 14:06:29 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_ffmpegmux_change_state (GstElement * element, GstStateChange transition)
|
2002-11-06 23:53:46 +00:00
|
|
|
{
|
2012-03-06 14:27:22 +00:00
|
|
|
GstStateChangeReturn ret;
|
2004-03-29 16:39:18 +00:00
|
|
|
GstFFMpegMux *ffmpegmux = (GstFFMpegMux *) (element);
|
2003-06-09 15:04:26 +00:00
|
|
|
|
|
|
|
switch (transition) {
|
2006-09-08 15:25:51 +00:00
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2012-04-17 13:36:12 +00:00
|
|
|
gst_collect_pads_start (ffmpegmux->collect);
|
2006-09-08 15:25:51 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
|
|
|
break;
|
2007-02-09 16:17:50 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2012-04-17 13:36:12 +00:00
|
|
|
gst_collect_pads_stop (ffmpegmux->collect);
|
2007-02-09 16:17:50 +00:00
|
|
|
break;
|
2006-09-08 15:25:51 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
|
|
|
break;
|
2005-09-05 14:06:29 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2008-12-16 15:58:05 +00:00
|
|
|
gst_tag_setter_reset_tags (GST_TAG_SETTER (ffmpegmux));
|
2003-06-09 15:04:26 +00:00
|
|
|
if (ffmpegmux->opened) {
|
|
|
|
ffmpegmux->opened = FALSE;
|
2007-12-17 12:43:06 +00:00
|
|
|
url_fclose (ffmpegmux->context->pb);
|
2003-06-09 15:04:26 +00:00
|
|
|
}
|
2002-11-06 23:53:46 +00:00
|
|
|
break;
|
2006-09-08 15:25:51 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2002-11-06 23:53:46 +00:00
|
|
|
}
|
2003-06-09 15:04:26 +00:00
|
|
|
|
2006-09-08 15:25:51 +00:00
|
|
|
return ret;
|
2002-11-06 23:53:46 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 07:49:43 +00:00
|
|
|
static GstCaps *
|
|
|
|
gst_ffmpegmux_get_id_caps (enum CodecID *id_list)
|
ext/ffmpeg/gstffmpeg.c: Enable muxers (only mp4 muxer for now).
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable muxers (only mp4 muxer for now).
* ext/ffmpeg/gstffmpegcodecmap.c:
(gst_ffmpeg_formatid_get_codecids), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Fix a bunch of typos in codec-id lookup (false/true return value
mixup), add a codec-id list retrieval function (because ffmpeg
does not provide one). With that, we can make valid pad templates.
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_init),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_change_state), (gst_ffmpegmux_get_id_caps),
(gst_ffmpegmux_register):
Fix for whatever changed since I last tried this. Works for MP4
muxing.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Update obviously-untested write code...
2005-03-14 15:27:43 +00:00
|
|
|
{
|
|
|
|
GstCaps *caps, *t;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
caps = gst_caps_new_empty ();
|
|
|
|
for (i = 0; id_list[i] != CODEC_ID_NONE; i++) {
|
|
|
|
if ((t = gst_ffmpeg_codecid_to_caps (id_list[i], NULL, TRUE)))
|
|
|
|
gst_caps_append (caps, t);
|
|
|
|
}
|
2009-05-15 14:48:35 +00:00
|
|
|
if (gst_caps_is_empty (caps)) {
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
return NULL;
|
|
|
|
}
|
ext/ffmpeg/gstffmpeg.c: Enable muxers (only mp4 muxer for now).
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable muxers (only mp4 muxer for now).
* ext/ffmpeg/gstffmpegcodecmap.c:
(gst_ffmpeg_formatid_get_codecids), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Fix a bunch of typos in codec-id lookup (false/true return value
mixup), add a codec-id list retrieval function (because ffmpeg
does not provide one). With that, we can make valid pad templates.
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_init),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_change_state), (gst_ffmpegmux_get_id_caps),
(gst_ffmpegmux_register):
Fix for whatever changed since I last tried this. Works for MP4
muxing.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Update obviously-untested write code...
2005-03-14 15:27:43 +00:00
|
|
|
|
|
|
|
return caps;
|
|
|
|
}
|
2003-06-09 15:04:26 +00:00
|
|
|
|
2007-02-09 17:30:19 +00:00
|
|
|
/* set a list of integer values on the caps, e.g. for sample rates */
|
|
|
|
static void
|
|
|
|
gst_ffmpeg_mux_simple_caps_set_int_list (GstCaps * caps, const gchar * field,
|
|
|
|
guint num, const gint * values)
|
|
|
|
{
|
|
|
|
GValue list = { 0, };
|
|
|
|
GValue val = { 0, };
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_CAPS_IS_SIMPLE (caps));
|
|
|
|
|
|
|
|
g_value_init (&list, GST_TYPE_LIST);
|
|
|
|
g_value_init (&val, G_TYPE_INT);
|
|
|
|
|
|
|
|
for (i = 0; i < num; ++i) {
|
|
|
|
g_value_set_int (&val, values[i]);
|
|
|
|
gst_value_list_append_value (&list, &val);
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_structure_set_value (gst_caps_get_structure (caps, 0), field, &list);
|
|
|
|
|
|
|
|
g_value_unset (&val);
|
|
|
|
g_value_unset (&list);
|
|
|
|
}
|
|
|
|
|
2002-11-06 23:53:46 +00:00
|
|
|
gboolean
|
2004-03-29 16:39:18 +00:00
|
|
|
gst_ffmpegmux_register (GstPlugin * plugin)
|
2002-11-06 23:53:46 +00:00
|
|
|
{
|
|
|
|
GTypeInfo typeinfo = {
|
2004-03-29 16:39:18 +00:00
|
|
|
sizeof (GstFFMpegMuxClass),
|
|
|
|
(GBaseInitFunc) gst_ffmpegmux_base_init,
|
2002-11-06 23:53:46 +00:00
|
|
|
NULL,
|
2004-03-29 16:39:18 +00:00
|
|
|
(GClassInitFunc) gst_ffmpegmux_class_init,
|
2002-11-06 23:53:46 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2004-03-29 16:39:18 +00:00
|
|
|
sizeof (GstFFMpegMux),
|
2002-11-06 23:53:46 +00:00
|
|
|
0,
|
2004-03-29 16:39:18 +00:00
|
|
|
(GInstanceInitFunc) gst_ffmpegmux_init,
|
2002-11-06 23:53:46 +00:00
|
|
|
};
|
ext/ffmpeg/gstffmpeg.c: Enable muxers (only mp4 muxer for now).
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable muxers (only mp4 muxer for now).
* ext/ffmpeg/gstffmpegcodecmap.c:
(gst_ffmpeg_formatid_get_codecids), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Fix a bunch of typos in codec-id lookup (false/true return value
mixup), add a codec-id list retrieval function (because ffmpeg
does not provide one). With that, we can make valid pad templates.
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_init),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_change_state), (gst_ffmpegmux_get_id_caps),
(gst_ffmpegmux_register):
Fix for whatever changed since I last tried this. Works for MP4
muxing.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Update obviously-untested write code...
2005-03-14 15:27:43 +00:00
|
|
|
static const GInterfaceInfo tag_setter_info = {
|
2007-02-09 16:17:50 +00:00
|
|
|
NULL, NULL, NULL
|
ext/ffmpeg/gstffmpeg.c: Enable muxers (only mp4 muxer for now).
Original commit message from CVS:
* ext/ffmpeg/gstffmpeg.c: (plugin_init):
Enable muxers (only mp4 muxer for now).
* ext/ffmpeg/gstffmpegcodecmap.c:
(gst_ffmpeg_formatid_get_codecids), (gst_ffmpeg_caps_to_codecid):
* ext/ffmpeg/gstffmpegcodecmap.h:
Fix a bunch of typos in codec-id lookup (false/true return value
mixup), add a codec-id list retrieval function (because ffmpeg
does not provide one). With that, we can make valid pad templates.
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_init),
(gst_ffmpegmux_connect), (gst_ffmpegmux_loop),
(gst_ffmpegmux_change_state), (gst_ffmpegmux_get_id_caps),
(gst_ffmpegmux_register):
Fix for whatever changed since I last tried this. Works for MP4
muxing.
* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
(gst_ffmpegdata_peek), (gst_ffmpegdata_write),
(gst_ffmpegdata_seek), (gst_ffmpegdata_close):
Update obviously-untested write code...
2005-03-14 15:27:43 +00:00
|
|
|
};
|
2002-11-06 23:53:46 +00:00
|
|
|
GType type;
|
2003-06-09 15:04:26 +00:00
|
|
|
AVOutputFormat *in_plugin;
|
2004-03-29 16:39:18 +00:00
|
|
|
|
2009-05-07 10:57:10 +00:00
|
|
|
in_plugin = av_oformat_next (NULL);
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2007-12-17 12:43:06 +00:00
|
|
|
GST_LOG ("Registering muxers");
|
|
|
|
|
2002-11-06 23:53:46 +00:00
|
|
|
while (in_plugin) {
|
|
|
|
gchar *type_name;
|
2003-06-09 15:04:26 +00:00
|
|
|
gchar *p;
|
2010-07-06 09:58:40 +00:00
|
|
|
GstRank rank = GST_RANK_MARGINAL;
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2009-02-27 08:40:03 +00:00
|
|
|
if ((!strncmp (in_plugin->name, "u16", 3)) ||
|
|
|
|
(!strncmp (in_plugin->name, "s16", 3)) ||
|
|
|
|
(!strncmp (in_plugin->name, "u24", 3)) ||
|
|
|
|
(!strncmp (in_plugin->name, "s24", 3)) ||
|
|
|
|
(!strncmp (in_plugin->name, "u8", 2)) ||
|
|
|
|
(!strncmp (in_plugin->name, "s8", 2)) ||
|
|
|
|
(!strncmp (in_plugin->name, "u32", 3)) ||
|
|
|
|
(!strncmp (in_plugin->name, "s32", 3)) ||
|
|
|
|
(!strncmp (in_plugin->name, "f32", 3)) ||
|
|
|
|
(!strncmp (in_plugin->name, "f64", 3)) ||
|
|
|
|
(!strncmp (in_plugin->name, "raw", 3)) ||
|
|
|
|
(!strncmp (in_plugin->name, "crc", 3)) ||
|
|
|
|
(!strncmp (in_plugin->name, "null", 4)) ||
|
|
|
|
(!strncmp (in_plugin->name, "gif", 3)) ||
|
|
|
|
(!strncmp (in_plugin->name, "frame", 5)) ||
|
2009-03-10 20:05:52 +00:00
|
|
|
(!strncmp (in_plugin->name, "image", 5)) ||
|
|
|
|
(!strncmp (in_plugin->name, "mulaw", 5)) ||
|
|
|
|
(!strncmp (in_plugin->name, "alaw", 4)) ||
|
2010-01-25 15:40:20 +00:00
|
|
|
(!strncmp (in_plugin->name, "h26", 3)) ||
|
2010-07-02 15:21:27 +00:00
|
|
|
(!strncmp (in_plugin->name, "rtp", 3)) ||
|
2011-01-24 16:43:44 +00:00
|
|
|
(!strncmp (in_plugin->name, "ass", 3)) ||
|
|
|
|
(!strncmp (in_plugin->name, "ffmetadata", 10)) ||
|
|
|
|
(!strncmp (in_plugin->name, "srt", 3))
|
2009-02-27 08:40:03 +00:00
|
|
|
) {
|
|
|
|
GST_LOG ("Ignoring muxer %s", in_plugin->name);
|
|
|
|
goto next;
|
|
|
|
}
|
|
|
|
|
2010-06-25 22:57:45 +00:00
|
|
|
if ((!strncmp (in_plugin->long_name, "raw ", 4))) {
|
|
|
|
GST_LOG ("Ignoring raw muxer %s", in_plugin->name);
|
|
|
|
goto next;
|
|
|
|
}
|
|
|
|
|
2010-07-06 09:58:40 +00:00
|
|
|
if (gst_ffmpegmux_get_replacement (in_plugin->name))
|
|
|
|
rank = GST_RANK_NONE;
|
|
|
|
|
2009-11-02 07:49:43 +00:00
|
|
|
/* FIXME : We need a fast way to know whether we have mappings for this
|
|
|
|
* muxer type. */
|
2003-06-09 15:04:26 +00:00
|
|
|
|
2002-11-06 23:53:46 +00:00
|
|
|
/* construct the type */
|
2012-04-12 17:41:52 +00:00
|
|
|
type_name = g_strdup_printf ("avmux_%s", in_plugin->name);
|
2003-06-09 15:04:26 +00:00
|
|
|
|
|
|
|
p = type_name;
|
|
|
|
|
|
|
|
while (*p) {
|
2004-03-29 16:39:18 +00:00
|
|
|
if (*p == '.')
|
|
|
|
*p = '_';
|
2003-06-09 15:04:26 +00:00
|
|
|
p++;
|
|
|
|
}
|
2002-11-06 23:53:46 +00:00
|
|
|
|
2009-06-05 11:19:03 +00:00
|
|
|
type = g_type_from_name (type_name);
|
|
|
|
|
|
|
|
if (!type) {
|
|
|
|
/* create the type now */
|
|
|
|
type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
|
2009-11-02 07:49:43 +00:00
|
|
|
g_type_set_qdata (type, GST_FFMUX_PARAMS_QDATA, (gpointer) in_plugin);
|
2009-06-05 11:19:03 +00:00
|
|
|
g_type_add_interface_static (type, GST_TYPE_TAG_SETTER, &tag_setter_info);
|
|
|
|
}
|
2007-02-16 11:48:15 +00:00
|
|
|
|
2010-07-06 09:58:40 +00:00
|
|
|
if (!gst_element_register (plugin, type_name, rank, type)) {
|
2004-09-16 21:14:46 +00:00
|
|
|
g_free (type_name);
|
2003-11-02 19:07:41 +00:00
|
|
|
return FALSE;
|
2004-09-16 21:14:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_free (type_name);
|
2003-11-02 19:07:41 +00:00
|
|
|
|
2004-03-29 16:39:18 +00:00
|
|
|
next:
|
2009-05-07 10:57:10 +00:00
|
|
|
in_plugin = av_oformat_next (in_plugin);
|
2002-11-06 23:53:46 +00:00
|
|
|
}
|
|
|
|
|
2007-12-17 12:43:06 +00:00
|
|
|
GST_LOG ("Finished registering muxers");
|
|
|
|
|
2002-11-06 23:53:46 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|