mirror of https://git.ffmpeg.org/ffmpeg.git
mpeg12: raise timecode to codec context.
This commit is contained in:
parent
2cf4bd7751
commit
b1ca5634fd
|
@ -2710,9 +2710,9 @@ typedef struct AVCodecContext {
|
|||
#endif
|
||||
|
||||
/**
|
||||
* GOP timecode frame start number, in non drop frame format
|
||||
* - encoding: Set by user.
|
||||
* - decoding: unused
|
||||
* GOP timecode frame start number
|
||||
* - encoding: Set by user, in non drop frame format
|
||||
* - decoding: Set by libavcodec (timecode in the 25 bits format, -1 if unset)
|
||||
*/
|
||||
int64_t timecode_frame_start;
|
||||
|
||||
|
|
|
@ -2141,20 +2141,12 @@ static void mpeg_decode_gop(AVCodecContext *avctx,
|
|||
{
|
||||
Mpeg1Context *s1 = avctx->priv_data;
|
||||
MpegEncContext *s = &s1->mpeg_enc_ctx;
|
||||
|
||||
int drop_frame_flag;
|
||||
int time_code_hours, time_code_minutes;
|
||||
int time_code_seconds, time_code_pictures;
|
||||
int broken_link;
|
||||
int64_t tc;
|
||||
|
||||
init_get_bits(&s->gb, buf, buf_size*8);
|
||||
|
||||
drop_frame_flag = get_bits(&s->gb, 1);
|
||||
time_code_hours = get_bits(&s->gb, 5);
|
||||
time_code_minutes = get_bits(&s->gb, 6);
|
||||
skip_bits1(&s->gb); // marker bit
|
||||
time_code_seconds = get_bits(&s->gb, 6);
|
||||
time_code_pictures = get_bits(&s->gb, 6);
|
||||
tc = avctx->timecode_frame_start = get_bits(&s->gb, 25);
|
||||
|
||||
s->closed_gop = get_bits1(&s->gb);
|
||||
/*broken_link indicate that after editing the
|
||||
|
@ -2162,11 +2154,17 @@ static void mpeg_decode_gop(AVCodecContext *avctx,
|
|||
are missing (open gop)*/
|
||||
broken_link = get_bits1(&s->gb);
|
||||
|
||||
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
|
||||
if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
|
||||
int time_code_hours = tc>>19 & 0x1f;
|
||||
int time_code_minutes = tc>>13 & 0x3f;
|
||||
int time_code_seconds = tc>>6 & 0x3f;
|
||||
int drop_frame_flag = tc & 1<<24;
|
||||
int time_code_pictures = tc & 0x3f;
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "GOP (%02d:%02d:%02d%c%02d) closed_gop=%d broken_link=%d\n",
|
||||
time_code_hours, time_code_minutes, time_code_seconds,
|
||||
drop_frame_flag ? ';' : ':',
|
||||
time_code_pictures, s->closed_gop, broken_link);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Find the end of the current frame in the bitstream.
|
||||
|
|
|
@ -185,6 +185,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
|||
if (ff_init_smtpe_timecode(s, &s->tc) < 0)
|
||||
return -1;
|
||||
s->avctx->timecode_frame_start = s->tc.start;
|
||||
} else {
|
||||
s->avctx->timecode_frame_start = 0; // default is -1
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -578,6 +578,7 @@ int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
|
|||
s->sample_aspect_ratio = (AVRational){0,1};
|
||||
s->pix_fmt = PIX_FMT_NONE;
|
||||
s->sample_fmt = AV_SAMPLE_FMT_NONE;
|
||||
s->timecode_frame_start = -1;
|
||||
|
||||
s->reget_buffer = avcodec_default_reget_buffer;
|
||||
s->reordered_opaque = AV_NOPTS_VALUE;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#define AVCODEC_VERSION_H
|
||||
|
||||
#define LIBAVCODEC_VERSION_MAJOR 53
|
||||
#define LIBAVCODEC_VERSION_MINOR 38
|
||||
#define LIBAVCODEC_VERSION_MINOR 39
|
||||
#define LIBAVCODEC_VERSION_MICRO 1
|
||||
|
||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||
|
|
Loading…
Reference in New Issue