ext/ffmpeg/gstffmpegmux.c: The ->frame_size for RAW audio is 1.

Original commit message from CVS:
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_collected):
The ->frame_size for RAW audio is 1.
Should fix behaviour of some muxers.
This commit is contained in:
Edward Hervey 2006-10-24 16:40:45 +00:00
parent d9b883110e
commit f36390c258
2 changed files with 32 additions and 11 deletions

View file

@ -1,3 +1,9 @@
2006-10-24 Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_collected):
The ->frame_size for RAW audio is 1.
Should fix behaviour of some muxers.
2006-10-24 Thomas Vander Stichele <thomas at apestaart dot org> 2006-10-24 Thomas Vander Stichele <thomas at apestaart dot org>
* gst-ffmpeg.spec.in: * gst-ffmpeg.spec.in:

View file

@ -374,8 +374,21 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
} }
/* set framerate for audio */ /* set framerate for audio */
if (st->codec->codec_type == CODEC_TYPE_AUDIO) { if (st->codec->codec_type == CODEC_TYPE_AUDIO) {
switch (st->codec->codec_id) {
case CODEC_ID_PCM_S16LE:
case CODEC_ID_PCM_S16BE:
case CODEC_ID_PCM_U16LE:
case CODEC_ID_PCM_U16BE:
case CODEC_ID_PCM_S8:
case CODEC_ID_PCM_U8:
st->codec->frame_size = 1;
break;
default:
{
GstBuffer *buffer; GstBuffer *buffer;
/* FIXME : This doesn't work for RAW AUDIO...
* in fact I'm wondering if it even works for any kind of audio... */
buffer = gst_collect_pads_peek (ffmpegmux->collect, buffer = gst_collect_pads_peek (ffmpegmux->collect,
(GstCollectData *)collect_pad); (GstCollectData *)collect_pad);
if (buffer) { if (buffer) {
@ -386,6 +399,8 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
} }
} }
} }
}
}
/* tags */ /* tags */
iface_tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (ffmpegmux)); iface_tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (ffmpegmux));
@ -521,7 +536,7 @@ next_pad:
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_util_uint64_scale_int(GST_BUFFER_DURATION (buf), AV_TIME_BASE, GST_SECOND);
else else
pkt.duration = 0; pkt.duration = 0;
av_write_frame (ffmpegmux->context, &pkt); av_write_frame (ffmpegmux->context, &pkt);