2004-12-16 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+ * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),
+ (gst_ffmpeg_caps_to_codecid), (gst_ffmpeg_get_codecid_longname),
+ (gst_ffmpeg_avpicture_fill):
+ Add new codecIDs from new snapshot (Thu Dec 16 11:27:18 2004).
+ * ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_src_event),
+ (gst_ffmpegdemux_type_find), (gst_ffmpegdemux_loop):
+ * ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_loop):
+ API updates.
+ * ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_read),
+ (gst_ffmpegdata_seek):
+ A slightly smarter approach, but it still needs lost of work to
+ be reliable in any way...
+
+2004-12-16 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_close), (gst_ffmpegdec_connect),
(gst_ffmpegdec_negotiate), (gst_ffmpegdec_chain):
caps = GST_FF_VID_CAPS_NEW ("video/x-h263", NULL);
break;
+ case CODEC_ID_H261:
+ caps = GST_FF_VID_CAPS_NEW ("video/x-h261", NULL);
+ break;
+
case CODEC_ID_RV10:
case CODEC_ID_RV20:
do {
case CODEC_ID_MJPEGB:
case CODEC_ID_LJPEG:
case CODEC_ID_SP5X:
- caps = GST_FF_VID_CAPS_NEW ("video/x-jpeg", NULL);
+ caps = GST_FF_VID_CAPS_NEW ("image/jpeg", NULL);
break;
case CODEC_ID_MPEG4:
case CODEC_ID_MSZH:
case CODEC_ID_ZLIB:
case CODEC_ID_QTRLE:
+ case CODEC_ID_SONIC:
+ case CODEC_ID_SONIC_LS:
+ case CODEC_ID_SNOW:
+ case CODEC_ID_TSCC:
+ case CODEC_ID_ULTI:
+ case CODEC_ID_QDRAW:
+ case CODEC_ID_VIXL:
+ case CODEC_ID_QPEG:
+ case CODEC_ID_XVID:
+ case CODEC_ID_PNG:
+ case CODEC_ID_PPM:
+ case CODEC_ID_PBM:
+ case CODEC_ID_PGM:
+ case CODEC_ID_PGMYUV:
+ case CODEC_ID_PAM:
+ case CODEC_ID_FFVHUFF:
buildcaps = TRUE;
break;
case CODEC_ID_ADPCM_ADX:
case CODEC_ID_ADPCM_EA:
case CODEC_ID_ADPCM_G726:
+ case CODEC_ID_ADPCM_CT:
do {
gchar *layout = NULL;
case CODEC_ID_ADPCM_G726:
layout = "g726";
break;
+ case CODEC_ID_ADPCM_CT:
+ layout = "ct";
+ break;
default:
g_assert (0); /* don't worry, we never get here */
break;
case CODEC_ID_ROQ_DPCM:
case CODEC_ID_INTERPLAY_DPCM:
case CODEC_ID_XAN_DPCM:
+ case CODEC_ID_SOL_DPCM:
do {
gchar *layout = NULL;
case CODEC_ID_XAN_DPCM:
layout = "xan";
break;
+ case CODEC_ID_SOL_DPCM:
+ layout = "sol";
+ break;
default:
g_assert (0); /* don't worry, we never get here */
break;
} else if (!strcmp (mimetype, "video/x-h263")) {
id = CODEC_ID_H263; /* or H263[IP] */
video = TRUE;
+ } else if (!strcmp (mimetype, "video/x-h261")) {
+ id = CODEC_ID_H261;
+ video = TRUE;
} else if (!strcmp (mimetype, "video/mpeg")) {
gboolean sys_strm;
gint mpegversion;
}
if (id != CODEC_ID_NONE)
video = TRUE;
- } else if (!strcmp (mimetype, "video/x-jpeg")) {
+ } else if (!strcmp (mimetype, "image/jpeg")) {
id = CODEC_ID_MJPEG; /* A... B... */
video = TRUE;
} else if (!strcmp (mimetype, "video/x-wmv")) {
id = CODEC_ID_ADPCM_EA;
} else if (!strcmp (layout, "g726")) {
id = CODEC_ID_ADPCM_G726;
+ } else if (!strcmp (layout, "ct")) {
+ id = CODEC_ID_ADPCM_CT;
}
if (id != CODEC_ID_NONE)
audio = TRUE;
id = CODEC_ID_INTERPLAY_DPCM;
} else if (!strcmp (layout, "xan")) {
id = CODEC_ID_XAN_DPCM;
+ } else if (!strcmp (layout, "sol")) {
+ id = CODEC_ID_SOL_DPCM;
}
if (id != CODEC_ID_NONE)
audio = TRUE;
sscanf (mimetype, "%*s/x-gst_ff-%s", ext) == 1) {
if ((codec = avcodec_find_decoder_by_name (ext)) ||
(codec = avcodec_find_encoder_by_name (ext))) {
- const GValue *data_v;
- const GstBuffer *data;
-
id = codec->id;
if (mimetype[0] == 'v')
video = TRUE;
case CODEC_ID_H263:
name = "H.263 video";
break;
+ case CODEC_ID_H261:
+ name = "H.261 video";
+ break;
case CODEC_ID_RV10:
name = "Realvideo 1.0";
break;
case CODEC_ID_QTRLE:
name = "Quicktime RLE animation video";
break;
+ case CODEC_ID_SONIC:
+ name = "Sonic audio";
+ break;
+ case CODEC_ID_SONIC_LS:
+ name = "Sonic lossless audio";
+ break;
+ case CODEC_ID_SNOW:
+ name = "Snow wave video";
+ break;
+ case CODEC_ID_TSCC:
+ name = "Techsmith Camtasia video";
+ break;
+ case CODEC_ID_ULTI:
+ name = "Ultimotion video";
+ break;
+ case CODEC_ID_QDRAW:
+ name = "Applet Quickdraw video";
+ break;
+ case CODEC_ID_VIXL:
+ name = "Miro VideoXL";
+ break;
+ case CODEC_ID_QPEG:
+ name = "QPEG video";
+ break;
+ case CODEC_ID_XVID:
+ name = "XviD video";
+ break;
+ case CODEC_ID_PNG:
+ name = "PNG image";
+ break;
+ case CODEC_ID_PPM:
+ name = "PPM image";
+ break;
+ case CODEC_ID_PBM:
+ name = "PBM image";
+ break;
+ case CODEC_ID_PGM:
+ name = "PGM image";
+ break;
+ case CODEC_ID_PGMYUV:
+ name = "PGM-YUV image";
+ break;
+ case CODEC_ID_PAM:
+ name = "PAM image";
+ break;
+ case CODEC_ID_FFVHUFF:
+ name = "FFMPEG non-compliant Huffyuv video";
+ break;
case CODEC_ID_PCM_MULAW:
name = "Mu-law audio";
break;
case CODEC_ID_ADPCM_G726:
name = "G.726 ADPCM";
break;
+ case CODEC_ID_ADPCM_CT:
+ name = "CT ADPCM";
+ break;
case CODEC_ID_RA_144:
name = "Realaudio 14k4bps";
break;
case CODEC_ID_XAN_DPCM:
name = "XAN DPCM audio";
break;
+ case CODEC_ID_SOL_DPCM:
+ name = "SOL DPCM audio";
+ break;
case CODEC_ID_FLAC:
name = "FLAC lossless audio";
break;
PixFmtInfo *pinfo;
pinfo = &pix_fmt_info[pix_fmt];
+
switch (pix_fmt) {
case PIX_FMT_YUV420P:
case PIX_FMT_YUV422P:
picture->data[2] = NULL;
picture->linesize[0] = stride;
return size;
+ /*case PIX_FMT_AYUV4444:
+ case PIX_FMT_RGB32:*/
case PIX_FMT_RGBA32:
stride = width * 4;
size = stride * height;
case PIX_FMT_RGB555:
case PIX_FMT_RGB565:
case PIX_FMT_YUV422:
+ case PIX_FMT_UYVY422:
stride = ROUND_UP_4 (width * 2);
size = stride * height;
picture->data[0] = ptr;
picture->data[2] = NULL;
picture->linesize[0] = stride;
return size;
+ case PIX_FMT_UYVY411:
+ /* FIXME, probably not the right stride */
+ stride = ROUND_UP_4 (width);
+ size = stride * height;
+ picture->data[0] = ptr;
+ picture->data[1] = NULL;
+ picture->data[2] = NULL;
+ picture->linesize[0] = width + width / 2;
+ return size + size / 2;
case PIX_FMT_GRAY8:
stride = ROUND_UP_4 (width);
size = stride * height;
/* fall-through */
case GST_FORMAT_TIME:
if (av_seek_frame (demux->context, stream->index,
- offset / (GST_SECOND / AV_TIME_BASE)))
+ offset / (GST_SECOND / AV_TIME_BASE) , 0))
res = FALSE;
break;
default:
res = in_plugin->read_probe (&probe_data);
if (res > 0) {
- res = MAX (1, res * GST_TYPE_FIND_POSSIBLE / AVPROBE_SCORE_MAX);
+ res = MAX (1, res * GST_TYPE_FIND_MAXIMUM / AVPROBE_SCORE_MAX);
gst_type_find_suggest (tf, res, params->sinkcaps);
}
}
if (!gst_ffmpegdemux_open (demux))
return;
gst_element_no_more_pads (element);
+ return;
}
/* read a package */
}
} while (!data);
- gst_ffmpegdemux_close (demux);
gst_pad_event_default (demux->sinkpad, GST_EVENT (data));
+ //gst_ffmpegdemux_close (demux);
return;
}
* no buffers left */
if (bufnum >= 0) {
GstBuffer *buf;
+ AVPacket pkt;
/* push out current buffer */
buf = ffmpegmux->bufferqueue[bufnum];
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),
- GST_BUFFER_SIZE (buf));
- //ffmpegmux->context->streams[bufnum]->codec.real_pict_num++;
+ pkt.pts = GST_BUFFER_TIMESTAMP (buf) * AV_TIME_BASE / GST_SECOND;
+ pkt.data = GST_BUFFER_DATA (buf);
+ pkt.size = GST_BUFFER_SIZE (buf);
+ pkt.stream_index = bufnum;
+ pkt.flags = 0;
+ if (GST_BUFFER_FLAGS (buf) & GST_BUFFER_KEY_UNIT)
+ pkt.flags |= PKT_FLAG_KEY;
+ if (GST_BUFFER_DURATION_IS_VALID (buf))
+ pkt.duration = GST_BUFFER_DURATION (buf) * AV_TIME_BASE / GST_SECOND;
+ else
+ pkt.duration = 0;
+ av_write_frame (ffmpegmux->context, &pkt);
gst_buffer_unref (buf);
} else {
/* close down */
g_warning ("gstffmpegprotocol: no bytestream event");
return total;
}
- have_event = TRUE;
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_DISCONTINUOUS:
- gst_bytestream_flush_fast (bs, remaining);
gst_event_unref (event);
break;
case GST_EVENT_EOS:
g_warning ("Unexpected/unwanted eos in data function");
info->eos = TRUE;
- have_event = FALSE;
+ have_event = TRUE;
gst_event_unref (event);
break;
case GST_EVENT_FLUSH:
gst_event_unref (event);
break;
case GST_EVENT_INTERRUPT:
- have_event = FALSE;
+ have_event = TRUE;
gst_event_unref (event);
break;
default:
info = (GstProtocolInfo *) h->priv_data;
+ /* get data (typefind hack) */
+ if (gst_bytestream_tell (info->bs) != gst_bytestream_length (info->bs)) {
+ //gchar buf;
+ //gst_ffmpegdata_read (h, &buf, 1);
+ //peek!!!!! not read = data loss if not seekable
+ }
+
/* hack in ffmpeg to get filesize... */
if (whence == SEEK_END && pos == -1)
return gst_bytestream_length (info->bs) - 1;
/* another hack to get the current position... */
else if (whence == SEEK_CUR && pos == 0)
return gst_bytestream_tell (info->bs);
- else
- g_assert (pos >= 0);
+ //else
+ //g_assert (pos >= 0);
switch (whence) {
case SEEK_SET: