Merge commit '20b40a597cdd4969cf1147d7c7efee2b6232524b'
* commit '20b40a597cdd4969cf1147d7c7efee2b6232524b': movenc: write hvcC tag for HEVC. Conflicts: libavformat/Makefile Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
1b1d77ae9b
@ -217,7 +217,7 @@ OBJS-$(CONFIG_MM_DEMUXER) += mm.o
|
||||
OBJS-$(CONFIG_MMF_DEMUXER) += mmf.o
|
||||
OBJS-$(CONFIG_MMF_MUXER) += mmf.o rawenc.o
|
||||
OBJS-$(CONFIG_MOV_DEMUXER) += mov.o isom.o mov_chan.o
|
||||
OBJS-$(CONFIG_MOV_MUXER) += movenc.o isom.o avc.o \
|
||||
OBJS-$(CONFIG_MOV_MUXER) += movenc.o isom.o avc.o hevc.o \
|
||||
movenchint.o mov_chan.o rtp.o
|
||||
OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o rawenc.o id3v2enc.o
|
||||
OBJS-$(CONFIG_MP3_DEMUXER) += mp3dec.o
|
||||
|
1076
libavformat/hevc.c
Normal file
1076
libavformat/hevc.c
Normal file
File diff suppressed because it is too large
Load Diff
50
libavformat/hevc.h
Normal file
50
libavformat/hevc.h
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Tim Walker <tdskywalker@gmail.com>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* internal header for HEVC (de)muxer utilities
|
||||
*/
|
||||
|
||||
#ifndef AVFORMAT_HEVC_H
|
||||
#define AVFORMAT_HEVC_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "avio.h"
|
||||
|
||||
/**
|
||||
* Writes HEVC extradata (parameter sets, declarative SEI NAL units) to the
|
||||
* provided AVIOContext.
|
||||
*
|
||||
* If the extradata is Annex B format, it gets converted to hvcC format before
|
||||
* writing.
|
||||
*
|
||||
* @param pb address of the AVIOContext where the hvcC shall be written
|
||||
* @param data address of the buffer holding the data needed to write the hvcC
|
||||
* @param size size (in bytes) of the data buffer
|
||||
* @param ps_array_completeness whether all parameter sets are in the hvcC (1)
|
||||
* or there may be additional parameter sets in the bitstream (0)
|
||||
* @return 0 in case of success, a negative value corresponding to an AVERROR
|
||||
* code in case of failure
|
||||
*/
|
||||
int ff_isom_write_hvcc(AVIOContext *pb, const uint8_t *data,
|
||||
int size, int ps_array_completeness);
|
||||
|
||||
#endif /* AVFORMAT_HEVC_H */
|
@ -39,6 +39,7 @@
|
||||
#include "libavutil/mathematics.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "libavutil/dict.h"
|
||||
#include "hevc.h"
|
||||
#include "rtpenc.h"
|
||||
#include "mov_chan.h"
|
||||
|
||||
@ -772,6 +773,16 @@ static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track)
|
||||
return update_size(pb, pos);
|
||||
}
|
||||
|
||||
static int mov_write_hvcc_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
int64_t pos = avio_tell(pb);
|
||||
|
||||
avio_wb32(pb, 0);
|
||||
ffio_wfourcc(pb, "hvcC");
|
||||
ff_isom_write_hvcc(pb, track->vos_data, track->vos_len, 0);
|
||||
return update_size(pb, pos);
|
||||
}
|
||||
|
||||
/* also used by all avid codecs (dv, imx, meridien) and their variants */
|
||||
static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
@ -1226,6 +1237,8 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
|
||||
avio_wb32(pb, 0);
|
||||
} else if (track->enc->codec_id == AV_CODEC_ID_DNXHD)
|
||||
mov_write_avid_tag(pb, track);
|
||||
else if (track->enc->codec_id == AV_CODEC_ID_HEVC)
|
||||
mov_write_hvcc_tag(pb, track);
|
||||
else if (track->enc->codec_id == AV_CODEC_ID_H264) {
|
||||
mov_write_avcc_tag(pb, track);
|
||||
if (track->mode == MODE_IPOD)
|
||||
|
Loading…
Reference in New Issue
Block a user