Commit 78637215 authored by Luca Ognibene's avatar Luca Ognibene

ext/ffmpeg/gstffmpegcodecmap.c: add flv encoder, fix #309050

Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps),
(gst_ffmpeg_formatid_get_codecids), (gst_ffmpeg_caps_to_codecid):
add flv encoder, fix #309050

* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame):
set both DELTA_UNIT and KEY_UNIT

* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_loop):
use DELTA_UNIT and not the deprecated KEY_UNIT
fix #309049
parent 8254a0ff
2005-06-27 Daniel Fischer <dan@f3c.com>
reviewed by: Luca Ognibene <luogni@tin.it>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps),
(gst_ffmpeg_formatid_get_codecids), (gst_ffmpeg_caps_to_codecid):
add flv encoder
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame):
set both DELTA_UNIT and KEY_UNIT
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_loop):
use DELTA_UNIT and not the deprecated KEY_UNIT
2005-06-25 Luca Ognibene <luogni@tin.it>
* ext/libpostproc/gstpostproc.c: (gst_ffmpeg_log_callback),
......
......@@ -1362,6 +1362,8 @@ gst_ffmpeg_formatid_to_caps (const gchar * format_name)
caps = gst_caps_new_simple ("application/x-id3", NULL);
} else if (!strcmp (format_name, "flic")) {
caps = gst_caps_new_simple ("video/x-fli", NULL);
} else if (!strcmp (format_name, "flv")) {
caps = gst_caps_new_simple ("video/x-flv", NULL);
} else {
gchar *name;
......@@ -1390,6 +1392,12 @@ gst_ffmpeg_formatid_get_codecids (const gchar *format_name,
*video_codec_list = mpeg_video_list;
*audio_codec_list = mpeg_audio_list;
} else if (!strcmp (format_name, "flv")) {
static enum CodecID flv_video_list[] = { CODEC_ID_FLV1, CODEC_ID_NONE };
static enum CodecID flv_audio_list[] = { CODEC_ID_MP3, CODEC_ID_NONE };
*video_codec_list = flv_video_list;
*audio_codec_list = flv_audio_list;
} else {
GST_WARNING ("Format %s not found", format_name);
return FALSE;
......@@ -1813,20 +1821,26 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
} else if (!strcmp (mimetype, "audio/x-amrwb")) {
id = CODEC_ID_AMR_WB;
audio = TRUE;
} else if (!strncmp (mimetype, "audio/x-gst_ff-", 15) ||
!strncmp (mimetype, "video/x-gst_ff-", 15)) {
} else if (!strncmp (mimetype, "audio/x-gst_ff-", 15) ) {
gchar ext[16];
AVCodec *codec;
if (strlen (mimetype) <= 30 &&
sscanf (mimetype, "%*s/x-gst_ff-%s", ext) == 1) {
sscanf (mimetype, "audio/x-gst_ff-%s", ext) == 1) {
if ((codec = avcodec_find_decoder_by_name (ext)) ||
(codec = avcodec_find_encoder_by_name (ext))) {
id = codec->id;
if (mimetype[0] == 'v')
video = TRUE;
else if (mimetype[0] == 'a')
audio = TRUE;
audio = TRUE;
}
}
} else if (!strncmp (mimetype, "video/x-gst_ff-", 15)) {
gchar ext[16];
AVCodec *codec;
if (strlen (mimetype) <= 30 &&
sscanf (mimetype, "video/x-gst_ff-%s", ext) == 1) {
if ((codec = avcodec_find_decoder_by_name (ext)) ||
(codec = avcodec_find_encoder_by_name (ext))) {
id = codec->id;
video = TRUE;
}
}
}
......
......@@ -725,6 +725,12 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec,
*in_ts = GST_CLOCK_TIME_NONE;
}
if (ffmpegdec->picture->key_frame) {
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_KEY_UNIT);
} else {
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_DELTA_UNIT);
}
GST_BUFFER_TIMESTAMP (outbuf) = ffmpegdec->next_ts;
if (ffmpegdec->context->frame_rate_base != 0 &&
ffmpegdec->context->frame_rate != 0) {
......
......@@ -475,8 +475,10 @@ gst_ffmpegmux_loop (GstElement * element)
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_FLAGS (buf) & GST_BUFFER_DELTA_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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment