ext/ffmpeg/gstffmpegcodecmap.c: Add new codecIDs from new snapshot (Thu Dec 16 11:27:18 2004).

Original commit message from CVS:
* 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...
This commit is contained in:
Ronald S. Bultje 2004-12-16 18:14:19 +00:00
parent 4ea32a6a05
commit 49b3ea828a
5 changed files with 150 additions and 19 deletions

View file

@ -1,3 +1,18 @@
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),

View file

@ -168,6 +168,10 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
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 {
@ -237,7 +241,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
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:
@ -456,6 +460,22 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
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;
@ -540,6 +560,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
case CODEC_ID_ADPCM_ADX:
case CODEC_ID_ADPCM_EA:
case CODEC_ID_ADPCM_G726:
case CODEC_ID_ADPCM_CT:
do {
gchar *layout = NULL;
@ -580,6 +601,9 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
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;
@ -617,6 +641,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
case CODEC_ID_ROQ_DPCM:
case CODEC_ID_INTERPLAY_DPCM:
case CODEC_ID_XAN_DPCM:
case CODEC_ID_SOL_DPCM:
do {
gchar *layout = NULL;
@ -630,6 +655,9 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
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;
@ -1353,6 +1381,9 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
} 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;
@ -1374,7 +1405,7 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
}
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")) {
@ -1564,6 +1595,8 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
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;
@ -1582,6 +1615,8 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
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;
@ -1656,9 +1691,6 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
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;
@ -1705,6 +1737,9 @@ gst_ffmpeg_get_codecid_longname (enum CodecID codec_id)
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;
@ -1886,6 +1921,54 @@ gst_ffmpeg_get_codecid_longname (enum CodecID codec_id)
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;
@ -1928,6 +2011,9 @@ gst_ffmpeg_get_codecid_longname (enum CodecID codec_id)
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;
@ -1943,6 +2029,9 @@ gst_ffmpeg_get_codecid_longname (enum CodecID codec_id)
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;
@ -2158,6 +2247,7 @@ gst_ffmpeg_avpicture_fill (AVPicture * picture,
PixFmtInfo *pinfo;
pinfo = &pix_fmt_info[pix_fmt];
switch (pix_fmt) {
case PIX_FMT_YUV420P:
case PIX_FMT_YUV422P:
@ -2190,6 +2280,8 @@ gst_ffmpeg_avpicture_fill (AVPicture * picture,
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;
@ -2201,6 +2293,7 @@ gst_ffmpeg_avpicture_fill (AVPicture * picture,
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;
@ -2208,6 +2301,15 @@ gst_ffmpeg_avpicture_fill (AVPicture * picture,
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;

View file

@ -308,7 +308,7 @@ gst_ffmpegdemux_src_event (GstPad * pad, GstEvent * event)
/* 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:
@ -552,7 +552,7 @@ gst_ffmpegdemux_type_find (GstTypeFind * tf, gpointer priv)
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);
}
}
@ -571,6 +571,7 @@ gst_ffmpegdemux_loop (GstElement * element)
if (!gst_ffmpegdemux_open (demux))
return;
gst_element_no_more_pads (element);
return;
}
/* read a package */
@ -600,8 +601,8 @@ gst_ffmpegdemux_loop (GstElement * element)
}
} while (!data);
gst_ffmpegdemux_close (demux);
gst_pad_event_default (demux->sinkpad, GST_EVENT (data));
//gst_ffmpegdemux_close (demux);
return;
}

View file

@ -390,6 +390,7 @@ gst_ffmpegmux_loop (GstElement * element)
* no buffers left */
if (bufnum >= 0) {
GstBuffer *buf;
AVPacket pkt;
/* push out current buffer */
buf = ffmpegmux->bufferqueue[bufnum];
@ -398,11 +399,18 @@ 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),
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 */

View file

@ -133,23 +133,21 @@ gst_ffmpegdata_read (URLContext * h, unsigned char *buf, int size)
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:
@ -194,14 +192,21 @@ gst_ffmpegdata_seek (URLContext * h, offset_t pos, int whence)
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: