Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 509298
Collapse All | Expand All

(-)file_not_specified_in_diff (-31 / +22 lines)
Line  Link Here
Patch based on work by Anton Khirnov, rebasing on mplayer2 revision
Patch based on work by Anton Khirnov, rebasing on mplayer2 revision
1
2c378c7 allowed great simplification.
1
2c378c7 allowed great simplification.
2
-- mplayer2-2.0-728-g2c378c7.orig/Makefile
2
++ mplayer2-2.0-728-g2c378c7/Makefile
Lines 301-307 SRCS_COMMON = asxparser.c \ Link Here
301
              libmpcodecs/vf_ilpack.c \
301
              libmpcodecs/vf_ilpack.c \
302
              libmpcodecs/vf_ivtc.c \
302
              libmpcodecs/vf_ivtc.c \
303
              libmpcodecs/vf_kerndeint.c \
303
              libmpcodecs/vf_kerndeint.c \
304
              libmpcodecs/vf_lavc.c \
305
              libmpcodecs/vf_lavcdeint.c \
304
              libmpcodecs/vf_lavcdeint.c \
306
              libmpcodecs/vf_mirror.c \
305
              libmpcodecs/vf_mirror.c \
307
              libmpcodecs/vf_noformat.c \
306
              libmpcodecs/vf_noformat.c \
308
-- mplayer2-2.0-728-g2c378c7.orig/screenshot.c
307
++ mplayer2-2.0-728-g2c378c7/screenshot.c
Lines 82-87 static int write_png(screenshot_ctx *ctx Link Here
82
    FILE *fp = NULL;
82
    FILE *fp = NULL;
83
    void *outbuffer = NULL;
83
    void *outbuffer = NULL;
84
    int success = 0;
84
    int success = 0;
85
    int got_output;
85
86
86
    struct AVCodec *png_codec = avcodec_find_encoder(AV_CODEC_ID_PNG);
87
    struct AVCodec *png_codec = avcodec_find_encoder(AV_CODEC_ID_PNG);
87
    AVCodecContext *avctx = NULL;
88
    AVCodecContext *avctx = NULL;
Lines 104-113 static int write_png(screenshot_ctx *ctx Link Here
104
        goto error_exit;
105
        goto error_exit;
105
    }
106
    }
106
107
108
    AVPacket pkt = { 0 };
107
    size_t outbuffer_size = image->width * image->height * 3 * 2;
109
    size_t outbuffer_size = image->width * image->height * 3 * 2;
108
    outbuffer = malloc(outbuffer_size);
109
    if (!outbuffer)
110
        goto error_exit;
111
110
112
    AVFrame *pic = ctx->pic;
111
    AVFrame *pic = ctx->pic;
113
    avcodec_get_frame_defaults(pic);
112
    avcodec_get_frame_defaults(pic);
Lines 115-122 static int write_png(screenshot_ctx *ctx Link Here
115
        pic->data[n] = image->planes[n];
114
        pic->data[n] = image->planes[n];
116
        pic->linesize[n] = image->stride[n];
115
        pic->linesize[n] = image->stride[n];
117
    }
116
    }
118
    int size = avcodec_encode_video(avctx, outbuffer, outbuffer_size, pic);
117
    int ret = avcodec_encode_video2(avctx, &pkt, pic, &got_output);
119
    if (size < 1)
118
    if (ret < 0 || !got_output)
120
        goto error_exit;
119
        goto error_exit;
121
120
122
    fp = fopen(fname, "wb");
121
    fp = fopen(fname, "wb");
Lines 126-133 static int write_png(screenshot_ctx *ctx Link Here
126
        goto error_exit;
125
        goto error_exit;
127
    }
126
    }
128
127
129
    fwrite(outbuffer, size, 1, fp);
128
    fwrite(pkt.data, pkt.size, 1, fp);
130
    fflush(fp);
129
    fflush(fp);
130
    av_free_packet(&pkt);
131
131
132
    if (ferror(fp))
132
    if (ferror(fp))
133
        goto error_exit;
133
        goto error_exit;
Lines 139-145 error_exit: Link Here
139
    av_free(avctx);
139
    av_free(avctx);
140
    if (fp)
140
    if (fp)
141
        fclose(fp);
141
        fclose(fp);
142
    free(outbuffer);
143
    return success;
142
    return success;
144
}
143
}
145
144
146
-- mplayer2-2.0-728-g2c378c7.orig/libmpcodecs/vf.c
145
++ mplayer2-2.0-728-g2c378c7/libmpcodecs/vf.c
Lines 48-54 extern const vf_info_t vf_info_flip; Link Here
48
extern const vf_info_t vf_info_rotate;
48
extern const vf_info_t vf_info_rotate;
49
extern const vf_info_t vf_info_mirror;
49
extern const vf_info_t vf_info_mirror;
50
extern const vf_info_t vf_info_palette;
50
extern const vf_info_t vf_info_palette;
51
extern const vf_info_t vf_info_lavc;
51
//extern const vf_info_t vf_info_lavc;
52
extern const vf_info_t vf_info_dvbscale;
52
extern const vf_info_t vf_info_dvbscale;
53
extern const vf_info_t vf_info_cropdetect;
53
extern const vf_info_t vf_info_cropdetect;
54
extern const vf_info_t vf_info_test;
54
extern const vf_info_t vf_info_test;
Lines 131-137 static const vf_info_t *const filter_lis Link Here
131
#ifdef CONFIG_LIBPOSTPROC
131
#ifdef CONFIG_LIBPOSTPROC
132
    &vf_info_pp,
