You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	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>
This commit is contained in:
		| @@ -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; | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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 }, | ||||
|   | ||||
| @@ -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) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user