Commit 1c6d9975 authored by michael's avatar michael

rtp_callback: send number of mb patch by (Johan Bilien {jobi via.ecp fr)


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@3926 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent f760601c
...@@ -17,7 +17,7 @@ extern "C" { ...@@ -17,7 +17,7 @@ extern "C" {
#define FFMPEG_VERSION_INT 0x000409 #define FFMPEG_VERSION_INT 0x000409
#define FFMPEG_VERSION "0.4.9-pre1" #define FFMPEG_VERSION "0.4.9-pre1"
#define LIBAVCODEC_BUILD 4739 #define LIBAVCODEC_BUILD 4740
#define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT #define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
#define LIBAVCODEC_VERSION FFMPEG_VERSION #define LIBAVCODEC_VERSION FFMPEG_VERSION
...@@ -859,8 +859,10 @@ typedef struct AVCodecContext { ...@@ -859,8 +859,10 @@ typedef struct AVCodecContext {
/* The RTP callcack: This function is called */ /* The RTP callcack: This function is called */
/* every time the encoder as a packet to send */ /* every time the encoder as a packet to send */
/* Depends on the encoder if the data starts */ /* Depends on the encoder if the data starts */
/* with a Start Code (it should) H.263 does */ /* with a Start Code (it should) H.263 does. */
void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int packet_number); /* mb_nb contains the number of macroblocks */
/* encoded in the RTP payload */
void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
/* statistics, used for 2-pass encoding */ /* statistics, used for 2-pass encoding */
int mv_bits; int mv_bits;
......
...@@ -4724,9 +4724,11 @@ static int encode_thread(AVCodecContext *c, void *arg){ ...@@ -4724,9 +4724,11 @@ static int encode_thread(AVCodecContext *c, void *arg){
assert(pbBufPtr(&s->pb) == s->ptr_lastgob); assert(pbBufPtr(&s->pb) == s->ptr_lastgob);
} }
} }
if (s->avctx->rtp_callback) if (s->avctx->rtp_callback){
s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, current_packet_size, 0); int number_mb = (mb_y - s->resync_mb_y)*s->mb_width + mb_x - s->resync_mb_x;
s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, current_packet_size, number_mb);
}
switch(s->codec_id){ switch(s->codec_id){
case CODEC_ID_MPEG4: case CODEC_ID_MPEG4:
...@@ -5166,10 +5168,11 @@ static int encode_thread(AVCodecContext *c, void *arg){ ...@@ -5166,10 +5168,11 @@ static int encode_thread(AVCodecContext *c, void *arg){
/* Send the last GOB if RTP */ /* Send the last GOB if RTP */
if (s->avctx->rtp_callback) { if (s->avctx->rtp_callback) {
int number_mb = (mb_y - s->resync_mb_y)*s->mb_width - s->resync_mb_x;
pdif = pbBufPtr(&s->pb) - s->ptr_lastgob; pdif = pbBufPtr(&s->pb) - s->ptr_lastgob;
/* Call the RTP callback to send the last GOB */ /* Call the RTP callback to send the last GOB */
emms_c(); emms_c();
s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, pdif, 0); s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, pdif, number_mb);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment