This is in preparation to use an 'out_packet' for the conversion to
avcodec_encode_video2().
uint8_t *out_buf;
int out_picture_size;
struct SwsContext *sw_scale_ctx;
uint8_t *out_buf;
int out_picture_size;
struct SwsContext *sw_scale_ctx;
int got_picture;
int ret = 0;
int got_picture;
int ret = 0;
while (run) {
/* read packet */
while (run) {
/* read packet */
- ret = av_read_frame(input_ctx.format_ctx, &packet);
+ ret = av_read_frame(input_ctx.format_ctx, &in_packet);
if (ret < 0) {
if (ret == (int)AVERROR_EOF || input_ctx.format_ctx->pb->eof_reached)
ret = 0;
if (ret < 0) {
if (ret == (int)AVERROR_EOF || input_ctx.format_ctx->pb->eof_reached)
ret = 0;
- if (packet.stream_index != input_ctx.video_stream_index) {
+ if (in_packet.stream_index != input_ctx.video_stream_index) {
/* that is more or less a "continue", but there is
* still the packet to free */
goto end_while;
/* that is more or less a "continue", but there is
* still the packet to free */
goto end_while;
/* decode */
got_picture = 0;
/* decode */
got_picture = 0;
- ret = avcodec_decode_video2(input_ctx.codec_ctx, picture_raw, &got_picture, &packet);
+ ret = avcodec_decode_video2(input_ctx.codec_ctx, picture_raw, &got_picture, &in_packet);
if (ret < 0) {
fprintf(stderr, "cannot decode video\n");
run = 0;
if (ret < 0) {
fprintf(stderr, "cannot decode video\n");
run = 0;
- av_free_packet(&packet);
+ av_free_packet(&in_packet);
}
sws_freeContext(sw_scale_ctx);
}
sws_freeContext(sw_scale_ctx);