mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-24 17:12:34 +02:00
support extracting sps/pps from bitstream and putting it in extradata
Originally committed as revision 4403 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
e679cd1ab0
commit
3f46995ca5
@ -7133,6 +7133,13 @@ static int find_frame_end(H264Context *h, const uint8_t *buf, int buf_size){
|
|||||||
}
|
}
|
||||||
pc->frame_start_found = 1;
|
pc->frame_start_found = 1;
|
||||||
}
|
}
|
||||||
|
if((state&0xFFFFFF1F) == 0x107 || (state&0xFFFFFF1F) == 0x108 || (state&0xFFFFFF1F) == 0x109){
|
||||||
|
if(pc->frame_start_found){
|
||||||
|
pc->state=-1;
|
||||||
|
pc->frame_start_found= 0;
|
||||||
|
return i-4;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (i<buf_size)
|
if (i<buf_size)
|
||||||
state= (state<<8) | buf[i];
|
state= (state<<8) | buf[i];
|
||||||
}
|
}
|
||||||
@ -7163,6 +7170,31 @@ static int h264_parse(AVCodecParserContext *s,
|
|||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int h264_split(AVCodecContext *avctx,
|
||||||
|
const uint8_t *buf, int buf_size)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
uint32_t state = -1;
|
||||||
|
int has_sps= 0;
|
||||||
|
|
||||||
|
for(i=0; i<=buf_size; i++){
|
||||||
|
if((state&0xFFFFFF1F) == 0x107)
|
||||||
|
has_sps=1;
|
||||||
|
/* if((state&0xFFFFFF1F) == 0x101 || (state&0xFFFFFF1F) == 0x102 || (state&0xFFFFFF1F) == 0x105){
|
||||||
|
}*/
|
||||||
|
if((state&0xFFFFFF00) == 0x100 && (state&0xFFFFFF1F) != 0x107 && (state&0xFFFFFF1F) != 0x108 && (state&0xFFFFFF1F) != 0x109){
|
||||||
|
if(has_sps){
|
||||||
|
while(i>4 && buf[i-5]==0) i--;
|
||||||
|
return i-4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i<buf_size)
|
||||||
|
state= (state<<8) | buf[i];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int decode_nal_units(H264Context *h, uint8_t *buf, int buf_size){
|
static int decode_nal_units(H264Context *h, uint8_t *buf, int buf_size){
|
||||||
MpegEncContext * const s = &h->s;
|
MpegEncContext * const s = &h->s;
|
||||||
AVCodecContext * const avctx= s->avctx;
|
AVCodecContext * const avctx= s->avctx;
|
||||||
@ -7709,6 +7741,7 @@ AVCodecParser h264_parser = {
|
|||||||
NULL,
|
NULL,
|
||||||
h264_parse,
|
h264_parse,
|
||||||
ff_parse_close,
|
ff_parse_close,
|
||||||
|
h264_split,
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "svq3.c"
|
#include "svq3.c"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user