mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-05 05:52:37 +00:00
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
This commit is contained in:
parent
8254a0ff62
commit
78637215f1
4 changed files with 46 additions and 10 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
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>
|
2005-06-25 Luca Ognibene <luogni@tin.it>
|
||||||
|
|
||||||
* ext/libpostproc/gstpostproc.c: (gst_ffmpeg_log_callback),
|
* 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);
|
caps = gst_caps_new_simple ("application/x-id3", NULL);
|
||||||
} else if (!strcmp (format_name, "flic")) {
|
} else if (!strcmp (format_name, "flic")) {
|
||||||
caps = gst_caps_new_simple ("video/x-fli", NULL);
|
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 {
|
} else {
|
||||||
gchar *name;
|
gchar *name;
|
||||||
|
|
||||||
|
@ -1390,6 +1392,12 @@ gst_ffmpeg_formatid_get_codecids (const gchar *format_name,
|
||||||
|
|
||||||
*video_codec_list = mpeg_video_list;
|
*video_codec_list = mpeg_video_list;
|
||||||
*audio_codec_list = mpeg_audio_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 {
|
} else {
|
||||||
GST_WARNING ("Format %s not found", format_name);
|
GST_WARNING ("Format %s not found", format_name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1813,22 +1821,28 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
|
||||||
} else if (!strcmp (mimetype, "audio/x-amrwb")) {
|
} else if (!strcmp (mimetype, "audio/x-amrwb")) {
|
||||||
id = CODEC_ID_AMR_WB;
|
id = CODEC_ID_AMR_WB;
|
||||||
audio = TRUE;
|
audio = TRUE;
|
||||||
} else if (!strncmp (mimetype, "audio/x-gst_ff-", 15) ||
|
} else if (!strncmp (mimetype, "audio/x-gst_ff-", 15) ) {
|
||||||
!strncmp (mimetype, "video/x-gst_ff-", 15)) {
|
|
||||||
gchar ext[16];
|
gchar ext[16];
|
||||||
AVCodec *codec;
|
AVCodec *codec;
|
||||||
|
|
||||||
if (strlen (mimetype) <= 30 &&
|
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)) ||
|
if ((codec = avcodec_find_decoder_by_name (ext)) ||
|
||||||
(codec = avcodec_find_encoder_by_name (ext))) {
|
(codec = avcodec_find_encoder_by_name (ext))) {
|
||||||
id = codec->id;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context != NULL) {
|
if (context != NULL) {
|
||||||
|
|
|
@ -725,6 +725,12 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec,
|
||||||
*in_ts = GST_CLOCK_TIME_NONE;
|
*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;
|
GST_BUFFER_TIMESTAMP (outbuf) = ffmpegdec->next_ts;
|
||||||
if (ffmpegdec->context->frame_rate_base != 0 &&
|
if (ffmpegdec->context->frame_rate_base != 0 &&
|
||||||
ffmpegdec->context->frame_rate != 0) {
|
ffmpegdec->context->frame_rate != 0) {
|
||||||
|
|
|
@ -475,8 +475,10 @@ gst_ffmpegmux_loop (GstElement * element)
|
||||||
pkt.size = GST_BUFFER_SIZE (buf);
|
pkt.size = GST_BUFFER_SIZE (buf);
|
||||||
pkt.stream_index = bufnum;
|
pkt.stream_index = bufnum;
|
||||||
pkt.flags = 0;
|
pkt.flags = 0;
|
||||||
if (GST_BUFFER_FLAGS (buf) & GST_BUFFER_KEY_UNIT)
|
|
||||||
|
if (!(GST_BUFFER_FLAGS (buf) & GST_BUFFER_DELTA_UNIT))
|
||||||
pkt.flags |= PKT_FLAG_KEY;
|
pkt.flags |= PKT_FLAG_KEY;
|
||||||
|
|
||||||
if (GST_BUFFER_DURATION_IS_VALID (buf))
|
if (GST_BUFFER_DURATION_IS_VALID (buf))
|
||||||
pkt.duration = GST_BUFFER_DURATION (buf) * AV_TIME_BASE / GST_SECOND;
|
pkt.duration = GST_BUFFER_DURATION (buf) * AV_TIME_BASE / GST_SECOND;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue