[FFmpeg-cvslog] Merge commit '52ec149fbee57b6ca817049c9706212a0774a32c'
Derek Buitenhuis
git at videolan.org
Tue Apr 26 15:04:55 CEST 2016
ffmpeg | branch: master | Derek Buitenhuis <derek.buitenhuis at gmail.com> | Tue Apr 26 14:04:03 2016 +0100| [b5c10c4c9274b06a7bd6f6e1f0f4c129aa6e892c] | committer: Derek Buitenhuis
Merge commit '52ec149fbee57b6ca817049c9706212a0774a32c'
* commit '52ec149fbee57b6ca817049c9706212a0774a32c':
h2645_parse: change the AVCodecContext* parameter to void*
Merged-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b5c10c4c9274b06a7bd6f6e1f0f4c129aa6e892c
---
libavcodec/h2645_parse.c | 14 +++++++-------
libavcodec/h2645_parse.h | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c
index 58c9118..fc22ec6 100644
--- a/libavcodec/h2645_parse.c
+++ b/libavcodec/h2645_parse.c
@@ -182,7 +182,7 @@ static const char *nal_unit_name(int nal_type)
* @return AVERROR_INVALIDDATA if the packet is not a valid NAL unit,
* 0 if the unit should be skipped, 1 otherwise
*/
-static int hevc_parse_nal_header(H2645NAL *nal, AVCodecContext *avctx)
+static int hevc_parse_nal_header(H2645NAL *nal, void *logctx)
{
GetBitContext *gb = &nal->gb;
int nuh_layer_id;
@@ -197,7 +197,7 @@ static int hevc_parse_nal_header(H2645NAL *nal, AVCodecContext *avctx)
if (nal->temporal_id < 0)
return AVERROR_INVALIDDATA;
- av_log(avctx, AV_LOG_DEBUG,
+ av_log(logctx, AV_LOG_DEBUG,
"nal_unit_type: %d(%s), nuh_layer_id: %d, temporal_id: %d\n",
nal->type, nal_unit_name(nal->type), nuh_layer_id, nal->temporal_id);
@@ -206,7 +206,7 @@ static int hevc_parse_nal_header(H2645NAL *nal, AVCodecContext *avctx)
int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
- AVCodecContext *avctx, int is_nalff, int nal_length_size)
+ void *logctx, int is_nalff, int nal_length_size)
{
int consumed, ret = 0;
@@ -223,7 +223,7 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
length -= nal_length_size;
if (extract_length > length) {
- av_log(avctx, AV_LOG_ERROR, "Invalid NAL unit size.\n");
+ av_log(logctx, AV_LOG_ERROR, "Invalid NAL unit size.\n");
return AVERROR_INVALIDDATA;
}
} else {
@@ -237,7 +237,7 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
// bytes at the end of the packet.
return 0;
} else {
- av_log(avctx, AV_LOG_ERROR, "No start code is found.\n");
+ av_log(logctx, AV_LOG_ERROR, "No start code is found.\n");
return AVERROR_INVALIDDATA;
}
}
@@ -279,10 +279,10 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
if (ret < 0)
return ret;
- ret = hevc_parse_nal_header(nal, avctx);
+ ret = hevc_parse_nal_header(nal, logctx);
if (ret <= 0) {
if (ret < 0) {
- av_log(avctx, AV_LOG_ERROR, "Invalid NAL unit %d, skipping.\n",
+ av_log(logctx, AV_LOG_ERROR, "Invalid NAL unit %d, skipping.\n",
nal->type);
}
pkt->nb_nals--;
diff --git a/libavcodec/h2645_parse.h b/libavcodec/h2645_parse.h
index 05c21b0..cbf07a2 100644
--- a/libavcodec/h2645_parse.h
+++ b/libavcodec/h2645_parse.h
@@ -63,7 +63,7 @@ int ff_h2645_extract_rbsp(const uint8_t *src, int length,
* Split an input packet into NAL units.
*/
int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
- AVCodecContext *avctx, int is_nalff, int nal_length_size);
+ void *logctx, int is_nalff, int nal_length_size);
/**
* Free all the allocated memory in the packet.
======================================================================
diff --cc libavcodec/h2645_parse.c
index 58c9118,57a78e9..fc22ec6
--- a/libavcodec/h2645_parse.c
+++ b/libavcodec/h2645_parse.c
@@@ -197,9 -147,9 +197,9 @@@ static int hevc_parse_nal_header(H2645N
if (nal->temporal_id < 0)
return AVERROR_INVALIDDATA;
- av_log(avctx, AV_LOG_DEBUG,
+ av_log(logctx, AV_LOG_DEBUG,
- "nal_unit_type: %d, nuh_layer_id: %dtemporal_id: %d\n",
- nal->type, nuh_layer_id, nal->temporal_id);
+ "nal_unit_type: %d(%s), nuh_layer_id: %d, temporal_id: %d\n",
+ nal->type, nal_unit_name(nal->type), nuh_layer_id, nal->temporal_id);
return nuh_layer_id == 0;
}
@@@ -227,21 -177,13 +227,21 @@@ int ff_h2645_packet_split(H2645Packet *
return AVERROR_INVALIDDATA;
}
} else {
- if (buf[2] == 0) {
- length--;
- buf++;
- continue;
+ /* search start code */
+ while (buf[0] != 0 || buf[1] != 0 || buf[2] != 1) {
+ ++buf;
+ --length;
+ if (length < 4) {
+ if (pkt->nb_nals > 0) {
+ // No more start codes: we discarded some irrelevant
+ // bytes at the end of the packet.
+ return 0;
+ } else {
- av_log(avctx, AV_LOG_ERROR, "No start code is found.\n");
++ av_log(logctx, AV_LOG_ERROR, "No start code is found.\n");
+ return AVERROR_INVALIDDATA;
+ }
+ }
}
- if (buf[0] != 0 || buf[1] != 0 || buf[2] != 1)
- return AVERROR_INVALIDDATA;
buf += 3;
length -= 3;
More information about the ffmpeg-cvslog
mailing list