Fix passthru of some eac3 tracks.

This commit is contained in:
Damiano Galassi committed 2016-02-16 13:14:05 +01:00
1 parent e044a50db1
commit c701a3ad4a
1 file changed
+20 -17
+20 -17
View File
@@ -727,29 +727,30 @@ concatenate:
return -2; return -2;
} }
/*if (!info->num_blocks) { if (!info->num_blocks) {
int ret; // Copy the frame
if ((ret = av_copy_packet(&info->pkt, pkt)) < 0) info->frame = (uint8_t *)malloc(size);
return ret; if (info->frame == NULL) {
return -2;
}
memcpy(info->frame, frame, size);
info->size = size;
info->num_blocks = num_blocks; info->num_blocks = num_blocks;
return 0; return 0;
} else { } else {
int ret; info->frame = (uint8_t *)realloc(info->frame, info->size + size);
if ((ret = av_grow_packet(&info->pkt, pkt->size)) < 0) if (info->frame == NULL) {
return ret; return -2;
memcpy(info->pkt.data + info->pkt.size - pkt->size, pkt->data, pkt->size); }
memcpy(info->frame + info->size, frame, size);
info->size += size;
info->num_blocks += num_blocks; info->num_blocks += num_blocks;
info->pkt.duration += pkt->duration;
if ((ret = av_copy_packet_side_data(&info->pkt, pkt)) < 0) if (info->num_blocks != 6) {
return ret;
if (info->num_blocks != 6)
return 0; return 0;
av_packet_unref(pkt); }
if ((ret = av_copy_packet(pkt, &info->pkt)) < 0)
return ret;
av_packet_unref(&info->pkt);
info->num_blocks = 0; info->num_blocks = 0;
}*/ }
return 0; return 0;
} }
@@ -787,5 +788,7 @@ CFDataRef createCookie_EAC3(void *context)
} }
} }
free(info->frame);
return CFDataCreate(kCFAllocatorDefault, cookie.GetBuffer(), cookie.GetBitPosition() / 8); return CFDataCreate(kCFAllocatorDefault, cookie.GetBuffer(), cookie.GetBitPosition() / 8);
} }