Lines 48-53
Link Here
|
48 |
#endif |
48 |
#endif |
49 |
|
49 |
|
50 |
#include "h263-1998.h" |
50 |
#include "h263-1998.h" |
|
|
51 |
extern "C" |
52 |
{ |
53 |
#include <libavutil/opt.h> |
54 |
} |
51 |
#include <limits> |
55 |
#include <limits> |
52 |
#include <iomanip> |
56 |
#include <iomanip> |
53 |
#include <stdio.h> |
57 |
#include <stdio.h> |
Lines 203-209
Link Here
|
203 |
PTRACE(4, m_prefix, "Encoder closed"); |
207 |
PTRACE(4, m_prefix, "Encoder closed"); |
204 |
} |
208 |
} |
205 |
|
209 |
|
206 |
bool H263_Base_EncoderContext::Init(CodecID codecId) |
210 |
bool H263_Base_EncoderContext::Init(AVCodecID codecId) |
207 |
{ |
211 |
{ |
208 |
PTRACE(5, m_prefix, "Opening encoder"); |
212 |
PTRACE(5, m_prefix, "Opening encoder"); |
209 |
|
213 |
|
Lines 317-325
Link Here
|
317 |
// Level 2+ |
321 |
// Level 2+ |
318 |
// works with eyeBeam, signaled via non-standard "D" |
322 |
// works with eyeBeam, signaled via non-standard "D" |
319 |
if (atoi(value) == 1) |
323 |
if (atoi(value) == 1) |
320 |
m_context->flags |= CODEC_FLAG_H263P_UMV; |
324 |
av_opt_set_int(m_context->priv_data, "umv", 1, 0); |
321 |
else |
325 |
else |
322 |
m_context->flags &= ~CODEC_FLAG_H263P_UMV; |
326 |
av_opt_set_int(m_context->priv_data, "umv", 0, 0); |
323 |
return; |
327 |
return; |
324 |
} |
328 |
} |
325 |
|
329 |
|
Lines 328-336
Link Here
|
328 |
// Annex F: Advanced Prediction Mode |
332 |
// Annex F: Advanced Prediction Mode |
329 |
// does not work with eyeBeam |
333 |
// does not work with eyeBeam |
330 |
if (atoi(value) == 1) |
334 |
if (atoi(value) == 1) |
331 |
m_context->flags |= CODEC_FLAG_OBMC; |
335 |
av_opt_set_int(m_context->priv_data, "obmc", 1, 0); |
332 |
else |
336 |
else |
333 |
m_context->flags &= ~CODEC_FLAG_OBMC; |
337 |
av_opt_set_int(m_context->priv_data, "obmc", 0, 0); |
334 |
return; |
338 |
return; |
335 |
} |
339 |
} |
336 |
#endif |
340 |
#endif |
Lines 360-368
Link Here
|
360 |
// Annex K: Slice Structure |
364 |
// Annex K: Slice Structure |
361 |
// does not work with eyeBeam |
365 |
// does not work with eyeBeam |
362 |
if (atoi(value) != 0) |
366 |
if (atoi(value) != 0) |
363 |
m_context->flags |= CODEC_FLAG_H263P_SLICE_STRUCT; |
367 |
av_opt_set_int(m_context->priv_data, "structured_slices", 1, 0); |
364 |
else |
368 |
else |
365 |
m_context->flags &= ~CODEC_FLAG_H263P_SLICE_STRUCT; |
369 |
av_opt_set_int(m_context->priv_data, "structured_slices", 0, 0); |
366 |
return; |
370 |
return; |
367 |
} |
371 |
} |
368 |
|
372 |
|
Lines 370-378
Link Here
|
370 |
// Annex S: Alternative INTER VLC mode |
374 |
// Annex S: Alternative INTER VLC mode |
371 |
// does not work with eyeBeam |
375 |
// does not work with eyeBeam |
372 |
if (atoi(value) == 1) |
376 |
if (atoi(value) == 1) |
373 |
m_context->flags |= CODEC_FLAG_H263P_AIV; |
377 |
av_opt_set_int(m_context->priv_data, "aiv", 1, 0); |
374 |
else |
378 |
else |
375 |
m_context->flags &= ~CODEC_FLAG_H263P_AIV; |
379 |
av_opt_set_int(m_context->priv_data, "aiv", 0, 0); |
376 |
return; |
380 |
return; |
377 |
} |
381 |
} |
378 |
|
382 |
|
Lines 450-464
Link Here
|
450 |
PTRACE(5, m_prefix, "qmax set to " << m_context->qmax); |
454 |
PTRACE(5, m_prefix, "qmax set to " << m_context->qmax); |
451 |
PTRACE(5, m_prefix, "payload size set to " << m_context->rtp_payload_size); |
455 |
PTRACE(5, m_prefix, "payload size set to " << m_context->rtp_payload_size); |
452 |
|
456 |
|
453 |
#define CODEC_TRACER_FLAG(tracer, flag) \ |
|
|
454 |
PTRACE(4, m_prefix, #flag " is " << ((m_context->flags & flag) ? "enabled" : "disabled")); |
455 |
CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_UMV); |
456 |
CODEC_TRACER_FLAG(tracer, CODEC_FLAG_OBMC); |
457 |
CODEC_TRACER_FLAG(tracer, CODEC_FLAG_AC_PRED); |
458 |
CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_SLICE_STRUCT) |
459 |
CODEC_TRACER_FLAG(tracer, CODEC_FLAG_LOOP_FILTER); |
460 |
CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_AIV); |
461 |
|
462 |
return FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec) == 0; |
457 |
return FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec) == 0; |
463 |
} |
458 |
} |
464 |
|
459 |
|
Lines 521-527
Link Here
|
521 |
|
516 |
|
522 |
// Need to copy to local buffer to guarantee 16 byte alignment |
517 |
// Need to copy to local buffer to guarantee 16 byte alignment |
523 |
memcpy(m_inputFrame->data[0], OPAL_VIDEO_FRAME_DATA_PTR(header), header->width*header->height*3/2); |
518 |
memcpy(m_inputFrame->data[0], OPAL_VIDEO_FRAME_DATA_PTR(header), header->width*header->height*3/2); |
524 |
m_inputFrame->pict_type = (flags & PluginCodec_CoderForceIFrame) ? FF_I_TYPE : AV_PICTURE_TYPE_NONE; |
519 |
m_inputFrame->pict_type = (flags & PluginCodec_CoderForceIFrame) ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_NONE; |
525 |
|
520 |
|
526 |
/* |
521 |
/* |
527 |
m_inputFrame->pts = (int64_t)srcRTP.GetTimestamp()*m_context->time_base.den/m_context->time_base.num/VIDEO_CLOCKRATE; |
522 |
m_inputFrame->pts = (int64_t)srcRTP.GetTimestamp()*m_context->time_base.den/m_context->time_base.num/VIDEO_CLOCKRATE; |
Lines 603-615
Link Here
|
603 |
m_context->rtp_callback = &H263_RFC2190_EncoderContext::RTPCallBack; |
598 |
m_context->rtp_callback = &H263_RFC2190_EncoderContext::RTPCallBack; |
604 |
m_context->opaque = this; // used to separate out packets from different encode threads |
599 |
m_context->opaque = this; // used to separate out packets from different encode threads |
605 |
|
600 |
|
606 |
m_context->flags &= ~CODEC_FLAG_H263P_UMV; |
601 |
av_opt_set_int(m_context->priv_data, "umv", 0, 0); |
607 |
m_context->flags &= ~CODEC_FLAG_4MV; |
602 |
m_context->flags &= ~CODEC_FLAG_4MV; |
608 |
#if LIBAVCODEC_RTP_MODE |
603 |
#if LIBAVCODEC_RTP_MODE |
609 |
m_context->flags &= ~CODEC_FLAG_H263P_AIC; |
604 |
m_context->flags &= ~CODEC_FLAG_H263P_AIC; |
610 |
#endif |
605 |
#endif |
611 |
m_context->flags &= ~CODEC_FLAG_H263P_AIV; |
606 |
av_opt_set_int(m_context->priv_data, "aiv", 0, 0); |
612 |
m_context->flags &= ~CODEC_FLAG_H263P_SLICE_STRUCT; |
607 |
av_opt_set_int(m_context->priv_data, "structured_slices", 0, 0); |
613 |
|
608 |
|
614 |
return true; |
609 |
return true; |
615 |
} |
610 |
} |