summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-04-28 20:45:06 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-04-28 20:45:06 +0200
commit9d7c1b4cf36737bde226d0f7bb4e271e61e4e8a6 (patch)
tree07577504efcb323108e1fcb6d76499a863386589
parentc31be45e144a5f4748c9b9d5b8802f254550a471 (diff)
parent9b9df1cdff149db5bbe6726b236934c5b5fbe21d (diff)
downloadffmpeg-streaming-9d7c1b4cf36737bde226d0f7bb4e271e61e4e8a6.zip
ffmpeg-streaming-9d7c1b4cf36737bde226d0f7bb4e271e61e4e8a6.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: h264: new assembly version of get_cabac for x86_64 with PIC h264: use one table instead of several for cabac functions h264: (trivial) remove unneeded macro argument in x86/cabac.h libschroedingerdec: check malloc segment: reorder seg_write_header allocation avio: make avio_close(NULL) a no-op mov: Parse EC3SpecificBox (dec3 atom). Conflicts: libavcodec/cabac.c libavcodec/x86/cabac.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/libschroedingerdec.c5
-rw-r--r--libavformat/aviobuf.c6
-rw-r--r--libavformat/mov.c29
-rw-r--r--libavformat/segment.c14
4 files changed, 45 insertions, 9 deletions
diff --git a/libavcodec/libschroedingerdec.c b/libavcodec/libschroedingerdec.c
index 3c52040..bd20c40 100644
--- a/libavcodec/libschroedingerdec.c
+++ b/libavcodec/libschroedingerdec.c
@@ -106,6 +106,11 @@ static SchroBuffer *FindNextSchroParseUnit(SchroParseUnitContext *parse_ctx)
return NULL;
in_buf = av_malloc(next_pu_offset);
+ if (!in_buf) {
+ av_log(parse_ctx, AV_LOG_ERROR, "Unable to allocate input buffer\n");
+ return NULL;
+ }
+
memcpy(in_buf, parse_ctx->buf, next_pu_offset);
enc_buf = schro_buffer_new_with_data(in_buf, next_pu_offset);
enc_buf->free = libschroedinger_decode_buffer_free;
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 2f57c55..45a8bad 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -785,8 +785,12 @@ int avio_open2(AVIOContext **s, const char *filename, int flags,
int avio_close(AVIOContext *s)
{
- URLContext *h = s->opaque;
+ URLContext *h;
+
+ if (!s)
+ return 0;
+ h = s->opaque;
av_free(s->buffer);
av_free(s);
return ffurl_close(h);
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 2f48f2e..5a03531 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -596,6 +596,34 @@ static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0;
}
+static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+ AVStream *st;
+ int eac3info, acmod, lfeon, bsmod;
+
+ if (c->fc->nb_streams < 1)
+ return 0;
+ st = c->fc->streams[c->fc->nb_streams-1];
+
+ /* No need to parse fields for additional independent substreams and its
+ * associated dependent substreams since libavcodec's E-AC-3 decoder
+ * does not support them yet. */
+ avio_rb16(pb); /* data_rate and num_ind_sub */
+ eac3info = avio_rb24(pb);
+ bsmod = (eac3info >> 12) & 0x1f;
+ acmod = (eac3info >> 9) & 0x7;
+ lfeon = (eac3info >> 8) & 0x1;
+ st->codec->channel_layout = avpriv_ac3_channel_layout_tab[acmod];
+ if (lfeon)
+ st->codec->channel_layout |= AV_CH_LOW_FREQUENCY;
+ st->codec->channels = av_get_channel_layout_nb_channels(st->codec->channel_layout);
+ st->codec->audio_service_type = bsmod;
+ if (st->codec->channels > 1 && bsmod == 0x7)
+ st->codec->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;
+
+ return 0;
+}
+
static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
AVStream *st;
@@ -2605,6 +2633,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
{ MKTAG('w','a','v','e'), mov_read_wave },
{ MKTAG('e','s','d','s'), mov_read_esds },
{ MKTAG('d','a','c','3'), mov_read_dac3 }, /* AC-3 info */
+{ MKTAG('d','e','c','3'), mov_read_dec3 }, /* EAC-3 info */
{ MKTAG('w','i','d','e'), mov_read_wide }, /* place holder */
{ MKTAG('w','f','e','x'), mov_read_wfex },
{ MKTAG('c','m','o','v'), mov_read_cmov },
diff --git a/libavformat/segment.c b/libavformat/segment.c
index 05f76a7..09949d7 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -113,10 +113,15 @@ static int seg_write_header(AVFormatContext *s)
seg->offset_time = 0;
seg->recording_time = seg->time * 1000000;
+ oc = avformat_alloc_context();
+
+ if (!oc)
+ return AVERROR(ENOMEM);
+
if (seg->list)
if ((ret = avio_open2(&seg->pb, seg->list, AVIO_FLAG_WRITE,
&s->interrupt_callback, NULL)) < 0)
- return ret;
+ goto fail;
for (i = 0; i< s->nb_streams; i++)
seg->has_video +=
@@ -127,13 +132,6 @@ static int seg_write_header(AVFormatContext *s)
"More than a single video stream present, "
"expect issues decoding it.\n");
- oc = avformat_alloc_context();
-
- if (!oc) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
-
oc->oformat = av_guess_format(seg->format, s->filename, NULL);
if (!oc->oformat) {
OpenPOWER on IntegriCloud