Original commit message from CVS:
indent
This commit is contained in:
Thomas Vander Stichele 2004-03-29 16:39:18 +00:00
parent d5cfdabbd8
commit 7383aa1baa
9 changed files with 891 additions and 984 deletions

View file

@ -1,3 +1,7 @@
2004-03-29 Thomas Vander Stichele <thomas at apestaart dot org>
* ext/ffmpeg/*.c: indent
2004-03-25 Ronald Bultje <rbultje@ronald.bitfreak.net>
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_base_init):

View file

@ -63,14 +63,9 @@ plugin_init (GstPlugin *plugin)
return TRUE;
}
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"ffmpeg",
"All FFMPEG codecs",
plugin_init,
FFMPEG_VERSION,
"LGPL",
"FFMpeg",
"http://ffmpeg.sourceforge.net/"
)
FFMPEG_VERSION, "LGPL", "FFMpeg", "http://ffmpeg.sourceforge.net/")

View file

@ -87,8 +87,7 @@
GstCaps *
gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
AVCodecContext *context,
gboolean encode)
AVCodecContext * context, gboolean encode)
{
GstCaps *caps = NULL;
gboolean buildcaps = FALSE;
@ -100,8 +99,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
/* FIXME: bitrate */
caps = GST_FF_VID_CAPS_NEW ("video/mpeg",
"mpegversion", G_TYPE_INT, 1,
"systemstream", G_TYPE_BOOLEAN, FALSE,
NULL);
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
}
break;
@ -110,15 +108,13 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
/* FIXME: bitrate */
caps = GST_FF_VID_CAPS_NEW ("video/mpeg",
"mpegversion", G_TYPE_INT, 2,
"systemstream", G_TYPE_BOOLEAN, FALSE,
NULL);
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
} else {
/* decode both MPEG-1 and MPEG-2; width/height/fps are all in
* the MPEG video stream headers, so may be omitted from caps. */
caps = gst_caps_new_simple ("video/mpeg",
"mpegversion", GST_TYPE_INT_RANGE, 1, 2,
"systemstream", G_TYPE_BOOLEAN, FALSE,
NULL);
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
}
break;
@ -141,8 +137,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
/* FIXME: context->sub_id must be filled in during decoding */
caps = GST_FF_VID_CAPS_NEW ("video/x-pn-realvideo",
"systemstream", G_TYPE_BOOLEAN, FALSE,
"rmversion", G_TYPE_INT, version,
NULL);
"rmversion", G_TYPE_INT, version, NULL);
} while (0);
break;
@ -151,9 +146,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
if (encode) {
/* FIXME: bitrate */
caps = GST_FF_AUD_CAPS_NEW ("audio/mpeg",
"mpegversion", G_TYPE_INT, 1,
"layer", G_TYPE_INT, 2,
NULL);
"mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 2, NULL);
}
break;
@ -161,16 +154,13 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
if (encode) {
/* FIXME: bitrate */
caps = GST_FF_AUD_CAPS_NEW ("audio/mpeg",
"mpegversion", G_TYPE_INT, 1,
"layer", G_TYPE_INT, 3,
NULL);
"mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL);
} else {
/* Decodes MPEG-1 layer 1/2/3. Samplerate, channels et al are
* in the MPEG audio header, so may be omitted from caps. */
caps = gst_caps_new_simple ("audio/mpeg",
"mpegversion", G_TYPE_INT, 1,
"layer", GST_TYPE_INT_RANGE, 1, 3,
NULL);
"layer", GST_TYPE_INT_RANGE, 1, 3, NULL);
}
break;
@ -214,17 +204,14 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
/* FIXME: bitrate */
caps = GST_FF_VID_CAPS_NEW ("video/mpeg",
"systemstream", G_TYPE_BOOLEAN, FALSE,
"mpegversion", G_TYPE_INT, 4,
NULL);
"mpegversion", G_TYPE_INT, 4, NULL);
} else {
/* The trick here is to separate xvid, divx, mpeg4, 3ivx et al */
caps = GST_FF_VID_CAPS_NEW ("video/mpeg",
"mpegversion", G_TYPE_INT, 4,
"systemstream", G_TYPE_BOOLEAN, FALSE,
NULL);
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
gst_caps_append (caps, GST_FF_VID_CAPS_NEW ("video/x-divx",
"divxversion", GST_TYPE_INT_RANGE, 4, 5,
NULL));
"divxversion", GST_TYPE_INT_RANGE, 4, 5, NULL));
gst_caps_append (caps, GST_FF_VID_CAPS_NEW ("video/x-xvid"));
gst_caps_append (caps, GST_FF_VID_CAPS_NEW ("video/x-3ivx"));
}
@ -242,12 +229,10 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
/* encode-FIXME: bitrate */
caps = GST_FF_VID_CAPS_NEW ("video/x-msmpeg",
"msmpegversion", G_TYPE_INT, version,
NULL);
"msmpegversion", G_TYPE_INT, version, NULL);
if (!encode && codec_id == CODEC_ID_MSMPEG4V3) {
gst_caps_append (caps, GST_FF_VID_CAPS_NEW ("video/x-divx",
"divxversion", G_TYPE_INT, 3,
NULL));
"divxversion", G_TYPE_INT, 3, NULL));
}
} while (0);
break;
@ -259,8 +244,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
/* encode-FIXME: bitrate */
caps = GST_FF_VID_CAPS_NEW ("video/x-wmv",
"wmvversion", G_TYPE_INT, version,
NULL);
"wmvversion", G_TYPE_INT, version, NULL);
} while (0);
break;
@ -270,8 +254,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
case CODEC_ID_SVQ1:
caps = GST_FF_VID_CAPS_NEW ("video/x-svq",
"svqversion", G_TYPE_INT, 1,
NULL);
"svqversion", G_TYPE_INT, 1, NULL);
break;
case CODEC_ID_SVQ3:
@ -280,8 +263,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
"halfpel_flag", GST_TYPE_INT_RANGE, 0, 1,
"thirdpel_flag", GST_TYPE_INT_RANGE, 0, 1,
"low_delay", GST_TYPE_INT_RANGE, 0, 1,
"unknown_svq3_flag", GST_TYPE_INT_RANGE, 0, 1,
NULL);
"unknown_svq3_flag", GST_TYPE_INT_RANGE, 0, 1, NULL);
break;
case CODEC_ID_DVAUDIO:
@ -302,8 +284,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
"flags1", GST_TYPE_INT_RANGE, G_MININT, G_MAXINT,
"flags2", GST_TYPE_INT_RANGE, G_MININT, G_MAXINT,
"block_align", GST_TYPE_INT_RANGE, 0, G_MAXINT,
"bitrate", GST_TYPE_INT_RANGE, 0, G_MAXINT,
NULL);
"bitrate", GST_TYPE_INT_RANGE, 0, G_MAXINT, NULL);
} while (0);
break;
@ -313,8 +294,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
gint version = (codec_id == CODEC_ID_MACE3) ? 3 : 6;
caps = GST_FF_AUD_CAPS_NEW ("audio/x-mace",
"maceversion", G_TYPE_INT, version,
NULL);
"maceversion", G_TYPE_INT, version, NULL);
} while (0);
break;
@ -332,8 +312,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
case CODEC_ID_INDEO3:
caps = GST_FF_VID_CAPS_NEW ("video/x-indeo",
"indeoversion", G_TYPE_INT, 3,
NULL);
"indeoversion", G_TYPE_INT, 3, NULL);
break;
case CODEC_ID_VP3:
@ -358,8 +337,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
case CODEC_ID_FFV1:
caps = GST_FF_VID_CAPS_NEW ("video/x-ffv",
"ffvversion", G_TYPE_INT, 1,
NULL);
"ffvversion", G_TYPE_INT, 1, NULL);
break;
case CODEC_ID_4XM:
@ -410,32 +388,38 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
switch (codec_id) {
case CODEC_ID_PCM_S16LE:
width = 16; depth = 16;
width = 16;
depth = 16;
endianness = G_LITTLE_ENDIAN;
signedness = TRUE;
break;
case CODEC_ID_PCM_S16BE:
width = 16; depth = 16;
width = 16;
depth = 16;
endianness = G_BIG_ENDIAN;
signedness = TRUE;
break;
case CODEC_ID_PCM_U16LE:
width = 16; depth = 16;
width = 16;
depth = 16;
endianness = G_LITTLE_ENDIAN;
signedness = FALSE;
break;
case CODEC_ID_PCM_U16BE:
width = 16; depth = 16;
width = 16;
depth = 16;
endianness = G_BIG_ENDIAN;
signedness = FALSE;
break;
case CODEC_ID_PCM_S8:
width = 8; depth = 8;
width = 8;
depth = 8;
endianness = G_BYTE_ORDER;
signedness = TRUE;
break;
case CODEC_ID_PCM_U8:
width = 8; depth = 8;
width = 8;
depth = 8;
endianness = G_BYTE_ORDER;
signedness = FALSE;
break;
@ -448,8 +432,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
"width", G_TYPE_INT, width,
"depth", G_TYPE_INT, depth,
"endianness", G_TYPE_INT, endianness,
"signed", G_TYPE_BOOLEAN, signedness,
NULL);
"signed", G_TYPE_BOOLEAN, signedness, NULL);
} while (0);
break;
@ -521,8 +504,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
/* FIXME: someone please check whether we need additional properties
* in this caps definition. */
caps = GST_FF_AUD_CAPS_NEW ("audio/x-adpcm",
"layout", G_TYPE_STRING, layout,
NULL);
"layout", G_TYPE_STRING, layout, NULL);
} while (0);
break;
@ -540,8 +522,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
/* FIXME: properties? */
caps = GST_FF_AUD_CAPS_NEW ("audio/x-pn-realaudio",
"raversion", G_TYPE_INT, version,
NULL);
"raversion", G_TYPE_INT, version, NULL);
} while (0);
break;
@ -569,8 +550,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
/* FIXME: someone please check whether we need additional properties
* in this caps definition. */
caps = GST_FF_AUD_CAPS_NEW ("audio/x-dpcm",
"layout", G_TYPE_STRING, layout,
NULL);
"layout", G_TYPE_STRING, layout, NULL);
} while (0);
break;
@ -613,6 +593,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
if (caps != NULL) {
char *str = gst_caps_to_string (caps);
GST_DEBUG ("caps for codec_id=%d: %s", codec_id, str);
g_free (str);
} else {
@ -630,8 +611,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
*/
static GstCaps *
gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt,
AVCodecContext *context)
gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context)
{
GstCaps *caps = NULL;
@ -649,12 +629,16 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt,
case PIX_FMT_RGB24:
bpp = depth = 24;
endianness = G_BIG_ENDIAN;
r_mask = 0xff0000; g_mask = 0x00ff00; b_mask = 0x0000ff;
r_mask = 0xff0000;
g_mask = 0x00ff00;
b_mask = 0x0000ff;
break;
case PIX_FMT_BGR24:
bpp = depth = 24;
endianness = G_BIG_ENDIAN;
r_mask = 0x0000ff; g_mask = 0x00ff00; b_mask = 0xff0000;
r_mask = 0x0000ff;
g_mask = 0x00ff00;
b_mask = 0xff0000;
break;
case PIX_FMT_YUV422P:
fmt = GST_MAKE_FOURCC ('Y', '4', '2', 'B');
@ -663,12 +647,17 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt,
/* .. */
break;
case PIX_FMT_RGBA32:
bpp = 32; depth = 24;
bpp = 32;
depth = 24;
endianness = G_BIG_ENDIAN;
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
r_mask = 0x00ff0000; g_mask = 0x0000ff00; b_mask = 0x000000ff;
r_mask = 0x00ff0000;
g_mask = 0x0000ff00;
b_mask = 0x000000ff;
#else
r_mask = 0x0000ff00; g_mask = 0x00ff0000; b_mask = 0xff000000;
r_mask = 0x0000ff00;
g_mask = 0x00ff0000;
b_mask = 0xff000000;
#endif
break;
case PIX_FMT_YUV410P:
@ -680,12 +669,17 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt,
case PIX_FMT_RGB565:
bpp = depth = 16;
endianness = G_BYTE_ORDER;
r_mask = 0xf800; g_mask = 0x07e0; b_mask = 0x001f;
r_mask = 0xf800;
g_mask = 0x07e0;
b_mask = 0x001f;
break;
case PIX_FMT_RGB555:
bpp = 16; depth = 15;
bpp = 16;
depth = 15;
endianness = G_BYTE_ORDER;
r_mask = 0x7c00; g_mask = 0x03e0; b_mask = 0x001f;
r_mask = 0x7c00;
g_mask = 0x03e0;
b_mask = 0x001f;
break;
default:
/* give up ... */
@ -699,16 +693,15 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt,
"red_mask", G_TYPE_INT, r_mask,
"green_mask", G_TYPE_INT, g_mask,
"blue_mask", G_TYPE_INT, b_mask,
"endianness", G_TYPE_INT, endianness,
NULL);
"endianness", G_TYPE_INT, endianness, NULL);
} else if (fmt) {
caps = GST_FF_VID_CAPS_NEW ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, fmt,
NULL);
"format", GST_TYPE_FOURCC, fmt, NULL);
}
if (caps != NULL) {
char *str = gst_caps_to_string (caps);
GST_DEBUG ("caps for pix_fmt=%d: %s", pix_fmt, str);
g_free (str);
} else {
@ -749,13 +742,12 @@ gst_ffmpeg_smpfmt_to_caps (enum SampleFormat sample_fmt,
caps = GST_FF_AUD_CAPS_NEW ("audio/x-raw-int",
"signed", G_TYPE_BOOLEAN, signedness,
"endianness", G_TYPE_INT, G_BYTE_ORDER,
"width", G_TYPE_INT, bpp,
"depth", G_TYPE_INT, bpp,
NULL);
"width", G_TYPE_INT, bpp, "depth", G_TYPE_INT, bpp, NULL);
}
if (caps != NULL) {
char *str = gst_caps_to_string (caps);
GST_DEBUG ("caps for sample_fmt=%d: %s", sample_fmt, str);
g_free (str);
} else {
@ -827,8 +819,7 @@ gst_ffmpeg_codectype_to_caps (enum CodecType codec_type,
* when needed.
*/
static void
gst_ffmpeg_caps_to_extradata (const GstCaps *caps,
AVCodecContext *context)
gst_ffmpeg_caps_to_extradata (const GstCaps * caps, AVCodecContext * context)
{
GstStructure *structure;
const gchar *mimetype;
@ -895,7 +886,8 @@ gst_ffmpeg_caps_to_extradata (const GstCaps *caps,
if (!gst_structure_get_int (structure, "halfpel_flag", &halfpel_flag) ||
!gst_structure_get_int (structure, "thirdpel_flag", &thirdpel_flag) ||
!gst_structure_get_int (structure, "low_delay", &low_delay) ||
!gst_structure_get_int (structure, "unknown_svq3_flag", &unknown_svq3_flag)) {
!gst_structure_get_int (structure, "unknown_svq3_flag",
&unknown_svq3_flag)) {
g_warning ("invalid caps for video/x-svq");
return;
}
@ -928,8 +920,7 @@ gst_ffmpeg_caps_to_extradata (const GstCaps *caps,
*/
static void
gst_ffmpeg_caps_to_smpfmt (const GstCaps *caps,
AVCodecContext *context)
gst_ffmpeg_caps_to_smpfmt (const GstCaps * caps, AVCodecContext * context)
{
GstStructure *structure;
gint depth = 0, width = 0, endianness = 0;
@ -964,8 +955,7 @@ gst_ffmpeg_caps_to_smpfmt (const GstCaps *caps,
*/
static void
gst_ffmpeg_caps_to_pixfmt (const GstCaps *caps,
AVCodecContext *context)
gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps, AVCodecContext * context)
{
GstStructure *structure;
gdouble fps;
@ -1008,7 +998,8 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps *caps,
#endif
}
}
} else if (strcmp (gst_structure_get_name (structure), "video/x-raw-rgb") == 0) {
} else if (strcmp (gst_structure_get_name (structure),
"video/x-raw-rgb") == 0) {
gint bpp = 0, rmask = 0, endianness = 0;
if (gst_structure_get_int (structure, "bpp", &bpp) &&
@ -1056,8 +1047,7 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps *caps,
void
gst_ffmpeg_caps_to_codectype (enum CodecType type,
const GstCaps *caps,
AVCodecContext *context)
const GstCaps * caps, AVCodecContext * context)
{
if (context == NULL)
return;
@ -1094,44 +1084,32 @@ gst_ffmpeg_formatid_to_caps (const gchar *format_name)
if (!strcmp (format_name, "mpeg")) {
caps = gst_caps_new_simple ("video/mpeg",
"systemstream", G_TYPE_BOOLEAN, TRUE,
NULL);
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
} else if (!strcmp (format_name, "mpegts")) {
caps = gst_caps_new_simple ("video/mpegts",
"systemstream", G_TYPE_BOOLEAN, TRUE,
NULL);
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
} else if (!strcmp (format_name, "rm")) {
caps = gst_caps_new_simple ("application/x-pn-realmedia",
"systemstream", G_TYPE_BOOLEAN, TRUE,
NULL);
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
} else if (!strcmp (format_name, "asf")) {
caps = gst_caps_new_simple ("video/x-ms-asf",
NULL);
caps = gst_caps_new_simple ("video/x-ms-asf", NULL);
} else if (!strcmp (format_name, "avi")) {
caps = gst_caps_new_simple ("video/x-msvideo",
NULL);
caps = gst_caps_new_simple ("video/x-msvideo", NULL);
} else if (!strcmp (format_name, "wav")) {
caps = gst_caps_new_simple ("video/x-wav",
NULL);
caps = gst_caps_new_simple ("video/x-wav", NULL);
} else if (!strcmp (format_name, "swf")) {
caps = gst_caps_new_simple ("application/x-shockwave-flash",
NULL);
caps = gst_caps_new_simple ("application/x-shockwave-flash", NULL);
} else if (!strcmp (format_name, "au")) {
caps = gst_caps_new_simple ("audio/x-au",
NULL);
caps = gst_caps_new_simple ("audio/x-au", NULL);
} else if (!strcmp (format_name, "mov_mp4_m4a_3gp")) {
caps = gst_caps_new_simple ("video/quicktime",
NULL);
caps = gst_caps_new_simple ("video/quicktime", NULL);
} else if (!strcmp (format_name, "dv")) {
caps = gst_caps_new_simple ("video/x-dv",
"systemstream", G_TYPE_BOOLEAN, TRUE,
NULL);
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
} else if (!strcmp (format_name, "4xm")) {
caps = gst_caps_new_simple ("video/x-4xm",
NULL);
caps = gst_caps_new_simple ("video/x-4xm", NULL);
} else if (!strcmp (format_name, "matroska")) {
caps = gst_caps_new_simple ("video/x-matroska",
NULL);
caps = gst_caps_new_simple ("video/x-matroska", NULL);
} else {
gchar *name;
@ -1154,8 +1132,7 @@ gst_ffmpeg_formatid_to_caps (const gchar *format_name)
*/
enum CodecID
gst_ffmpeg_caps_to_codecid (const GstCaps *caps,
AVCodecContext *context)
gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
{
enum CodecID id = CODEC_ID_NONE;
const gchar *mimetype;
@ -1341,6 +1318,7 @@ gst_ffmpeg_caps_to_codecid (const GstCaps *caps,
gboolean sys_strm = TRUE;
gint mpegversion = 0;
gst_structure_get_boolean (structure, "systemstream", &sys_strm);
gst_structure_get_int (structure, "mpegversion", &mpegversion);
if (!sys_strm) {
@ -1760,6 +1738,7 @@ gst_ffmpeg_caps_to_codecid (const GstCaps *caps,
if (id != CODEC_ID_NONE) {
char *str = gst_caps_to_string (caps);
GST_DEBUG ("The id=%d belongs to the caps %s", id, str);
g_free (str);
}

View file

@ -46,22 +46,21 @@
typedef struct _GstFFMpegCsp GstFFMpegCsp;
typedef struct _GstFFMpegCspClass GstFFMpegCspClass;
struct _GstFFMpegCsp {
struct _GstFFMpegCsp
{
GstElement element;
GstPad *sinkpad, *srcpad;
gint width, height;
gfloat fps;
enum PixelFormat
from_pixfmt,
to_pixfmt;
AVFrame *from_frame,
*to_frame;
enum PixelFormat from_pixfmt, to_pixfmt;
AVFrame *from_frame, *to_frame;
GstCaps *sinkcaps;
};
struct _GstFFMpegCspClass {
struct _GstFFMpegCspClass
{
GstElementClass parent_class;
};
@ -75,12 +74,14 @@ static GstElementDetails ffmpegcsp_details = {
/* Stereo signals and args */
enum {
enum
{
/* FILL ME */
LAST_SIGNAL
};
enum {
enum
{
ARG_0,
};
@ -91,25 +92,19 @@ static void gst_ffmpegcsp_class_init (GstFFMpegCspClass *klass);
static void gst_ffmpegcsp_init (GstFFMpegCsp * space);
static void gst_ffmpegcsp_set_property (GObject * object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
guint prop_id, const GValue * value, GParamSpec * pspec);
static void gst_ffmpegcsp_get_property (GObject * object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
guint prop_id, GValue * value, GParamSpec * pspec);
static GstPadLinkReturn
gst_ffmpegcsp_pad_link (GstPad *pad,
const GstCaps *caps);
gst_ffmpegcsp_pad_link (GstPad * pad, const GstCaps * caps);
static void gst_ffmpegcsp_chain (GstPad *pad,
GstData *data);
static GstElementStateReturn
gst_ffmpegcsp_change_state (GstElement *element);
static void gst_ffmpegcsp_chain (GstPad * pad, GstData * data);
static GstElementStateReturn gst_ffmpegcsp_change_state (GstElement * element);
static GstPadTemplate *srctempl, *sinktempl;
static GstElementClass *parent_class = NULL;
/*static guint gst_ffmpegcsp_signals[LAST_SIGNAL] = { 0 }; */
@ -171,8 +166,7 @@ gst_ffmpegcsp_getcaps (GstPad *pad)
}
static GstPadLinkReturn
gst_ffmpegcsp_pad_link (GstPad *pad,
const GstCaps *caps)
gst_ffmpegcsp_pad_link (GstPad * pad, const GstCaps * caps)
{
GstStructure *structure;
AVCodecContext *ctx;
@ -223,8 +217,7 @@ gst_ffmpegcsp_pad_link (GstPad *pad,
gst_caps_set_simple (caps,
"width", G_TYPE_INT, width,
"height", G_TYPE_INT, height,
"framerate", G_TYPE_DOUBLE, framerate,
NULL);
"framerate", G_TYPE_DOUBLE, framerate, NULL);
ret = gst_pad_try_set_caps (otherpad, caps);
if (GST_PAD_LINK_FAILED (ret)) {
return ret;
@ -270,8 +263,7 @@ gst_ffmpegcsp_get_type (void)
};
ffmpegcsp_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstFFMpegCsp",
&ffmpegcsp_info, 0);
"GstFFMpegCsp", &ffmpegcsp_info, 0);
}
return ffmpegcsp_type;
@ -323,8 +315,7 @@ gst_ffmpegcsp_init (GstFFMpegCsp *space)
}
static void
gst_ffmpegcsp_chain (GstPad *pad,
GstData *data)
gst_ffmpegcsp_chain (GstPad * pad, GstData * data)
{
GstBuffer *inbuf = GST_BUFFER (data);
GstFFMpegCsp *space;
@ -339,8 +330,7 @@ gst_ffmpegcsp_chain (GstPad *pad,
g_return_if_fail (space != NULL);
g_return_if_fail (GST_IS_FFMPEGCSP (space));
if (space->from_pixfmt == PIX_FMT_NB ||
space->to_pixfmt == PIX_FMT_NB) {
if (space->from_pixfmt == PIX_FMT_NB || space->to_pixfmt == PIX_FMT_NB) {
GST_ELEMENT_ERROR (space, CORE, NOT_IMPLEMENTED, NULL,
("attempting to convert colorspaces between unknown formats"));
gst_buffer_unref (inbuf);
@ -354,8 +344,8 @@ gst_ffmpegcsp_chain (GstPad *pad,
guint size = avpicture_get_size (space->to_pixfmt,
space->width,
space->height);
outbuf = gst_pad_alloc_buffer (space->srcpad,
GST_BUFFER_OFFSET_NONE, size);
outbuf = gst_pad_alloc_buffer (space->srcpad, GST_BUFFER_OFFSET_NONE, size);
/* convert */
avpicture_fill ((AVPicture *) space->from_frame, GST_BUFFER_DATA (inbuf),
@ -401,9 +391,7 @@ gst_ffmpegcsp_change_state (GstElement *element)
static void
gst_ffmpegcsp_set_property (GObject * object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
guint prop_id, const GValue * value, GParamSpec * pspec)
{
GstFFMpegCsp *space;
@ -419,9 +407,7 @@ gst_ffmpegcsp_set_property (GObject *object,
static void
gst_ffmpegcsp_get_property (GObject * object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
guint prop_id, GValue * value, GParamSpec * pspec)
{
GstFFMpegCsp *space;
@ -446,13 +432,8 @@ gst_ffmpegcsp_register (GstPlugin *plugin)
/* build templates */
srctempl = gst_pad_template_new ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
gst_caps_copy (caps));
sinktempl = gst_pad_template_new ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
caps);
GST_PAD_SRC, GST_PAD_ALWAYS, gst_caps_copy (caps));
sinktempl = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, caps);
return gst_element_register (plugin, "ffcolorspace",
GST_RANK_NONE, GST_TYPE_FFMPEGCSP);

View file

@ -36,7 +36,8 @@
typedef struct _GstFFMpegDec GstFFMpegDec;
struct _GstFFMpegDec {
struct _GstFFMpegDec
{
GstElement element;
/* We need to keep track of our pads, so we do so here. */
@ -50,7 +51,8 @@ struct _GstFFMpegDec {
typedef struct _GstFFMpegDecClass GstFFMpegDecClass;
struct _GstFFMpegDecClass {
struct _GstFFMpegDecClass
{
GstElementClass parent_class;
AVCodec *in_plugin;
@ -59,7 +61,8 @@ struct _GstFFMpegDecClass {
typedef struct _GstFFMpegDecClassParams GstFFMpegDecClassParams;
struct _GstFFMpegDecClassParams {
struct _GstFFMpegDecClassParams
{
AVCodec *in_plugin;
GstCaps *srccaps, *sinkcaps;
};
@ -75,12 +78,14 @@ struct _GstFFMpegDecClassParams {
#define GST_IS_FFMPEGDEC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGDEC))
enum {
enum
{
/* FILL ME */
LAST_SIGNAL
};
enum {
enum
{
ARG_0,
/* FILL ME */
};
@ -95,11 +100,9 @@ static void gst_ffmpegdec_dispose (GObject *object);
static GstPadLinkReturn gst_ffmpegdec_connect (GstPad * pad,
const GstCaps * caps);
static void gst_ffmpegdec_chain (GstPad *pad,
GstData *data);
static void gst_ffmpegdec_chain (GstPad * pad, GstData * data);
static GstElementStateReturn
gst_ffmpegdec_change_state (GstElement *element);
static GstElementStateReturn gst_ffmpegdec_change_state (GstElement * element);
#if 0
/* some sort of bufferpool handling, but different */
@ -125,16 +128,14 @@ gst_ffmpegdec_base_init (GstFFMpegDecClass *klass)
params = g_hash_table_lookup (global_plugins,
GINT_TO_POINTER (G_OBJECT_CLASS_TYPE (gobject_class)));
if (!params)
params = g_hash_table_lookup (global_plugins,
GINT_TO_POINTER (0));
params = g_hash_table_lookup (global_plugins, GINT_TO_POINTER (0));
g_assert (params);
/* construct the element details struct */
details.longname = g_strdup_printf ("FFMPEG %s decoder",
params->in_plugin->name);
details.klass = g_strdup_printf ("Codec/%s/Decoder",
(params->in_plugin->type == CODEC_TYPE_VIDEO) ?
"Video" : "Audio");
(params->in_plugin->type == CODEC_TYPE_VIDEO) ? "Video" : "Audio");
details.description = g_strdup_printf ("FFMPEG %s decoder",
params->in_plugin->name);
details.author = "Wim Taymans <wim.taymans@chello.be>, "
@ -176,7 +177,8 @@ gst_ffmpegdec_class_init (GstFFMpegDecClass *klass)
static void
gst_ffmpegdec_init (GstFFMpegDec * ffmpegdec)
{
GstFFMpegDecClass *oclass = (GstFFMpegDecClass*)(G_OBJECT_GET_CLASS (ffmpegdec));
GstFFMpegDecClass *oclass =
(GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
/* setup pads */
ffmpegdec->sinkpad = gst_pad_new_from_template (oclass->sinktempl, "sink");
@ -210,11 +212,11 @@ gst_ffmpegdec_dispose (GObject *object)
}
static GstPadLinkReturn
gst_ffmpegdec_connect (GstPad *pad,
const GstCaps *caps)
gst_ffmpegdec_connect (GstPad * pad, const GstCaps * caps)
{
GstFFMpegDec *ffmpegdec = (GstFFMpegDec *) (gst_pad_get_parent (pad));
GstFFMpegDecClass *oclass = (GstFFMpegDecClass*)(G_OBJECT_GET_CLASS (ffmpegdec));
GstFFMpegDecClass *oclass =
(GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
/* close old session */
if (ffmpegdec->opened) {
@ -263,8 +265,7 @@ gst_ffmpegdec_connect (GstPad *pad,
#if 0
static int
gst_ffmpegdec_get_buffer (AVCodecContext *context,
AVFrame *picture)
gst_ffmpegdec_get_buffer (AVCodecContext * context, AVFrame * picture)
{
GstBuffer *buf = NULL;
gulong bufsize = 0;
@ -272,12 +273,10 @@ gst_ffmpegdec_get_buffer (AVCodecContext *context,
switch (context->codec_type) {
case CODEC_TYPE_VIDEO:
bufsize = avpicture_get_size (context->pix_fmt,
context->width,
context->height);
context->width, context->height);
buf = gst_buffer_new_and_alloc (bufsize);
avpicture_fill ((AVPicture *) picture, GST_BUFFER_DATA (buf),
context->pix_fmt,
context->width, context->height);
context->pix_fmt, context->width, context->height);
break;
case CODEC_TYPE_AUDIO:
@ -301,11 +300,11 @@ gst_ffmpegdec_get_buffer (AVCodecContext *context,
}
static void
gst_ffmpegdec_release_buffer (AVCodecContext *context,
AVFrame *picture)
gst_ffmpegdec_release_buffer (AVCodecContext * context, AVFrame * picture)
{
gint i;
GstBuffer *buf = GST_BUFFER (picture->base[0]);
gst_buffer_unref (buf);
/* zero out the reference in ffmpeg */
@ -317,13 +316,13 @@ gst_ffmpegdec_release_buffer (AVCodecContext *context,
#endif
static void
gst_ffmpegdec_chain (GstPad *pad,
GstData *_data)
gst_ffmpegdec_chain (GstPad * pad, GstData * _data)
{
GstBuffer *inbuf = GST_BUFFER (_data);
GstBuffer *outbuf = NULL;
GstFFMpegDec *ffmpegdec = (GstFFMpegDec *) (gst_pad_get_parent (pad));
GstFFMpegDecClass *oclass = (GstFFMpegDecClass*)(G_OBJECT_GET_CLASS (ffmpegdec));
GstFFMpegDecClass *oclass =
(GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
guchar *data;
gint size, len = 0;
gint have_data;
@ -359,9 +358,7 @@ gst_ffmpegdec_chain (GstPad *pad,
size = GST_BUFFER_SIZE (inbuf);
}
len = avcodec_decode_video (ffmpegdec->context,
ffmpegdec->picture,
&have_data,
data, size);
ffmpegdec->picture, &have_data, data, size);
if (have_data) {
/* libavcodec constantly crashes on stupid buffer allocation
* errors inside. This drives me crazy, so we let it allocate
@ -370,16 +367,15 @@ gst_ffmpegdec_chain (GstPad *pad,
gint size = avpicture_get_size (ffmpegdec->context->pix_fmt,
ffmpegdec->context->width,
ffmpegdec->context->height);
outbuf = gst_buffer_new_and_alloc (size);
avpicture_fill (&pic, GST_BUFFER_DATA (outbuf),
ffmpegdec->context->pix_fmt,
ffmpegdec->context->width,
ffmpegdec->context->height);
ffmpegdec->context->width, ffmpegdec->context->height);
img_convert (&pic, ffmpegdec->context->pix_fmt,
(AVPicture *) ffmpegdec->picture,
ffmpegdec->context->pix_fmt,
ffmpegdec->context->width,
ffmpegdec->context->height);
ffmpegdec->context->width, ffmpegdec->context->height);
/* this isn't necessarily true, but it's better than nothing */
GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (inbuf);
@ -389,15 +385,12 @@ gst_ffmpegdec_chain (GstPad *pad,
case CODEC_TYPE_AUDIO:
outbuf = gst_buffer_new_and_alloc (AVCODEC_MAX_AUDIO_FRAME_SIZE);
len = avcodec_decode_audio (ffmpegdec->context,
(int16_t *) GST_BUFFER_DATA (outbuf),
&have_data,
data, size);
(int16_t *) GST_BUFFER_DATA (outbuf), &have_data, data, size);
if (have_data) {
GST_BUFFER_SIZE (outbuf) = have_data;
GST_BUFFER_DURATION (outbuf) = (have_data * GST_SECOND) /
(ffmpegdec->context->channels *
ffmpegdec->context->sample_rate);
(ffmpegdec->context->channels * ffmpegdec->context->sample_rate);
} else {
gst_buffer_unref (outbuf);
}
@ -416,6 +409,7 @@ gst_ffmpegdec_chain (GstPad *pad,
if (have_data) {
if (!GST_PAD_CAPS (ffmpegdec->srcpad)) {
GstCaps *caps;
caps = gst_ffmpeg_codectype_to_caps (oclass->in_plugin->type,
ffmpegdec->context);
if (caps == NULL ||
@ -518,8 +512,7 @@ gst_ffmpegdec_register (GstPlugin *plugin)
params->srccaps = srccaps;
params->sinkcaps = sinkcaps;
g_hash_table_insert (global_plugins,
GINT_TO_POINTER (0),
(gpointer) params);
GINT_TO_POINTER (0), (gpointer) params);
/* create the gtype now
* (Ronald) MPEG-4 gets a higher priority because it has been well-
@ -535,8 +528,7 @@ gst_ffmpegdec_register (GstPlugin *plugin)
g_free (type_name);
g_hash_table_insert (global_plugins,
GINT_TO_POINTER (type),
(gpointer) params);
GINT_TO_POINTER (type), (gpointer) params);
next:
in_plugin = in_plugin->next;

View file

@ -36,7 +36,8 @@
typedef struct _GstFFMpegDemux GstFFMpegDemux;
struct _GstFFMpegDemux {
struct _GstFFMpegDemux
{
GstElement element;
/* We need to keep track of our pads, so we do so here. */
@ -51,14 +52,16 @@ struct _GstFFMpegDemux {
gint videopads, audiopads;
};
typedef struct _GstFFMpegDemuxClassParams {
typedef struct _GstFFMpegDemuxClassParams
{
AVInputFormat *in_plugin;
GstCaps *sinkcaps, *videosrccaps, *audiosrccaps;
} GstFFMpegDemuxClassParams;
typedef struct _GstFFMpegDemuxClass GstFFMpegDemuxClass;
struct _GstFFMpegDemuxClass {
struct _GstFFMpegDemuxClass
{
GstElementClass parent_class;
AVInputFormat *in_plugin;
@ -78,12 +81,14 @@ struct _GstFFMpegDemuxClass {
#define GST_IS_FFMPEGDEC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGDEC))
enum {
enum
{
/* FILL ME */
LAST_SIGNAL
};
enum {
enum
{
ARG_0,
/* FILL ME */
};
@ -149,8 +154,7 @@ gst_ffmpegdemux_base_init (GstFFMpegDemuxClass *klass)
params = g_hash_table_lookup (global_plugins,
GINT_TO_POINTER (G_OBJECT_CLASS_TYPE (gobject_class)));
if (!params)
params = g_hash_table_lookup (global_plugins,
GINT_TO_POINTER (0));
params = g_hash_table_lookup (global_plugins, GINT_TO_POINTER (0));
g_assert (params);
/* construct the element details struct */
@ -167,17 +171,11 @@ gst_ffmpegdemux_base_init (GstFFMpegDemuxClass *klass)
/* pad templates */
sinktempl = gst_pad_template_new ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
params->sinkcaps);
GST_PAD_SINK, GST_PAD_ALWAYS, params->sinkcaps);
videosrctempl = gst_pad_template_new ("video_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
params->videosrccaps);
GST_PAD_SRC, GST_PAD_SOMETIMES, params->videosrccaps);
audiosrctempl = gst_pad_template_new ("audio_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
params->audiosrccaps);
GST_PAD_SRC, GST_PAD_SOMETIMES, params->audiosrccaps);
gst_element_class_add_pad_template (element_class, videosrctempl);
gst_element_class_add_pad_template (element_class, audiosrctempl);
@ -206,14 +204,13 @@ gst_ffmpegdemux_class_init (GstFFMpegDemuxClass *klass)
static void
gst_ffmpegdemux_init (GstFFMpegDemux * demux)
{
GstFFMpegDemuxClass *oclass = (GstFFMpegDemuxClass *) (G_OBJECT_GET_CLASS (demux));
GstFFMpegDemuxClass *oclass =
(GstFFMpegDemuxClass *) (G_OBJECT_GET_CLASS (demux));
gint n;
demux->sinkpad = gst_pad_new_from_template (oclass->sinktempl,
"sink");
demux->sinkpad = gst_pad_new_from_template (oclass->sinktempl, "sink");
gst_element_add_pad (GST_ELEMENT (demux), demux->sinkpad);
gst_element_set_loop_function (GST_ELEMENT (demux),
gst_ffmpegdemux_loop);
gst_element_set_loop_function (GST_ELEMENT (demux), gst_ffmpegdemux_loop);
demux->opened = FALSE;
demux->context = NULL;
@ -283,8 +280,7 @@ gst_ffmpegdemux_src_event_mask (GstPad *pad)
}
static gboolean
gst_ffmpegdemux_src_event (GstPad *pad,
GstEvent *event)
gst_ffmpegdemux_src_event (GstPad * pad, GstEvent * event)
{
GstFFMpegDemux *demux = (GstFFMpegDemux *) gst_pad_get_parent (pad);
AVStream *stream = gst_ffmpegdemux_stream_from_pad (pad);
@ -304,6 +300,7 @@ gst_ffmpegdemux_src_event (GstPad *pad,
break;
} else {
GstFormat fmt = GST_FORMAT_TIME;
if (!(res = gst_pad_convert (pad, GST_FORMAT_DEFAULT, offset,
&fmt, &offset)))
break;
@ -336,9 +333,7 @@ gst_ffmpegdemux_src_format_list (GstPad *pad)
GST_FORMAT_DEFAULT,
0
}, src_a_formats[] = {
GST_FORMAT_TIME,
0
};
GST_FORMAT_TIME, 0};
return (stream->codec.codec_type == CODEC_TYPE_VIDEO) ?
src_v_formats : src_a_formats;
@ -358,9 +353,7 @@ gst_ffmpegdemux_src_query_list (GstPad *pad)
static gboolean
gst_ffmpegdemux_src_query (GstPad * pad,
GstQueryType type,
GstFormat *fmt,
gint64 *value)
GstQueryType type, GstFormat * fmt, gint64 * value)
{
GstFFMpegDemux *demux = (GstFFMpegDemux *) gst_pad_get_parent (pad);
AVStream *stream = gst_ffmpegdemux_stream_from_pad (pad);
@ -394,8 +387,7 @@ gst_ffmpegdemux_src_query (GstPad *pad,
break;
case GST_FORMAT_DEFAULT:
res = gst_pad_convert (pad, GST_FORMAT_TIME,
demux->last_ts[stream->index],
fmt, value);
demux->last_ts[stream->index], fmt, value);
break;
default:
res = FALSE;
@ -413,9 +405,7 @@ gst_ffmpegdemux_src_query (GstPad *pad,
static gboolean
gst_ffmpegdemux_src_convert (GstPad * pad,
GstFormat src_fmt,
gint64 src_value,
GstFormat *dest_fmt,
gint64 *dest_value)
gint64 src_value, GstFormat * dest_fmt, gint64 * dest_value)
{
GstFFMpegDemux *demux = (GstFFMpegDemux *) gst_pad_get_parent (pad);
AVStream *stream = gst_ffmpegdemux_stream_from_pad (pad);
@ -456,10 +446,10 @@ gst_ffmpegdemux_src_convert (GstPad *pad,
}
static gboolean
gst_ffmpegdemux_add (GstFFMpegDemux *demux,
AVStream *stream)
gst_ffmpegdemux_add (GstFFMpegDemux * demux, AVStream * stream)
{
GstFFMpegDemuxClass *oclass = (GstFFMpegDemuxClass *) G_OBJECT_GET_CLASS (demux);
GstFFMpegDemuxClass *oclass =
(GstFFMpegDemuxClass *) G_OBJECT_GET_CLASS (demux);
GstPadTemplate *templ = NULL;
GstPad *pad;
GstCaps *caps;
@ -499,7 +489,8 @@ gst_ffmpegdemux_add (GstFFMpegDemux *demux,
demux->srcpads[stream->index] = pad;
/* get caps that belongs to this stream */
caps = gst_ffmpeg_codecid_to_caps (stream->codec.codec_id, &stream->codec, TRUE);
caps =
gst_ffmpeg_codecid_to_caps (stream->codec.codec_id, &stream->codec, TRUE);
gst_pad_set_explicit_caps (pad, caps);
gst_element_add_pad (GST_ELEMENT (demux), pad);
@ -510,7 +501,8 @@ gst_ffmpegdemux_add (GstFFMpegDemux *demux,
static gboolean
gst_ffmpegdemux_open (GstFFMpegDemux * demux)
{
GstFFMpegDemuxClass *oclass = (GstFFMpegDemuxClass *) G_OBJECT_GET_CLASS (demux);
GstFFMpegDemuxClass *oclass =
(GstFFMpegDemuxClass *) G_OBJECT_GET_CLASS (demux);
gchar *location;
gint res;
@ -680,7 +672,8 @@ gst_ffmpegdemux_register (GstPlugin *plugin)
p = name = g_strdup (in_plugin->name);
while (*p) {
if (*p == '.' || *p == ',') *p = '_';
if (*p == '.' || *p == ',')
*p = '_';
p++;
}
@ -694,9 +687,9 @@ gst_ffmpegdemux_register (GstPlugin *plugin)
* when we open the stream */
audiosrccaps = gst_caps_new_empty ();
videosrccaps = gst_caps_new_empty ();
for (in_codec = first_avcodec; in_codec != NULL;
in_codec = in_codec->next) {
for (in_codec = first_avcodec; in_codec != NULL; in_codec = in_codec->next) {
GstCaps *temp = gst_ffmpeg_codecid_to_caps (in_codec->id, NULL, TRUE);
if (!temp) {
continue;
}
@ -732,15 +725,13 @@ gst_ffmpegdemux_register (GstPlugin *plugin)
params->audiosrccaps = audiosrccaps;
g_hash_table_insert (global_plugins,
GINT_TO_POINTER (0),
(gpointer) params);
GINT_TO_POINTER (0), (gpointer) params);
/* create the type now */
type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
g_hash_table_insert (global_plugins,
GINT_TO_POINTER (type),
(gpointer) params);
GINT_TO_POINTER (type), (gpointer) params);
if (in_plugin->extensions)
extensions = g_strsplit (in_plugin->extensions, " ", 0);
@ -749,8 +740,7 @@ gst_ffmpegdemux_register (GstPlugin *plugin)
if (!gst_element_register (plugin, type_name, GST_RANK_MARGINAL, type) ||
!gst_type_find_register (plugin, typefind_name, GST_RANK_MARGINAL,
gst_ffmpegdemux_type_find,
extensions, sinkcaps, params)) {
gst_ffmpegdemux_type_find, extensions, sinkcaps, params)) {
g_warning ("Register of type ffdemux_%s failed", name);
return FALSE;
}

View file

@ -36,7 +36,8 @@
typedef struct _GstFFMpegEnc GstFFMpegEnc;
struct _GstFFMpegEnc {
struct _GstFFMpegEnc
{
GstElement element;
/* We need to keep track of our pads, so we do so here. */
@ -57,14 +58,16 @@ struct _GstFFMpegEnc {
typedef struct _GstFFMpegEncClass GstFFMpegEncClass;
struct _GstFFMpegEncClass {
struct _GstFFMpegEncClass
{
GstElementClass parent_class;
AVCodec *in_plugin;
GstPadTemplate *srctempl, *sinktempl;
};
typedef struct {
typedef struct
{
AVCodec *in_plugin;
GstCaps *srccaps, *sinkcaps;
} GstFFMpegEncClassParams;
@ -82,12 +85,14 @@ typedef struct {
#define VIDEO_BUFFER_SIZE (1024*1024)
enum {
enum
{
/* FILL ME */
LAST_SIGNAL
};
enum {
enum
{
ARG_0,
ARG_BIT_RATE,
ARG_GOP_SIZE,
@ -111,7 +116,8 @@ gst_ffmpegenc_me_method_get_type (void)
{0, NULL, NULL},
};
if (!ffmpegenc_me_method_type) {
ffmpegenc_me_method_type = g_enum_register_static ("GstFFMpegEncMeMethod", ffmpegenc_me_methods);
ffmpegenc_me_method_type =
g_enum_register_static ("GstFFMpegEncMeMethod", ffmpegenc_me_methods);
}
return ffmpegenc_me_method_type;
}
@ -130,16 +136,11 @@ static void gst_ffmpegenc_chain_video (GstPad *pad, GstData *_data);
static void gst_ffmpegenc_chain_audio (GstPad * pad, GstData * _data);
static void gst_ffmpegenc_set_property (GObject * object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
guint prop_id, const GValue * value, GParamSpec * pspec);
static void gst_ffmpegenc_get_property (GObject * object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
guint prop_id, GValue * value, GParamSpec * pspec);
static GstElementStateReturn
gst_ffmpegenc_change_state (GstElement *element);
static GstElementStateReturn gst_ffmpegenc_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
@ -158,8 +159,7 @@ gst_ffmpegenc_base_init (GstFFMpegEncClass *klass)
GINT_TO_POINTER (G_OBJECT_CLASS_TYPE (gobject_class)));
/* HACK: if we don't have a GType yet, our params are stored at position 0 */
if (!params) {
params = g_hash_table_lookup (enc_global_plugins,
GINT_TO_POINTER (0));
params = g_hash_table_lookup (enc_global_plugins, GINT_TO_POINTER (0));
}
g_assert (params);
@ -167,8 +167,7 @@ gst_ffmpegenc_base_init (GstFFMpegEncClass *klass)
details.longname = g_strdup_printf ("FFMPEG %s encoder",
params->in_plugin->name);
details.klass = g_strdup_printf ("Codec/%s/Encoder",
(params->in_plugin->type == CODEC_TYPE_VIDEO) ?
"Video" : "Audio");
(params->in_plugin->type == CODEC_TYPE_VIDEO) ? "Video" : "Audio");
details.description = g_strdup_printf ("FFMPEG %s encoder",
params->in_plugin->name);
details.author = "Wim Taymans <wim.taymans@chello.be>, "
@ -206,8 +205,7 @@ gst_ffmpegenc_class_init (GstFFMpegEncClass *klass)
if (klass->in_plugin->type == CODEC_TYPE_VIDEO) {
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIT_RATE,
g_param_spec_ulong ("bitrate", "Bit Rate",
"Target Video Bitrate",
0, G_MAXULONG, 300000, G_PARAM_READWRITE));
"Target Video Bitrate", 0, G_MAXULONG, 300000, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GOP_SIZE,
g_param_spec_int ("gop_size", "GOP Size",
"Number of frames within one GOP",
@ -218,14 +216,11 @@ gst_ffmpegenc_class_init (GstFFMpegEncClass *klass)
GST_TYPE_ME_METHOD, ME_LOG, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFSIZE,
g_param_spec_ulong ("buffer_size", "Buffer Size",
"Size of the video buffers",
0,G_MAXULONG,0,G_PARAM_READWRITE));
}
else if (klass->in_plugin->type == CODEC_TYPE_AUDIO) {
"Size of the video buffers", 0, G_MAXULONG, 0, G_PARAM_READWRITE));
} else if (klass->in_plugin->type == CODEC_TYPE_AUDIO) {
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIT_RATE,
g_param_spec_ulong ("bitrate", "Bit Rate",
"Target Audio Bitrate",
0, G_MAXULONG, 128000, G_PARAM_READWRITE));
"Target Audio Bitrate", 0, G_MAXULONG, 128000, G_PARAM_READWRITE));
}
gobject_class->set_property = gst_ffmpegenc_set_property;
@ -239,7 +234,8 @@ gst_ffmpegenc_class_init (GstFFMpegEncClass *klass)
static void
gst_ffmpegenc_init (GstFFMpegEnc * ffmpegenc)
{
GstFFMpegEncClass *oclass = (GstFFMpegEncClass*)(G_OBJECT_GET_CLASS (ffmpegenc));
GstFFMpegEncClass *oclass =
(GstFFMpegEncClass *) (G_OBJECT_GET_CLASS (ffmpegenc));
/* setup pads */
ffmpegenc->sinkpad = gst_pad_new_from_template (oclass->sinktempl, "sink");
@ -286,15 +282,15 @@ gst_ffmpegenc_dispose (GObject *object)
}
static GstPadLinkReturn
gst_ffmpegenc_connect (GstPad *pad,
const GstCaps *caps)
gst_ffmpegenc_connect (GstPad * pad, const GstCaps * caps)
{
GstCaps *other_caps;
GstCaps *allowed_caps;
GstCaps *icaps;
enum PixelFormat pix_fmt;
GstFFMpegEnc *ffmpegenc = (GstFFMpegEnc *) gst_pad_get_parent (pad);
GstFFMpegEncClass *oclass = (GstFFMpegEncClass *) G_OBJECT_GET_CLASS(ffmpegenc);
GstFFMpegEncClass *oclass =
(GstFFMpegEncClass *) G_OBJECT_GET_CLASS (ffmpegenc);
/* close old session */
if (ffmpegenc->opened) {
@ -363,7 +359,9 @@ gst_ffmpegenc_connect (GstPad *pad,
if (gst_caps_get_size (icaps) > 1) {
GstCaps *newcaps;
newcaps = gst_caps_new_full (gst_structure_copy (gst_caps_get_structure (icaps, 0)), NULL);
newcaps =
gst_caps_new_full (gst_structure_copy (gst_caps_get_structure (icaps,
0)), NULL);
gst_caps_free (icaps);
icaps = newcaps;
}
@ -384,13 +382,13 @@ gst_ffmpegenc_connect (GstPad *pad,
}
static void
gst_ffmpegenc_chain_video (GstPad *pad,
GstData *_data)
gst_ffmpegenc_chain_video (GstPad * pad, GstData * _data)
{
GstBuffer *inbuf = GST_BUFFER (_data);
GstBuffer *outbuf = NULL;
GstFFMpegEnc *ffmpegenc = (GstFFMpegEnc *) (gst_pad_get_parent (pad));
GstFFMpegEncClass *oclass = (GstFFMpegEncClass*)(G_OBJECT_GET_CLASS(ffmpegenc));
GstFFMpegEncClass *oclass =
(GstFFMpegEncClass *) (G_OBJECT_GET_CLASS (ffmpegenc));
gint ret_size = 0;
/* FIXME: events (discont (flush!) and eos (close down) etc.) */
@ -399,17 +397,14 @@ gst_ffmpegenc_chain_video (GstPad *pad,
avpicture_fill ((AVPicture *) ffmpegenc->picture,
GST_BUFFER_DATA (inbuf),
ffmpegenc->context->pix_fmt,
ffmpegenc->context->width,
ffmpegenc->context->height);
ffmpegenc->context->width, ffmpegenc->context->height);
ffmpegenc->picture->pts = GST_BUFFER_TIMESTAMP (inbuf) / 1000;
ret_size = avcodec_encode_video (ffmpegenc->context,
GST_BUFFER_DATA (outbuf),
GST_BUFFER_MAXSIZE (outbuf),
ffmpegenc->picture);
GST_BUFFER_MAXSIZE (outbuf), ffmpegenc->picture);
if (ret_size < 0) {
g_warning("ffenc_%s: failed to encode buffer",
oclass->in_plugin->name);
g_warning ("ffenc_%s: failed to encode buffer", oclass->in_plugin->name);
gst_buffer_unref (inbuf);
return;
}
@ -423,13 +418,13 @@ gst_ffmpegenc_chain_video (GstPad *pad,
}
static void
gst_ffmpegenc_chain_audio (GstPad *pad,
GstData *_data)
gst_ffmpegenc_chain_audio (GstPad * pad, GstData * _data)
{
GstBuffer *inbuf = GST_BUFFER (_data);
GstBuffer *outbuf = NULL, *subbuf;
GstFFMpegEnc *ffmpegenc = (GstFFMpegEnc *) (gst_pad_get_parent (pad));
GstFFMpegEncClass *oclass = (GstFFMpegEncClass*)(G_OBJECT_GET_CLASS(ffmpegenc));
GstFFMpegEncClass *oclass =
(GstFFMpegEncClass *) (G_OBJECT_GET_CLASS (ffmpegenc));
gint size, ret_size = 0, in_size, frame_size;
size = GST_BUFFER_SIZE (inbuf);
@ -457,10 +452,11 @@ gst_ffmpegenc_chain_audio (GstPad *pad,
ffmpegenc->cache = gst_buffer_create_sub (inbuf, size - in_size,
in_size);
GST_BUFFER_DURATION (ffmpegenc->cache) =
GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (ffmpegenc->cache) / size;
GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (ffmpegenc->cache) /
size;
GST_BUFFER_TIMESTAMP (ffmpegenc->cache) =
GST_BUFFER_TIMESTAMP (inbuf) + (GST_BUFFER_DURATION (inbuf) *
(size - in_size) / size);
GST_BUFFER_TIMESTAMP (inbuf) +
(GST_BUFFER_DURATION (inbuf) * (size - in_size) / size);
gst_buffer_unref (inbuf);
} else {
gst_buffer_unref (inbuf);
@ -489,13 +485,11 @@ gst_ffmpegenc_chain_audio (GstPad *pad,
outbuf = gst_buffer_new_and_alloc (GST_BUFFER_SIZE (inbuf));
ret_size = avcodec_encode_audio (ffmpegenc->context,
GST_BUFFER_DATA (outbuf),
GST_BUFFER_MAXSIZE (outbuf),
(const short int *)
GST_BUFFER_MAXSIZE (outbuf), (const short int *)
GST_BUFFER_DATA (subbuf));
if (ret_size < 0) {
g_warning("ffenc_%s: failed to encode buffer",
oclass->in_plugin->name);
g_warning ("ffenc_%s: failed to encode buffer", oclass->in_plugin->name);
gst_buffer_unref (inbuf);
gst_buffer_unref (outbuf);
gst_buffer_unref (subbuf);
@ -514,9 +508,7 @@ gst_ffmpegenc_chain_audio (GstPad *pad,
static void
gst_ffmpegenc_set_property (GObject * object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
guint prop_id, const GValue * value, GParamSpec * pspec)
{
GstFFMpegEnc *ffmpegenc;
@ -546,9 +538,7 @@ gst_ffmpegenc_set_property (GObject *object,
/* The set function is simply the inverse of the get fuction. */
static void
gst_ffmpegenc_get_property (GObject * object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
guint prop_id, GValue * value, GParamSpec * pspec)
{
GstFFMpegEnc *ffmpegenc;
@ -658,8 +648,7 @@ gst_ffmpegenc_register (GstPlugin *plugin)
params->sinkcaps = sinkcaps;
g_hash_table_insert (enc_global_plugins,
GINT_TO_POINTER (0),
(gpointer) params);
GINT_TO_POINTER (0), (gpointer) params);
/* create the glib type now */
type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
@ -671,8 +660,7 @@ gst_ffmpegenc_register (GstPlugin *plugin)
g_free (type_name);
g_hash_table_insert (enc_global_plugins,
GINT_TO_POINTER (type),
(gpointer) params);
GINT_TO_POINTER (type), (gpointer) params);
next:
in_plugin = in_plugin->next;

View file

@ -34,7 +34,8 @@
typedef struct _GstFFMpegMux GstFFMpegMux;
struct _GstFFMpegMux {
struct _GstFFMpegMux
{
GstElement element;
/* We need to keep track of our pads, so we do so here. */
@ -49,14 +50,16 @@ struct _GstFFMpegMux {
gboolean eos[MAX_STREAMS];
};
typedef struct _GstFFMpegMuxClassParams {
typedef struct _GstFFMpegMuxClassParams
{
AVOutputFormat *in_plugin;
GstCaps *srccaps, *videosinkcaps, *audiosinkcaps;
} GstFFMpegMuxClassParams;
typedef struct _GstFFMpegMuxClass GstFFMpegMuxClass;
struct _GstFFMpegMuxClass {
struct _GstFFMpegMuxClass
{
GstElementClass parent_class;
AVOutputFormat *in_plugin;
@ -73,12 +76,14 @@ struct _GstFFMpegMuxClass {
#define GST_IS_FFMPEGMUX_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGMUX))
enum {
enum
{
/* FILL ME */
LAST_SIGNAL
};
enum {
enum
{
ARG_0,
/* FILL ME */
};
@ -92,15 +97,12 @@ static void gst_ffmpegmux_init (GstFFMpegMux *ffmpegmux);
static void gst_ffmpegmux_dispose (GObject * object);
static GstPadLinkReturn
gst_ffmpegmux_connect (GstPad *pad,
const GstCaps *caps);
gst_ffmpegmux_connect (GstPad * pad, const GstCaps * caps);
static GstPad *gst_ffmpegmux_request_new_pad (GstElement * element,
GstPadTemplate *templ,
const gchar *name);
GstPadTemplate * templ, const gchar * name);
static void gst_ffmpegmux_loop (GstElement * element);
static GstElementStateReturn
gst_ffmpegmux_change_state (GstElement *element);
static GstElementStateReturn gst_ffmpegmux_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
@ -118,8 +120,7 @@ gst_ffmpegmux_base_init (GstFFMpegMuxClass *klass)
params = g_hash_table_lookup (global_plugins,
GINT_TO_POINTER (G_OBJECT_CLASS_TYPE (gobject_class)));
if (!params)
params = g_hash_table_lookup (global_plugins,
GINT_TO_POINTER (0));
params = g_hash_table_lookup (global_plugins, GINT_TO_POINTER (0));
g_assert (params);
/* construct the element details struct */
@ -137,16 +138,11 @@ gst_ffmpegmux_base_init (GstFFMpegMuxClass *klass)
/* pad templates */
srctempl = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
params->srccaps);
GST_PAD_ALWAYS, params->srccaps);
audiosinktempl = gst_pad_template_new ("audio_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
params->audiosinkcaps);
GST_PAD_SINK, GST_PAD_REQUEST, params->audiosinkcaps);
videosinktempl = gst_pad_template_new ("video_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
params->videosinkcaps);
GST_PAD_SINK, GST_PAD_REQUEST, params->videosinkcaps);
gst_element_class_add_pad_template (element_class, srctempl);
gst_element_class_add_pad_template (element_class, videosinktempl);
@ -179,10 +175,8 @@ gst_ffmpegmux_init(GstFFMpegMux *ffmpegmux)
GstPadTemplate *templ = gst_element_class_get_pad_template (klass, "src");
ffmpegmux->srcpad = gst_pad_new_from_template (templ, "src");
gst_element_set_loop_function (GST_ELEMENT (ffmpegmux),
gst_ffmpegmux_loop);
gst_element_add_pad (GST_ELEMENT (ffmpegmux),
ffmpegmux->srcpad);
gst_element_set_loop_function (GST_ELEMENT (ffmpegmux), gst_ffmpegmux_loop);
gst_element_add_pad (GST_ELEMENT (ffmpegmux), ffmpegmux->srcpad);
ffmpegmux->context = g_new0 (AVFormatContext, 1);
ffmpegmux->context->oformat = oclass->in_plugin;
@ -211,8 +205,7 @@ gst_ffmpegmux_dispose (GObject *object)
static GstPad *
gst_ffmpegmux_request_new_pad (GstElement * element,
GstPadTemplate *templ,
const gchar *name)
GstPadTemplate * templ, const gchar * name)
{
GstFFMpegMux *ffmpegmux = (GstFFMpegMux *) element;
GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
@ -229,14 +222,12 @@ gst_ffmpegmux_request_new_pad (GstElement *element,
/* figure out a name that *we* like */
if (templ == gst_element_class_get_pad_template (klass, "video_%d")) {
padname = g_strdup_printf ("video_%d",
ffmpegmux->videopads++);
padname = g_strdup_printf ("video_%d", ffmpegmux->videopads++);
type = CODEC_TYPE_VIDEO;
bitrate = 64 * 1024;
framesize = 1152;
} else if (templ == gst_element_class_get_pad_template (klass, "audio_%d")) {
padname = g_strdup_printf ("audio_%d",
ffmpegmux->audiopads++);
padname = g_strdup_printf ("audio_%d", ffmpegmux->audiopads++);
type = CODEC_TYPE_AUDIO;
bitrate = 285 * 1024;
} else {
@ -269,8 +260,7 @@ gst_ffmpegmux_request_new_pad (GstElement *element,
}
static GstPadLinkReturn
gst_ffmpegmux_connect (GstPad *pad,
const GstCaps *caps)
gst_ffmpegmux_connect (GstPad * pad, const GstCaps * caps)
{
GstFFMpegMux *ffmpegmux = (GstFFMpegMux *) (gst_pad_get_parent (pad));
gint i;
@ -292,8 +282,7 @@ gst_ffmpegmux_connect (GstPad *pad,
/* for the format-specific guesses, we'll go to
* our famous codec mapper */
if (gst_ffmpeg_caps_to_codecid (caps,
&st->codec) != CODEC_ID_NONE) {
if (gst_ffmpeg_caps_to_codecid (caps, &st->codec) != CODEC_ID_NONE) {
ffmpegmux->eos[i] = FALSE;
return GST_PAD_LINK_OK;
}
@ -314,8 +303,7 @@ gst_ffmpegmux_loop (GstElement *element)
/* check for "pull'ability" */
while (pad != NULL &&
GST_PAD_IS_USABLE (pad) &&
ffmpegmux->eos[i] == FALSE &&
ffmpegmux->bufferqueue[i] == NULL) {
ffmpegmux->eos[i] == FALSE && ffmpegmux->bufferqueue[i] == NULL) {
GstData *data;
/* we can pull a buffer! */
@ -357,8 +345,7 @@ gst_ffmpegmux_loop (GstElement *element)
}
if (url_fopen (&ffmpegmux->context->pb,
ffmpegmux->context->filename,
URL_WRONLY) < 0) {
ffmpegmux->context->filename, URL_WRONLY) < 0) {
GST_ELEMENT_ERROR (element, LIBRARY, TOO_LAZY, (NULL),
("Failed to open stream context in ffmux"));
return;
@ -411,9 +398,9 @@ gst_ffmpegmux_loop (GstElement *element)
ffmpegmux->context->streams[bufnum]->codec.frame_number++;
/* set time */
ffmpegmux->context->streams[bufnum]->pts.val = (GST_BUFFER_TIMESTAMP (buf) * 90) / 1000000;
av_write_frame (ffmpegmux->context, bufnum,
GST_BUFFER_DATA (buf),
ffmpegmux->context->streams[bufnum]->pts.val =
(GST_BUFFER_TIMESTAMP (buf) * 90) / 1000000;
av_write_frame (ffmpegmux->context, bufnum, GST_BUFFER_DATA (buf),
GST_BUFFER_SIZE (buf));
//ffmpegmux->context->streams[bufnum]->codec.real_pict_num++;
gst_buffer_unref (buf);
@ -486,9 +473,9 @@ gst_ffmpegmux_register (GstPlugin *plugin)
* when we open the stream */
audiosinkcaps = gst_caps_new_empty ();
videosinkcaps = gst_caps_new_empty ();
for (in_codec = first_avcodec; in_codec != NULL;
in_codec = in_codec->next) {
for (in_codec = first_avcodec; in_codec != NULL; in_codec = in_codec->next) {
GstCaps *temp = gst_ffmpeg_codecid_to_caps (in_codec->id, NULL, TRUE);
if (!temp) {
continue;
}
@ -511,7 +498,8 @@ gst_ffmpegmux_register (GstPlugin *plugin)
p = type_name;
while (*p) {
if (*p == '.') *p = '_';
if (*p == '.')
*p = '_';
p++;
}
@ -529,8 +517,7 @@ gst_ffmpegmux_register (GstPlugin *plugin)
params->audiosinkcaps = audiosinkcaps;
g_hash_table_insert (global_plugins,
GINT_TO_POINTER (0),
(gpointer) params);
GINT_TO_POINTER (0), (gpointer) params);
/* create the type now */
type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
@ -538,8 +525,7 @@ gst_ffmpegmux_register (GstPlugin *plugin)
return FALSE;
g_hash_table_insert (global_plugins,
GINT_TO_POINTER (type),
(gpointer) params);
GINT_TO_POINTER (type), (gpointer) params);
next:
in_plugin = in_plugin->next;

View file

@ -34,7 +34,8 @@
typedef struct _GstProtocolInfo GstProtocolInfo;
struct _GstProtocolInfo {
struct _GstProtocolInfo
{
GstPad *pad;
int flags;
@ -43,9 +44,7 @@ struct _GstProtocolInfo {
};
static int
gst_ffmpegdata_open (URLContext *h,
const char *filename,
int flags)
gst_ffmpegdata_open (URLContext * h, const char *filename, int flags)
{
GstProtocolInfo *info;
GstPad *pad;
@ -54,8 +53,7 @@ gst_ffmpegdata_open (URLContext *h,
info->flags = flags;
/* we don't support R/W together */
if (flags != URL_RDONLY &&
flags != URL_WRONLY) {
if (flags != URL_RDONLY && flags != URL_WRONLY) {
g_warning ("Only read-only or write-only are supported");
return -EINVAL;
}
@ -88,9 +86,7 @@ gst_ffmpegdata_open (URLContext *h,
}
static int
gst_ffmpegdata_read (URLContext *h,
unsigned char *buf,
int size)
gst_ffmpegdata_read (URLContext * h, unsigned char *buf, int size)
{
GstByteStream *bs;
guint32 total, request;
@ -152,9 +148,7 @@ gst_ffmpegdata_read (URLContext *h,
}
static int
gst_ffmpegdata_write (URLContext *h,
unsigned char *buf,
int size)
gst_ffmpegdata_write (URLContext * h, unsigned char *buf, int size)
{
GstProtocolInfo *info;
GstBuffer *outbuf;
@ -174,9 +168,7 @@ gst_ffmpegdata_write (URLContext *h,
}
static offset_t
gst_ffmpegdata_seek (URLContext *h,
offset_t pos,
int whence)
gst_ffmpegdata_seek (URLContext * h, offset_t pos, int whence)
{
GstSeekType seek_type = 0;
GstProtocolInfo *info;
@ -226,6 +218,7 @@ gst_ffmpegdata_close (URLContext *h)
case URL_WRONLY:{
/* send EOS - that closes down the stream */
GstEvent *event = gst_event_new (GST_EVENT_EOS);
gst_pad_push (info->pad, GST_DATA (event));
}
break;
@ -250,4 +243,3 @@ URLProtocol gstreamer_protocol = {
.url_seek = gst_ffmpegdata_seek,
.url_close = gst_ffmpegdata_close,
};