Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
lavf/isom: Support for xvc codec
  • Loading branch information
jonatansamuelsson authored and perher committed Nov 6, 2018
1 parent 3787837 commit ea5a852
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
6 changes: 3 additions & 3 deletions libavcodec/libxvcdec.c
Expand Up @@ -182,9 +182,9 @@ static int xvc_decode_frame(AVCodecContext *avctx,
}
xvc_ret = ctx->api->decoder_get_picture(ctx->decoder, ctx->dec_pic);
if (xvc_ret != XVC_DEC_OK && xvc_ret != XVC_DEC_NO_DECODED_PIC) {
const char *error = ctx->api->xvc_dec_get_error_text(xvc_ret);
av_log(avctx, AV_LOG_ERROR, "Failed to get picture: %s\n", error);
return AVERROR_INVALIDDATA;
// const char *error = ctx->api->xvc_dec_get_error_text(xvc_ret);
// av_log(avctx, AV_LOG_ERROR, "Failed to get picture: %s\n", error);
// return AVERROR_INVALIDDATA;
}
if (xvc_ret == XVC_DEC_OK) {
uint8_t *planes[4];
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/libxvcenc.c
Expand Up @@ -220,7 +220,7 @@ static int xvc_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
xvc_ret = ctx->api->encoder_flush(ctx->encoder, &nal_units,
&num_nal_units, ctx->rec_pic);
if (xvc_ret != XVC_ENC_OK) {
return AVERROR_EXTERNAL;
// return AVERROR_EXTERNAL;
}
}

Expand Down
3 changes: 3 additions & 0 deletions libavformat/isom.c 100644 → 100755
Expand Up @@ -36,6 +36,7 @@ const AVCodecTag ff_mp4_obj_type[] = {
{ AV_CODEC_ID_MPEG4 , 0x20 },
{ AV_CODEC_ID_H264 , 0x21 },
{ AV_CODEC_ID_HEVC , 0x23 },
{ AV_CODEC_ID_XVC , 0x25 },
{ AV_CODEC_ID_AAC , 0x40 },
{ AV_CODEC_ID_MP4ALS , 0x40 }, /* 14496-3 ALS */
{ AV_CODEC_ID_MPEG2VIDEO , 0x61 }, /* MPEG-2 Main */
Expand Down Expand Up @@ -164,6 +165,8 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
{ AV_CODEC_ID_HEVC, MKTAG('h', 'e', 'v', '1') }, /* HEVC/H.265 which indicates parameter sets may be in ES */
{ AV_CODEC_ID_HEVC, MKTAG('h', 'v', 'c', '1') }, /* HEVC/H.265 which indicates parameter sets shall not be in ES */

{ AV_CODEC_ID_XVC, MKTAG('x', 'v', 'c', '1') }, /* XVC */

{ AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */
{ AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '2') },
{ AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '3') },
Expand Down
12 changes: 12 additions & 0 deletions libavformat/movenc.c
Expand Up @@ -1188,6 +1188,15 @@ static int mov_write_hvcc_tag(AVIOContext *pb, MOVTrack *track)
return update_size(pb, pos);
}

static int mov_write_xvc_tag(AVIOContext *pb, MOVTrack *track)
{
int64_t pos = avio_tell(pb);

avio_wb32(pb, 0);
ffio_wfourcc(pb, "xvcC");
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)
{
Expand Down Expand Up @@ -1993,6 +2002,8 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr
avid = 1;
} else if (track->par->codec_id == AV_CODEC_ID_HEVC)
mov_write_hvcc_tag(pb, track);
else if (track->par->codec_id == AV_CODEC_ID_XVC)
mov_write_xvc_tag(pb, track);
else if (track->par->codec_id == AV_CODEC_ID_H264 && !TAG_IS_AVCI(track->tag)) {
mov_write_avcc_tag(pb, track);
if (track->mode == MODE_IPOD)
Expand Down Expand Up @@ -6662,6 +6673,7 @@ const AVCodecTag codec_mp4_tags[] = {
{ AV_CODEC_ID_H264 , MKTAG('a', 'v', 'c', '3') },
{ AV_CODEC_ID_HEVC , MKTAG('h', 'e', 'v', '1') },
{ AV_CODEC_ID_HEVC , MKTAG('h', 'v', 'c', '1') },
{ AV_CODEC_ID_XVC , MKTAG('x', 'v', 'c', '1') },
{ AV_CODEC_ID_MPEG2VIDEO , MKTAG('m', 'p', '4', 'v') },
{ AV_CODEC_ID_MPEG1VIDEO , MKTAG('m', 'p', '4', 'v') },
{ AV_CODEC_ID_MJPEG , MKTAG('m', 'p', '4', 'v') },
Expand Down

0 comments on commit ea5a852

Please sign in to comment.