Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-03-11 16:13:42 +0400
committerMichael Niedermayer <michaelni@gmx.at>2014-03-11 16:13:42 +0400
commit5227eac5b0408ea077ef7d1ff94ae35748fb012f (patch)
treec4ae35bde00ce6c8de0ae629411dee110abd4516 /libavformat
parentbb40f8f5e22c0c4097a704fdd6e7a66b96f0318d (diff)
parent6d56bc9a6d853a33fe53ab63db580c4facaba420 (diff)
Merge commit '6d56bc9a6d853a33fe53ab63db580c4facaba420' into release/2.2
* commit '6d56bc9a6d853a33fe53ab63db580c4facaba420': lavf: simplify ff_hevc_annexb2mp4_buf Conflicts: libavformat/hevc.c libavformat/hevc.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/hevc.c43
-rw-r--r--libavformat/hevc.h4
2 files changed, 5 insertions, 42 deletions
diff --git a/libavformat/hevc.c b/libavformat/hevc.c
index 09d1355573..9632386153 100644
--- a/libavformat/hevc.c
+++ b/libavformat/hevc.c
@@ -1066,52 +1066,15 @@ int ff_hevc_annexb2mp4_buf(const uint8_t *buf_in, uint8_t **buf_out,
int *size, int filter_ps, int *ps_count)
{
AVIOContext *pb;
- int num_ps = 0, ret = 0;
- uint8_t *buf, *end, *start = NULL;
-
- if (!filter_ps) {
- ret = ff_avc_parse_nal_units_buf(buf_in, buf_out, size);
- goto end;
- }
+ int ret;
ret = avio_open_dyn_buf(&pb);
if (ret < 0)
- goto end;
-
- ret = ff_avc_parse_nal_units_buf(buf_in, &start, size);
- if (ret < 0)
- goto end;
-
- buf = start;
- end = start + *size;
-
- while (end - buf > 4) {
- uint32_t len = FFMIN(AV_RB32(buf), end - buf - 4);
- uint8_t type = (buf[4] >> 1) & 0x3f;
-
- buf += 4;
-
- switch (type) {
- case NAL_VPS:
- case NAL_SPS:
- case NAL_PPS:
- num_ps++;
- break;
- default:
- avio_wb32(pb, len);
- avio_write(pb, buf, len);
- break;
- }
-
- buf += len;
- }
+ return ret;
+ ret = ff_hevc_annexb2mp4(pb, buf_in, *size, filter_ps, ps_count);
*size = avio_close_dyn_buf(pb, buf_out);
-end:
- av_free(start);
- if (ps_count)
- *ps_count = num_ps;
return ret;
}
diff --git a/libavformat/hevc.h b/libavformat/hevc.h
index c687f1b1fc..796eaf40b1 100644
--- a/libavformat/hevc.h
+++ b/libavformat/hevc.h
@@ -71,8 +71,8 @@ int ff_hevc_annexb2mp4(AVIOContext *pb, const uint8_t *buf_in,
* or to discard them (non-zero)
* @param ps_count address of the variable where the number of discarded
* parameter set NAL units shall be written, may be NULL
- * @return >=0 in case of success, a negative value corresponding to an AVERROR
- * code in case of failure
+ * @return the amount (in bytes) of data written in case of success, a negative
+ * value corresponding to an AVERROR code in case of failure
*/
int ff_hevc_annexb2mp4_buf(const uint8_t *buf_in, uint8_t **buf_out,
int *size, int filter_ps, int *ps_count);