diff options
author | Carlos Rafael Giani <dv@pseudoterminal.org> | 2016-08-02 13:38:25 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-08-02 14:41:31 +0300 |
commit | 975f147abebe7e58fc74e8fb34f141ffec18dd06 (patch) | |
tree | 1e4fff4a08b780176804e1bc6b589aa5f2c1ea16 /gst/asfdemux | |
parent | 9f51f72b3784c44258202b21ce25fea612930992 (diff) | |
download | gstreamer-plugins-ugly-975f147abebe7e58fc74e8fb34f141ffec18dd06.tar.gz |
asfdemux: Add byte rate based bitrate tag in case there are no audio props
https://bugzilla.gnome.org/show_bug.cgi?id=769418
Diffstat (limited to 'gst/asfdemux')
-rw-r--r-- | gst/asfdemux/gstasfdemux.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gst/asfdemux/gstasfdemux.c b/gst/asfdemux/gstasfdemux.c index f65bf821..283538c2 100644 --- a/gst/asfdemux/gstasfdemux.c +++ b/gst/asfdemux/gstasfdemux.c @@ -2625,6 +2625,27 @@ gst_asf_demux_add_audio_stream (GstASFDemux * demux, g_free (codec_name); } + if (audio->byte_rate > 0) { + /* Some ASF files have no bitrate props object (often seen with + * ASF files that contain raw audio data). Example files can + * be generated with FFmpeg (tested with v2.8.6), like this: + * + * ffmpeg -i sine-wave.wav -c:a pcm_alaw file.asf + * + * In this case, if audio->byte_rate is nonzero, use that as + * the bitrate. */ + + guint bitrate = audio->byte_rate * 8; + + if (tags == NULL) + tags = gst_tag_list_new_empty (); + + /* Add bitrate, but only if there is none set already, since + * this is just a fallback in case there is no bitrate tag + * already present */ + gst_tag_list_add (tags, GST_TAG_MERGE_KEEP, GST_TAG_BITRATE, bitrate, NULL); + } + if (extradata) gst_buffer_unref (extradata); |