~ubuntu-branches/debian/sid/ffmpeg/sid

« back to all changes in this revision

Viewing changes to ffplay.c

  • Committer: Package Import Robot
  • Author(s): Andreas Cadhalpun, Fabian Greffrath, Andreas Cadhalpun
  • Date: 2015-09-22 15:15:20 UTC
  • mfrom: (0.1.29)
  • Revision ID: package-import@ubuntu.com-20150922151520-hhmd3in9ykigjvs9
Tags: 7:2.8-1
[ Fabian Greffrath ]
* Pass the --dbg-package=ffmpeg-dbg parameter only to dh_strip.
* Add alternative Depends: libavcodec-ffmpeg-extra56 to libavcodec-dev and
  ffmpeg-dbg to allow for building and debugging with this library installed.

[ Andreas Cadhalpun ]
* Import new major upstream release 2.8.
* Remove the transitional lib*-ffmpeg-dev packages.
* Drop old Breaks on kodi-bin.
* Drop workaround for sparc, which is no Debian architecture anymore.
* Re-enable x265 on alpha, as it's available again.
* Disable unavailable frei0r, opencv and x264 on mips64el.
* Disable libopenjpeg (#787275) and libschroedinger (#787957) decoders.
  (Closes: #786670)
* Disable libdc1394 on sparc64, because it links against the broken due to
  #790560 libudev1.
* Enable libsnappy support.
* Add new symbols.
* Update debian/copyright.
* Update debian/tests/encdec_list.txt.
* Add hls-only-seek-if-there-is-an-offset.patch. (Closes: #798189)
* Add 'Breaks: libavutil-ffmpeg54 (>= 8:0)' to the libraries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include <stdint.h>
32
32
 
33
33
#include "libavutil/avstring.h"
34
 
#include "libavutil/colorspace.h"
35
34
#include "libavutil/eval.h"
36
35
#include "libavutil/mathematics.h"
37
36
#include "libavutil/pixdesc.h"
66
65
const int program_birth_year = 2003;
67
66
 
68
67
#define MAX_QUEUE_SIZE (15 * 1024 * 1024)
69
 
#define MIN_FRAMES 5
 
68
#define MIN_FRAMES 25
 
69
#define EXTERNAL_CLOCK_MIN_FRAMES 2
 
70
#define EXTERNAL_CLOCK_MAX_FRAMES 10
70
71
 
71
72
/* Minimum SDL audio buffer size, in samples. */
72
73
#define SDL_AUDIO_MIN_BUFFER_SIZE 512
102
103
 
103
104
#define CURSOR_HIDE_DELAY 1000000
104
105
 
105
 
static int64_t sws_flags = SWS_BICUBIC;
 
106
static unsigned sws_flags = SWS_BICUBIC;
106
107
 
107
108
typedef struct MyAVPacketList {
108
109
    AVPacket pkt;
223
224
    Decoder viddec;
224
225
    Decoder subdec;
225
226
 
 
227
    int viddec_width;
 
228
    int viddec_height;
 
229
 
226
230
    int audio_stream;
227
231
 
228
232
    int av_sync_type;
278
282
#if !CONFIG_AVFILTER
279
283
    struct SwsContext *img_convert_ctx;
280
284
#endif
 
285
    struct SwsContext *sub_convert_ctx;
281
286
    SDL_Rect last_display_rect;
282
287
    int eof;
283
288
 
829
834
#define ALPHA_BLEND(a, oldp, newp, s)\
830
835
((((oldp << s) * (255 - (a))) + (newp * (a))) / (255 << s))
831
836
 
832
 
#define RGBA_IN(r, g, b, a, s)\
833
 
{\
834
 
    unsigned int v = ((const uint32_t *)(s))[0];\
835
 
    a = (v >> 24) & 0xff;\
836
 
    r = (v >> 16) & 0xff;\
837
 
    g = (v >> 8) & 0xff;\
838
 
    b = v & 0xff;\
839
 
}
840
 
 
841
 
#define YUVA_IN(y, u, v, a, s, pal)\
842
 
{\
843
 
    unsigned int val = ((const uint32_t *)(pal))[*(const uint8_t*)(s)];\
844
 
    a = (val >> 24) & 0xff;\
845
 
    y = (val >> 16) & 0xff;\
846
 
    u = (val >> 8) & 0xff;\
847
 
    v = val & 0xff;\
848
 
}
849
 
 
850
 
#define YUVA_OUT(d, y, u, v, a)\
851
 
{\
852
 
    ((uint32_t *)(d))[0] = (a << 24) | (y << 16) | (u << 8) | v;\
853
 
}
854
837
 
855
838
 
856
839
#define BPP 1
857
840
 
858
841
static void blend_subrect(AVPicture *dst, const AVSubtitleRect *rect, int imgw, int imgh)
859
842
{
860
 
    int wrap, wrap3, width2, skip2;
861
 
    int y, u, v, a, u1, v1, a1, w, h;
 
843
    int x, y, Y, U, V, A;
862
844
    uint8_t *lum, *cb, *cr;
863
 
    const uint8_t *p;
864
 
    const uint32_t *pal;
865
845
    int dstx, dsty, dstw, dsth;
 
846
    const AVPicture *src = &rect->pict;
866
847
 
867
848
    dstw = av_clip(rect->w, 0, imgw);
868
849
    dsth = av_clip(rect->h, 0, imgh);
869
850
    dstx = av_clip(rect->x, 0, imgw - dstw);
870
851
    dsty = av_clip(rect->y, 0, imgh - dsth);
871
 
    lum = dst->data[0] + dsty * dst->linesize[0];
872
 
    cb  = dst->data[1] + (dsty >> 1) * dst->linesize[1];
873
 
    cr  = dst->data[2] + (dsty >> 1) * dst->linesize[2];
874
 
 
875
 
    width2 = ((dstw + 1) >> 1) + (dstx & ~dstw & 1);
876
 
    skip2 = dstx >> 1;
877
 
    wrap = dst->linesize[0];
878
 
    wrap3 = rect->pict.linesize[0];
879
 
    p = rect->pict.data[0];
880
 
    pal = (const uint32_t *)rect->pict.data[1];  /* Now in YCrCb! */
881
 
 
882
 
    if (dsty & 1) {
883
 
        lum += dstx;
884
 
        cb += skip2;
885
 
        cr += skip2;
886
 
 
887
 
        if (dstx & 1) {
888
 
            YUVA_IN(y, u, v, a, p, pal);
889
 
            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
890
 
            cb[0] = ALPHA_BLEND(a >> 2, cb[0], u, 0);
891
 
            cr[0] = ALPHA_BLEND(a >> 2, cr[0], v, 0);
892
 
            cb++;
893
 
            cr++;
894
 
            lum++;
895
 
            p += BPP;
896
 
        }
897
 
        for (w = dstw - (dstx & 1); w >= 2; w -= 2) {
898
 
            YUVA_IN(y, u, v, a, p, pal);
899
 
            u1 = u;
900
 
            v1 = v;
901
 
            a1 = a;
902
 
            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
903
 
 
904
 
            YUVA_IN(y, u, v, a, p + BPP, pal);
905
 
            u1 += u;
906
 
            v1 += v;
907
 
            a1 += a;
908
 
            lum[1] = ALPHA_BLEND(a, lum[1], y, 0);
909
 
            cb[0] = ALPHA_BLEND(a1 >> 2, cb[0], u1, 1);
910
 
            cr[0] = ALPHA_BLEND(a1 >> 2, cr[0], v1, 1);
911
 
            cb++;
912
 
            cr++;
913
 
            p += 2 * BPP;
914
 
            lum += 2;
915
 
        }
916
 
        if (w) {
917
 
            YUVA_IN(y, u, v, a, p, pal);
918
 
            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
919
 
            cb[0] = ALPHA_BLEND(a >> 2, cb[0], u, 0);
920
 
            cr[0] = ALPHA_BLEND(a >> 2, cr[0], v, 0);
921
 
            p++;
922
 
            lum++;
923
 
        }
924
 
        p += wrap3 - dstw * BPP;
925
 
        lum += wrap - dstw - dstx;
926
 
        cb += dst->linesize[1] - width2 - skip2;
927
 
        cr += dst->linesize[2] - width2 - skip2;
928
 
    }
929
 
    for (h = dsth - (dsty & 1); h >= 2; h -= 2) {
930
 
        lum += dstx;
931
 
        cb += skip2;
932
 
        cr += skip2;
933
 
 
934
 
        if (dstx & 1) {
935
 
            YUVA_IN(y, u, v, a, p, pal);
936
 
            u1 = u;
937
 
            v1 = v;
938
 
            a1 = a;
939
 
            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
940
 
            p += wrap3;
941
 
            lum += wrap;
942
 
            YUVA_IN(y, u, v, a, p, pal);
943
 
            u1 += u;
944
 
            v1 += v;
945
 
            a1 += a;
946
 
            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
947
 
            cb[0] = ALPHA_BLEND(a1 >> 2, cb[0], u1, 1);
948
 
            cr[0] = ALPHA_BLEND(a1 >> 2, cr[0], v1, 1);
949
 
            cb++;
950
 
            cr++;
951
 
            p += -wrap3 + BPP;
952
 
            lum += -wrap + 1;
953
 
        }
954
 
        for (w = dstw - (dstx & 1); w >= 2; w -= 2) {
955
 
            YUVA_IN(y, u, v, a, p, pal);
956
 
            u1 = u;
957
 
            v1 = v;
958
 
            a1 = a;
959
 
            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
960
 
 
961
 
            YUVA_IN(y, u, v, a, p + BPP, pal);
962
 
            u1 += u;
963
 
            v1 += v;
964
 
            a1 += a;
965
 
            lum[1] = ALPHA_BLEND(a, lum[1], y, 0);
966
 
            p += wrap3;
967
 
            lum += wrap;
968
 
 
969
 
            YUVA_IN(y, u, v, a, p, pal);
970
 
            u1 += u;
971
 
            v1 += v;
972
 
            a1 += a;
973
 
            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
974
 
 
975
 
            YUVA_IN(y, u, v, a, p + BPP, pal);
976
 
            u1 += u;
977
 
            v1 += v;
978
 
            a1 += a;
979
 
            lum[1] = ALPHA_BLEND(a, lum[1], y, 0);
980
 
 
981
 
            cb[0] = ALPHA_BLEND(a1 >> 2, cb[0], u1, 2);
982
 
            cr[0] = ALPHA_BLEND(a1 >> 2, cr[0], v1, 2);
983
 
 
984
 
            cb++;
985
 
            cr++;
986
 
            p += -wrap3 + 2 * BPP;
987
 
            lum += -wrap + 2;
988
 
        }
989
 
        if (w) {
990
 
            YUVA_IN(y, u, v, a, p, pal);
991
 
            u1 = u;
992
 
            v1 = v;
993
 
            a1 = a;
994
 
            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
995
 
            p += wrap3;
996
 
            lum += wrap;
997
 
            YUVA_IN(y, u, v, a, p, pal);
998
 
            u1 += u;
999
 
            v1 += v;
1000
 
            a1 += a;
1001
 
            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
1002
 
            cb[0] = ALPHA_BLEND(a1 >> 2, cb[0], u1, 1);
1003
 
            cr[0] = ALPHA_BLEND(a1 >> 2, cr[0], v1, 1);
1004
 
            cb++;
1005
 
            cr++;
1006
 
            p += -wrap3 + BPP;
1007
 
            lum += -wrap + 1;
1008
 
        }
1009
 
        p += wrap3 + (wrap3 - dstw * BPP);
1010
 
        lum += wrap + (wrap - dstw - dstx);
1011
 
        cb += dst->linesize[1] - width2 - skip2;
1012
 
        cr += dst->linesize[2] - width2 - skip2;
1013
 
    }
1014
 
    /* handle odd height */
1015
 
    if (h) {
1016
 
        lum += dstx;
1017
 
        cb += skip2;
1018
 
        cr += skip2;
1019
 
 
1020
 
        if (dstx & 1) {
1021
 
            YUVA_IN(y, u, v, a, p, pal);
1022
 
            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
1023
 
            cb[0] = ALPHA_BLEND(a >> 2, cb[0], u, 0);
1024
 
            cr[0] = ALPHA_BLEND(a >> 2, cr[0], v, 0);
1025
 
            cb++;
1026
 
            cr++;
1027
 
            lum++;
1028
 
            p += BPP;
1029
 
        }
1030
 
        for (w = dstw - (dstx & 1); w >= 2; w -= 2) {
1031
 
            YUVA_IN(y, u, v, a, p, pal);
1032
 
            u1 = u;
1033
 
            v1 = v;
1034
 
            a1 = a;
1035
 
            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
1036
 
 
1037
 
            YUVA_IN(y, u, v, a, p + BPP, pal);
1038
 
            u1 += u;
1039
 
            v1 += v;
1040
 
            a1 += a;
1041
 
            lum[1] = ALPHA_BLEND(a, lum[1], y, 0);
1042
 
            cb[0] = ALPHA_BLEND(a1 >> 2, cb[0], u, 1);
1043
 
            cr[0] = ALPHA_BLEND(a1 >> 2, cr[0], v, 1);
1044
 
            cb++;
1045
 
            cr++;
1046
 
            p += 2 * BPP;
1047
 
            lum += 2;
1048
 
        }
1049
 
        if (w) {
1050
 
            YUVA_IN(y, u, v, a, p, pal);
1051
 
            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
1052
 
            cb[0] = ALPHA_BLEND(a >> 2, cb[0], u, 0);
1053
 
            cr[0] = ALPHA_BLEND(a >> 2, cr[0], v, 0);
1054
 
        }
 
852
    lum = dst->data[0] + dstx + dsty * dst->linesize[0];
 
853
    cb  = dst->data[1] + dstx/2 + (dsty >> 1) * dst->linesize[1];
 
854
    cr  = dst->data[2] + dstx/2 + (dsty >> 1) * dst->linesize[2];
 
855
 
 
856
    for (y = 0; y<dsth; y++) {
 
857
        for (x = 0; x<dstw; x++) {
 
858
            Y = src->data[0][x + y*src->linesize[0]];
 
859
            A = src->data[3][x + y*src->linesize[3]];
 
860
            lum[0] = ALPHA_BLEND(A, lum[0], Y, 0);
 
861
            lum++;
 
862
        }
 
863
        lum += dst->linesize[0] - dstw;
 
864
    }
 
865
 
 
866
    for (y = 0; y<dsth/2; y++) {
 
867
        for (x = 0; x<dstw/2; x++) {
 
868
            U = src->data[1][x + y*src->linesize[1]];
 
869
            V = src->data[2][x + y*src->linesize[2]];
 
870
            A = src->data[3][2*x     +  2*y   *src->linesize[3]]
 
871
              + src->data[3][2*x + 1 +  2*y   *src->linesize[3]]
 
872
              + src->data[3][2*x + 1 + (2*y+1)*src->linesize[3]]
 
873
              + src->data[3][2*x     + (2*y+1)*src->linesize[3]];
 
874
            cb[0] = ALPHA_BLEND(A>>2, cb[0], U, 0);
 
875
            cr[0] = ALPHA_BLEND(A>>2, cr[0], V, 0);
 
876
            cb++;
 
877
            cr++;
 
878
        }
 
879
        cb += dst->linesize[1] - dstw/2;
 
880
        cr += dst->linesize[2] - dstw/2;
1055
881
    }
1056
882
}
1057
883
 
1306
1132
#if !CONFIG_AVFILTER
1307
1133
    sws_freeContext(is->img_convert_ctx);
1308
1134
#endif
 
1135
    sws_freeContext(is->sub_convert_ctx);
1309
1136
    av_free(is);
1310
1137
}
1311
1138
 
1475
1302
}
1476
1303
 
1477
1304
static void check_external_clock_speed(VideoState *is) {
1478
 
   if (is->video_stream >= 0 && is->videoq.nb_packets <= MIN_FRAMES / 2 ||
1479
 
       is->audio_stream >= 0 && is->audioq.nb_packets <= MIN_FRAMES / 2) {
 
1305
   if (is->video_stream >= 0 && is->videoq.nb_packets <= EXTERNAL_CLOCK_MIN_FRAMES ||
 
1306
       is->audio_stream >= 0 && is->audioq.nb_packets <= EXTERNAL_CLOCK_MIN_FRAMES) {
1480
1307
       set_clock_speed(&is->extclk, FFMAX(EXTERNAL_CLOCK_SPEED_MIN, is->extclk.speed - EXTERNAL_CLOCK_SPEED_STEP));
1481
 
   } else if ((is->video_stream < 0 || is->videoq.nb_packets > MIN_FRAMES * 2) &&
1482
 
              (is->audio_stream < 0 || is->audioq.nb_packets > MIN_FRAMES * 2)) {
 
1308
   } else if ((is->video_stream < 0 || is->videoq.nb_packets > EXTERNAL_CLOCK_MAX_FRAMES) &&
 
1309
              (is->audio_stream < 0 || is->audioq.nb_packets > EXTERNAL_CLOCK_MAX_FRAMES)) {
1483
1310
       set_clock_speed(&is->extclk, FFMIN(EXTERNAL_CLOCK_SPEED_MAX, is->extclk.speed + EXTERNAL_CLOCK_SPEED_STEP));
1484
1311
   } else {
1485
1312
       double speed = is->extclk.speed;
1851
1678
        av_picture_copy(&pict, (AVPicture *)src_frame,
1852
1679
                        src_frame->format, vp->width, vp->height);
1853
1680
#else
1854
 
        av_opt_get_int(sws_opts, "sws_flags", 0, &sws_flags);
 
1681
        {
 
1682
            AVDictionaryEntry *e = av_dict_get(sws_dict, "sws_flags", NULL, 0);
 
1683
            if (e) {
 
1684
                const AVClass *class = sws_get_class();
 
1685
                const AVOption    *o = av_opt_find(&class, "sws_flags", NULL, 0,
 
1686
                                                   AV_OPT_SEARCH_FAKE_OBJ);
 
1687
                int ret = av_opt_eval_flags(&class, o, e->value, &sws_flags);
 
1688
                if (ret < 0)
 
1689
                    exit(1);
 
1690
            }
 
1691
        }
 
1692
 
1855
1693
        is->img_convert_ctx = sws_getCachedContext(is->img_convert_ctx,
1856
1694
            vp->width, vp->height, src_frame->format, vp->width, vp->height,
1857
1695
            AV_PIX_FMT_YUV420P, sws_flags, NULL, NULL, NULL);
1893
1731
 
1894
1732
        frame->sample_aspect_ratio = av_guess_sample_aspect_ratio(is->ic, is->video_st, frame);
1895
1733
 
 
1734
        is->viddec_width  = frame->width;
 
1735
        is->viddec_height = frame->height;
 
1736
 
1896
1737
        if (framedrop>0 || (framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) {
1897
1738
            if (frame->pts != AV_NOPTS_VALUE) {
1898
1739
                double diff = dpts - get_master_clock(is);
1958
1799
static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const char *vfilters, AVFrame *frame)
1959
1800
{
1960
1801
    static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE };
1961
 
    char sws_flags_str[128];
 
1802
    char sws_flags_str[512] = "";
1962
1803
    char buffersrc_args[256];
1963
1804
    int ret;
1964
1805
    AVFilterContext *filt_src = NULL, *filt_out = NULL, *last_filter = NULL;
1965
1806
    AVCodecContext *codec = is->video_st->codec;
1966
1807
    AVRational fr = av_guess_frame_rate(is->ic, is->video_st, NULL);
1967
 
 
1968
 
    av_opt_get_int(sws_opts, "sws_flags", 0, &sws_flags);
1969
 
    snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%"PRId64, sws_flags);
 
1808
    AVDictionaryEntry *e = NULL;
 
1809
 
 
1810
    while ((e = av_dict_get(sws_dict, "", e, AV_DICT_IGNORE_SUFFIX))) {
 
1811
        if (!strcmp(e->key, "sws_flags")) {
 
1812
            av_strlcatf(sws_flags_str, sizeof(sws_flags_str), "%s=%s:", "flags", e->value);
 
1813
        } else
 
1814
            av_strlcatf(sws_flags_str, sizeof(sws_flags_str), "%s=%s:", e->key, e->value);
 
1815
    }
 
1816
    if (strlen(sws_flags_str))
 
1817
        sws_flags_str[strlen(sws_flags_str)-1] = '\0';
 
1818
 
1970
1819
    graph->scale_sws_opts = av_strdup(sws_flags_str);
1971
1820
 
1972
1821
    snprintf(buffersrc_args, sizeof(buffersrc_args),
2328
2177
    Frame *sp;
2329
2178
    int got_subtitle;
2330
2179
    double pts;
2331
 
    int i, j;
2332
 
    int r, g, b, y, u, v, a;
 
2180
    int i;
2333
2181
 
2334
2182
    for (;;) {
2335
2183
        if (!(sp = frame_queue_peek_writable(&is->subpq)))
2348
2196
 
2349
2197
            for (i = 0; i < sp->sub.num_rects; i++)
2350
2198
            {
2351
 
                for (j = 0; j < sp->sub.rects[i]->nb_colors; j++)
2352
 
                {
2353
 
                    RGBA_IN(r, g, b, a, (uint32_t*)sp->sub.rects[i]->pict.data[1] + j);
2354
 
                    y = RGB_TO_Y_CCIR(r, g, b);
2355
 
                    u = RGB_TO_U_CCIR(r, g, b, 0);
2356
 
                    v = RGB_TO_V_CCIR(r, g, b, 0);
2357
 
                    YUVA_OUT((uint32_t*)sp->sub.rects[i]->pict.data[1] + j, y, u, v, a);
 
2199
                int in_w = sp->sub.rects[i]->w;
 
2200
                int in_h = sp->sub.rects[i]->h;
 
2201
                int subw = is->subdec.avctx->width  ? is->subdec.avctx->width  : is->viddec_width;
 
2202
                int subh = is->subdec.avctx->height ? is->subdec.avctx->height : is->viddec_height;
 
2203
                int out_w = is->viddec_width  ? in_w * is->viddec_width  / subw : in_w;
 
2204
                int out_h = is->viddec_height ? in_h * is->viddec_height / subh : in_h;
 
2205
                AVPicture newpic;
 
2206
 
 
2207
                //can not use avpicture_alloc as it is not compatible with avsubtitle_free()
 
2208
                av_image_fill_linesizes(newpic.linesize, AV_PIX_FMT_YUVA420P, out_w);
 
2209
                newpic.data[0] = av_malloc(newpic.linesize[0] * out_h);
 
2210
                newpic.data[3] = av_malloc(newpic.linesize[3] * out_h);
 
2211
                newpic.data[1] = av_malloc(newpic.linesize[1] * ((out_h+1)/2));
 
2212
                newpic.data[2] = av_malloc(newpic.linesize[2] * ((out_h+1)/2));
 
2213
 
 
2214
                is->sub_convert_ctx = sws_getCachedContext(is->sub_convert_ctx,
 
2215
                    in_w, in_h, AV_PIX_FMT_PAL8, out_w, out_h,
 
2216
                    AV_PIX_FMT_YUVA420P, sws_flags, NULL, NULL, NULL);
 
2217
                if (!is->sub_convert_ctx || !newpic.data[0] || !newpic.data[3] ||
 
2218
                    !newpic.data[1] || !newpic.data[2]
 
2219
                ) {
 
2220
                    av_log(NULL, AV_LOG_FATAL, "Cannot initialize the sub conversion context\n");
 
2221
                    exit(1);
2358
2222
                }
 
2223
                sws_scale(is->sub_convert_ctx,
 
2224
                          (void*)sp->sub.rects[i]->pict.data, sp->sub.rects[i]->pict.linesize,
 
2225
                          0, in_h, newpic.data, newpic.linesize);
 
2226
 
 
2227
                av_free(sp->sub.rects[i]->pict.data[0]);
 
2228
                av_free(sp->sub.rects[i]->pict.data[1]);
 
2229
                sp->sub.rects[i]->pict = newpic;
 
2230
                sp->sub.rects[i]->w = out_w;
 
2231
                sp->sub.rects[i]->h = out_h;
 
2232
                sp->sub.rects[i]->x = sp->sub.rects[i]->x * out_w / in_w;
 
2233
                sp->sub.rects[i]->y = sp->sub.rects[i]->y * out_h / in_h;
2359
2234
            }
2360
2235
 
2361
2236
            /* now we can update the picture count */
2448
2323
        return -1;
2449
2324
 
2450
2325
    do {
 
2326
#if defined(_WIN32)
 
2327
        while (frame_queue_nb_remaining(&is->sampq) == 0) {
 
2328
            if ((av_gettime_relative() - audio_callback_time) > 1000000LL * is->audio_hw_buf_size / is->audio_tgt.bytes_per_sec / 2)
 
2329
                return -1;
 
2330
            av_usleep (1000);
 
2331
        }
 
2332
#endif
2451
2333
        if (!(af = frame_queue_peek_readable(&is->sampq)))
2452
2334
            return -1;
2453
2335
        frame_queue_next(&is->sampq);
2695
2577
    }
2696
2578
    av_codec_set_lowres(avctx, stream_lowres);
2697
2579
 
 
2580
#if FF_API_EMU_EDGE
2698
2581
    if(stream_lowres) avctx->flags |= CODEC_FLAG_EMU_EDGE;
2699
 
    if (fast)   avctx->flags2 |= CODEC_FLAG2_FAST;
2700
 
    if(codec->capabilities & CODEC_CAP_DR1)
 
2582
#endif
 
2583
    if (fast)
 
2584
        avctx->flags2 |= AV_CODEC_FLAG2_FAST;
 
2585
#if FF_API_EMU_EDGE
 
2586
    if(codec->capabilities & AV_CODEC_CAP_DR1)
2701
2587
        avctx->flags |= CODEC_FLAG_EMU_EDGE;
 
2588
#endif
2702
2589
 
2703
2590
    opts = filter_codec_opts(codec_opts, avctx->codec_id, ic, ic->streams[stream_index], codec);
2704
2591
    if (!av_dict_get(opts, "threads", NULL, 0))
2771
2658
        is->video_stream = stream_index;
2772
2659
        is->video_st = ic->streams[stream_index];
2773
2660
 
 
2661
        is->viddec_width  = avctx->width;
 
2662
        is->viddec_height = avctx->height;
 
2663
 
2774
2664
        decoder_init(&is->viddec, avctx, &is->videoq, is->continue_read_thread);
2775
2665
        decoder_start(&is->viddec, video_thread, is);
2776
2666
        is->queue_attachments_req = 1;