*/
#include "config.h"
+#include <gst/gst.h>
#ifdef HAVE_FFMPEG_UNINSTALLED
#include <avcodec.h>
#include <avformat.h>
#include <ffmpeg/avformat.h>
#endif
-#include <gst/gst.h>
-
extern gboolean gst_ffmpegdemux_register (GstPlugin *plugin);
extern gboolean gst_ffmpegdec_register (GstPlugin *plugin);
extern gboolean gst_ffmpegenc_register (GstPlugin *plugin);
*/
#include "config.h"
+#include <gst/gst.h>
#ifdef HAVE_FFMPEG_UNINSTALLED
#include <avcodec.h>
#else
#include <ffmpeg/avcodec.h>
#endif
#include <string.h>
-#include <gst/gst.h>
#include "gstffmpegcodecmap.h"
case GST_MAKE_FOURCC ('I','4','2','0'):
context->pix_fmt = PIX_FMT_YUV420P;
break;
- case GST_MAKE_FOURCC ('Y','4','1','P'):
+ case GST_MAKE_FOURCC ('Y','4','1','B'):
context->pix_fmt = PIX_FMT_YUV411P;
break;
+ case GST_MAKE_FOURCC ('Y','U','V','9'):
+ context->pix_fmt = PIX_FMT_YUV410P;
+ break;
+#if 0
+ case FIXME:
+ context->pix_fmt = PIX_FMT_YUV444P;
+ break;
+#endif
case GST_MAKE_FOURCC ('R','G','B',' '):
if (gst_caps_has_property_typed (caps, "depth",
GST_PROPS_INT_TYPE) &&
#include "config.h"
#endif
+#include <gst/gst.h>
#ifdef HAVE_FFMPEG_UNINSTALLED
#include <avcodec.h>
#else
#include <ffmpeg/avcodec.h>
#endif
-#include <gst/gst.h>
#include "gstffmpegcodecmap.h"
static GstElementStateReturn
gst_ffmpegdec_change_state (GstElement *element);
+#if 0
/* some sort of bufferpool handling, but different */
static int gst_ffmpegdec_get_buffer (AVCodecContext *context,
AVFrame *picture);
static void gst_ffmpegdec_release_buffer (AVCodecContext *context,
AVFrame *picture);
+#endif
static GstElementClass *parent_class = NULL;
/* set defaults */
avcodec_get_context_defaults (ffmpegdec->context);
+#if 0
/* set buffer functions */
ffmpegdec->context->get_buffer = gst_ffmpegdec_get_buffer;
ffmpegdec->context->release_buffer = gst_ffmpegdec_release_buffer;
+#endif
/* get size and so */
gst_ffmpeg_caps_to_codectype (oclass->in_plugin->type,
return GST_PAD_LINK_OK;
}
+#if 0
static int
gst_ffmpegdec_get_buffer (AVCodecContext *context,
AVFrame *picture)
picture->linesize[i] = 0;
}
}
+#endif
static void
gst_ffmpegdec_chain (GstPad *pad,
&have_data,
data, size);
if (have_data) {
- outbuf = GST_BUFFER (ffmpegdec->picture->base[0]);
- GST_BUFFER_SIZE (outbuf) = GST_BUFFER_MAXSIZE (outbuf);
+ /* libavcodec constantly crashes on stupid buffer allocation
+ * errors inside. This drives me crazy, so we let it allocate
+ * it's own buffers and copy to our own buffer afterwards... */
+ AVPicture pic;
+ 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);
+ img_convert (&pic, ffmpegdec->context->pix_fmt,
+ (AVPicture *) ffmpegdec->picture,
+ ffmpegdec->context->pix_fmt,
+ 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);
}
/* cache */
gulong bitrate;
gint me_method;
- gboolean hq;
gint gop_size;
gulong buffer_size;
};
ARG_0,
ARG_BIT_RATE,
ARG_GOP_SIZE,
- ARG_HQ,
ARG_ME_METHOD,
ARG_BUFSIZE
/* FILL ME */
g_param_spec_int ("gop_size","GOP Size",
"Number of frames within one GOP",
0, G_MAXINT, 15, G_PARAM_READWRITE));
- g_object_class_install_property(G_OBJECT_CLASS (klass), ARG_HQ,
- g_param_spec_boolean ("hq","HQ",
- "Brute Force (slow) MB-type decision mode",
- FALSE, G_PARAM_READWRITE));
g_object_class_install_property(G_OBJECT_CLASS (klass), ARG_ME_METHOD,
g_param_spec_enum ("me_method","ME Method",
"Motion Estimation Method",
g_param_spec_ulong ("bitrate","Bit Rate",
"Target Audio Bitrate",
0, G_MAXULONG, 128000, G_PARAM_READWRITE));
- g_object_class_install_property(G_OBJECT_CLASS (klass), ARG_HQ,
- g_param_spec_boolean ("hq","HQ",
- "Brute Force (slow) MB-type decision mode",
- FALSE, G_PARAM_READWRITE));
}
gobject_class->set_property = gst_ffmpegenc_set_property;
ffmpegenc->bitrate = 300000;
ffmpegenc->buffer_size = 512 * 1024;
ffmpegenc->gop_size = 15;
- ffmpegenc->hq = FALSE;
} else if (oclass->in_plugin->type == CODEC_TYPE_AUDIO) {
ffmpegenc->bitrate = 128000;
}
ffmpegenc->context->bit_rate = ffmpegenc->bitrate;
ffmpegenc->context->bit_rate_tolerance = ffmpegenc->bitrate;
ffmpegenc->context->gop_size = ffmpegenc->gop_size;
- if (ffmpegenc->hq) {
- ffmpegenc->context->flags |= CODEC_FLAG_HQ;
- } else {
- ffmpegenc->context->flags &= ~CODEC_FLAG_HQ;
- }
ffmpegenc->context->me_method = ffmpegenc->me_method;
/* general properties */
case ARG_GOP_SIZE:
ffmpegenc->gop_size = g_value_get_int (value);
break;
- case ARG_HQ:
- ffmpegenc->hq = g_value_get_boolean (value);
- break;
case ARG_ME_METHOD:
ffmpegenc->me_method = g_value_get_enum (value);
break;
case ARG_GOP_SIZE:
g_value_set_int (value, ffmpegenc->gop_size);
break;
- case ARG_HQ:
- g_value_set_boolean (value, ffmpegenc->hq);
- break;
case ARG_ME_METHOD:
g_value_set_enum (value, ffmpegenc->me_method);
break;