mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Merge commit 'f1e9398621af0bc9d166014e4ce6996bb4f141d0'
* commit 'f1e9398621af0bc9d166014e4ce6996bb4f141d0': lavc: Rename avpriv_mpv_find_start_code after moving out from mpegvideo Conflicts: libavcodec/h264_parser.c libavcodec/internal.h libavcodec/mpeg12.c libavcodec/utils.c libavformat/mpegtsenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
b19604cc4b
@ -1159,7 +1159,7 @@ static int cavs_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
|||||||
buf_ptr = buf;
|
buf_ptr = buf;
|
||||||
buf_end = buf + buf_size;
|
buf_end = buf + buf_size;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
buf_ptr = avpriv_mpv_find_start_code(buf_ptr, buf_end, &stc);
|
buf_ptr = avpriv_find_start_code(buf_ptr, buf_end, &stc);
|
||||||
if ((stc & 0xFFFFFE00) || buf_ptr == buf_end)
|
if ((stc & 0xFFFFFE00) || buf_ptr == buf_end)
|
||||||
return FFMAX(0, buf_ptr - buf);
|
return FFMAX(0, buf_ptr - buf);
|
||||||
input_size = (buf_end - buf_ptr) * 8;
|
input_size = (buf_end - buf_ptr) * 8;
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
#include "h264data.h"
|
#include "h264data.h"
|
||||||
#include "golomb.h"
|
#include "golomb.h"
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
|
|
||||||
static int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_size)
|
static int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_size)
|
||||||
@ -176,7 +177,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
|
|||||||
}
|
}
|
||||||
src_length = nalsize;
|
src_length = nalsize;
|
||||||
} else {
|
} else {
|
||||||
buf = avpriv_mpv_find_start_code(buf, buf_end, &state);
|
buf = avpriv_find_start_code(buf, buf_end, &state);
|
||||||
if(buf >= buf_end)
|
if(buf >= buf_end)
|
||||||
break;
|
break;
|
||||||
--buf;
|
--buf;
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "libavutil/mathematics.h"
|
#include "libavutil/mathematics.h"
|
||||||
#include "libavutil/pixfmt.h"
|
#include "libavutil/pixfmt.h"
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#define FF_SANE_NB_CHANNELS 63U
|
#define FF_SANE_NB_CHANNELS 63U
|
||||||
|
|
||||||
@ -227,4 +228,8 @@ int ff_codec_close_recursive(AVCodecContext *avctx);
|
|||||||
*/
|
*/
|
||||||
int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf);
|
int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf);
|
||||||
|
|
||||||
|
const uint8_t *avpriv_find_start_code(const uint8_t *p,
|
||||||
|
const uint8_t *end,
|
||||||
|
uint32_t *state);
|
||||||
|
|
||||||
#endif /* AVCODEC_INTERNAL_H */
|
#endif /* AVCODEC_INTERNAL_H */
|
||||||
|
@ -1747,7 +1747,7 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
|
|||||||
if (avctx->hwaccel) {
|
if (avctx->hwaccel) {
|
||||||
const uint8_t *buf_end, *buf_start = *buf - 4; /* include start_code */
|
const uint8_t *buf_end, *buf_start = *buf - 4; /* include start_code */
|
||||||
int start_code = -1;
|
int start_code = -1;
|
||||||
buf_end = avpriv_mpv_find_start_code(buf_start + 2, *buf + buf_size, &start_code);
|
buf_end = avpriv_find_start_code(buf_start + 2, *buf + buf_size, &start_code);
|
||||||
if (buf_end < *buf + buf_size)
|
if (buf_end < *buf + buf_size)
|
||||||
buf_end -= 4;
|
buf_end -= 4;
|
||||||
s->mb_y = mb_y;
|
s->mb_y = mb_y;
|
||||||
@ -1948,7 +1948,7 @@ static int slice_decode_thread(AVCodecContext *c, void *arg)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
start_code = -1;
|
start_code = -1;
|
||||||
buf = avpriv_mpv_find_start_code(buf, s->gb.buffer_end, &start_code);
|
buf = avpriv_find_start_code(buf, s->gb.buffer_end, &start_code);
|
||||||
mb_y= start_code - SLICE_MIN_START_CODE;
|
mb_y= start_code - SLICE_MIN_START_CODE;
|
||||||
if(s->codec_id != AV_CODEC_ID_MPEG1VIDEO && s->mb_height > 2800/16)
|
if(s->codec_id != AV_CODEC_ID_MPEG1VIDEO && s->mb_height > 2800/16)
|
||||||
mb_y += (*buf&0xE0)<<2;
|
mb_y += (*buf&0xE0)<<2;
|
||||||
@ -2247,7 +2247,7 @@ int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size,
|
|||||||
}
|
}
|
||||||
state++;
|
state++;
|
||||||
} else {
|
} else {
|
||||||
i = avpriv_mpv_find_start_code(buf + i, buf + buf_size, &state) - buf - 1;
|
i = avpriv_find_start_code(buf + i, buf + buf_size, &state) - buf - 1;
|
||||||
if (pc->frame_start_found == 0 && state >= SLICE_MIN_START_CODE && state <= SLICE_MAX_START_CODE) {
|
if (pc->frame_start_found == 0 && state >= SLICE_MIN_START_CODE && state <= SLICE_MAX_START_CODE) {
|
||||||
i++;
|
i++;
|
||||||
pc->frame_start_found = 4;
|
pc->frame_start_found = 4;
|
||||||
@ -2292,7 +2292,7 @@ static int decode_chunks(AVCodecContext *avctx,
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
/* find next start code */
|
/* find next start code */
|
||||||
uint32_t start_code = -1;
|
uint32_t start_code = -1;
|
||||||
buf_ptr = avpriv_mpv_find_start_code(buf_ptr, buf_end, &start_code);
|
buf_ptr = avpriv_find_start_code(buf_ptr, buf_end, &start_code);
|
||||||
if (start_code > 0x1ff) {
|
if (start_code > 0x1ff) {
|
||||||
if (s2->pict_type != AV_PICTURE_TYPE_B || avctx->skip_frame <= AVDISCARD_DEFAULT) {
|
if (s2->pict_type != AV_PICTURE_TYPE_B || avctx->skip_frame <= AVDISCARD_DEFAULT) {
|
||||||
if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE)) {
|
if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE)) {
|
||||||
|
@ -823,7 +823,6 @@ int ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src);
|
|||||||
int ff_MPV_lowest_referenced_row(MpegEncContext *s, int dir);
|
int ff_MPV_lowest_referenced_row(MpegEncContext *s, int dir);
|
||||||
void ff_MPV_report_decode_progress(MpegEncContext *s);
|
void ff_MPV_report_decode_progress(MpegEncContext *s);
|
||||||
int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src);
|
int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src);
|
||||||
const uint8_t *avpriv_mpv_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state);
|
|
||||||
void ff_set_qscale(MpegEncContext * s, int qscale);
|
void ff_set_qscale(MpegEncContext * s, int qscale);
|
||||||
|
|
||||||
void ff_mpeg_er_frame_start(MpegEncContext *s);
|
void ff_mpeg_er_frame_start(MpegEncContext *s);
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
#include "mpegvideo.h"
|
#include "mpegvideo.h"
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
struct MpvParseContext {
|
struct MpvParseContext {
|
||||||
ParseContext pc;
|
ParseContext pc;
|
||||||
@ -50,7 +51,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s,
|
|||||||
|
|
||||||
while (buf < buf_end) {
|
while (buf < buf_end) {
|
||||||
start_code= -1;
|
start_code= -1;
|
||||||
buf= avpriv_mpv_find_start_code(buf, buf_end, &start_code);
|
buf= avpriv_find_start_code(buf, buf_end, &start_code);
|
||||||
bytes_left = buf_end - buf;
|
bytes_left = buf_end - buf;
|
||||||
switch(start_code) {
|
switch(start_code) {
|
||||||
case PICTURE_START_CODE:
|
case PICTURE_START_CODE:
|
||||||
|
@ -41,7 +41,6 @@
|
|||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "dsputil.h"
|
#include "dsputil.h"
|
||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
#include "mpegvideo.h"
|
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "frame_thread_encoder.h"
|
#include "frame_thread_encoder.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
@ -3100,7 +3099,7 @@ int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t *avpriv_mpv_find_start_code(const uint8_t *av_restrict p,
|
const uint8_t *avpriv_find_start_code(const uint8_t *av_restrict p,
|
||||||
const uint8_t *end,
|
const uint8_t *end,
|
||||||
uint32_t *av_restrict state)
|
uint32_t *av_restrict state)
|
||||||
{
|
{
|
||||||
|
@ -22,10 +22,11 @@
|
|||||||
#include "libavutil/bswap.h"
|
#include "libavutil/bswap.h"
|
||||||
#include "libavutil/crc.h"
|
#include "libavutil/crc.h"
|
||||||
#include "libavutil/dict.h"
|
#include "libavutil/dict.h"
|
||||||
|
#include "libavutil/intreadwrite.h"
|
||||||
#include "libavutil/mathematics.h"
|
#include "libavutil/mathematics.h"
|
||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
#include "libavutil/avassert.h"
|
#include "libavutil/avassert.h"
|
||||||
#include "libavcodec/mpegvideo.h"
|
#include "libavcodec/internal.h"
|
||||||
#include "avformat.h"
|
#include "avformat.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "mpegts.h"
|
#include "mpegts.h"
|
||||||
@ -1100,7 +1101,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
p = avpriv_mpv_find_start_code(p, buf_end, &state);
|
p = avpriv_find_start_code(p, buf_end, &state);
|
||||||
av_dlog(s, "nal %d\n", state & 0x1f);
|
av_dlog(s, "nal %d\n", state & 0x1f);
|
||||||
} while (p < buf_end && (state & 0x1f) != 9 &&
|
} while (p < buf_end && (state & 0x1f) != 9 &&
|
||||||
(state & 0x1f) != 5 && (state & 0x1f) != 1);
|
(state & 0x1f) != 5 && (state & 0x1f) != 1);
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libavcodec/mpegvideo.h"
|
#include "libavcodec/internal.h"
|
||||||
#include "avformat.h"
|
#include "avformat.h"
|
||||||
#include "rtpenc.h"
|
#include "rtpenc.h"
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ void ff_rtp_send_mpegvideo(AVFormatContext *s1, const uint8_t *buf1, int size)
|
|||||||
r1 = buf1;
|
r1 = buf1;
|
||||||
while (1) {
|
while (1) {
|
||||||
start_code = -1;
|
start_code = -1;
|
||||||
r = avpriv_mpv_find_start_code(r1, end, &start_code);
|
r = avpriv_find_start_code(r1, end, &start_code);
|
||||||
if((start_code & 0xFFFFFF00) == 0x100) {
|
if((start_code & 0xFFFFFF00) == 0x100) {
|
||||||
/* New start code found */
|
/* New start code found */
|
||||||
if (start_code == 0x100) {
|
if (start_code == 0x100) {
|
||||||
|
Loading…
Reference in New Issue
Block a user