diff options
author | Rob Clark | 2010-08-31 11:54:12 -0500 |
---|---|---|
committer | Nikhil Devshatwar | 2013-05-16 03:52:20 -0500 |
commit | 96301e4ed8422d23a8c4317f638fc7a269c01598 (patch) | |
tree | eda61384f093b8441555ce9f55640fcc34cf9b30 | |
parent | da885673c1a4724a19de67691eb94e3676613f99 (diff) | |
download | gstreamer0-10-ffmpeg-96301e4ed8422d23a8c4317f638fc7a269c01598.tar.gz gstreamer0-10-ffmpeg-96301e4ed8422d23a8c4317f638fc7a269c01598.tar.xz gstreamer0-10-ffmpeg-96301e4ed8422d23a8c4317f638fc7a269c01598.zip |
ffdec: zero copy support for edges
Increase the frame size to add padding, and use a crop event to crop out
the edges in the display. This avoids the need to memcpy for codecs that
don't support CODEC_FLAG_EMU_EDGE. Currently only enabled for ffvp8, but
could be enabled for other codecs which still disable direct rendering
(VP5, VP6*, H264).
-rw-r--r-- | ext/ffmpeg/gstffmpegcodecmap.c | 412 | ||||
-rw-r--r-- | ext/ffmpeg/gstffmpegcodecmap.h | 5 | ||||
-rw-r--r-- | ext/ffmpeg/gstffmpegdec.c | 41 | ||||
-rw-r--r-- | ext/ffmpeg/gstffmpegdeinterlace.c | 4 | ||||
-rw-r--r-- | ext/ffmpeg/gstffmpegdemux.c | 8 | ||||
-rw-r--r-- | ext/ffmpeg/gstffmpegenc.c | 12 | ||||
-rw-r--r-- | ext/ffmpeg/gstffmpegmux.c | 4 | ||||
-rw-r--r-- | ext/ffmpeg/gstffmpegscale.c | 4 | ||||
-rw-r--r-- | ext/ffmpeg/gstffmpegutils.c | 34 | ||||
-rw-r--r-- | ext/ffmpeg/gstffmpegutils.h | 10 |
10 files changed, 353 insertions, 181 deletions
diff --git a/ext/ffmpeg/gstffmpegcodecmap.c b/ext/ffmpeg/gstffmpegcodecmap.c index f3381dd..06313fa 100644 --- a/ext/ffmpeg/gstffmpegcodecmap.c +++ b/ext/ffmpeg/gstffmpegcodecmap.c | |||
@@ -32,6 +32,7 @@ | |||
32 | 32 | ||
33 | #include "gstffmpeg.h" | 33 | #include "gstffmpeg.h" |
34 | #include "gstffmpegcodecmap.h" | 34 | #include "gstffmpegcodecmap.h" |
35 | #include "gstffmpegutils.h" | ||
35 | 36 | ||
36 | #include <gst/pbutils/codec-utils.h> | 37 | #include <gst/pbutils/codec-utils.h> |
37 | 38 | ||
@@ -185,8 +186,8 @@ gst_ff_channel_layout_to_gst (guint64 channel_layout, guint channels) | |||
185 | * but I'm too lazy today. Maybe later. | 186 | * but I'm too lazy today. Maybe later. |
186 | */ | 187 | */ |
187 | static GstCaps * | 188 | static GstCaps * |
188 | gst_ff_vid_caps_new (AVCodecContext * context, enum CodecID codec_id, | 189 | gst_ff_vid_caps_new (AVCodecContext * context, gboolean use_border, |
189 | const char *mimetype, const char *fieldname, ...) | 190 | enum CodecID codec_id, const char *mimetype, const char *fieldname, ...) |
190 | { | 191 | { |
191 | GstStructure *structure = NULL; | 192 | GstStructure *structure = NULL; |
192 | GstCaps *caps = NULL; | 193 | GstCaps *caps = NULL; |
@@ -198,10 +199,22 @@ gst_ff_vid_caps_new (AVCodecContext * context, enum CodecID codec_id, | |||
198 | /* fixed, non probing context */ | 199 | /* fixed, non probing context */ |
199 | if (context != NULL && context->width != -1) { | 200 | if (context != NULL && context->width != -1) { |
200 | gint num, denom; | 201 | gint num, denom; |
202 | gint width, height; | ||
201 | 203 | ||
202 | caps = gst_caps_new_simple (mimetype, | 204 | width = context->width; |
203 | "width", G_TYPE_INT, context->width, | 205 | height = context->height; |
204 | "height", G_TYPE_INT, context->height, NULL); | 206 | |
207 | if (use_border) { | ||
208 | width += 2 * EDGE_WIDTH; | ||
209 | height += 2 * EDGE_WIDTH; | ||
210 | |||
211 | /* this is a bit ugly.. need to find a cleaner way to know any additional | ||
212 | * padding that is required.. but common codecs need picture to be a | ||
213 | * multiple of 16x16 macroblocks... | ||
214 | */ | ||
215 | width = (width + 15) & ~0x0f; | ||
216 | height = (height + 15) & ~0x0f; | ||
217 | } | ||
205 | 218 | ||
206 | num = context->time_base.den / context->ticks_per_frame; | 219 | num = context->time_base.den / context->ticks_per_frame; |
207 | denom = context->time_base.num; | 220 | denom = context->time_base.num; |
@@ -216,7 +229,9 @@ gst_ff_vid_caps_new (AVCodecContext * context, enum CodecID codec_id, | |||
216 | denom = 1; | 229 | denom = 1; |
217 | } | 230 | } |
218 | GST_LOG ("setting framerate: %d/%d", num, denom); | 231 | GST_LOG ("setting framerate: %d/%d", num, denom); |
219 | gst_caps_set_simple (caps, | 232 | caps = gst_caps_new_simple (mimetype, |
233 | "width", G_TYPE_INT, width, | ||
234 | "height", G_TYPE_INT, height, | ||
220 | "framerate", GST_TYPE_FRACTION, num, denom, NULL); | 235 | "framerate", GST_TYPE_FRACTION, num, denom, NULL); |
221 | } else { | 236 | } else { |
222 | /* so we are after restricted caps in this case */ | 237 | /* so we are after restricted caps in this case */ |
@@ -517,7 +532,7 @@ gst_ff_aud_caps_new (AVCodecContext * context, enum CodecID codec_id, | |||
517 | 532 | ||
518 | GstCaps * | 533 | GstCaps * |
519 | gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | 534 | gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, |
520 | AVCodecContext * context, gboolean encode) | 535 | AVCodecContext * context, gboolean use_border, gboolean encode) |
521 | { | 536 | { |
522 | GstCaps *caps = NULL; | 537 | GstCaps *caps = NULL; |
523 | gboolean buildcaps = FALSE; | 538 | gboolean buildcaps = FALSE; |
@@ -527,7 +542,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
527 | switch (codec_id) { | 542 | switch (codec_id) { |
528 | case CODEC_ID_MPEG1VIDEO: | 543 | case CODEC_ID_MPEG1VIDEO: |
529 | /* FIXME: bitrate */ | 544 | /* FIXME: bitrate */ |
530 | caps = gst_ff_vid_caps_new (context, codec_id, "video/mpeg", | 545 | caps = gst_ff_vid_caps_new (context, use_border, codec_id, "video/mpeg", |
531 | "mpegversion", G_TYPE_INT, 1, | 546 | "mpegversion", G_TYPE_INT, 1, |
532 | "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); | 547 | "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); |
533 | break; | 548 | break; |
@@ -535,7 +550,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
535 | case CODEC_ID_MPEG2VIDEO: | 550 | case CODEC_ID_MPEG2VIDEO: |
536 | if (encode) { | 551 | if (encode) { |
537 | /* FIXME: bitrate */ | 552 | /* FIXME: bitrate */ |
538 | caps = gst_ff_vid_caps_new (context, codec_id, "video/mpeg", | 553 | caps = gst_ff_vid_caps_new (context, use_border, codec_id, "video/mpeg", |
539 | "mpegversion", G_TYPE_INT, 2, | 554 | "mpegversion", G_TYPE_INT, 2, |
540 | "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); | 555 | "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); |
541 | } else { | 556 | } else { |
@@ -553,20 +568,22 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
553 | 568 | ||
554 | case CODEC_ID_H263: | 569 | case CODEC_ID_H263: |
555 | if (encode) { | 570 | if (encode) { |
556 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-h263", | 571 | caps = |
557 | "variant", G_TYPE_STRING, "itu", | 572 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-h263", |
558 | "h263version", G_TYPE_STRING, "h263", NULL); | 573 | "variant", G_TYPE_STRING, "itu", "h263version", G_TYPE_STRING, |
574 | "h263", NULL); | ||
559 | } else { | 575 | } else { |
560 | /* don't pass codec_id, we can decode other variants with the H263 | 576 | /* don't pass codec_id, we can decode other variants with the H263 |
561 | * decoder that don't have specific size requirements | 577 | * decoder that don't have specific size requirements |
562 | */ | 578 | */ |
563 | caps = gst_ff_vid_caps_new (context, CODEC_ID_NONE, "video/x-h263", | 579 | caps = |
564 | "variant", G_TYPE_STRING, "itu", NULL); | 580 | gst_ff_vid_caps_new (context, use_border, CODEC_ID_NONE, |
581 | "video/x-h263", "variant", G_TYPE_STRING, "itu", NULL); | ||
565 | } | 582 | } |
566 | break; | 583 | break; |
567 | 584 | ||
568 | case CODEC_ID_H263P: | 585 | case CODEC_ID_H263P: |
569 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-h263", | 586 | caps = gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-h263", |
570 | "variant", G_TYPE_STRING, "itu", | 587 | "variant", G_TYPE_STRING, "itu", |
571 | "h263version", G_TYPE_STRING, "h263p", NULL); | 588 | "h263version", G_TYPE_STRING, "h263p", NULL); |
572 | if (encode && context) { | 589 | if (encode && context) { |
@@ -581,12 +598,15 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
581 | break; | 598 | break; |
582 | 599 | ||
583 | case CODEC_ID_H263I: | 600 | case CODEC_ID_H263I: |
584 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-intel-h263", | 601 | caps = |
585 | "variant", G_TYPE_STRING, "intel", NULL); | 602 | gst_ff_vid_caps_new (context, use_border, codec_id, |
603 | "video/x-intel-h263", "variant", G_TYPE_STRING, "intel", NULL); | ||
586 | break; | 604 | break; |
587 | 605 | ||
588 | case CODEC_ID_H261: | 606 | case CODEC_ID_H261: |
589 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-h261", NULL); | 607 | caps = |
608 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-h261", | ||
609 | NULL); | ||
590 | break; | 610 | break; |
591 | 611 | ||
592 | case CODEC_ID_RV10: | 612 | case CODEC_ID_RV10: |
@@ -612,8 +632,9 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
612 | } | 632 | } |
613 | 633 | ||
614 | /* FIXME: context->sub_id must be filled in during decoding */ | 634 | /* FIXME: context->sub_id must be filled in during decoding */ |
615 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-pn-realvideo", | 635 | caps = |
616 | "systemstream", G_TYPE_BOOLEAN, FALSE, | 636 | gst_ff_vid_caps_new (context, use_border, codec_id, |
637 | "video/x-pn-realvideo", "systemstream", G_TYPE_BOOLEAN, FALSE, | ||
617 | "rmversion", G_TYPE_INT, version, NULL); | 638 | "rmversion", G_TYPE_INT, version, NULL); |
618 | if (context) { | 639 | if (context) { |
619 | gst_caps_set_simple (caps, "format", G_TYPE_INT, context->sub_id, NULL); | 640 | gst_caps_set_simple (caps, "format", G_TYPE_INT, context->sub_id, NULL); |
@@ -721,15 +742,21 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
721 | * MJPEG-B and sp5x decoding...)? */ | 742 | * MJPEG-B and sp5x decoding...)? */ |
722 | case CODEC_ID_MJPEG: | 743 | case CODEC_ID_MJPEG: |
723 | case CODEC_ID_LJPEG: | 744 | case CODEC_ID_LJPEG: |
724 | caps = gst_ff_vid_caps_new (context, codec_id, "image/jpeg", NULL); | 745 | caps = |
746 | gst_ff_vid_caps_new (context, use_border, codec_id, "image/jpeg", | ||
747 | NULL); | ||
725 | break; | 748 | break; |
726 | 749 | ||
727 | case CODEC_ID_SP5X: | 750 | case CODEC_ID_SP5X: |
728 | caps = gst_ff_vid_caps_new (context, codec_id, "video/sp5x", NULL); | 751 | caps = |
752 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/sp5x", | ||
753 | NULL); | ||
729 | break; | 754 | break; |
730 | 755 | ||
731 | case CODEC_ID_MJPEGB: | 756 | case CODEC_ID_MJPEGB: |
732 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-mjpeg-b", NULL); | 757 | caps = |
758 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-mjpeg-b", | ||
759 | NULL); | ||
733 | break; | 760 | break; |
734 | 761 | ||
735 | case CODEC_ID_MPEG4: | 762 | case CODEC_ID_MPEG4: |
@@ -738,41 +765,43 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
738 | * the AVI fourcc 'DIVX', but 'mp4v' for Quicktime... */ | 765 | * the AVI fourcc 'DIVX', but 'mp4v' for Quicktime... */ |
739 | switch (context->codec_tag) { | 766 | switch (context->codec_tag) { |
740 | case GST_MAKE_FOURCC ('D', 'I', 'V', 'X'): | 767 | case GST_MAKE_FOURCC ('D', 'I', 'V', 'X'): |
741 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-divx", | 768 | caps = |
742 | "divxversion", G_TYPE_INT, 5, NULL); | 769 | gst_ff_vid_caps_new (context, use_border, codec_id, |
770 | "video/x-divx", "divxversion", G_TYPE_INT, 5, NULL); | ||
743 | break; | 771 | break; |
744 | case GST_MAKE_FOURCC ('m', 'p', '4', 'v'): | 772 | case GST_MAKE_FOURCC ('m', 'p', '4', 'v'): |
745 | default: | 773 | default: |
746 | /* FIXME: bitrate */ | 774 | /* FIXME: bitrate */ |
747 | caps = gst_ff_vid_caps_new (context, codec_id, "video/mpeg", | 775 | caps = |
748 | "systemstream", G_TYPE_BOOLEAN, FALSE, | 776 | gst_ff_vid_caps_new (context, use_border, codec_id, |
777 | "video/mpeg", "systemstream", G_TYPE_BOOLEAN, FALSE, | ||
749 | "mpegversion", G_TYPE_INT, 4, NULL); | 778 | "mpegversion", G_TYPE_INT, 4, NULL); |
750 | break; | 779 | break; |
751 | } | 780 | } |
752 | } else { | 781 | } else { |
753 | /* The trick here is to separate xvid, divx, mpeg4, 3ivx et al */ | 782 | /* The trick here is to separate xvid, divx, mpeg4, 3ivx et al */ |
754 | caps = gst_ff_vid_caps_new (context, codec_id, "video/mpeg", | 783 | caps = gst_ff_vid_caps_new (context, use_border, codec_id, "video/mpeg", |
755 | "mpegversion", G_TYPE_INT, 4, | 784 | "mpegversion", G_TYPE_INT, 4, |
756 | "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); | 785 | "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); |
757 | if (encode) { | 786 | if (encode) { |
758 | gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, | 787 | gst_caps_append (caps, gst_ff_vid_caps_new (context, use_border, |
759 | "video/x-divx", "divxversion", G_TYPE_INT, 5, NULL)); | 788 | codec_id, "video/x-divx", "divxversion", G_TYPE_INT, 5, |
760 | } else { | ||
761 | gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, | ||
762 | "video/x-divx", "divxversion", GST_TYPE_INT_RANGE, 4, 5, | ||
763 | NULL)); | 789 | NULL)); |
764 | gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, | 790 | } else { |
765 | "video/x-xvid", NULL)); | 791 | gst_caps_append (caps, gst_ff_vid_caps_new (context, use_border, |
766 | gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, | 792 | codec_id, "video/x-divx", "divxversion", GST_TYPE_INT_RANGE, |
767 | "video/x-3ivx", NULL)); | 793 | 4, 5, NULL)); |
794 | gst_caps_append (caps, gst_ff_vid_caps_new (context, use_border, | ||
795 | codec_id, "video/x-xvid", NULL)); | ||
796 | gst_caps_append (caps, gst_ff_vid_caps_new (context, use_border, | ||
797 | codec_id, "video/x-3ivx", NULL)); | ||
768 | } | 798 | } |
769 | } | 799 | } |
770 | break; | 800 | break; |
771 | 801 | ||
772 | case CODEC_ID_RAWVIDEO: | 802 | case CODEC_ID_RAWVIDEO: |
773 | caps = | 803 | caps = gst_ffmpeg_codectype_to_caps (AVMEDIA_TYPE_VIDEO, context, |
774 | gst_ffmpeg_codectype_to_caps (AVMEDIA_TYPE_VIDEO, context, codec_id, | 804 | use_border, codec_id, encode); |
775 | encode); | ||
776 | break; | 805 | break; |
777 | 806 | ||
778 | case CODEC_ID_MSMPEG4V1: | 807 | case CODEC_ID_MSMPEG4V1: |
@@ -782,11 +811,12 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
782 | gint version = 41 + codec_id - CODEC_ID_MSMPEG4V1; | 811 | gint version = 41 + codec_id - CODEC_ID_MSMPEG4V1; |
783 | 812 | ||
784 | /* encode-FIXME: bitrate */ | 813 | /* encode-FIXME: bitrate */ |
785 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-msmpeg", | 814 | caps = |
815 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-msmpeg", | ||
786 | "msmpegversion", G_TYPE_INT, version, NULL); | 816 | "msmpegversion", G_TYPE_INT, version, NULL); |
787 | if (!encode && codec_id == CODEC_ID_MSMPEG4V3) { | 817 | if (!encode && codec_id == CODEC_ID_MSMPEG4V3) { |
788 | gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, | 818 | gst_caps_append (caps, gst_ff_vid_caps_new (context, use_border, |
789 | "video/x-divx", "divxversion", G_TYPE_INT, 3, NULL)); | 819 | codec_id, "video/x-divx", "divxversion", G_TYPE_INT, 3, NULL)); |
790 | } | 820 | } |
791 | } | 821 | } |
792 | break; | 822 | break; |
@@ -796,23 +826,24 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
796 | { | 826 | { |
797 | gint version = (codec_id == CODEC_ID_WMV1) ? 1 : 2; | 827 | gint version = (codec_id == CODEC_ID_WMV1) ? 1 : 2; |
798 | 828 | ||
799 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-wmv", | 829 | caps = gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-wmv", |
800 | "wmvversion", G_TYPE_INT, version, NULL); | 830 | "wmvversion", G_TYPE_INT, version, NULL); |
801 | } | 831 | } |
802 | break; | 832 | break; |
803 | 833 | ||
804 | case CODEC_ID_FLV1: | 834 | case CODEC_ID_FLV1: |
805 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-flash-video", | 835 | caps = |
806 | "flvversion", G_TYPE_INT, 1, NULL); | 836 | gst_ff_vid_caps_new (context, use_border, codec_id, |
837 | "video/x-flash-video", "flvversion", G_TYPE_INT, 1, NULL); | ||
807 | break; | 838 | break; |
808 | 839 | ||
809 | case CODEC_ID_SVQ1: | 840 | case CODEC_ID_SVQ1: |
810 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-svq", | 841 | caps = gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-svq", |
811 | "svqversion", G_TYPE_INT, 1, NULL); | 842 | "svqversion", G_TYPE_INT, 1, NULL); |
812 | break; | 843 | break; |
813 | 844 | ||
814 | case CODEC_ID_SVQ3: | 845 | case CODEC_ID_SVQ3: |
815 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-svq", | 846 | caps = gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-svq", |
816 | "svqversion", G_TYPE_INT, 3, NULL); | 847 | "svqversion", G_TYPE_INT, 3, NULL); |
817 | break; | 848 | break; |
818 | 849 | ||
@@ -851,11 +882,11 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
851 | fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0'); | 882 | fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0'); |
852 | break; | 883 | break; |
853 | } | 884 | } |
854 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-dv", | 885 | caps = gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-dv", |
855 | "systemstream", G_TYPE_BOOLEAN, FALSE, | 886 | "systemstream", G_TYPE_BOOLEAN, FALSE, |
856 | "format", GST_TYPE_FOURCC, fourcc, NULL); | 887 | "format", GST_TYPE_FOURCC, fourcc, NULL); |
857 | } else { | 888 | } else { |
858 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-dv", | 889 | caps = gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-dv", |
859 | "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); | 890 | "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); |
860 | } | 891 | } |
861 | } | 892 | } |
@@ -903,7 +934,9 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
903 | break; | 934 | break; |
904 | 935 | ||
905 | case CODEC_ID_HUFFYUV: | 936 | case CODEC_ID_HUFFYUV: |
906 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-huffyuv", NULL); | 937 | caps = |
938 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-huffyuv", | ||
939 | NULL); | ||
907 | if (context) { | 940 | if (context) { |
908 | gst_caps_set_simple (caps, | 941 | gst_caps_set_simple (caps, |
909 | "bpp", G_TYPE_INT, context->bits_per_coded_sample, NULL); | 942 | "bpp", G_TYPE_INT, context->bits_per_coded_sample, NULL); |
@@ -912,60 +945,80 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
912 | 945 | ||
913 | case CODEC_ID_CYUV: | 946 | case CODEC_ID_CYUV: |
914 | caps = | 947 | caps = |
915 | gst_ff_vid_caps_new (context, codec_id, "video/x-compressed-yuv", | 948 | gst_ff_vid_caps_new (context, use_border, codec_id, |
916 | NULL); | 949 | "video/x-compressed-yuv", NULL); |
917 | break; | 950 | break; |
918 | 951 | ||
919 | case CODEC_ID_H264: | 952 | case CODEC_ID_H264: |
920 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-h264", NULL); | 953 | caps = |
954 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-h264", | ||
955 | NULL); | ||
921 | break; | 956 | break; |
922 | 957 | ||
923 | case CODEC_ID_INDEO5: | 958 | case CODEC_ID_INDEO5: |
924 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-indeo", | 959 | caps = |
960 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-indeo", | ||
925 | "indeoversion", G_TYPE_INT, 5, NULL); | 961 | "indeoversion", G_TYPE_INT, 5, NULL); |
926 | break; | 962 | break; |
927 | 963 | ||
928 | case CODEC_ID_INDEO3: | 964 | case CODEC_ID_INDEO3: |
929 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-indeo", | 965 | caps = |
966 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-indeo", | ||
930 | "indeoversion", G_TYPE_INT, 3, NULL); | 967 | "indeoversion", G_TYPE_INT, 3, NULL); |
931 | break; | 968 | break; |
932 | 969 | ||
933 | case CODEC_ID_INDEO2: | 970 | case CODEC_ID_INDEO2: |
934 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-indeo", | 971 | caps = |
972 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-indeo", | ||
935 | "indeoversion", G_TYPE_INT, 2, NULL); | 973 | "indeoversion", G_TYPE_INT, 2, NULL); |
936 | break; | 974 | break; |
937 | 975 | ||
938 | case CODEC_ID_FLASHSV: | 976 | case CODEC_ID_FLASHSV: |
939 | caps = | 977 | caps = |
940 | gst_ff_vid_caps_new (context, codec_id, "video/x-flash-screen", NULL); | 978 | gst_ff_vid_caps_new (context, use_border, codec_id, |
979 | "video/x-flash-screen", NULL); | ||
941 | break; | 980 | break; |
942 | 981 | ||
943 | case CODEC_ID_VP3: | 982 | case CODEC_ID_VP3: |
944 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp3", NULL); | 983 | caps = |
984 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-vp3", | ||
985 | NULL); | ||
945 | break; | 986 | break; |
946 | 987 | ||
947 | case CODEC_ID_VP5: | 988 | case CODEC_ID_VP5: |
948 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp5", NULL); | 989 | caps = |
990 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-vp5", | ||
991 | NULL); | ||
949 | break; | 992 | break; |
950 | 993 | ||
951 | case CODEC_ID_VP6: | 994 | case CODEC_ID_VP6: |
952 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp6", NULL); | 995 | caps = |
996 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-vp6", | ||
997 | NULL); | ||
953 | break; | 998 | break; |
954 | 999 | ||
955 | case CODEC_ID_VP6F: | 1000 | case CODEC_ID_VP6F: |
956 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp6-flash", NULL); | 1001 | caps = |
1002 | gst_ff_vid_caps_new (context, use_border, codec_id, | ||
1003 | "video/x-vp6-flash", NULL); | ||
957 | break; | 1004 | break; |
958 | 1005 | ||
959 | case CODEC_ID_VP6A: | 1006 | case CODEC_ID_VP6A: |
960 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp6-alpha", NULL); | 1007 | caps = |
1008 | gst_ff_vid_caps_new (context, use_border, codec_id, | ||
1009 | "video/x-vp6-alpha", NULL); | ||
961 | break; | 1010 | break; |
962 | 1011 | ||
963 | case CODEC_ID_VP8: | 1012 | case CODEC_ID_VP8: |
964 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp8", NULL); | 1013 | caps = |
1014 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-vp8", | ||
1015 | NULL); | ||
965 | break; | 1016 | break; |
966 | 1017 | ||
967 | case CODEC_ID_THEORA: | 1018 | case CODEC_ID_THEORA: |
968 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-theora", NULL); | 1019 | caps = |
1020 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-theora", | ||
1021 | NULL); | ||
969 | break; | 1022 | break; |
970 | 1023 | ||
971 | case CODEC_ID_AAC: | 1024 | case CODEC_ID_AAC: |
@@ -1018,37 +1071,41 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
1018 | break; | 1071 | break; |
1019 | 1072 | ||
1020 | case CODEC_ID_ASV1: | 1073 | case CODEC_ID_ASV1: |
1021 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-asus", | 1074 | caps = gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-asus", |
1022 | "asusversion", G_TYPE_INT, 1, NULL); | 1075 | "asusversion", G_TYPE_INT, 1, NULL); |
1023 | break; | 1076 | break; |
1024 | case CODEC_ID_ASV2: | 1077 | case CODEC_ID_ASV2: |
1025 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-asus", | 1078 | caps = gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-asus", |
1026 | "asusversion", G_TYPE_INT, 2, NULL); | 1079 | "asusversion", G_TYPE_INT, 2, NULL); |
1027 | break; | 1080 | break; |
1028 | 1081 | ||
1029 | case CODEC_ID_FFV1: | 1082 | case CODEC_ID_FFV1: |
1030 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-ffv", | 1083 | caps = gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-ffv", |
1031 | "ffvversion", G_TYPE_INT, 1, NULL); | 1084 | "ffvversion", G_TYPE_INT, 1, NULL); |
1032 | break; | 1085 | break; |
1033 | 1086 | ||
1034 | case CODEC_ID_4XM: | 1087 | case CODEC_ID_4XM: |
1035 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-4xm", NULL); | 1088 | caps = |
1089 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-4xm", | ||
1090 | NULL); | ||
1036 | break; | 1091 | break; |
1037 | 1092 | ||
1038 | case CODEC_ID_XAN_WC3: | 1093 | case CODEC_ID_XAN_WC3: |
1039 | case CODEC_ID_XAN_WC4: | 1094 | case CODEC_ID_XAN_WC4: |
1040 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-xan", | 1095 | caps = gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-xan", |
1041 | "wcversion", G_TYPE_INT, 3 - CODEC_ID_XAN_WC3 + codec_id, NULL); | 1096 | "wcversion", G_TYPE_INT, 3 - CODEC_ID_XAN_WC3 + codec_id, NULL); |
1042 | break; | 1097 | break; |
1043 | 1098 | ||
1044 | case CODEC_ID_CLJR: | 1099 | case CODEC_ID_CLJR: |
1045 | caps = | 1100 | caps = |
1046 | gst_ff_vid_caps_new (context, codec_id, | 1101 | gst_ff_vid_caps_new (context, use_border, codec_id, |
1047 | "video/x-cirrus-logic-accupak", NULL); | 1102 | "video/x-cirrus-logic-accupak", NULL); |
1048 | break; | 1103 | break; |
1049 | 1104 | ||
1050 | case CODEC_ID_FRAPS: | 1105 | case CODEC_ID_FRAPS: |
1051 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-fraps", NULL); | 1106 | caps = |
1107 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-fraps", | ||
1108 | NULL); | ||
1052 | break; | 1109 | break; |
1053 | 1110 | ||
1054 | case CODEC_ID_MDEC: | 1111 | case CODEC_ID_MDEC: |
@@ -1058,23 +1115,27 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
1058 | break; | 1115 | break; |
1059 | 1116 | ||
1060 | case CODEC_ID_VCR1: | 1117 | case CODEC_ID_VCR1: |
1061 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-ati-vcr", | 1118 | caps = |
1119 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-ati-vcr", | ||
1062 | "vcrversion", G_TYPE_INT, 1, NULL); | 1120 | "vcrversion", G_TYPE_INT, 1, NULL); |
1063 | break; | 1121 | break; |
1064 | 1122 | ||
1065 | case CODEC_ID_RPZA: | 1123 | case CODEC_ID_RPZA: |
1066 | caps = | 1124 | caps = |
1067 | gst_ff_vid_caps_new (context, codec_id, "video/x-apple-video", NULL); | 1125 | gst_ff_vid_caps_new (context, use_border, codec_id, |
1126 | "video/x-apple-video", NULL); | ||
1068 | break; | 1127 | break; |
1069 | 1128 | ||
1070 | case CODEC_ID_CINEPAK: | 1129 | case CODEC_ID_CINEPAK: |
1071 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-cinepak", NULL); | 1130 | caps = |
1131 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-cinepak", | ||
1132 | NULL); | ||
1072 | break; | 1133 | break; |
1073 | 1134 | ||
1074 | /* WS_VQA belogns here (order) */ | 1135 | /* WS_VQA belogns here (order) */ |
1075 | 1136 | ||
1076 | case CODEC_ID_MSRLE: | 1137 | case CODEC_ID_MSRLE: |
1077 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-rle", | 1138 | caps = gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-rle", |
1078 | "layout", G_TYPE_STRING, "microsoft", NULL); | 1139 | "layout", G_TYPE_STRING, "microsoft", NULL); |
1079 | if (context) { | 1140 | if (context) { |
1080 | gst_caps_set_simple (caps, | 1141 | gst_caps_set_simple (caps, |
@@ -1085,7 +1146,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
1085 | break; | 1146 | break; |
1086 | 1147 | ||
1087 | case CODEC_ID_QTRLE: | 1148 | case CODEC_ID_QTRLE: |
1088 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-rle", | 1149 | caps = gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-rle", |
1089 | "layout", G_TYPE_STRING, "quicktime", NULL); | 1150 | "layout", G_TYPE_STRING, "quicktime", NULL); |
1090 | if (context) { | 1151 | if (context) { |
1091 | gst_caps_set_simple (caps, | 1152 | gst_caps_set_simple (caps, |
@@ -1096,16 +1157,17 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
1096 | break; | 1157 | break; |
1097 | 1158 | ||
1098 | case CODEC_ID_MSVIDEO1: | 1159 | case CODEC_ID_MSVIDEO1: |
1099 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-msvideocodec", | 1160 | caps = |
1100 | "msvideoversion", G_TYPE_INT, 1, NULL); | 1161 | gst_ff_vid_caps_new (context, use_border, codec_id, |
1162 | "video/x-msvideocodec", "msvideoversion", G_TYPE_INT, 1, NULL); | ||
1101 | break; | 1163 | break; |
1102 | 1164 | ||
1103 | case CODEC_ID_WMV3: | 1165 | case CODEC_ID_WMV3: |
1104 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-wmv", | 1166 | caps = gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-wmv", |
1105 | "wmvversion", G_TYPE_INT, 3, NULL); | 1167 | "wmvversion", G_TYPE_INT, 3, NULL); |
1106 | break; | 1168 | break; |
1107 | case CODEC_ID_VC1: | 1169 | case CODEC_ID_VC1: |
1108 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-wmv", | 1170 | caps = gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-wmv", |
1109 | "wmvversion", G_TYPE_INT, 3, "format", GST_TYPE_FOURCC, | 1171 | "wmvversion", G_TYPE_INT, 3, "format", GST_TYPE_FOURCC, |
1110 | GST_MAKE_FOURCC ('W', 'V', 'C', '1'), NULL); | 1172 | GST_MAKE_FOURCC ('W', 'V', 'C', '1'), NULL); |
1111 | break; | 1173 | break; |
@@ -1114,29 +1176,38 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
1114 | break; | 1176 | break; |
1115 | 1177 | ||
1116 | case CODEC_ID_MSZH: | 1178 | case CODEC_ID_MSZH: |
1117 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-mszh", NULL); | 1179 | caps = |
1180 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-mszh", | ||
1181 | NULL); | ||
1118 | break; | 1182 | break; |
1119 | 1183 | ||
1120 | case CODEC_ID_ZLIB: | 1184 | case CODEC_ID_ZLIB: |
1121 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-zlib", NULL); | 1185 | caps = |
1186 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-zlib", | ||
1187 | NULL); | ||
1122 | break; | 1188 | break; |
1123 | 1189 | ||
1124 | case CODEC_ID_TRUEMOTION1: | 1190 | case CODEC_ID_TRUEMOTION1: |
1125 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-truemotion", | 1191 | caps = |
1126 | "trueversion", G_TYPE_INT, 1, NULL); | 1192 | gst_ff_vid_caps_new (context, use_border, codec_id, |
1193 | "video/x-truemotion", "trueversion", G_TYPE_INT, 1, NULL); | ||
1127 | break; | 1194 | break; |
1128 | case CODEC_ID_TRUEMOTION2: | 1195 | case CODEC_ID_TRUEMOTION2: |
1129 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-truemotion", | 1196 | caps = |
1130 | "trueversion", G_TYPE_INT, 2, NULL); | 1197 | gst_ff_vid_caps_new (context, use_border, codec_id, |
1198 | "video/x-truemotion", "trueversion", G_TYPE_INT, 2, NULL); | ||
1131 | break; | 1199 | break; |
1132 | 1200 | ||
1133 | case CODEC_ID_ULTI: | 1201 | case CODEC_ID_ULTI: |
1134 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-ultimotion", | 1202 | caps = |
1135 | NULL); | 1203 | gst_ff_vid_caps_new (context, use_border, codec_id, |
1204 | "video/x-ultimotion", NULL); | ||
1136 | break; | 1205 | break; |
1137 | 1206 | ||
1138 | case CODEC_ID_TSCC: | 1207 | case CODEC_ID_TSCC: |
1139 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-camtasia", NULL); | 1208 | caps = |
1209 | gst_ff_vid_caps_new (context, use_border, codec_id, | ||
1210 | "video/x-camtasia", NULL); | ||
1140 | if (context) { | 1211 | if (context) { |
1141 | gst_caps_set_simple (caps, | 1212 | gst_caps_set_simple (caps, |
1142 | "depth", G_TYPE_INT, (gint) context->bits_per_coded_sample, NULL); | 1213 | "depth", G_TYPE_INT, (gint) context->bits_per_coded_sample, NULL); |
@@ -1146,80 +1217,111 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
1146 | break; | 1217 | break; |
1147 | 1218 | ||
1148 | case CODEC_ID_KMVC: | 1219 | case CODEC_ID_KMVC: |
1149 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-kmvc", NULL); | 1220 | caps = |
1221 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-kmvc", | ||
1222 | NULL); | ||
1150 | break; | 1223 | break; |
1151 | 1224 | ||
1152 | case CODEC_ID_NUV: | 1225 | case CODEC_ID_NUV: |
1153 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-nuv", NULL); | 1226 | caps = |
1227 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-nuv", | ||
1228 | NULL); | ||
1154 | break; | 1229 | break; |
1155 | 1230 | ||
1156 | case CODEC_ID_GIF: | 1231 | case CODEC_ID_GIF: |
1157 | caps = gst_ff_vid_caps_new (context, codec_id, "image/gif", NULL); | 1232 | caps = |
1233 | gst_ff_vid_caps_new (context, use_border, codec_id, "image/gif", | ||
1234 | NULL); | ||
1158 | break; | 1235 | break; |
1159 | 1236 | ||
1160 | case CODEC_ID_PNG: | 1237 | case CODEC_ID_PNG: |
1161 | caps = gst_ff_vid_caps_new (context, codec_id, "image/png", NULL); | 1238 | caps = |
1239 | gst_ff_vid_caps_new (context, use_border, codec_id, "image/png", | ||
1240 | NULL); | ||
1162 | break; | 1241 | break; |
1163 | 1242 | ||
1164 | case CODEC_ID_PPM: | 1243 | case CODEC_ID_PPM: |
1165 | caps = gst_ff_vid_caps_new (context, codec_id, "image/ppm", NULL); | 1244 | caps = |
1245 | gst_ff_vid_caps_new (context, use_border, codec_id, "image/ppm", | ||
1246 | NULL); | ||
1166 | break; | 1247 | break; |
1167 | 1248 | ||
1168 | case CODEC_ID_PBM: | 1249 | case CODEC_ID_PBM: |
1169 | caps = gst_ff_vid_caps_new (context, codec_id, "image/pbm", NULL); | 1250 | caps = |
1251 | gst_ff_vid_caps_new (context, use_border, codec_id, "image/pbm", | ||
1252 | NULL); | ||
1170 | break; | 1253 | break; |
1171 | 1254 | ||
1172 | case CODEC_ID_PAM: | 1255 | case CODEC_ID_PAM: |
1173 | caps = | 1256 | caps = |
1174 | gst_ff_vid_caps_new (context, codec_id, "image/x-portable-anymap", | 1257 | gst_ff_vid_caps_new (context, use_border, codec_id, |
1175 | NULL); | 1258 | "image/x-portable-anymap", NULL); |
1176 | break; | 1259 | break; |
1177 | 1260 | ||
1178 | case CODEC_ID_PGM: | 1261 | case CODEC_ID_PGM: |
1179 | caps = | 1262 | caps = |
1180 | gst_ff_vid_caps_new (context, codec_id, "image/x-portable-graymap", | 1263 | gst_ff_vid_caps_new (context, use_border, codec_id, |
1181 | NULL); | 1264 | "image/x-portable-graymap", NULL); |
1182 | break; | 1265 | break; |
1183 | 1266 | ||
1184 | case CODEC_ID_PCX: | 1267 | case CODEC_ID_PCX: |
1185 | caps = gst_ff_vid_caps_new (context, codec_id, "image/x-pcx", NULL); | 1268 | caps = |
1269 | gst_ff_vid_caps_new (context, use_border, codec_id, "image/x-pcx", | ||
1270 | NULL); | ||
1186 | break; | 1271 | break; |
1187 | 1272 | ||
1188 | case CODEC_ID_SGI: | 1273 | case CODEC_ID_SGI: |
1189 | caps = gst_ff_vid_caps_new (context, codec_id, "image/x-sgi", NULL); | 1274 | caps = |
1275 | gst_ff_vid_caps_new (context, use_border, codec_id, "image/x-sgi", | ||
1276 | NULL); | ||
1190 | break; | 1277 | break; |
1191 | 1278 | ||
1192 | case CODEC_ID_TARGA: | 1279 | case CODEC_ID_TARGA: |
1193 | caps = gst_ff_vid_caps_new (context, codec_id, "image/x-tga", NULL); | 1280 | caps = |
1281 | gst_ff_vid_caps_new (context, use_border, codec_id, "image/x-tga", | ||
1282 | NULL); | ||
1194 | break; | 1283 | break; |
1195 | 1284 | ||
1196 | case CODEC_ID_TIFF: | 1285 | case CODEC_ID_TIFF: |
1197 | caps = gst_ff_vid_caps_new (context, codec_id, "image/tiff", NULL); | 1286 | caps = |
1287 | gst_ff_vid_caps_new (context, use_border, codec_id, "image/tiff", | ||
1288 | NULL); | ||
1198 | break; | 1289 | break; |
1199 | 1290 | ||
1200 | case CODEC_ID_SUNRAST: | 1291 | case CODEC_ID_SUNRAST: |
1201 | caps = | 1292 | caps = |
1202 | gst_ff_vid_caps_new (context, codec_id, "image/x-sun-raster", NULL); | 1293 | gst_ff_vid_caps_new (context, use_border, codec_id, |
1294 | "image/x-sun-raster", NULL); | ||
1203 | break; | 1295 | break; |
1204 | 1296 | ||
1205 | case CODEC_ID_SMC: | 1297 | case CODEC_ID_SMC: |
1206 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-smc", NULL); | 1298 | caps = |
1299 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-smc", | ||
1300 | NULL); | ||
1207 | break; | 1301 | break; |
1208 | 1302 | ||
1209 | case CODEC_ID_QDRAW: | 1303 | case CODEC_ID_QDRAW: |
1210 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-qdrw", NULL); | 1304 | caps = |
1305 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-qdrw", | ||
1306 | NULL); | ||
1211 | break; | 1307 | break; |
1212 | 1308 | ||
1213 | case CODEC_ID_DNXHD: | 1309 | case CODEC_ID_DNXHD: |
1214 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-dnxhd", NULL); | 1310 | caps = |
1311 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-dnxhd", | ||
1312 | NULL); | ||
1215 | break; | 1313 | break; |
1216 | 1314 | ||
1217 | case CODEC_ID_MIMIC: | 1315 | case CODEC_ID_MIMIC: |
1218 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-mimic", NULL); | 1316 | caps = |
1317 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-mimic", | ||
1318 | NULL); | ||
1219 | break; | 1319 | break; |
1220 | 1320 | ||
1221 | case CODEC_ID_VMNC: | 1321 | case CODEC_ID_VMNC: |
1222 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vmnc", NULL); | 1322 | caps = |
1323 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-vmnc", | ||
1324 | NULL); | ||
1223 | break; | 1325 | break; |
1224 | 1326 | ||
1225 | case CODEC_ID_TRUESPEECH: | 1327 | case CODEC_ID_TRUESPEECH: |
@@ -1232,27 +1334,39 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
1232 | break; | 1334 | break; |
1233 | 1335 | ||
1234 | case CODEC_ID_AMV: | 1336 | case CODEC_ID_AMV: |
1235 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-amv", NULL); | 1337 | caps = |
1338 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-amv", | ||
1339 | NULL); | ||
1236 | break; | 1340 | break; |
1237 | 1341 | ||
1238 | case CODEC_ID_AASC: | 1342 | case CODEC_ID_AASC: |
1239 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-aasc", NULL); | 1343 | caps = |
1344 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-aasc", | ||
1345 | NULL); | ||
1240 | break; | 1346 | break; |
1241 | 1347 | ||
1242 | case CODEC_ID_LOCO: | 1348 | case CODEC_ID_LOCO: |
1243 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-loco", NULL); | 1349 | caps = |
1350 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-loco", | ||
1351 | NULL); | ||
1244 | break; | 1352 | break; |
1245 | 1353 | ||
1246 | case CODEC_ID_ZMBV: | 1354 | case CODEC_ID_ZMBV: |
1247 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-zmbv", NULL); | 1355 | caps = |
1356 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-zmbv", | ||
1357 | NULL); | ||
1248 | break; | 1358 | break; |
1249 | 1359 | ||
1250 | case CODEC_ID_LAGARITH: | 1360 | case CODEC_ID_LAGARITH: |
1251 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-lagarith", NULL); | 1361 | caps = |
1362 | gst_ff_vid_caps_new (context, use_border, codec_id, | ||
1363 | "video/x-lagarith", NULL); | ||
1252 | break; | 1364 | break; |
1253 | 1365 | ||
1254 | case CODEC_ID_CSCD: | 1366 | case CODEC_ID_CSCD: |
1255 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-camstudio", NULL); | 1367 | caps = |
1368 | gst_ff_vid_caps_new (context, use_border, codec_id, | ||
1369 | "video/x-camstudio", NULL); | ||
1256 | if (context) { | 1370 | if (context) { |
1257 | gst_caps_set_simple (caps, | 1371 | gst_caps_set_simple (caps, |
1258 | "depth", G_TYPE_INT, (gint) context->bits_per_coded_sample, NULL); | 1372 | "depth", G_TYPE_INT, (gint) context->bits_per_coded_sample, NULL); |
@@ -1659,7 +1773,8 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
1659 | switch (codec->type) { | 1773 | switch (codec->type) { |
1660 | case AVMEDIA_TYPE_VIDEO: | 1774 | case AVMEDIA_TYPE_VIDEO: |
1661 | mime = g_strdup_printf ("video/x-gst_ff-%s", codec->name); | 1775 | mime = g_strdup_printf ("video/x-gst_ff-%s", codec->name); |
1662 | caps = gst_ff_vid_caps_new (context, codec_id, mime, NULL); | 1776 | caps = |
1777 | gst_ff_vid_caps_new (context, use_border, codec_id, mime, NULL); | ||
1663 | g_free (mime); | 1778 | g_free (mime); |
1664 | break; | 1779 | break; |
1665 | case AVMEDIA_TYPE_AUDIO: | 1780 | case AVMEDIA_TYPE_AUDIO: |
@@ -1712,7 +1827,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
1712 | 1827 | ||
1713 | GstCaps * | 1828 | GstCaps * |
1714 | gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context, | 1829 | gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context, |
1715 | enum CodecID codec_id) | 1830 | gboolean use_border, enum CodecID codec_id) |
1716 | { | 1831 | { |
1717 | GstCaps *caps = NULL; | 1832 | GstCaps *caps = NULL; |
1718 | 1833 | ||
@@ -1796,8 +1911,10 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context, | |||
1796 | break; | 1911 | break; |
1797 | case PIX_FMT_GRAY8: | 1912 | case PIX_FMT_GRAY8: |
1798 | bpp = depth = 8; | 1913 | bpp = depth = 8; |
1799 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-gray", | 1914 | caps = |
1800 | "bpp", G_TYPE_INT, bpp, "depth", G_TYPE_INT, depth, NULL); | 1915 | gst_ff_vid_caps_new (context, use_border, codec_id, |
1916 | "video/x-raw-gray", "bpp", G_TYPE_INT, bpp, "depth", G_TYPE_INT, | ||
1917 | depth, NULL); | ||
1801 | break; | 1918 | break; |
1802 | default: | 1919 | default: |
1803 | /* give up ... */ | 1920 | /* give up ... */ |
@@ -1808,34 +1925,32 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context, | |||
1808 | if (bpp != 0) { | 1925 | if (bpp != 0) { |
1809 | if (r_mask != 0) { | 1926 | if (r_mask != 0) { |
1810 | if (a_mask) { | 1927 | if (a_mask) { |
1811 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-rgb", | 1928 | caps = |
1812 | "bpp", G_TYPE_INT, bpp, | 1929 | gst_ff_vid_caps_new (context, use_border, codec_id, |
1813 | "depth", G_TYPE_INT, depth, | 1930 | "video/x-raw-rgb", "bpp", G_TYPE_INT, bpp, "depth", G_TYPE_INT, |
1814 | "red_mask", G_TYPE_INT, r_mask, | 1931 | depth, "red_mask", G_TYPE_INT, r_mask, "green_mask", G_TYPE_INT, |
1815 | "green_mask", G_TYPE_INT, g_mask, | 1932 | g_mask, "blue_mask", G_TYPE_INT, b_mask, "alpha_mask", G_TYPE_INT, |
1816 | "blue_mask", G_TYPE_INT, b_mask, | 1933 | a_mask, "endianness", G_TYPE_INT, endianness, NULL); |
1817 | "alpha_mask", G_TYPE_INT, a_mask, | ||
1818 | "endianness", G_TYPE_INT, endianness, NULL); | ||
1819 | } else { | 1934 | } else { |
1820 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-rgb", | 1935 | caps = |
1821 | "bpp", G_TYPE_INT, bpp, | 1936 | gst_ff_vid_caps_new (context, use_border, codec_id, |
1822 | "depth", G_TYPE_INT, depth, | 1937 | "video/x-raw-rgb", "bpp", G_TYPE_INT, bpp, "depth", G_TYPE_INT, |
1823 | "red_mask", G_TYPE_INT, r_mask, | 1938 | depth, "red_mask", G_TYPE_INT, r_mask, "green_mask", G_TYPE_INT, |
1824 | "green_mask", G_TYPE_INT, g_mask, | 1939 | g_mask, "blue_mask", G_TYPE_INT, b_mask, "endianness", G_TYPE_INT, |
1825 | "blue_mask", G_TYPE_INT, b_mask, | 1940 | endianness, NULL); |
1826 | "endianness", G_TYPE_INT, endianness, NULL); | ||
1827 | } | 1941 | } |
1828 | } else { | 1942 | } else { |
1829 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-rgb", | 1943 | caps = |
1830 | "bpp", G_TYPE_INT, bpp, | 1944 | gst_ff_vid_caps_new (context, use_border, codec_id, |
1831 | "depth", G_TYPE_INT, depth, | 1945 | "video/x-raw-rgb", "bpp", G_TYPE_INT, bpp, "depth", G_TYPE_INT, |
1832 | "endianness", G_TYPE_INT, endianness, NULL); | 1946 | depth, "endianness", G_TYPE_INT, endianness, NULL); |
1833 | if (caps && context) { | 1947 | if (caps && context) { |
1834 | gst_ffmpeg_set_palette (caps, context); | 1948 | gst_ffmpeg_set_palette (caps, context); |
1835 | } | 1949 | } |
1836 | } | 1950 | } |
1837 | } else if (fmt) { | 1951 | } else if (fmt) { |
1838 | caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-yuv", | 1952 | caps = |
1953 | gst_ff_vid_caps_new (context, use_border, codec_id, "video/x-raw-yuv", | ||
1839 | "format", GST_TYPE_FOURCC, fmt, NULL); | 1954 | "format", GST_TYPE_FOURCC, fmt, NULL); |
1840 | } | 1955 | } |
1841 | } | 1956 | } |
@@ -1958,7 +2073,8 @@ gst_ffmpeg_codectype_to_audio_caps (AVCodecContext * context, | |||
1958 | 2073 | ||
1959 | GstCaps * | 2074 | GstCaps * |
1960 | gst_ffmpeg_codectype_to_video_caps (AVCodecContext * context, | 2075 | gst_ffmpeg_codectype_to_video_caps (AVCodecContext * context, |
1961 | enum CodecID codec_id, gboolean encode, AVCodec * codec) | 2076 | gboolean use_border, enum CodecID codec_id, gboolean encode, |
2077 | AVCodec * codec) | ||
1962 | { | 2078 | { |
1963 | GstCaps *caps; | 2079 | GstCaps *caps; |
1964 | 2080 | ||
@@ -1966,7 +2082,9 @@ gst_ffmpeg_codectype_to_video_caps (AVCodecContext * context, | |||
1966 | context, codec_id, encode, codec); | 2082 | context, codec_id, encode, codec); |
1967 | 2083 | ||
1968 | if (context) { | 2084 | if (context) { |
1969 | caps = gst_ffmpeg_pixfmt_to_caps (context->pix_fmt, context, codec_id); | 2085 | caps = |
2086 | gst_ffmpeg_pixfmt_to_caps (context->pix_fmt, context, use_border, | ||
2087 | codec_id); | ||
1970 | } else { | 2088 | } else { |
1971 | GstCaps *temp; | 2089 | GstCaps *temp; |
1972 | enum PixelFormat i; | 2090 | enum PixelFormat i; |
@@ -1976,7 +2094,9 @@ gst_ffmpeg_codectype_to_video_caps (AVCodecContext * context, | |||
1976 | for (i = 0; i < PIX_FMT_NB; i++) { | 2094 | for (i = 0; i < PIX_FMT_NB; i++) { |
1977 | ctx.width = -1; | 2095 | ctx.width = -1; |
1978 | ctx.pix_fmt = i; | 2096 | ctx.pix_fmt = i; |
1979 | temp = gst_ffmpeg_pixfmt_to_caps (i, encode ? &ctx : NULL, codec_id); | 2097 | temp = |
2098 | gst_ffmpeg_pixfmt_to_caps (i, encode ? &ctx : NULL, use_border, | ||
2099 | codec_id); | ||
1980 | if (temp != NULL) { | 2100 | if (temp != NULL) { |
1981 | gst_caps_append (caps, temp); | 2101 | gst_caps_append (caps, temp); |
1982 | } | 2102 | } |
@@ -1994,14 +2114,16 @@ gst_ffmpeg_codectype_to_video_caps (AVCodecContext * context, | |||
1994 | 2114 | ||
1995 | GstCaps * | 2115 | GstCaps * |
1996 | gst_ffmpeg_codectype_to_caps (enum AVMediaType codec_type, | 2116 | gst_ffmpeg_codectype_to_caps (enum AVMediaType codec_type, |
1997 | AVCodecContext * context, enum CodecID codec_id, gboolean encode) | 2117 | AVCodecContext * context, gboolean use_border, enum CodecID codec_id, |
2118 | gboolean encode) | ||
1998 | { | 2119 | { |
1999 | GstCaps *caps; | 2120 | GstCaps *caps; |
2000 | 2121 | ||
2001 | switch (codec_type) { | 2122 | switch (codec_type) { |
2002 | case AVMEDIA_TYPE_VIDEO: | 2123 | case AVMEDIA_TYPE_VIDEO: |
2003 | caps = | 2124 | caps = |
2004 | gst_ffmpeg_codectype_to_video_caps (context, codec_id, encode, NULL); | 2125 | gst_ffmpeg_codectype_to_video_caps (context, use_border, |
2126 | codec_id, encode, NULL); | ||
2005 | break; | 2127 | break; |
2006 | case AVMEDIA_TYPE_AUDIO: | 2128 | case AVMEDIA_TYPE_AUDIO: |
2007 | caps = | 2129 | caps = |
diff --git a/ext/ffmpeg/gstffmpegcodecmap.h b/ext/ffmpeg/gstffmpegcodecmap.h index d3d6170..311a9e9 100644 --- a/ext/ffmpeg/gstffmpegcodecmap.h +++ b/ext/ffmpeg/gstffmpegcodecmap.h | |||
@@ -37,6 +37,7 @@ | |||
37 | GstCaps * | 37 | GstCaps * |
38 | gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | 38 | gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, |
39 | AVCodecContext *context, | 39 | AVCodecContext *context, |
40 | gboolean use_border, | ||
40 | gboolean encode); | 41 | gboolean encode); |
41 | 42 | ||
42 | /* | 43 | /* |
@@ -47,6 +48,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, | |||
47 | GstCaps * | 48 | GstCaps * |
48 | gst_ffmpeg_codectype_to_caps (enum AVMediaType codec_type, | 49 | gst_ffmpeg_codectype_to_caps (enum AVMediaType codec_type, |
49 | AVCodecContext *context, | 50 | AVCodecContext *context, |
51 | gboolean use_border, | ||
50 | enum CodecID codec_id, | 52 | enum CodecID codec_id, |
51 | gboolean encode); | 53 | gboolean encode); |
52 | GstCaps * | 54 | GstCaps * |
@@ -56,6 +58,7 @@ gst_ffmpeg_codectype_to_audio_caps (AVCodecContext *context, | |||
56 | AVCodec *codec); | 58 | AVCodec *codec); |
57 | GstCaps * | 59 | GstCaps * |
58 | gst_ffmpeg_codectype_to_video_caps (AVCodecContext *context, | 60 | gst_ffmpeg_codectype_to_video_caps (AVCodecContext *context, |
61 | gboolean use_border, | ||
59 | enum CodecID codec_id, | 62 | enum CodecID codec_id, |
60 | gboolean encode, | 63 | gboolean encode, |
61 | AVCodec *codec); | 64 | AVCodec *codec); |
@@ -109,7 +112,7 @@ gst_ffmpeg_formatid_to_caps (const gchar *format_name); | |||
109 | */ | 112 | */ |
110 | 113 | ||
111 | GstCaps * | 114 | GstCaps * |
112 | gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context, enum CodecID codec_id); | 115 | gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context, gboolean use_border, enum CodecID codec_id); |
113 | 116 | ||
114 | /* | 117 | /* |
115 | * _formatid_get_codecids () can be used to get the codecIDs | 118 | * _formatid_get_codecids () can be used to get the codecIDs |
diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index cc07889..0fbc5ca 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c | |||
@@ -113,6 +113,7 @@ struct _GstFFMpegDec | |||
113 | GValue *par; /* pixel aspect ratio of incoming data */ | 113 | GValue *par; /* pixel aspect ratio of incoming data */ |
114 | gboolean current_dr; /* if direct rendering is enabled */ | 114 | gboolean current_dr; /* if direct rendering is enabled */ |
115 | gboolean extra_ref; /* keep extra ref around in get/release */ | 115 | gboolean extra_ref; /* keep extra ref around in get/release */ |
116 | gboolean use_border; /* codec requires padded buffers */ | ||
116 | 117 | ||
117 | /* some properties */ | 118 | /* some properties */ |
118 | enum AVDiscard skip_frame; | 119 | enum AVDiscard skip_frame; |
@@ -320,7 +321,7 @@ gst_ffmpegdec_base_init (GstFFMpegDecClass * klass) | |||
320 | g_free (description); | 321 | g_free (description); |
321 | 322 | ||
322 | /* get the caps */ | 323 | /* get the caps */ |
323 | sinkcaps = gst_ffmpeg_codecid_to_caps (in_plugin->id, NULL, FALSE); | 324 | sinkcaps = gst_ffmpeg_codecid_to_caps (in_plugin->id, NULL, FALSE, FALSE); |
324 | if (!sinkcaps) { | 325 | if (!sinkcaps) { |
325 | GST_DEBUG ("Couldn't get sink caps for decoder '%s'", in_plugin->name); | 326 | GST_DEBUG ("Couldn't get sink caps for decoder '%s'", in_plugin->name); |
326 | sinkcaps = gst_caps_from_string ("unknown/unknown"); | 327 | sinkcaps = gst_caps_from_string ("unknown/unknown"); |
@@ -832,6 +833,10 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps) | |||
832 | /* does not work, uses a incompatible stride. See #610613 */ | 833 | /* does not work, uses a incompatible stride. See #610613 */ |
833 | ffmpegdec->current_dr = FALSE; | 834 | ffmpegdec->current_dr = FALSE; |
834 | ffmpegdec->extra_ref = TRUE; | 835 | ffmpegdec->extra_ref = TRUE; |
836 | } else if (oclass->in_plugin->id == CODEC_ID_VP8) { | ||
837 | /* note: following is probably true of h264 and other vpN codecs: */ | ||
838 | ffmpegdec->current_dr = TRUE; | ||
839 | ffmpegdec->use_border = TRUE; | ||
835 | } else { | 840 | } else { |
836 | GST_DEBUG_OBJECT (ffmpegdec, "enabled direct rendering"); | 841 | GST_DEBUG_OBJECT (ffmpegdec, "enabled direct rendering"); |
837 | ffmpegdec->current_dr = TRUE; | 842 | ffmpegdec->current_dr = TRUE; |
@@ -840,9 +845,7 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps) | |||
840 | GST_DEBUG_OBJECT (ffmpegdec, "direct rendering not supported"); | 845 | GST_DEBUG_OBJECT (ffmpegdec, "direct rendering not supported"); |
841 | } | 846 | } |
842 | } | 847 | } |
843 | if (ffmpegdec->current_dr) { | 848 | if (ffmpegdec->current_dr && !ffmpegdec->use_border) { |
844 | /* do *not* draw edges when in direct rendering, for some reason it draws | ||
845 | * outside of the memory. */ | ||
846 | ffmpegdec->context->flags |= CODEC_FLAG_EMU_EDGE; | 849 | ffmpegdec->context->flags |= CODEC_FLAG_EMU_EDGE; |
847 | } | 850 | } |
848 | 851 | ||
@@ -942,10 +945,10 @@ alloc_output_buffer (GstFFMpegDec * ffmpegdec, GstBuffer ** outbuf, | |||
942 | /* get the size of the gstreamer output buffer given a | 945 | /* get the size of the gstreamer output buffer given a |
943 | * width/height/format */ | 946 | * width/height/format */ |
944 | fsize = gst_ffmpeg_avpicture_get_size (ffmpegdec->context->pix_fmt, | 947 | fsize = gst_ffmpeg_avpicture_get_size (ffmpegdec->context->pix_fmt, |
945 | width, height); | 948 | width, height, ffmpegdec->use_border); |
946 | 949 | ||
947 | if (!ffmpegdec->context->palctrl && ffmpegdec->can_allocate_aligned) { | 950 | if (!ffmpegdec->context->palctrl && ffmpegdec->can_allocate_aligned) { |
948 | GST_LOG_OBJECT (ffmpegdec, "calling pad_alloc"); | 951 | GST_LOG_OBJECT (ffmpegdec, "calling pad_alloc: fsize=%d", fsize); |
949 | /* no pallete, we can use the buffer size to alloc */ | 952 | /* no pallete, we can use the buffer size to alloc */ |
950 | ret = gst_pad_alloc_buffer_and_set_caps (ffmpegdec->srcpad, | 953 | ret = gst_pad_alloc_buffer_and_set_caps (ffmpegdec->srcpad, |
951 | GST_BUFFER_OFFSET_NONE, fsize, | 954 | GST_BUFFER_OFFSET_NONE, fsize, |
@@ -1054,9 +1057,12 @@ gst_ffmpegdec_get_buffer (AVCodecContext * context, AVFrame * picture) | |||
1054 | width, height, clip_width, clip_height); | 1057 | width, height, clip_width, clip_height); |
1055 | 1058 | ||
1056 | if (width != clip_width || height != clip_height) { | 1059 | if (width != clip_width || height != clip_height) { |
1057 | /* We can't alloc if we need to clip the output buffer later */ | 1060 | /* we can clip.. although we should somehow keep track of the |
1058 | GST_LOG_OBJECT (ffmpegdec, "we need clipping, fallback alloc"); | 1061 | * clipped size so we can send the correct vstab event to the |
1059 | return avcodec_default_get_buffer (context, picture); | 1062 | * video sink.. |
1063 | */ | ||
1064 | width = clip_width; | ||
1065 | height = clip_height; | ||
1060 | } | 1066 | } |
1061 | 1067 | ||
1062 | /* alloc with aligned dimensions for ffmpeg */ | 1068 | /* alloc with aligned dimensions for ffmpeg */ |
@@ -1068,8 +1074,8 @@ gst_ffmpegdec_get_buffer (AVCodecContext * context, AVFrame * picture) | |||
1068 | } | 1074 | } |
1069 | 1075 | ||
1070 | /* copy the right pointers and strides in the picture object */ | 1076 | /* copy the right pointers and strides in the picture object */ |
1071 | gst_ffmpeg_avpicture_fill ((AVPicture *) picture, | 1077 | gst_ffmpeg_avpicture_fill ((AVPicture *) picture, GST_BUFFER_DATA (buf), |
1072 | GST_BUFFER_DATA (buf), context->pix_fmt, width, height); | 1078 | context->pix_fmt, width, height, ffmpegdec->use_border); |
1073 | break; | 1079 | break; |
1074 | } | 1080 | } |
1075 | case AVMEDIA_TYPE_AUDIO: | 1081 | case AVMEDIA_TYPE_AUDIO: |
@@ -1275,7 +1281,13 @@ gst_ffmpegdec_negotiate (GstFFMpegDec * ffmpegdec, gboolean force) | |||
1275 | } | 1281 | } |
1276 | 1282 | ||
1277 | caps = gst_ffmpeg_codectype_to_caps (oclass->in_plugin->type, | 1283 | caps = gst_ffmpeg_codectype_to_caps (oclass->in_plugin->type, |
1278 | ffmpegdec->context, oclass->in_plugin->id, FALSE); | 1284 | ffmpegdec->context, ffmpegdec->use_border, oclass->in_plugin->id, FALSE); |
1285 | |||
1286 | if (ffmpegdec->use_border) { | ||
1287 | gst_pad_push_event (ffmpegdec->srcpad, | ||
1288 | gst_event_new_crop (EDGE_WIDTH, EDGE_WIDTH, | ||
1289 | ffmpegdec->context->width, ffmpegdec->context->height)); | ||
1290 | } | ||
1279 | 1291 | ||
1280 | if (caps == NULL) | 1292 | if (caps == NULL) |
1281 | goto no_caps; | 1293 | goto no_caps; |
@@ -1610,16 +1622,17 @@ get_output_buffer (GstFFMpegDec * ffmpegdec, GstBuffer ** outbuf) | |||
1610 | /* original ffmpeg code does not handle odd sizes correctly. | 1622 | /* original ffmpeg code does not handle odd sizes correctly. |
1611 | * This patched up version does */ | 1623 | * This patched up version does */ |
1612 | gst_ffmpeg_avpicture_fill (&pic, GST_BUFFER_DATA (*outbuf), | 1624 | gst_ffmpeg_avpicture_fill (&pic, GST_BUFFER_DATA (*outbuf), |
1613 | ffmpegdec->context->pix_fmt, width, height); | 1625 | ffmpegdec->context->pix_fmt, width, height, ffmpegdec->use_border); |
1614 | 1626 | ||
1615 | outpic = (AVPicture *) ffmpegdec->picture; | 1627 | outpic = (AVPicture *) ffmpegdec->picture; |
1616 | 1628 | ||
1617 | GST_LOG_OBJECT (ffmpegdec, "linsize %d %d %d", outpic->linesize[0], | 1629 | GST_LOG_OBJECT (ffmpegdec, "linesize %d %d %d", outpic->linesize[0], |
1618 | outpic->linesize[1], outpic->linesize[2]); | 1630 | outpic->linesize[1], outpic->linesize[2]); |
1619 | GST_LOG_OBJECT (ffmpegdec, "data %u %u %u", 0, | 1631 | GST_LOG_OBJECT (ffmpegdec, "data %u %u %u", 0, |
1620 | (guint) (outpic->data[1] - outpic->data[0]), | 1632 | (guint) (outpic->data[1] - outpic->data[0]), |
1621 | (guint) (outpic->data[2] - outpic->data[0])); | 1633 | (guint) (outpic->data[2] - outpic->data[0])); |
1622 | 1634 | ||
1635 | // XXX is this ok with original width/height? double check this | ||
1623 | av_picture_copy (&pic, outpic, ffmpegdec->context->pix_fmt, width, height); | 1636 | av_picture_copy (&pic, outpic, ffmpegdec->context->pix_fmt, width, height); |
1624 | } | 1637 | } |
1625 | ffmpegdec->picture->reordered_opaque = -1; | 1638 | ffmpegdec->picture->reordered_opaque = -1; |
diff --git a/ext/ffmpeg/gstffmpegdeinterlace.c b/ext/ffmpeg/gstffmpegdeinterlace.c index de95314..e64378f 100644 --- a/ext/ffmpeg/gstffmpegdeinterlace.c +++ b/ext/ffmpeg/gstffmpegdeinterlace.c | |||
@@ -290,10 +290,10 @@ gst_ffmpegdeinterlace_chain (GstPad * pad, GstBuffer * inbuf) | |||
290 | if (result == GST_FLOW_OK) { | 290 | if (result == GST_FLOW_OK) { |
291 | gst_ffmpeg_avpicture_fill (&deinterlace->from_frame, | 291 | gst_ffmpeg_avpicture_fill (&deinterlace->from_frame, |
292 | GST_BUFFER_DATA (inbuf), deinterlace->pixfmt, deinterlace->width, | 292 | GST_BUFFER_DATA (inbuf), deinterlace->pixfmt, deinterlace->width, |
293 | deinterlace->height); | 293 | deinterlace->height, FALSE); |
294 | 294 | ||
295 | gst_ffmpeg_avpicture_fill (&deinterlace->to_frame, GST_BUFFER_DATA (outbuf), | 295 | gst_ffmpeg_avpicture_fill (&deinterlace->to_frame, GST_BUFFER_DATA (outbuf), |
296 | deinterlace->pixfmt, deinterlace->width, deinterlace->height); | 296 | deinterlace->pixfmt, deinterlace->width, deinterlace->height, FALSE); |
297 | 297 | ||
298 | avpicture_deinterlace (&deinterlace->to_frame, &deinterlace->from_frame, | 298 | avpicture_deinterlace (&deinterlace->to_frame, &deinterlace->from_frame, |
299 | deinterlace->pixfmt, deinterlace->width, deinterlace->height); | 299 | deinterlace->pixfmt, deinterlace->width, deinterlace->height); |
diff --git a/ext/ffmpeg/gstffmpegdemux.c b/ext/ffmpeg/gstffmpegdemux.c index 3eb5328..18f7ec7 100644 --- a/ext/ffmpeg/gstffmpegdemux.c +++ b/ext/ffmpeg/gstffmpegdemux.c | |||
@@ -992,7 +992,7 @@ gst_ffmpegdemux_get_stream (GstFFMpegDemux * demux, AVStream * avstream) | |||
992 | } | 992 | } |
993 | 993 | ||
994 | /* get caps that belongs to this stream */ | 994 | /* get caps that belongs to this stream */ |
995 | caps = gst_ffmpeg_codecid_to_caps (ctx->codec_id, ctx, TRUE); | 995 | caps = gst_ffmpeg_codecid_to_caps (ctx->codec_id, ctx, FALSE, TRUE); |
996 | if (caps == NULL) | 996 | if (caps == NULL) |
997 | goto unknown_caps; | 997 | goto unknown_caps; |
998 | 998 | ||
@@ -1411,7 +1411,7 @@ gst_ffmpegdemux_loop (GstFFMpegDemux * demux) | |||
1411 | 1411 | ||
1412 | if (rawvideo) | 1412 | if (rawvideo) |
1413 | outsize = gst_ffmpeg_avpicture_get_size (avstream->codec->pix_fmt, | 1413 | outsize = gst_ffmpeg_avpicture_get_size (avstream->codec->pix_fmt, |
1414 | avstream->codec->width, avstream->codec->height); | 1414 | avstream->codec->width, avstream->codec->height, FALSE); |
1415 | else | 1415 | else |
1416 | outsize = pkt.size; | 1416 | outsize = pkt.size; |
1417 | 1417 | ||
@@ -1441,12 +1441,12 @@ gst_ffmpegdemux_loop (GstFFMpegDemux * demux) | |||
1441 | GST_WARNING ("Unknown demuxer %s, no idea what to do", plugin_name); | 1441 | GST_WARNING ("Unknown demuxer %s, no idea what to do", plugin_name); |
1442 | gst_ffmpeg_avpicture_fill (&src, pkt.data, | 1442 | gst_ffmpeg_avpicture_fill (&src, pkt.data, |
1443 | avstream->codec->pix_fmt, avstream->codec->width, | 1443 | avstream->codec->pix_fmt, avstream->codec->width, |
1444 | avstream->codec->height); | 1444 | avstream->codec->height, FALSE); |
1445 | } | 1445 | } |
1446 | 1446 | ||
1447 | gst_ffmpeg_avpicture_fill (&dst, GST_BUFFER_DATA (outbuf), | 1447 | gst_ffmpeg_avpicture_fill (&dst, GST_BUFFER_DATA (outbuf), |
1448 | avstream->codec->pix_fmt, avstream->codec->width, | 1448 | avstream->codec->pix_fmt, avstream->codec->width, |
1449 | avstream->codec->height); | 1449 | avstream->codec->height, FALSE); |
1450 | 1450 | ||
1451 | av_picture_copy (&dst, &src, avstream->codec->pix_fmt, | 1451 | av_picture_copy (&dst, &src, avstream->codec->pix_fmt, |
1452 | avstream->codec->width, avstream->codec->height); | 1452 | avstream->codec->width, avstream->codec->height); |
diff --git a/ext/ffmpeg/gstffmpegenc.c b/ext/ffmpeg/gstffmpegenc.c index f3dd34d..fce3199 100644 --- a/ext/ffmpeg/gstffmpegenc.c +++ b/ext/ffmpeg/gstffmpegenc.c | |||
@@ -146,7 +146,8 @@ gst_ffmpegenc_base_init (GstFFMpegEncClass * klass) | |||
146 | g_free (classification); | 146 | g_free (classification); |
147 | g_free (description); | 147 | g_free (description); |
148 | 148 | ||
149 | if (!(srccaps = gst_ffmpeg_codecid_to_caps (in_plugin->id, NULL, TRUE))) { | 149 | if (!(srccaps = gst_ffmpeg_codecid_to_caps (in_plugin->id, |
150 | NULL, FALSE, TRUE))) { | ||
150 | GST_DEBUG ("Couldn't get source caps for encoder '%s'", in_plugin->name); | 151 | GST_DEBUG ("Couldn't get source caps for encoder '%s'", in_plugin->name); |
151 | srccaps = gst_caps_new_simple ("unknown/unknown", NULL); | 152 | srccaps = gst_caps_new_simple ("unknown/unknown", NULL); |
152 | } | 153 | } |
@@ -428,7 +429,8 @@ gst_ffmpegenc_getcaps (GstPad * pad) | |||
428 | } | 429 | } |
429 | GST_DEBUG_OBJECT (ffmpegenc, | 430 | GST_DEBUG_OBJECT (ffmpegenc, |
430 | "Got an official pixfmt [%d], attempting to get caps", pixfmt); | 431 | "Got an official pixfmt [%d], attempting to get caps", pixfmt); |
431 | tmpcaps = gst_ffmpeg_pixfmt_to_caps (pixfmt, NULL, oclass->in_plugin->id); | 432 | tmpcaps = gst_ffmpeg_pixfmt_to_caps (pixfmt, |
433 | NULL, FALSE, oclass->in_plugin->id); | ||
432 | if (tmpcaps) { | 434 | if (tmpcaps) { |
433 | GST_DEBUG_OBJECT (ffmpegenc, "Got caps, breaking out"); | 435 | GST_DEBUG_OBJECT (ffmpegenc, "Got caps, breaking out"); |
434 | if (!caps) | 436 | if (!caps) |
@@ -473,7 +475,7 @@ gst_ffmpegenc_getcaps (GstPad * pad) | |||
473 | if (!caps) | 475 | if (!caps) |
474 | caps = gst_caps_new_empty (); | 476 | caps = gst_caps_new_empty (); |
475 | tmpcaps = gst_ffmpeg_codectype_to_caps (oclass->in_plugin->type, ctx, | 477 | tmpcaps = gst_ffmpeg_codectype_to_caps (oclass->in_plugin->type, ctx, |
476 | oclass->in_plugin->id, TRUE); | 478 | FALSE, oclass->in_plugin->id, TRUE); |
477 | if (tmpcaps) | 479 | if (tmpcaps) |
478 | gst_caps_append (caps, tmpcaps); | 480 | gst_caps_append (caps, tmpcaps); |
479 | else | 481 | else |
@@ -694,7 +696,7 @@ gst_ffmpegenc_setcaps (GstPad * pad, GstCaps * caps) | |||
694 | 696 | ||
695 | /* try to set this caps on the other side */ | 697 | /* try to set this caps on the other side */ |
696 | other_caps = gst_ffmpeg_codecid_to_caps (oclass->in_plugin->id, | 698 | other_caps = gst_ffmpeg_codecid_to_caps (oclass->in_plugin->id, |
697 | ffmpegenc->context, TRUE); | 699 | ffmpegenc->context, FALSE, TRUE); |
698 | 700 | ||
699 | if (!other_caps) { | 701 | if (!other_caps) { |
700 | gst_ffmpeg_avcodec_close (ffmpegenc->context); | 702 | gst_ffmpeg_avcodec_close (ffmpegenc->context); |
@@ -775,7 +777,7 @@ gst_ffmpegenc_chain_video (GstPad * pad, GstBuffer * inbuf) | |||
775 | frame_size = gst_ffmpeg_avpicture_fill ((AVPicture *) ffmpegenc->picture, | 777 | frame_size = gst_ffmpeg_avpicture_fill ((AVPicture *) ffmpegenc->picture, |
776 | GST_BUFFER_DATA (inbuf), | 778 | GST_BUFFER_DATA (inbuf), |
777 | ffmpegenc->context->pix_fmt, | 779 | ffmpegenc->context->pix_fmt, |
778 | ffmpegenc->context->width, ffmpegenc->context->height); | 780 | ffmpegenc->context->width, ffmpegenc->context->height, FALSE); |
779 | g_return_val_if_fail (frame_size == GST_BUFFER_SIZE (inbuf), GST_FLOW_ERROR); | 781 | g_return_val_if_fail (frame_size == GST_BUFFER_SIZE (inbuf), GST_FLOW_ERROR); |
780 | 782 | ||
781 | ffmpegenc->picture->pts = | 783 | ffmpegenc->picture->pts = |
diff --git a/ext/ffmpeg/gstffmpegmux.c b/ext/ffmpeg/gstffmpegmux.c index 538aeed..6830fe0 100644 --- a/ext/ffmpeg/gstffmpegmux.c +++ b/ext/ffmpeg/gstffmpegmux.c | |||
@@ -741,7 +741,7 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data) | |||
741 | dst.linesize[0] = st->codec->width * 3; | 741 | dst.linesize[0] = st->codec->width * 3; |
742 | 742 | ||
743 | gst_ffmpeg_avpicture_fill (&src, GST_BUFFER_DATA (buf), | 743 | gst_ffmpeg_avpicture_fill (&src, GST_BUFFER_DATA (buf), |
744 | PIX_FMT_RGB24, st->codec->width, st->codec->height); | 744 | PIX_FMT_RGB24, st->codec->width, st->codec->height, FALSE); |
745 | 745 | ||
746 | av_picture_copy (&dst, &src, PIX_FMT_RGB24, | 746 | av_picture_copy (&dst, &src, PIX_FMT_RGB24, |
747 | st->codec->width, st->codec->height); | 747 | st->codec->width, st->codec->height); |
@@ -829,7 +829,7 @@ gst_ffmpegmux_get_id_caps (enum CodecID *id_list) | |||
829 | 829 | ||
830 | caps = gst_caps_new_empty (); | 830 | caps = gst_caps_new_empty (); |
831 | for (i = 0; id_list[i] != CODEC_ID_NONE; i++) { | 831 | for (i = 0; id_list[i] != CODEC_ID_NONE; i++) { |
832 | if ((t = gst_ffmpeg_codecid_to_caps (id_list[i], NULL, TRUE))) | 832 | if ((t = gst_ffmpeg_codecid_to_caps (id_list[i], NULL, FALSE, TRUE))) |
833 | gst_caps_append (caps, t); | 833 | gst_caps_append (caps, t); |
834 | } | 834 | } |
835 | if (gst_caps_is_empty (caps)) { | 835 | if (gst_caps_is_empty (caps)) { |
diff --git a/ext/ffmpeg/gstffmpegscale.c b/ext/ffmpeg/gstffmpegscale.c index a8678ae..f41832a 100644 --- a/ext/ffmpeg/gstffmpegscale.c +++ b/ext/ffmpeg/gstffmpegscale.c | |||
@@ -276,7 +276,7 @@ gst_ffmpegscale_get_unit_size (GstBaseTransform * trans, GstCaps * caps, | |||
276 | ctx->width = width; | 276 | ctx->width = width; |
277 | ctx->height = height; | 277 | ctx->height = height; |
278 | ctx->pix_fmt = PIX_FMT_NB; | 278 | ctx->pix_fmt = PIX_FMT_NB; |
279 | gst_ffmpeg_caps_with_codectype (CODEC_TYPE_VIDEO, caps, ctx); | 279 | gst_ffmpeg_caps_with_codectype (AVMEDIA_TYPE_VIDEO, caps, ctx); |
280 | if (ctx->pix_fmt == PIX_FMT_NB) { | 280 | if (ctx->pix_fmt == PIX_FMT_NB) { |
281 | av_free (ctx); | 281 | av_free (ctx); |
282 | return FALSE; | 282 | return FALSE; |
@@ -321,7 +321,7 @@ gst_ffmpegscale_set_caps (GstBaseTransform * trans, GstCaps * incaps, | |||
321 | ctx->width = scale->in_width; | 321 | ctx->width = scale->in_width; |
322 | ctx->height = scale->in_height; | 322 | ctx->height = scale->in_height; |
323 | ctx->pix_fmt = PIX_FMT_NB; | 323 | ctx->pix_fmt = PIX_FMT_NB; |
324 | gst_ffmpeg_caps_with_codectype (CODEC_TYPE_VIDEO, incaps, ctx); | 324 | gst_ffmpeg_caps_with_codectype (AVMEDIA_TYPE_VIDEO, incaps, ctx); |
325 | if (ctx->pix_fmt == PIX_FMT_NB) { | 325 | if (ctx->pix_fmt == PIX_FMT_NB) { |
326 | av_free (ctx); | 326 | av_free (ctx); |
327 | return FALSE; | 327 | return FALSE; |
diff --git a/ext/ffmpeg/gstffmpegutils.c b/ext/ffmpeg/gstffmpegutils.c index d039914..2d27447 100644 --- a/ext/ffmpeg/gstffmpegutils.c +++ b/ext/ffmpeg/gstffmpegutils.c | |||
@@ -253,11 +253,13 @@ gst_ffmpeg_init_pix_fmt_info (void) | |||
253 | }; | 253 | }; |
254 | 254 | ||
255 | int | 255 | int |
256 | gst_ffmpeg_avpicture_get_size (int pix_fmt, int width, int height) | 256 | gst_ffmpeg_avpicture_get_size (int pix_fmt, int width, int height, |
257 | gboolean use_border) | ||
257 | { | 258 | { |
258 | AVPicture dummy_pict; | 259 | AVPicture dummy_pict; |
259 | 260 | ||
260 | return gst_ffmpeg_avpicture_fill (&dummy_pict, NULL, pix_fmt, width, height); | 261 | return gst_ffmpeg_avpicture_fill (&dummy_pict, NULL, pix_fmt, |
262 | width, height, use_border); | ||
261 | } | 263 | } |
262 | 264 | ||
263 | #define GEN_MASK(x) ((1<<(x))-1) | 265 | #define GEN_MASK(x) ((1<<(x))-1) |
@@ -268,13 +270,29 @@ gst_ffmpeg_avpicture_get_size (int pix_fmt, int width, int height) | |||
268 | #define DIV_ROUND_UP_X(v,x) (((v) + GEN_MASK(x)) >> (x)) | 270 | #define DIV_ROUND_UP_X(v,x) (((v) + GEN_MASK(x)) >> (x)) |
269 | 271 | ||
270 | int | 272 | int |
271 | gst_ffmpeg_avpicture_fill (AVPicture * picture, | 273 | gst_ffmpeg_avpicture_fill (AVPicture * picture, uint8_t * ptr, |
272 | uint8_t * ptr, enum PixelFormat pix_fmt, int width, int height) | 274 | enum PixelFormat pix_fmt, int width, int height, gboolean use_border) |
273 | { | 275 | { |
274 | int size, w2, h2, size2; | 276 | int size, w2, h2, size2; |
275 | int stride, stride2; | 277 | int stride, stride2; |
276 | PixFmtInfo *pinfo; | 278 | PixFmtInfo *pinfo; |
277 | 279 | ||
280 | GST_DEBUG ("%dx%d", width, height); | ||
281 | |||
282 | // why not use av_fill_image_pointers()?? | ||
283 | |||
284 | if (use_border) { | ||
285 | width += 2 * EDGE_WIDTH; | ||
286 | height += 2 * EDGE_WIDTH; | ||
287 | |||
288 | /* this is a bit ugly.. need to find a cleaner way to know any additional | ||
289 | * padding that is required.. but common codecs need picture to be a | ||
290 | * multiple of 16x16 macroblocks... | ||
291 | */ | ||
292 | width = (width + 15) & ~0x0f; | ||
293 | height = (height + 15) & ~0x0f; | ||
294 | } | ||
295 | |||
278 | pinfo = &pix_fmt_info[pix_fmt]; | 296 | pinfo = &pix_fmt_info[pix_fmt]; |
279 | 297 | ||
280 | switch (pix_fmt) { | 298 | switch (pix_fmt) { |
@@ -303,6 +321,14 @@ gst_ffmpeg_avpicture_fill (AVPicture * picture, | |||
303 | picture->linesize[3] = 0; | 321 | picture->linesize[3] = 0; |
304 | GST_DEBUG ("planes %d %d %d", 0, size, size + size2); | 322 | GST_DEBUG ("planes %d %d %d", 0, size, size + size2); |
305 | GST_DEBUG ("strides %d %d %d", stride, stride2, stride2); | 323 | GST_DEBUG ("strides %d %d %d", stride, stride2, stride2); |
324 | /* note: only I420 is used by decoders, so for now I suppose we are | ||
325 | * ok only handling use_border case here | ||
326 | */ | ||
327 | if (use_border) { | ||
328 | picture->data[0] += (EDGE_WIDTH * width) + EDGE_WIDTH; | ||
329 | picture->data[1] += (EDGE_WIDTH / 2 * width / 2) + EDGE_WIDTH / 2; | ||
330 | picture->data[2] += (EDGE_WIDTH / 2 * width / 2) + EDGE_WIDTH / 2; | ||
331 | } | ||
306 | return size + 2 * size2; | 332 | return size + 2 * size2; |
307 | case PIX_FMT_YUVA420P: | 333 | case PIX_FMT_YUVA420P: |
308 | stride = ROUND_UP_4 (width); | 334 | stride = ROUND_UP_4 (width); |
diff --git a/ext/ffmpeg/gstffmpegutils.h b/ext/ffmpeg/gstffmpegutils.h index 4b713de..783bdba 100644 --- a/ext/ffmpeg/gstffmpegutils.h +++ b/ext/ffmpeg/gstffmpegutils.h | |||
@@ -27,11 +27,16 @@ | |||
27 | #endif | 27 | #endif |
28 | #include <gst/gst.h> | 28 | #include <gst/gst.h> |
29 | 29 | ||
30 | |||
31 | #define EDGE_WIDTH avcodec_get_edge_width() | ||
32 | |||
33 | |||
30 | /* | 34 | /* |
31 | *Get the size of an picture | 35 | *Get the size of an picture |
32 | */ | 36 | */ |
33 | int | 37 | int |
34 | gst_ffmpeg_avpicture_get_size (int pix_fmt, int width, int height); | 38 | gst_ffmpeg_avpicture_get_size (int pix_fmt, int width, int height, |
39 | gboolean use_border); | ||
35 | 40 | ||
36 | /* | 41 | /* |
37 | * Fill in pointers in an AVPicture, aligned by 4 (required by X). | 42 | * Fill in pointers in an AVPicture, aligned by 4 (required by X). |
@@ -42,7 +47,8 @@ gst_ffmpeg_avpicture_fill (AVPicture * picture, | |||
42 | uint8_t * ptr, | 47 | uint8_t * ptr, |
43 | enum PixelFormat pix_fmt, | 48 | enum PixelFormat pix_fmt, |
44 | int width, | 49 | int width, |
45 | int height); | 50 | int height, |
51 | gboolean use_border); | ||
46 | 52 | ||
47 | /* | 53 | /* |
48 | * Convert from/to a GStreamer <-> FFMpeg timestamp. | 54 | * Convert from/to a GStreamer <-> FFMpeg timestamp. |