Browse Source

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>
tags/n0.11
Michael Niedermayer 13 years ago
parent
commit
9d7c1b4cf3
4 changed files with 45 additions and 9 deletions
  1. +5
    -0
      libavcodec/libschroedingerdec.c
  2. +5
    -1
      libavformat/aviobuf.c
  3. +29
    -0
      libavformat/mov.c
  4. +6
    -8
      libavformat/segment.c

+ 5
- 0
libavcodec/libschroedingerdec.c View File

@@ -106,6 +106,11 @@ static SchroBuffer *FindNextSchroParseUnit(SchroParseUnitContext *parse_ctx)
return NULL; return NULL;


in_buf = av_malloc(next_pu_offset); 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); memcpy(in_buf, parse_ctx->buf, next_pu_offset);
enc_buf = schro_buffer_new_with_data(in_buf, next_pu_offset); enc_buf = schro_buffer_new_with_data(in_buf, next_pu_offset);
enc_buf->free = libschroedinger_decode_buffer_free; enc_buf->free = libschroedinger_decode_buffer_free;


+ 5
- 1
libavformat/aviobuf.c View File

@@ -785,8 +785,12 @@ int avio_open2(AVIOContext **s, const char *filename, int flags,


int avio_close(AVIOContext *s) 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->buffer);
av_free(s); av_free(s);
return ffurl_close(h); return ffurl_close(h);


+ 29
- 0
libavformat/mov.c View File

@@ -596,6 +596,34 @@ static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0; 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) static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
@@ -2605,6 +2633,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
{ MKTAG('w','a','v','e'), mov_read_wave }, { MKTAG('w','a','v','e'), mov_read_wave },
{ MKTAG('e','s','d','s'), mov_read_esds }, { MKTAG('e','s','d','s'), mov_read_esds },
{ MKTAG('d','a','c','3'), mov_read_dac3 }, /* AC-3 info */ { 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','i','d','e'), mov_read_wide }, /* place holder */
{ MKTAG('w','f','e','x'), mov_read_wfex }, { MKTAG('w','f','e','x'), mov_read_wfex },
{ MKTAG('c','m','o','v'), mov_read_cmov }, { MKTAG('c','m','o','v'), mov_read_cmov },


+ 6
- 8
libavformat/segment.c View File

@@ -113,10 +113,15 @@ static int seg_write_header(AVFormatContext *s)
seg->offset_time = 0; seg->offset_time = 0;
seg->recording_time = seg->time * 1000000; seg->recording_time = seg->time * 1000000;


oc = avformat_alloc_context();

if (!oc)
return AVERROR(ENOMEM);

if (seg->list) if (seg->list)
if ((ret = avio_open2(&seg->pb, seg->list, AVIO_FLAG_WRITE, if ((ret = avio_open2(&seg->pb, seg->list, AVIO_FLAG_WRITE,
&s->interrupt_callback, NULL)) < 0) &s->interrupt_callback, NULL)) < 0)
return ret;
goto fail;


for (i = 0; i< s->nb_streams; i++) for (i = 0; i< s->nb_streams; i++)
seg->has_video += seg->has_video +=
@@ -127,13 +132,6 @@ static int seg_write_header(AVFormatContext *s)
"More than a single video stream present, " "More than a single video stream present, "
"expect issues decoding it.\n"); "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); oc->oformat = av_guess_format(seg->format, s->filename, NULL);


if (!oc->oformat) { if (!oc->oformat) {


Loading…
Cancel
Save