Merge branch 'master' into 0.11

This commit is contained in:
Wim Taymans 2011-06-02 17:03:21 +02:00
commit c312409c83
6 changed files with 62 additions and 29 deletions

2
common

@ -1 +1 @@
Subproject commit 46dfcea233cf6df83e3771d8a8066e87d614f893
Subproject commit 69b981f10caa234ad0ff639179d0fda8505bd94b

View file

@ -369,7 +369,7 @@ else
AS_MKDIR_P(["$ac_top_build_prefix"gst-libs/ext/libav])
cd "$ac_top_build_prefix"gst-libs/ext/libav &&
$confcmd $embffmpeg_configure_args ||
eval "$confcmd $embffmpeg_configure_args" ||
AC_MSG_ERROR([Failed to configure embedded Libav tree])
cd "$origdir"
],

View file

@ -22,7 +22,7 @@ libgstffmpeg_la_SOURCES = gstffmpeg.c \
# gstffmpegscale.c
libgstffmpeg_la_CFLAGS = $(FFMPEG_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
libgstffmpeg_la_LIBADD = $(FFMPEG_LIBS) $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LIBM) $(WIN32_LIBS) -lz $(BZ2_LIBS)
libgstffmpeg_la_LIBADD = $(FFMPEG_LIBS) $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) -lgstpbutils-$(GST_MAJORMINOR) $(LIBM) $(WIN32_LIBS) -lz $(BZ2_LIBS)
libgstffmpeg_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(DARWIN_LDFLAGS)
libgstffmpeg_la_LIBTOOLFLAGS = --tag=disable-static

View file

@ -33,6 +33,8 @@
#include "gstffmpeg.h"
#include "gstffmpegcodecmap.h"
#include <gst/pbutils/codec-utils.h>
/*
* Read a palette from a caps.
*/
@ -439,6 +441,7 @@ gst_ff_aud_caps_new (AVCodecContext * context, enum CodecID codec_id,
case CODEC_ID_AC3:
case CODEC_ID_EAC3:
case CODEC_ID_AAC:
case CODEC_ID_AAC_LATM:
case CODEC_ID_DTS:
maxchannels = 6;
break;
@ -956,8 +959,52 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
break;
case CODEC_ID_AAC:
{
caps = gst_ff_aud_caps_new (context, codec_id, "audio/mpeg", NULL);
if (!encode) {
GValue arr = { 0, };
GValue item = { 0, };
g_value_init (&arr, GST_TYPE_LIST);
g_value_init (&item, G_TYPE_INT);
g_value_set_int (&item, 2);
gst_value_list_append_value (&arr, &item);
g_value_set_int (&item, 4);
gst_value_list_append_value (&arr, &item);
g_value_unset (&item);
gst_caps_set_value (caps, "mpegversion", &arr);
g_value_unset (&arr);
g_value_init (&arr, GST_TYPE_LIST);
g_value_init (&item, G_TYPE_STRING);
g_value_set_string (&item, "raw");
gst_value_list_append_value (&arr, &item);
g_value_set_string (&item, "adts");
gst_value_list_append_value (&arr, &item);
g_value_set_string (&item, "adif");
gst_value_list_append_value (&arr, &item);
g_value_unset (&item);
gst_caps_set_value (caps, "stream-format", &arr);
g_value_unset (&arr);
} else {
gst_caps_set_simple (caps, "mpegversion", G_TYPE_INT, 4,
"stream-format", G_TYPE_STRING, "raw",
"base-profile", G_TYPE_STRING, "lc", NULL);
if (context && context->extradata_size > 0)
gst_codec_utils_aac_caps_set_level_and_profile (caps,
context->extradata, context->extradata_size);
}
break;
}
case CODEC_ID_AAC_LATM: /* LATM/LOAS AAC syntax */
caps = gst_ff_aud_caps_new (context, codec_id, "audio/mpeg",
"mpegversion", G_TYPE_INT, 4, NULL);
"mpegversion", G_TYPE_INT, 4, "stream-format", G_TYPE_STRING, "loas",
NULL);
break;
case CODEC_ID_ASV1:

View file

