comparison mpeg.c @ 1169:d18cc9a1fd02 libavformat

allow individual selection of muxers and demuxers
author mru
date Mon, 10 Jul 2006 21:14:37 +0000
parents d89d7ef290da
children 6c654821b0ae
comparison
equal deleted inserted replaced
1168:c894489e2abe 1169:d18cc9a1fd02
106 #define STREAM_TYPE_AUDIO_DTS 0x8a 106 #define STREAM_TYPE_AUDIO_DTS 0x8a
107 107
108 static const int lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000 }; 108 static const int lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000 };
109 109
110 #ifdef CONFIG_MUXERS 110 #ifdef CONFIG_MUXERS
111 static AVOutputFormat mpeg1system_muxer; 111 AVOutputFormat mpeg1system_muxer;
112 static AVOutputFormat mpeg1vcd_muxer; 112 AVOutputFormat mpeg1vcd_muxer;
113 static AVOutputFormat mpeg2vob_muxer; 113 AVOutputFormat mpeg2vob_muxer;
114 static AVOutputFormat mpeg2svcd_muxer; 114 AVOutputFormat mpeg2svcd_muxer;
115 static AVOutputFormat mpeg2dvd_muxer; 115 AVOutputFormat mpeg2dvd_muxer;
116 116
117 static int put_pack_header(AVFormatContext *ctx, 117 static int put_pack_header(AVFormatContext *ctx,
118 uint8_t *buf, int64_t timestamp) 118 uint8_t *buf, int64_t timestamp)
119 { 119 {
120 MpegMuxContext *s = ctx->priv_data; 120 MpegMuxContext *s = ctx->priv_data;
1710 #endif 1710 #endif
1711 *ppos = pos; 1711 *ppos = pos;
1712 return dts; 1712 return dts;
1713 } 1713 }
1714 1714
1715 #ifdef CONFIG_MUXERS 1715 #ifdef CONFIG_MPEG1SYSTEM_MUXER
1716 static AVOutputFormat mpeg1system_muxer = { 1716 AVOutputFormat mpeg1system_muxer = {
1717 "mpeg", 1717 "mpeg",
1718 "MPEG1 System format", 1718 "MPEG1 System format",
1719 "video/mpeg", 1719 "video/mpeg",
1720 "mpg,mpeg", 1720 "mpg,mpeg",
1721 sizeof(MpegMuxContext), 1721 sizeof(MpegMuxContext),
1723 CODEC_ID_MPEG1VIDEO, 1723 CODEC_ID_MPEG1VIDEO,
1724 mpeg_mux_init, 1724 mpeg_mux_init,
1725 mpeg_mux_write_packet, 1725 mpeg_mux_write_packet,
1726 mpeg_mux_end, 1726 mpeg_mux_end,
1727 }; 1727 };
1728 1728 #endif
1729 static AVOutputFormat mpeg1vcd_muxer = { 1729 #ifdef CONFIG_MPEG1VCD_MUXER
1730 AVOutputFormat mpeg1vcd_muxer = {
1730 "vcd", 1731 "vcd",
1731 "MPEG1 System format (VCD)", 1732 "MPEG1 System format (VCD)",
1732 "video/mpeg", 1733 "video/mpeg",
1733 NULL, 1734 NULL,
1734 sizeof(MpegMuxContext), 1735 sizeof(MpegMuxContext),
1736 CODEC_ID_MPEG1VIDEO, 1737 CODEC_ID_MPEG1VIDEO,
1737 mpeg_mux_init, 1738 mpeg_mux_init,
1738 mpeg_mux_write_packet, 1739 mpeg_mux_write_packet,
1739 mpeg_mux_end, 1740 mpeg_mux_end,
1740 }; 1741 };
1741 1742 #endif
1742 static AVOutputFormat mpeg2vob_muxer = { 1743 #ifdef CONFIG_MPEG2VOB_MUXER
1744 AVOutputFormat mpeg2vob_muxer = {
1743 "vob", 1745 "vob",
1744 "MPEG2 PS format (VOB)", 1746 "MPEG2 PS format (VOB)",
1745 "video/mpeg", 1747 "video/mpeg",
1746 "vob", 1748 "vob",
1747 sizeof(MpegMuxContext), 1749 sizeof(MpegMuxContext),
1749 CODEC_ID_MPEG2VIDEO, 1751 CODEC_ID_MPEG2VIDEO,
1750 mpeg_mux_init, 1752 mpeg_mux_init,
1751 mpeg_mux_write_packet, 1753 mpeg_mux_write_packet,
1752 mpeg_mux_end, 1754 mpeg_mux_end,
1753 }; 1755 };
1754 1756 #endif
1755 /* Same as mpeg2vob_muxer except that the pack size is 2324 */ 1757
1756 static AVOutputFormat mpeg2svcd_muxer = { 1758 /* Same as mpeg2vob_mux except that the pack size is 2324 */
1759 #ifdef CONFIG_MPEG2SVCD_MUXER
1760 AVOutputFormat mpeg2svcd_muxer = {
1757 "svcd", 1761 "svcd",
1758 "MPEG2 PS format (VOB)", 1762 "MPEG2 PS format (VOB)",
1759 "video/mpeg", 1763 "video/mpeg",
1760 "vob", 1764 "vob",
1761 sizeof(MpegMuxContext), 1765 sizeof(MpegMuxContext),
1763 CODEC_ID_MPEG2VIDEO, 1767 CODEC_ID_MPEG2VIDEO,
1764 mpeg_mux_init, 1768 mpeg_mux_init,
1765 mpeg_mux_write_packet, 1769 mpeg_mux_write_packet,
1766 mpeg_mux_end, 1770 mpeg_mux_end,
1767 }; 1771 };
1768 1772 #endif
1769 /* Same as mpeg2vob_muxer except the 'is_dvd' flag is set to produce NAV pkts */ 1773
1770 static AVOutputFormat mpeg2dvd_muxer = { 1774 /* Same as mpeg2vob_mux except the 'is_dvd' flag is set to produce NAV pkts */
1775 #ifdef CONFIG_MPEG2DVD_MUXER
1776 AVOutputFormat mpeg2dvd_muxer = {
1771 "dvd", 1777 "dvd",
1772 "MPEG2 PS format (DVD VOB)", 1778 "MPEG2 PS format (DVD VOB)",
1773 "video/mpeg", 1779 "video/mpeg",
1774 "dvd", 1780 "dvd",
1775 sizeof(MpegMuxContext), 1781 sizeof(MpegMuxContext),
1777 CODEC_ID_MPEG2VIDEO, 1783 CODEC_ID_MPEG2VIDEO,
1778 mpeg_mux_init, 1784 mpeg_mux_init,
1779 mpeg_mux_write_packet, 1785 mpeg_mux_write_packet,
1780 mpeg_mux_end, 1786 mpeg_mux_end,
1781 }; 1787 };
1782 1788 #endif
1783 #endif //CONFIG_MUXERS 1789
1784 1790 #ifdef CONFIG_MPEGPS_DEMUXER
1785 AVInputFormat mpegps_demuxer = { 1791 AVInputFormat mpegps_demuxer = {
1786 "mpeg", 1792 "mpeg",
1787 "MPEG PS format", 1793 "MPEG PS format",
1788 sizeof(MpegDemuxContext), 1794 sizeof(MpegDemuxContext),
1789 mpegps_probe, 1795 mpegps_probe,
1792 mpegps_read_close, 1798 mpegps_read_close,
1793 NULL, //mpegps_read_seek, 1799 NULL, //mpegps_read_seek,
1794 mpegps_read_dts, 1800 mpegps_read_dts,
1795 .flags = AVFMT_SHOW_IDS, 1801 .flags = AVFMT_SHOW_IDS,
1796 }; 1802 };
1797 1803 #endif
1798 int mpegps_init(void)
1799 {
1800 #ifdef CONFIG_MUXERS
1801 av_register_output_format(&mpeg1system_muxer);
1802 av_register_output_format(&mpeg1vcd_muxer);
1803 av_register_output_format(&mpeg2vob_muxer);
1804 av_register_output_format(&mpeg2svcd_muxer);
1805 av_register_output_format(&mpeg2dvd_muxer);
1806 #endif //CONFIG_MUXERS
1807 av_register_input_format(&mpegps_demuxer);
1808 return 0;
1809 }