132
    &vf_info_pp,
133
#endif
133
#endif
134
    &vf_info_lavc,
134
    //&vf_info_lavc,
135
    &vf_info_lavcdeint,
135
    &vf_info_lavcdeint,
136
    &vf_info_screenshot,
136
    &vf_info_screenshot,
137
    &vf_info_fspp,
137
    &vf_info_fspp,
138
-- mplayer2-2.0-728-g2c378c7.orig/libvo/vo_png.c
138
++ mplayer2-2.0-728-g2c378c7/libvo/vo_png.c
Lines 52-59 static int z_compression; Link Here
52
static int framenum;
52
static int framenum;
53
static int use_alpha;
53
static int use_alpha;
54
static AVCodecContext *avctx;
54
static AVCodecContext *avctx;
55
static uint8_t *outbuffer;
56
int outbuffer_size;
57
55
58
static int
56
static int
59
config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
57
config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
Lines 87-95 config(uint32_t width, uint32_t height, Link Here
87
85
88
86
89
static uint32_t draw_image(mp_image_t* mpi){
87
static uint32_t draw_image(mp_image_t* mpi){
88
    AVPacket pkt = { 0 };
90
    AVFrame pic;
89
    AVFrame pic;
91
    int buffersize;
90
    int buffersize;
92
    int res;
91
    int res, got_output;
93
    char buf[100];
92
    char buf[100];
94
    FILE *outfile;
93
    FILE *outfile;
95
94
Lines 105-126 static uint32_t draw_image(mp_image_t* m Link Here
105
104
106
    pic.data[0] = mpi->planes[0];
105
    pic.data[0] = mpi->planes[0];
107
    pic.linesize[0] = mpi->stride[0];
106
    pic.linesize[0] = mpi->stride[0];
108
    buffersize = mpi->w * mpi->h * 8;
109
    if (outbuffer_size < buffersize) {
110
        av_freep(&outbuffer);
111
        outbuffer = av_malloc(buffersize);
112
        outbuffer_size = buffersize;
113
    }
114
    res = avcodec_encode_video(avctx, outbuffer, outbuffer_size, &pic);
115
107
116
    if(res < 0){
108
    res = avcodec_encode_video2(avctx, &pkt, &pic, &got_output);
109
110
    if(res < 0 || !got_output){
117
 	    mp_msg(MSGT_VO,MSGL_WARN, "[VO_PNG] Error in create_png.\n");
111
 	    mp_msg(MSGT_VO,MSGL_WARN, "[VO_PNG] Error in create_png.\n");
118
            fclose(outfile);
112
            fclose(outfile);
119
	    return 1;
113
	    return 1;
120
    }
114
    }
121
115
122
    fwrite(outbuffer, res, 1, outfile);
116
    fwrite(pkt.data, pkt.size, 1, outfile);
123
    fclose(outfile);
117
    fclose(outfile);
118
    av_free_packet(&pkt);
124
119
125
    return VO_TRUE;
120
    return VO_TRUE;
126
}
121
}
Lines 157-164 static void uninit(void) Link Here
157
    if (avctx)
152
    if (avctx)
158
        avcodec_close(avctx);
153
        avcodec_close(avctx);
159
    av_freep(&avctx);
154
    av_freep(&avctx);
160
    av_freep(&outbuffer);
161
    outbuffer_size = 0;
162
}
155
}
163
156
164
static void check_events(void){}
157
static void check_events(void){}
165
-- mplayer2-2.0-728-g2c378c7.orig/libmpdemux/demux_lavf.c
158
++ mplayer2-2.0-728-g2c378c7/libmpdemux/demux_lavf.c
Lines 422-429 static void handle_stream(demuxer_t *dem Link Here
422
         * heuristic makes up works with subtitles in practice.
422
         * heuristic makes up works with subtitles in practice.
423
         */
423
         */
424
        double fps;
424
        double fps;
425
        if (st->r_frame_rate.num)
425
        if (st->avg_frame_rate.num)
426
            fps = av_q2d(st->r_frame_rate);
426
            fps = av_q2d(st->avg_frame_rate);
427
        else
427
        else
428
            fps = 1.0 / FFMAX(av_q2d(st->time_base),
428
            fps = 1.0 / FFMAX(av_q2d(st->time_base),
429
                              av_q2d(st->codec->time_base) *
429
                              av_q2d(st->codec->time_base) *

Return to bug 509298