@ -822,8 +822,9 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps)
ffmpegdec->context->flags |= CODEC_FLAG_EMU_EDGE;
}
/* for AAC we only use av_parse if not on raw caps */
if (oclass->in_plugin->id == CODEC_ID_AAC) {
/* for AAC we only use av_parse if not on stream-format==raw or ==loas */
if (oclass->in_plugin->id == CODEC_ID_AAC
|| oclass->in_plugin->id == CODEC_ID_AAC_LATM) {
const gchar *format = gst_structure_get_string (structure, "stream-format");
if (format == NULL || strcmp (format, "raw") == 0) {
@ -1423,14 +1424,7 @@ gst_ffmpegdec_do_qos (GstFFMpegDec * ffmpegdec, GstClockTime timestamp,
if (proportion < 0.4 && diff < 0) {
goto normal_mode;
} else {
/* if we're more than two seconds late, switch to the next keyframe */
/* FIXME, let the demuxer decide what's the best since we might be dropping
* a lot of frames when the keyframe is far away or we even might not get a new
* keyframe at all.. */
if (diff > ((GstClockTimeDiff) GST_SECOND * 2)
&& !ffmpegdec->waiting_for_key) {
goto skip_to_keyframe;
} else if (diff >= 0) {
if (diff >= 0) {
/* we're too slow, try to speed up */
if (ffmpegdec->waiting_for_key) {
/* we were waiting for a keyframe, that's ok */
@ -1457,16 +1451,6 @@ normal_mode:
}
return TRUE;
}
skip_to_keyframe:
{
ffmpegdec->context->skip_frame = AVDISCARD_NONKEY;
ffmpegdec->waiting_for_key = TRUE;
*mode_switch = TRUE;
GST_DEBUG_OBJECT (ffmpegdec,
"QOS: keyframe, %" G_GINT64_FORMAT " > GST_SECOND/2", diff);
/* we can skip the current frame */
return FALSE;
}
skip_frame:
{
if (ffmpegdec->context->skip_frame != AVDISCARD_NONREF) {
@ -1855,7 +1839,7 @@ gst_ffmpegdec_video_frame (GstFFMpegDec * ffmpegdec,
/* we assume DTS as input timestamps unless we see reordered input
* timestamps */
if (!ffmpegdec->reordered_in) {
if (!ffmpegdec->reordered_in && ffmpegdec->reordered_out) {
/* PTS and DTS are the same for keyframes */
if (!iskeyframe && ffmpegdec->next_out != -1) {
/* interpolate all timestamps except for keyframes, FIXME, this is
@ -2193,7 +2177,8 @@ gst_ffmpegdec_audio_frame (GstFFMpegDec * ffmpegdec,
GST_BUFFER_OFFSET (*outbuf) = out_offset;
/* the next timestamp we'll use when interpolating */
ffmpegdec->next_out = out_timestamp + out_duration;
if (GST_CLOCK_TIME_IS_VALID (out_timestamp))
ffmpegdec->next_out = out_timestamp + out_duration;
/* now see if we need to clip the buffer against the segment boundaries. */
if (G_UNLIKELY (!clip_audio_buffer (ffmpegdec, *outbuf, out_timestamp,
@ -2208,7 +2193,8 @@ gst_ffmpegdec_audio_frame (GstFFMpegDec * ffmpegdec,
/* If we don't error out after the first failed read with the AAC decoder,
* we must *not* carry on pushing data, else we'll cause segfaults... */
if (len == -1 && in_plugin->id == CODEC_ID_AAC) {
if (len == -1 && (in_plugin->id == CODEC_ID_AAC
|| in_plugin->id == CODEC_ID_AAC_LATM)) {
GST_ELEMENT_ERROR (ffmpegdec, STREAM, DECODE, (NULL),
("Decoding of AAC stream by FFMPEG failed."));
*ret = GST_FLOW_ERROR;
@ -2666,7 +2652,7 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf)
ffmpegdec->pctx->pts);
/* store pts for decoding */
if (ffmpegdec->pctx->pts != -1)
if (ffmpegdec->pctx->pts != AV_NOPTS_VALUE && ffmpegdec->pctx->pts != -1)
dec_info = gst_ts_info_get (ffmpegdec, ffmpegdec->pctx->pts);
else {
/* ffmpeg sometimes loses track after a flush, help it by feeding a

@ -1 +1 @@
Subproject commit 151cd4f98225c0c5cab8fb29e1dbc0719f7f67e3
Subproject commit 371266daa3df35c424203fff0ce2e6de0e33a29d