mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
avformat/avidec: use avpriv_find_start_code in avi_read_packet()
Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
e3f5b6f16d
commit
bf696e265a
@ -36,6 +36,7 @@
|
|||||||
#include "riff.h"
|
#include "riff.h"
|
||||||
#include "libavcodec/bytestream.h"
|
#include "libavcodec/bytestream.h"
|
||||||
#include "libavcodec/exif.h"
|
#include "libavcodec/exif.h"
|
||||||
|
#include "libavcodec/internal.h"
|
||||||
#include "libavformat/isom.h"
|
#include "libavformat/isom.h"
|
||||||
|
|
||||||
typedef struct AVIStream {
|
typedef struct AVIStream {
|
||||||
@ -1446,17 +1447,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
if (index >= 0 && e->timestamp == ast->frame_offset) {
|
if (index >= 0 && e->timestamp == ast->frame_offset) {
|
||||||
if (index == st->nb_index_entries-1) {
|
if (index == st->nb_index_entries-1) {
|
||||||
int key=1;
|
int key=1;
|
||||||
int i;
|
|
||||||
uint32_t state=-1;
|
uint32_t state=-1;
|
||||||
for (i=0; i<FFMIN(size,256); i++) {
|
if (st->codec->codec_id == AV_CODEC_ID_MPEG4) {
|
||||||
if (st->codec->codec_id == AV_CODEC_ID_MPEG4) {
|
const uint8_t *ptr = pkt->data, *end = ptr + FFMIN(size, 256);
|
||||||
if (state == 0x1B6) {
|
while (ptr < end) {
|
||||||
key= !(pkt->data[i]&0xC0);
|
ptr = avpriv_find_start_code(ptr, end, &state);
|
||||||
|
if (state == 0x1B6 && ptr < end) {
|
||||||
|
key = !(*ptr & 0xC0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}else
|
}
|
||||||
break;
|
|
||||||
state= (state<<8) + pkt->data[i];
|
|
||||||
}
|
}
|
||||||
if (!key)
|
if (!key)
|
||||||
e->flags &= ~AVINDEX_KEYFRAME;
|
e->flags &= ~AVINDEX_KEYFRAME;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user