~ubuntu-branches/ubuntu/wily/rtmpdump/wily-proposed

« back to all changes in this revision

Viewing changes to rtmpgw.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2014-04-11 22:08:17 UTC
  • mfrom: (6.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20140411220817-gef1vkyrygbyd87i
Tags: 2.4+20131018.git79459a2-2
Depends on libgmp-dev and nettle-dev to librtmpdev (Closes: #744242)

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
  uint32_t bufferTime;
86
86
 
87
87
  char *rtmpurl;
 
88
  AVal fullUrl;
88
89
  AVal playpath;
89
90
  AVal swfUrl;
90
91
  AVal tcUrl;
469
470
    }
470
471
 
471
472
  // do necessary checks right here to make sure the combined request of default values and GET parameters is correct
472
 
  if (!req.hostname.av_len)
 
473
  if (!req.hostname.av_len && !req.fullUrl.av_len)
473
474
    {
474
475
      RTMP_Log(RTMP_LOGERROR,
475
476
          "You must specify a hostname (--host) or url (-r \"rtmp://host[:port]/playpath\") containing a hostname");
476
477
      status = "400 Missing Hostname";
477
478
      goto filenotfound;
478
479
    }
479
 
  if (req.playpath.av_len == 0)
 
480
  if (req.playpath.av_len == 0 && !req.fullUrl.av_len)
480
481
    {
481
482
      RTMP_Log(RTMP_LOGERROR,
482
483
          "You must specify a playpath (--playpath) or url (-r \"rtmp://host[:port]/playpath\") containing a playpath");
484
485
      goto filenotfound;;
485
486
    }
486
487
 
487
 
  if (req.protocol == RTMP_PROTOCOL_UNDEFINED)
 
488
  if (req.protocol == RTMP_PROTOCOL_UNDEFINED && !req.fullUrl.av_len)
488
489
    {
489
490
      RTMP_Log(RTMP_LOGWARNING,
490
491
          "You haven't specified a protocol (--protocol) or rtmp url (-r), using default protocol RTMP");
491
492
      req.protocol = RTMP_PROTOCOL_RTMP;
492
493
    }
493
 
  if (req.rtmpport == -1)
 
494
  if (req.rtmpport == -1 && !req.fullUrl.av_len)
494
495
    {
495
496
      RTMP_Log(RTMP_LOGWARNING,
496
497
          "You haven't specified a port (--port) or rtmp url (-r), using default port");
497
498
      req.rtmpport = 0;
498
499
    }
499
 
  if (req.rtmpport == 0)
 
500
  if (req.rtmpport == 0 && !req.fullUrl.av_len)
500
501
    {
501
502
      if (req.protocol & RTMP_FEATURE_SSL)
502
503
        req.rtmpport = 443;
552
553
  RTMP_Log(RTMP_LOGDEBUG, "Setting buffer time to: %dms", req.bufferTime);
553
554
  RTMP_Init(&rtmp);
554
555
  RTMP_SetBufferMS(&rtmp, req.bufferTime);
555
 
  RTMP_SetupStream(&rtmp, req.protocol, &req.hostname, req.rtmpport, &req.sockshost,
556
 
                   &req.playpath, &req.tcUrl, &req.swfUrl, &req.pageUrl, &req.app, &req.auth, &req.swfHash, req.swfSize, &req.flashVer, &req.subscribepath, &req.usherToken, dSeek, req.dStopOffset,
557
 
                   req.bLiveStream, req.timeout);
 
556
  if (!req.fullUrl.av_len)
 
557
    {
 
558
      RTMP_SetupStream(&rtmp, req.protocol, &req.hostname, req.rtmpport, &req.sockshost,
 
559
                       &req.playpath, &req.tcUrl, &req.swfUrl, &req.pageUrl, &req.app, &req.auth, &req.swfHash, req.swfSize, &req.flashVer, &req.subscribepath, &req.usherToken, dSeek, req.dStopOffset,
 
560
                       req.bLiveStream, req.timeout);
 
561
    }
 
562
  else
 
563
    {
 
564
      if (RTMP_SetupURL(&rtmp, req.fullUrl.av_val) == FALSE)
 
565
        {
 
566
          RTMP_Log(RTMP_LOGERROR, "Couldn't parse URL: %s", req.fullUrl.av_val);
 
567
          return;
 
568
        }
 
569
    }
558
570
  /* backward compatibility, we always sent this as true before */
559
571
  if (req.auth.av_len)
560
572
    rtmp.Link.lFlags |= RTMP_LF_AUTH;
908
920
          }
909
921
        break;
910
922
      }
 
923
    case 'i':
 
924
      STR2AVAL(req->fullUrl, arg);
 
925
      break;
911
926
    case 's':
912
927
      STR2AVAL(req->swfUrl, arg);
913
928
      break;
927
942
      STR2AVAL(req->auth, arg);
928
943
      break;
929
944
    case 'C':
930
 
      parseAMF(&req->extras, optarg, &req->edepth);
 
945
      parseAMF(&req->extras, arg, &req->edepth);
931
946
      break;
932
947
    case 'm':
933
948
      req->timeout = atoi(arg);
993
1008
  int opt;
994
1009
  struct option longopts[] = {
995
1010
    {"help", 0, NULL, 'h'},
 
1011
    {"url", 1, NULL, 'i'},
996
1012
    {"host", 1, NULL, 'n'},
997
1013
    {"port", 1, NULL, 'c'},
998
1014
    {"socks", 1, NULL, 'S'},
1040
1056
 
1041
1057
  while ((opt =
1042
1058
          getopt_long(argc, argv,
1043
 
                      "hvqVzr:s:t:p:a:f:u:n:c:l:y:m:d:D:A:B:T:g:w:x:W:X:S:j:", longopts,
 
1059
                      "hvqVzr:s:t:i:p:a:f:u:n:c:l:y:m:d:D:A:B:T:g:w:x:W:X:S:j:", longopts,
1044
1060
                      NULL)) != -1)
1045
1061
    {
1046
1062
      switch (opt)
1050
1066
            ("\nThis program serves media content streamed from RTMP onto HTTP.\n\n");
1051
1067
          RTMP_LogPrintf("--help|-h               Prints this help screen.\n");
1052
1068
          RTMP_LogPrintf
 
1069
            ("--url|-i url            URL with options included (e.g. rtmp://host[:port]/path swfUrl=url tcUrl=url)\n");
 
1070
          RTMP_LogPrintf
1053
1071
            ("--rtmp|-r url           URL (e.g. rtmp://host[:port]/path)\n");
1054
1072
          RTMP_LogPrintf
1055
1073
            ("--host|-n hostname      Overrides the hostname in the rtmp url\n");