Merge commit '52ec149fbee57b6ca817049c9706212a0774a32c'
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>
Tue, 26 Apr 2016 13:04:03 +0000 (14:04 +0100)
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>
Tue, 26 Apr 2016 13:04:48 +0000 (14:04 +0100)
* commit '52ec149fbee57b6ca817049c9706212a0774a32c':
  h2645_parse: change the AVCodecContext* parameter to void*

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
1  2 
libavcodec/h2645_parse.c
libavcodec/h2645_parse.h

@@@ -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;
Simple merge